1 | #include "RtnetDataHandler.h"
|
---|
2 |
|
---|
3 | #include <cstdio>
|
---|
4 |
|
---|
5 | extern "C" {
|
---|
6 | #include <time.h>
|
---|
7 | }
|
---|
8 |
|
---|
9 | using namespace com::gpssolutions::rtnet;
|
---|
10 |
|
---|
11 | RtnetDataHandler::RtnetDataHandler()
|
---|
12 | {
|
---|
13 | }
|
---|
14 |
|
---|
15 | RtnetDataHandler::~RtnetDataHandler() {
|
---|
16 | }
|
---|
17 |
|
---|
18 | void
|
---|
19 | RtnetDataHandler::startDataStream() {
|
---|
20 | }
|
---|
21 |
|
---|
22 | void
|
---|
23 | RtnetDataHandler::registerRtnet(const RtnetInformation& info) {
|
---|
24 | /*registered_ = true;
|
---|
25 | jobName_ = info.jobName;
|
---|
26 | printf("registerRtnet(): %s\n",jobName_.c_str());
|
---|
27 | OneRtnetJobInfo* pInfo = jobStatus_->oneJobInfo(jobName_);
|
---|
28 | {
|
---|
29 | Guard lock(pInfo->mutex());
|
---|
30 | UpdateStatus& status = pInfo->updateStatus();
|
---|
31 | status.stationInfoUpdated = 0;
|
---|
32 | status.stationAuxInfoUpdated = 0;
|
---|
33 | status.rtnetInfoUpdated = 0;
|
---|
34 | }*/
|
---|
35 | }
|
---|
36 |
|
---|
37 | void
|
---|
38 | RtnetDataHandler::handleZDAmb(const std::vector<ZDAmb> & ambList) {
|
---|
39 | printf("Decoded ZD ambiguity record\n");
|
---|
40 | if (ambList.empty()) {
|
---|
41 | printf("No ZD ambiguities present\n");
|
---|
42 | return;
|
---|
43 | }
|
---|
44 | std::vector<ZDAmb>::const_iterator zdIt;
|
---|
45 | std::string staName = ambList[0].stationID;
|
---|
46 | printf ("Received %zd zero-difference ambiguities for station %s\n",ambList.size(),staName.c_str());
|
---|
47 | }
|
---|
48 |
|
---|
49 | void
|
---|
50 | RtnetDataHandler::handleDDAmbresBaselines(const std::vector<DDAmbresBaseline>& ambList) {
|
---|
51 | printf("Decoded double difference ambiguities record (%zd DD ambiguities)\n",ambList.size());
|
---|
52 | }
|
---|
53 |
|
---|
54 | void
|
---|
55 | RtnetDataHandler::handleSatelliteXYZ(const std::vector<SatelliteXYZ>& svXYZList) {
|
---|
56 | printf("Decoded satellite XYZ record (%zd satellites)\n",svXYZList.size());
|
---|
57 | }
|
---|
58 |
|
---|
59 | void
|
---|
60 | RtnetDataHandler::handleStationInfo(const std::vector<StationInfo> & stationList) {
|
---|
61 | printf("Decoded station information record for %zd stations\n",stationList.size());
|
---|
62 | }
|
---|
63 |
|
---|
64 | void
|
---|
65 | RtnetDataHandler::handleStationAuxInfo(const std::vector<StationAuxInfo> & stationAuxList) {
|
---|
66 | printf("Decoded auxilary station record for %d stations\n",stationAuxList.size());
|
---|
67 | }
|
---|
68 |
|
---|
69 | void
|
---|
70 | RtnetDataHandler::handleDGPSCorr(const std::vector<DGPSCorr> & dgpsList) {
|
---|
71 | printf("Decoded DGPS correction (%zd corrections)\n",dgpsList.size());
|
---|
72 | }
|
---|
73 |
|
---|
74 | void
|
---|
75 | RtnetDataHandler::handleSatelliteClock(const std::vector<SatelliteClock> & svList) {
|
---|
76 | printf("Decoded RTNet satellite clock structure (%zd satellite clocks)\n",svList.size());
|
---|
77 | }
|
---|
78 |
|
---|
79 | void
|
---|
80 | RtnetDataHandler::handleEpochResults(const RtnetEpoch& epoch) {
|
---|
81 | long mjlDay = epoch.mjlDay;
|
---|
82 | if (mjlDay < 0) mjlDay += 65536l;
|
---|
83 | long unixSec = (mjlDay-40587L)*24L*60L*60L;
|
---|
84 | unixSec += epoch.msecDay / 1000;
|
---|
85 | char timeStrBuffer[18];
|
---|
86 | struct tm tmEpoch;
|
---|
87 | time_t tEpoch = static_cast<time_t>(unixSec);
|
---|
88 | gmtime_r(&tEpoch,&tmEpoch);
|
---|
89 | if (strftime(timeStrBuffer,17,"%H:%M:%S",&tmEpoch) != 0)
|
---|
90 | printf("Decoded RTNet epoch structure for epoch %s.%03d\n",timeStrBuffer,epoch.msecDay % 1000);
|
---|
91 | else
|
---|
92 | printf("Decoded RTNet epoch structure for epoch %ld %.3f\n",epoch.mjlDay,epoch.msecDay / 1000.0);
|
---|
93 | }
|
---|
94 |
|
---|