#include #include #include #include #include #include #include "gen-cpp/RtnetData.h" using namespace apache::thrift; using namespace apache::thrift::protocol; using namespace apache::thrift::transport; using namespace com::gpssolutions::rtnet; using namespace std; using namespace boost; // Handler Class Definition ////////////////////////////////////////////////////////////////////////////// class RtnetClientHandler : public RtnetDataIf { public: RtnetClientHandler() {} ~RtnetClientHandler() {} void startDataStream() {} void registerRtnet(const RtnetInformation& info) {} void handleZDAmb(const vector& ambList) {} void handleDDAmbresBaselines(const vector& ambList) {} void handleSatelliteXYZ(const vector< SatelliteXYZ>& svXYZList); void handleStationInfo(const vector& stationList) {} void handleStationAuxInfo(const vector& stationAuxList) {} void handleDGPSCorr(const vector& dgpsList) {} void handleSatelliteClock(const vector& svList) {} void handleEpochResults(const RtnetEpoch& epoch) {} }; // Program ////////////////////////////////////////////////////////////////////////////// int main(int argc, char **argv) { shared_ptr socket(new TSocket("localhost", 6666)); shared_ptr transport(new TBufferedTransport(socket)); shared_ptr protocol(new TBinaryProtocol(transport)); shared_ptr dataHandler(new RtnetClientHandler()); shared_ptr processor(new RtnetDataProcessor(dataHandler)); try { transport->open(); while (processor->process(protocol,protocol,0)) {} transport->close(); } catch (TException& e) { cerr << "Caught an exception generated by Thrift: " << e.what() << endl; return 1; } catch (...) { cerr << "Unknown exception" << endl; return 1; } return 0; } // Handle Satellite Positions ////////////////////////////////////////////////////////////////////////////// void RtnetClientHandler:: handleSatelliteXYZ(const vector& svXYZList) { cout.setf(ios::fixed); for (unsigned ii = 0; ii < svXYZList.size(); ii++) { const SatelliteXYZ& sat = svXYZList[ii]; cout << unsigned(sat.ID) << ' ' << setprecision(3) << sat.xyz.x << ' ' << setprecision(3) << sat.xyz.y << ' ' << setprecision(3) << sat.xyz.z << endl; } cout << endl; }