Changeset 5409 in ntrip for trunk/GnssCenter
- Timestamp:
- Sep 10, 2013, 3:15:35 PM (11 years ago)
- Location:
- trunk/GnssCenter/map_stations
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GnssCenter/map_stations/thriftclient.cpp
r5407 r5409 14 14 using namespace boost; 15 15 16 // // Program 17 // ////////////////////////////////////////////////////////////////////////////// 18 // int main(int argc, char **argv) { 19 // 20 // // Parse Input Options 21 // // ------------------- 22 // map<string, string> OPT; 23 // parseCmdLine(argc, argv, OPT); 24 // if (OPT.find("port") == OPT.end()) { 25 // cerr << "usage: rtnetThriftClient [--host <host>] --port <port>" << endl; 26 // return 1; 27 // } 28 // string host = OPT.find("host") == OPT.end() ? "localhost" : OPT["host"]; 29 // int port; istringstream(OPT["port"]) >> port; 30 // 31 // shared_ptr<TSocket> socket(new TSocket(host, port)); 32 // shared_ptr<TTransport> transport(new TBufferedTransport(socket)); 33 // shared_ptr<TProtocol> protocol(new TBinaryProtocol(transport)); 34 // shared_ptr<RtnetDataIf> dataHandler(new t_thriftClient()); 35 // shared_ptr<TProcessor> processor(new RtnetDataProcessor(dataHandler)); 36 // 37 // try { 38 // transport->open(); 39 // 40 // while (processor->process(protocol,protocol,0)) {} 41 // 42 // transport->close(); 43 // } 44 // catch (TException& e) { 45 // cerr << "Caught an exception generated by Thrift: " << e.what() << endl; 46 // return 1; 47 // } 48 // catch (...) { 49 // cerr << "Unknown exception" << endl; 50 // return 1; 51 // } 52 // 53 // return 0; 54 // } 16 // Constructor 17 ////////////////////////////////////////////////////////////////////////////// 18 t_thriftClient::t_thriftClient() { 19 20 } 21 22 // Destructor 23 ////////////////////////////////////////////////////////////////////////////// 24 t_thriftClient::~t_thriftClient() { 25 26 } 27 28 // Run (virtual) 29 ////////////////////////////////////////////////////////////////////////////// 30 void t_thriftClient::run() { 31 32 string host = "rtnet.rtcm-ntrip.org"; 33 int port = 7777; 34 35 shared_ptr<TSocket> socket(new TSocket(host, port)); 36 shared_ptr<TTransport> transport(new TBufferedTransport(socket)); 37 shared_ptr<TProtocol> protocol(new TBinaryProtocol(transport)); 38 shared_ptr<RtnetDataIf> dataHandler(new t_thriftClient()); 39 shared_ptr<TProcessor> processor(new RtnetDataProcessor(dataHandler)); 40 41 try { 42 transport->open(); 43 while (processor->process(protocol,protocol,0)) {} 44 transport->close(); 45 } 46 catch (TException& e) { 47 cerr << "Caught an exception generated by Thrift: " << e.what() << endl; 48 } 49 catch (...) { 50 cerr << "Unknown exception" << endl; 51 } 52 } 55 53 56 54 // Handle Satellite Positions -
trunk/GnssCenter/map_stations/thriftclient.h
r5407 r5409 4 4 #include <string> 5 5 #include <map> 6 #include <QThread> 6 7 7 8 #include <transport/TSocket.h> … … 15 16 // Handler Class Definition 16 17 ////////////////////////////////////////////////////////////////////////////// 17 class t_thriftClient : public com::gpssolutions::rtnet::RtnetDataIf {18 class t_thriftClient : public com::gpssolutions::rtnet::RtnetDataIf, QThread { 18 19 public: 19 t_thriftClient() {} 20 ~t_thriftClient() {} 20 t_thriftClient(); 21 ~t_thriftClient(); 22 virtual void run(); 21 23 22 24 void startDataStream() {}
Note:
See TracChangeset
for help on using the changeset viewer.