[3504] | 1 |
|
---|
| 2 | /* -------------------------------------------------------------------------
|
---|
| 3 | * BKG NTRIP Client
|
---|
| 4 | * -------------------------------------------------------------------------
|
---|
| 5 | *
|
---|
| 6 | * Class: hassDecoder
|
---|
| 7 | *
|
---|
| 8 | * Purpose: Decode Data (PPP Corrections) in HASS Format
|
---|
| 9 | *
|
---|
| 10 | * Author: L. Mervart
|
---|
| 11 | *
|
---|
| 12 | * Created: 19-Nov-2011
|
---|
| 13 | *
|
---|
| 14 | * Changes:
|
---|
| 15 | *
|
---|
| 16 | * -----------------------------------------------------------------------*/
|
---|
| 17 |
|
---|
| 18 | #include "hassDecoder.h"
|
---|
[3507] | 19 | #include "bnctime.h"
|
---|
[3504] | 20 |
|
---|
| 21 | using namespace std;
|
---|
| 22 |
|
---|
| 23 | // Constructor
|
---|
| 24 | ////////////////////////////////////////////////////////////////////////////
|
---|
[3505] | 25 | hassDecoder::hassDecoder(const QString& staID) : RTCM3coDecoder(staID) {
|
---|
[3506] | 26 | _GPSweeks = -1.0;
|
---|
[3504] | 27 | }
|
---|
| 28 |
|
---|
| 29 | // Destructor
|
---|
| 30 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 31 | hassDecoder::~hassDecoder() {
|
---|
| 32 | }
|
---|
| 33 |
|
---|
| 34 | //
|
---|
| 35 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 36 | t_irc hassDecoder::Decode(char* data, int dataLen, vector<string>& errmsg) {
|
---|
| 37 |
|
---|
| 38 | errmsg.clear();
|
---|
| 39 |
|
---|
| 40 | _buffer += QByteArray(data, dataLen);
|
---|
| 41 |
|
---|
[3506] | 42 | bool corrFound = false;
|
---|
| 43 | int indexEOL = -1;
|
---|
| 44 | while ( (indexEOL = _buffer.indexOf('\n')) != -1) {
|
---|
| 45 | QByteArray line = _buffer.left(indexEOL-1);
|
---|
| 46 | _buffer = _buffer.mid(indexEOL);
|
---|
[3504] | 47 |
|
---|
[3506] | 48 | if (QString(line).split(QRegExp("\\s+")).count() != 11) {
|
---|
| 49 | continue;
|
---|
| 50 | }
|
---|
| 51 | else {
|
---|
| 52 | corrFound = true;
|
---|
| 53 | }
|
---|
| 54 |
|
---|
| 55 | QTextStream in(line, QIODevice::ReadOnly | QIODevice::Text);
|
---|
| 56 | int mjd, IOD;
|
---|
| 57 | double daySec;
|
---|
| 58 | double deltaX, deltaY, deltaZ, deltaClk;
|
---|
| 59 | double rateDeltaX, rateDeltaY, rateDeltaZ;
|
---|
| 60 | QString prn;
|
---|
| 61 |
|
---|
| 62 | in >> mjd >> daySec >> prn >> IOD >> deltaX >> deltaY >> deltaZ
|
---|
| 63 | >> deltaClk >> rateDeltaX >> rateDeltaY >> rateDeltaZ;
|
---|
| 64 |
|
---|
[3507] | 65 | bncTime tt;
|
---|
| 66 | tt.setmjd(daySec, mjd);
|
---|
| 67 |
|
---|
| 68 | _GPSweeks = tt.gpssec();
|
---|
| 69 | long coTime = tt.gpsw() * 7*24*3600 + long(floor(_GPSweeks+0.5));
|
---|
| 70 |
|
---|
| 71 | QString corrLine;
|
---|
| 72 |
|
---|
| 73 | int updateInterval = 0;
|
---|
[3508] | 74 | int messageType = 0;
|
---|
| 75 | if (prn[0] == 'G') {
|
---|
| 76 | messageType = -COTYPE_GPSCOMBINED;
|
---|
| 77 | }
|
---|
| 78 | else if (prn[0] == 'R') {
|
---|
| 79 | messageType = -COTYPE_GLONASSCOMBINED;
|
---|
| 80 | }
|
---|
[3507] | 81 |
|
---|
| 82 | corrLine.sprintf("%d %d %d %.1f %s"
|
---|
| 83 | " %3d"
|
---|
| 84 | " %8.3f %8.3f %8.3f %8.3f"
|
---|
| 85 | " %10.5f %10.5f %10.5f %10.5f"
|
---|
| 86 | " %10.5f",
|
---|
| 87 | messageType, updateInterval, tt.gpsw(), _GPSweeks,
|
---|
| 88 | prn.toAscii().data(), IOD,
|
---|
| 89 | deltaClk, deltaX, deltaY, deltaZ,
|
---|
| 90 | 0.0, rateDeltaX, rateDeltaY, rateDeltaZ, 0.0);
|
---|
| 91 |
|
---|
| 92 | printLine(corrLine, coTime);
|
---|
[3506] | 93 | }
|
---|
| 94 |
|
---|
| 95 | if (corrFound) {
|
---|
| 96 | return success;
|
---|
| 97 | }
|
---|
| 98 | else {
|
---|
| 99 | return failure;
|
---|
| 100 | }
|
---|
[3504] | 101 | }
|
---|