| Line | |
|---|
| 1 |
|
|---|
| 2 | /* -------------------------------------------------------------------------
|
|---|
| 3 | * Bernese NTRIP Client
|
|---|
| 4 | * -------------------------------------------------------------------------
|
|---|
| 5 | *
|
|---|
| 6 | * Class: rtigs
|
|---|
| 7 | *
|
|---|
| 8 | * Purpose: RTIGS Decoder
|
|---|
| 9 | *
|
|---|
| 10 | * Author: L. Mervart
|
|---|
| 11 | *
|
|---|
| 12 | * Created: 24-Aug-2006
|
|---|
| 13 | *
|
|---|
| 14 | * Changes:
|
|---|
| 15 | *
|
|---|
| 16 | * -----------------------------------------------------------------------*/
|
|---|
| 17 |
|
|---|
| 18 | #include "rtigs.h"
|
|---|
| 19 |
|
|---|
| 20 | using namespace std;
|
|---|
| 21 |
|
|---|
| 22 | // Constructor
|
|---|
| 23 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 24 | rtigs::rtigs() : GPSDecoder() {
|
|---|
| 25 | }
|
|---|
| 26 |
|
|---|
| 27 | // Destructor
|
|---|
| 28 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 29 | rtigs::~rtigs() {
|
|---|
| 30 | }
|
|---|
| 31 |
|
|---|
| 32 | //
|
|---|
| 33 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 34 | void rtigs::Decode(char* buffer, int bufLen) {
|
|---|
| 35 |
|
|---|
| 36 | unsigned char* lBuffer = (unsigned char*) buffer;
|
|---|
| 37 |
|
|---|
| 38 | // Find the beginning of the message
|
|---|
| 39 | // ---------------------------------
|
|---|
| 40 | size_t sz = sizeof(unsigned short);
|
|---|
| 41 | bool found = false;
|
|---|
| 42 | size_t ii;
|
|---|
| 43 |
|
|---|
| 44 | for (ii = 0; bufLen > sz && ii < bufLen - sz; ii += sz) {
|
|---|
| 45 | unsigned short xx;
|
|---|
| 46 | memcpy( (void*) &xx, &lBuffer[ii], sz);
|
|---|
| 47 | SwitchBytes( (char*) &xx, sz);
|
|---|
| 48 | if (xx == 200) {
|
|---|
| 49 | found = true;
|
|---|
| 50 | break;
|
|---|
| 51 | }
|
|---|
| 52 | }
|
|---|
| 53 | if (! found) {
|
|---|
| 54 | cout << "Message not found\n";
|
|---|
| 55 | return;
|
|---|
| 56 | }
|
|---|
| 57 | else {
|
|---|
| 58 | cout << "Message found at " << ii << endl;
|
|---|
| 59 | }
|
|---|
| 60 |
|
|---|
| 61 | unsigned short messType = _GPSTrans.GetRTIGSHdrRecType(&lBuffer[ii]);
|
|---|
| 62 | unsigned short numbytes = _GPSTrans.GetRTIGSHdrRecBytes(&lBuffer[ii]);
|
|---|
| 63 | unsigned short statID = _GPSTrans.GetRTIGSHdrStaID(&lBuffer[ii]);
|
|---|
| 64 |
|
|---|
| 65 | if (messType == 200) {
|
|---|
| 66 | RTIGSO_T rtigs_obs;
|
|---|
| 67 | short retval = _GPSTrans.Decode_RTIGS_Obs(&lBuffer[ii], numbytes ,
|
|---|
| 68 | rtigs_obs);
|
|---|
| 69 | if (retval >= 1) {
|
|---|
| 70 | _GPSTrans.print_CMEAS();
|
|---|
| 71 | }
|
|---|
| 72 | }
|
|---|
| 73 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.