Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: example-ublox-at-cellular-interface-ext example-low-power-sleep example-C030-out-of-box-demo example-C030-out-of-box-demo ... more
Revision 33:75163fa7e453, committed 2019-05-29
- Comitter:
- fahimalavi
- Date:
- Wed May 29 16:45:00 2019 +0500
- Parent:
- 32:36bf0ff17131
- Child:
- 34:d6a65d4c902a
- Commit message:
- Code style corrected
Changed in this revision
--- a/gnss.cpp Wed Apr 24 17:55:48 2019 +0500
+++ b/gnss.cpp Wed May 29 16:45:00 2019 +0500
@@ -33,7 +33,7 @@
{
// Create the enable pin but set everything to disabled
_gnssEnable = NULL;
-
+
#ifdef TARGET_UBLOX_C030
_gnssEnable = new DigitalInOut(GNSSEN, PIN_OUTPUT, PushPullNoPull, 0);
#else
@@ -52,13 +52,16 @@
void GnssParser::powerOff(void)
{
// Set the GNSS into backup mode using the command RMX-LPREQ
- struct { unsigned long dur; unsigned long flags; } msg = {0/*endless*/,0/*backup*/};
+ struct {
+ unsigned long dur;
+ unsigned long flags;
+ } msg = {0/*endless*/,0/*backup*/};
sendUbx(0x02, 0x41, &msg, sizeof(msg));
}
void GnssParser::cutOffPower(void)
{
- //Disabling PA15 to cut off power supply
+ //Disabling PA15 to cut off power supply
if (_gnssEnable != NULL)
*_gnssEnable = 0;
wait_ms(1);
@@ -67,7 +70,7 @@
void GnssParser::_powerOn(void)
{
if (_gnssEnable != NULL) {
- *_gnssEnable = 1;
+ *_gnssEnable = 1;
}
wait_ms (1);
}
@@ -84,29 +87,29 @@
// NMEA protocol
pipe->set(unkn);
int nmea = _parseNmea(pipe,len);
- if ((nmea != NOT_FOUND) && (unkn > 0))
+ if ((nmea != NOT_FOUND) && (unkn > 0))
return UNKNOWN | pipe->get(buf,unkn);
- if (nmea == WAIT && fr)
+ if (nmea == WAIT && fr)
return WAIT;
- if (nmea > 0)
+ if (nmea > 0)
return NMEA | pipe->get(buf,nmea);
// UBX protocol
-
+
pipe->set(unkn);
int ubx = _parseUbx(pipe,len);
- if ((ubx != NOT_FOUND) && (unkn > 0))
+ if ((ubx != NOT_FOUND) && (unkn > 0))
return UNKNOWN | pipe->get(buf,unkn);
- if (ubx == WAIT && fr)
+ if (ubx == WAIT && fr)
return WAIT;
- if (ubx > 0)
+ if (ubx > 0)
return UBX | pipe->get(buf,ubx);
-
+
// UNKNOWN
unkn ++;
len--;
}
- if (unkn > 0)
- return UNKNOWN | pipe->get(buf,unkn);
+ if (unkn > 0)
+ return UNKNOWN | pipe->get(buf,unkn);
return WAIT;
}
@@ -117,13 +120,13 @@
char ch;
if (++o > len) return WAIT;
if ('$' != pipe->next()) return NOT_FOUND;
- // This needs to be extended by crc checking
+ // This needs to be extended by crc checking
for (;;)
{
if (++o > len) return WAIT;
ch = pipe->next();
- if ('*' == ch) break; // crc delimiter
- if (!isprint(ch)) return NOT_FOUND;
+ if ('*' == ch) break; // crc delimiter
+ if (!isprint(ch)) return NOT_FOUND;
c ^= ch;
}
if (++o > len) return WAIT;
@@ -143,25 +146,34 @@
{
int o = 0;
if (++o > l) return WAIT;
- if ('\xB5' != pipe->next()) return NOT_FOUND;
+ if ('\xB5' != pipe->next()) return NOT_FOUND;
if (++o > l) return WAIT;
if ('\x62' != pipe->next()) return NOT_FOUND;
o += 4;
if (o > l) return WAIT;
int i,j,ca,cb;
- i = pipe->next(); ca = i; cb = ca; // cls
- i = pipe->next(); ca += i; cb += ca; // id
- i = pipe->next(); ca += i; cb += ca; // len_lsb
- j = pipe->next(); ca += j; cb += ca; // len_msb
+ i = pipe->next();
+ ca = i;
+ cb = ca; // cls
+ i = pipe->next();
+ ca += i;
+ cb += ca; // id
+ i = pipe->next();
+ ca += i;
+ cb += ca; // len_lsb
+ j = pipe->next();
+ ca += j;
+ cb += ca; // len_msb
j = i + (j << 8);
while (j--)
{
if (++o > l) return WAIT;
- i = pipe->next();
- ca += i;
+ i = pipe->next();
+ ca += i;
cb += ca;
}
- ca &= 0xFF; cb &= 0xFF;
+ ca &= 0xFF;
+ cb &= 0xFF;
if (++o > l) return WAIT;
if (ca != pipe->next()) return NOT_FOUND;
if (++o > l) return WAIT;
@@ -205,7 +217,7 @@
for (i = 0; i < len; i ++)
{
ca += ((char*)buf)[i];
- cb += ca;
+ cb += ca;
}
i = _send(head, sizeof(head));
i += _send(buf, len);
@@ -224,10 +236,10 @@
ix --;
}
// Found and check bounds
- if ((ix == 0) && (start < end) &&
- (*start != ',') && (*start != '*') && (*start != '\r') && (*start != '\n'))
+ if ((ix == 0) && (start < end) &&
+ (*start != ',') && (*start != '*') && (*start != '\r') && (*start != '\n'))
return start;
- else
+ else
return NULL;
}
@@ -265,8 +277,8 @@
while ((pos < end) && isspace(*pos))
pos++;
// Check bound
- if ((pos < end) &&
- (*pos != ',') && (*pos != '*') && (*pos != '\r') && (*pos != '\n'))
+ if ((pos < end) &&
+ (*pos != ',') && (*pos != '*') && (*pos != '\r') && (*pos != '\n'))
{
val = *pos;
return true;
@@ -277,8 +289,8 @@
bool GnssParser::getNmeaAngle(int ix, char* buf, int len, double& val)
{
char ch;
- if (getNmeaItem(ix,buf,len,val) && getNmeaItem(ix+1,buf,len,ch) &&
- ((ch == 'S') || (ch == 'N') || (ch == 'E') || (ch == 'W')))
+ if (getNmeaItem(ix,buf,len,val) && getNmeaItem(ix+1,buf,len,ch) &&
+ ((ch == 'S') || (ch == 'N') || (ch == 'E') || (ch == 'W')))
{
val *= 0.01;
int i = (int)val;
@@ -292,326 +304,326 @@
int GnssParser::enable_ubx() {
- unsigned char ubx_cfg_prt[]={0x01, 0x00, 0x00, 0x00, 0xD0, 0x08, 0x00, 0x00, 0x00, 0xC2, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00,0x00, 0x00};
- int conf = RETRY;
- int length = 0;
+ unsigned char ubx_cfg_prt[]= {0x01, 0x00, 0x00, 0x00, 0xD0, 0x08, 0x00, 0x00, 0x00, 0xC2, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00,0x00, 0x00};
+ int conf = RETRY;
+ int length = 0;
- while(conf)
- {
- length = sendUbx(0x06, 0x00, ubx_cfg_prt, sizeof(ubx_cfg_prt));
- if(length >= (int)(sizeof(ubx_cfg_prt) + UBX_FRAME_SIZE))
- {
- wait(5);
- break;
- }
- else
- {
- conf = conf - 1;
- }
- }
- return (conf == 0) ? 0 : 1;
+ while(conf)
+ {
+ length = sendUbx(0x06, 0x00, ubx_cfg_prt, sizeof(ubx_cfg_prt));
+ if(length >= (int)(sizeof(ubx_cfg_prt) + UBX_FRAME_SIZE))
+ {
+ wait(5);
+ break;
+ }
+ else
+ {
+ conf = conf - 1;
+ }
+ }
+ return (conf == 0) ? 0 : 1;
}
eUBX_MESSAGE GnssParser::get_ubx_message(char *buff) {
- eUBX_MESSAGE return_value = UNKNOWN_UBX;
+ eUBX_MESSAGE return_value = UNKNOWN_UBX;
- if(buff[SYNC_CHAR_INDEX_1] == 0xB5 && buff[SYNC_CHAR_INDEX_2] == 0x62) {
+ if(buff[SYNC_CHAR_INDEX_1] == 0xB5 && buff[SYNC_CHAR_INDEX_2] == 0x62) {
- switch (buff[MSG_CLASS_INDEX]) {
+ switch (buff[MSG_CLASS_INDEX]) {
- case NAV: {
- switch (buff[MSG_ID_INDEX]) {
+ case NAV: {
+ switch (buff[MSG_ID_INDEX]) {
- case 0x07: {
- return_value = UBX_NAV_PVT;
- }
- break;
- case 0x09: {
- return_value = UBX_NAV_ODO;
- }
- break;
- case 0x03: {
- return_value = UBX_NAV_STATUS;
- }
- break;
- case 0x35: {
- return_value = UBX_NAV_SAT;
- }
- break;
- default:
- {
- return_value = UNKNOWN_UBX;
- }
- break;
- }
- }
- break;
- case ACK: {
- switch (buff[MSG_ID_INDEX]) {
- case 0x00: {
- return_value = UBX_ACK_NAK;
- }
- break;
- case 0x01: {
- return_value = UBX_ACK_ACK;
- }
- break;
- default:
- {
- return_value = UNKNOWN_UBX;
- }
- break;
- }
- }
- break;
- case LOG: {
- switch (buff[MSG_ID_INDEX]) {
- case 0x11: {
- return_value = UBX_LOG_BATCH;
- }
- break;
- default:
- {
- return_value = UNKNOWN_UBX;
- }
- break;
- }
- }
- break;
- default:
- {
- return_value = UNKNOWN_UBX;
- }
- break;
- }
- }
- return return_value;
+ case 0x07: {
+ return_value = UBX_NAV_PVT;
+ }
+ break;
+ case 0x09: {
+ return_value = UBX_NAV_ODO;
+ }
+ break;
+ case 0x03: {
+ return_value = UBX_NAV_STATUS;
+ }
+ break;
+ case 0x35: {
+ return_value = UBX_NAV_SAT;
+ }
+ break;
+ default:
+ {
+ return_value = UNKNOWN_UBX;
+ }
+ break;
+ }
+ }
+ break;
+ case ACK: {
+ switch (buff[MSG_ID_INDEX]) {
+ case 0x00: {
+ return_value = UBX_ACK_NAK;
+ }
+ break;
+ case 0x01: {
+ return_value = UBX_ACK_ACK;
+ }
+ break;
+ default:
+ {
+ return_value = UNKNOWN_UBX;
+ }
+ break;
+ }
+ }
+ break;
+ case LOG: {
+ switch (buff[MSG_ID_INDEX]) {
+ case 0x11: {
+ return_value = UBX_LOG_BATCH;
+ }
+ break;
+ default:
+ {
+ return_value = UNKNOWN_UBX;
+ }
+ break;
+ }
+ }
+ break;
+ default:
+ {
+ return_value = UNKNOWN_UBX;
+ }
+ break;
+ }
+ }
+ return return_value;
}
tUBX_ACK_ACK GnssParser::decode_ubx_cfg_ack_nak_msg(char *buf) {
- tUBX_ACK_ACK return_decoded_msg;
- uint8_t index = UBX_PAYLOAD_INDEX;
+ tUBX_ACK_ACK return_decoded_msg;
+ uint8_t index = UBX_PAYLOAD_INDEX;
- return_decoded_msg.msg_class = buf[index++];
- return_decoded_msg.msg_id = buf[index];
+ return_decoded_msg.msg_class = buf[index++];
+ return_decoded_msg.msg_id = buf[index];
- return return_decoded_msg;
+ return return_decoded_msg;
}
tUBX_NAV_ODO GnssParser::decode_ubx_nav_odo_msg(char *buf) {
- tUBX_NAV_ODO return_decoded_msg;
- uint8_t index = UBX_PAYLOAD_INDEX;
+ tUBX_NAV_ODO return_decoded_msg;
+ uint8_t index = UBX_PAYLOAD_INDEX;
- return_decoded_msg.version = buf[index++];
- index +=3; // 3 bytes are reserved
+ return_decoded_msg.version = buf[index++];
+ index +=3; // 3 bytes are reserved
- return_decoded_msg.itow = buf[index++];
- return_decoded_msg.itow |= (buf[index++] << 8);
- return_decoded_msg.itow |= (buf[index++] << 16);
- return_decoded_msg.itow |= (buf[index++] << 24);
+ return_decoded_msg.itow = buf[index++];
+ return_decoded_msg.itow |= (buf[index++] << 8);
+ return_decoded_msg.itow |= (buf[index++] << 16);
+ return_decoded_msg.itow |= (buf[index++] << 24);
- return_decoded_msg.distance = buf[index++];
- return_decoded_msg.distance |= (buf[index++] << 8);
- return_decoded_msg.distance |= (buf[index++] << 16);
- return_decoded_msg.distance |= (buf[index++] << 24);
+ return_decoded_msg.distance = buf[index++];
+ return_decoded_msg.distance |= (buf[index++] << 8);
+ return_decoded_msg.distance |= (buf[index++] << 16);
+ return_decoded_msg.distance |= (buf[index++] << 24);
- return_decoded_msg.totalDistance = buf[index++];
- return_decoded_msg.totalDistance |= (buf[index++] << 8);
- return_decoded_msg.totalDistance |= (buf[index++] << 16);
- return_decoded_msg.totalDistance |= (buf[index++] << 24);
+ return_decoded_msg.totalDistance = buf[index++];
+ return_decoded_msg.totalDistance |= (buf[index++] << 8);
+ return_decoded_msg.totalDistance |= (buf[index++] << 16);
+ return_decoded_msg.totalDistance |= (buf[index++] << 24);
- return_decoded_msg.distanceSTD = buf[index++];
- return_decoded_msg.distanceSTD |= (buf[index++] << 8);
- return_decoded_msg.distanceSTD |= (buf[index++] << 16);
- return_decoded_msg.distanceSTD |= (buf[index++] << 24);
+ return_decoded_msg.distanceSTD = buf[index++];
+ return_decoded_msg.distanceSTD |= (buf[index++] << 8);
+ return_decoded_msg.distanceSTD |= (buf[index++] << 16);
+ return_decoded_msg.distanceSTD |= (buf[index++] << 24);
- return return_decoded_msg;
+ return return_decoded_msg;
}
tUBX_NAV_PVT GnssParser::decode_ubx_nav_pvt_msg(char *buf) {
- tUBX_NAV_PVT return_decoded_msg;
- uint8_t index = UBX_PAYLOAD_INDEX;
+ tUBX_NAV_PVT return_decoded_msg;
+ uint8_t index = UBX_PAYLOAD_INDEX;
- return_decoded_msg.itow = buf[index++];
- return_decoded_msg.itow |= (buf[index++] << 8);
- return_decoded_msg.itow |= (buf[index++] << 16);
- return_decoded_msg.itow |= (buf[index++] << 24);
+ return_decoded_msg.itow = buf[index++];
+ return_decoded_msg.itow |= (buf[index++] << 8);
+ return_decoded_msg.itow |= (buf[index++] << 16);
+ return_decoded_msg.itow |= (buf[index++] << 24);
- return_decoded_msg.year = buf[index++];
- return_decoded_msg.year |= (buf[index++] << 8);
+ return_decoded_msg.year = buf[index++];
+ return_decoded_msg.year |= (buf[index++] << 8);
- return_decoded_msg.month = buf[index++];
+ return_decoded_msg.month = buf[index++];
- return_decoded_msg.day = buf[index++];
+ return_decoded_msg.day = buf[index++];
- // Go to Fix type
- index = UBX_PAYLOAD_INDEX + 20;
+ // Go to Fix type
+ index = UBX_PAYLOAD_INDEX + 20;
return_decoded_msg.fixType = buf[index++];
return_decoded_msg.flag1 = buf[index];
- // Go to lon
- index = UBX_PAYLOAD_INDEX + 24;
+ // Go to lon
+ index = UBX_PAYLOAD_INDEX + 24;
- return_decoded_msg.lon = buf[index++];
- return_decoded_msg.lon |= (buf[index++] << 8);
- return_decoded_msg.lon |= (buf[index++] << 16);
- return_decoded_msg.lon |= (buf[index++] << 24);
+ return_decoded_msg.lon = buf[index++];
+ return_decoded_msg.lon |= (buf[index++] << 8);
+ return_decoded_msg.lon |= (buf[index++] << 16);
+ return_decoded_msg.lon |= (buf[index++] << 24);
- return_decoded_msg.lat = buf[index++];
- return_decoded_msg.lat |= (buf[index++] << 8);
- return_decoded_msg.lat |= (buf[index++] << 16);
- return_decoded_msg.lat |= (buf[index++] << 24);
+ return_decoded_msg.lat = buf[index++];
+ return_decoded_msg.lat |= (buf[index++] << 8);
+ return_decoded_msg.lat |= (buf[index++] << 16);
+ return_decoded_msg.lat |= (buf[index++] << 24);
- return_decoded_msg.height = buf[index++];
- return_decoded_msg.height |= (buf[index++] << 8);
- return_decoded_msg.height |= (buf[index++] << 16);
- return_decoded_msg.height |= (buf[index++] << 24);
+ return_decoded_msg.height = buf[index++];
+ return_decoded_msg.height |= (buf[index++] << 8);
+ return_decoded_msg.height |= (buf[index++] << 16);
+ return_decoded_msg.height |= (buf[index++] << 24);
- // Go to gSpeed
- index = UBX_PAYLOAD_INDEX + 60;
- return_decoded_msg.speed = buf[index++];
- return_decoded_msg.speed |= (buf[index++] << 8);
- return_decoded_msg.speed |= (buf[index++] << 16);
- return_decoded_msg.speed |= (buf[index++] << 24);
+ // Go to gSpeed
+ index = UBX_PAYLOAD_INDEX + 60;
+ return_decoded_msg.speed = buf[index++];
+ return_decoded_msg.speed |= (buf[index++] << 8);
+ return_decoded_msg.speed |= (buf[index++] << 16);
+ return_decoded_msg.speed |= (buf[index++] << 24);
- return return_decoded_msg;
+ return return_decoded_msg;
}
tUBX_LOG_BATCH GnssParser::decode_ubx_log_batch_msg(char *buf) {
- tUBX_LOG_BATCH return_decoded_msg;
- uint8_t index = UBX_PAYLOAD_INDEX;
+ tUBX_LOG_BATCH return_decoded_msg;
+ uint8_t index = UBX_PAYLOAD_INDEX;
- // move index itow
- index = UBX_PAYLOAD_INDEX + 4;
+ // move index itow
+ index = UBX_PAYLOAD_INDEX + 4;
- return_decoded_msg.itow = buf[index++];
- return_decoded_msg.itow |= (buf[index++] << 8);
- return_decoded_msg.itow |= (buf[index++] << 16);
- return_decoded_msg.itow |= (buf[index++] << 24);
+ return_decoded_msg.itow = buf[index++];
+ return_decoded_msg.itow |= (buf[index++] << 8);
+ return_decoded_msg.itow |= (buf[index++] << 16);
+ return_decoded_msg.itow |= (buf[index++] << 24);
- // move index lon
- index = UBX_PAYLOAD_INDEX + 24;
+ // move index lon
+ index = UBX_PAYLOAD_INDEX + 24;
- return_decoded_msg.lon = buf[index++];
- return_decoded_msg.lon |= (buf[index++] << 8);
- return_decoded_msg.lon |= (buf[index++] << 16);
- return_decoded_msg.lon |= (buf[index++] << 24);
+ return_decoded_msg.lon = buf[index++];
+ return_decoded_msg.lon |= (buf[index++] << 8);
+ return_decoded_msg.lon |= (buf[index++] << 16);
+ return_decoded_msg.lon |= (buf[index++] << 24);
- return_decoded_msg.lat = buf[index++];
- return_decoded_msg.lat |= (buf[index++] << 8);
- return_decoded_msg.lat |= (buf[index++] << 16);
- return_decoded_msg.lat |= (buf[index++] << 24);
+ return_decoded_msg.lat = buf[index++];
+ return_decoded_msg.lat |= (buf[index++] << 8);
+ return_decoded_msg.lat |= (buf[index++] << 16);
+ return_decoded_msg.lat |= (buf[index++] << 24);
- return_decoded_msg.height = buf[index++];
- return_decoded_msg.height |= (buf[index++] << 8);
- return_decoded_msg.height |= (buf[index++] << 16);
- return_decoded_msg.height |= (buf[index++] << 24);
+ return_decoded_msg.height = buf[index++];
+ return_decoded_msg.height |= (buf[index++] << 8);
+ return_decoded_msg.height |= (buf[index++] << 16);
+ return_decoded_msg.height |= (buf[index++] << 24);
- // move index to distance
- index = UBX_PAYLOAD_INDEX + 84;
+ // move index to distance
+ index = UBX_PAYLOAD_INDEX + 84;
- return_decoded_msg.distance = buf[index++];
- return_decoded_msg.distance |= (buf[index++] << 8);
- return_decoded_msg.distance |= (buf[index++] << 16);
- return_decoded_msg.distance |= (buf[index++] << 24);
+ return_decoded_msg.distance = buf[index++];
+ return_decoded_msg.distance |= (buf[index++] << 8);
+ return_decoded_msg.distance |= (buf[index++] << 16);
+ return_decoded_msg.distance |= (buf[index++] << 24);
- return_decoded_msg.totalDistance = buf[index++];
- return_decoded_msg.totalDistance |= (buf[index++] << 8);
- return_decoded_msg.totalDistance |= (buf[index++] << 16);
- return_decoded_msg.totalDistance |= (buf[index++] << 24);
+ return_decoded_msg.totalDistance = buf[index++];
+ return_decoded_msg.totalDistance |= (buf[index++] << 8);
+ return_decoded_msg.totalDistance |= (buf[index++] << 16);
+ return_decoded_msg.totalDistance |= (buf[index++] << 24);
- return_decoded_msg.distanceSTD = buf[index++];
- return_decoded_msg.distanceSTD |= (buf[index++] << 8);
- return_decoded_msg.distanceSTD |= (buf[index++] << 16);
- return_decoded_msg.distanceSTD |= (buf[index++] << 24);
+ return_decoded_msg.distanceSTD = buf[index++];
+ return_decoded_msg.distanceSTD |= (buf[index++] << 8);
+ return_decoded_msg.distanceSTD |= (buf[index++] << 16);
+ return_decoded_msg.distanceSTD |= (buf[index++] << 24);
- return return_decoded_msg;
+ return return_decoded_msg;
}
tUBX_NAV_STATUS GnssParser::decode_ubx_nav_status_msg(char *buf) {
- tUBX_NAV_STATUS return_decoded_msg;
- uint8_t index = UBX_PAYLOAD_INDEX;
+ tUBX_NAV_STATUS return_decoded_msg;
+ uint8_t index = UBX_PAYLOAD_INDEX;
- return_decoded_msg.itow = buf[index++];
- return_decoded_msg.itow |= (buf[index++] << 8);
- return_decoded_msg.itow |= (buf[index++] << 16);
- return_decoded_msg.itow |= (buf[index++] << 24);
+ return_decoded_msg.itow = buf[index++];
+ return_decoded_msg.itow |= (buf[index++] << 8);
+ return_decoded_msg.itow |= (buf[index++] << 16);
+ return_decoded_msg.itow |= (buf[index++] << 24);
- // move index flag
- return_decoded_msg.fix = buf[index++];
+ // move index flag
+ return_decoded_msg.fix = buf[index++];
- return_decoded_msg.flags = buf[index++];
+ return_decoded_msg.flags = buf[index++];
- // move to ttff
- index+=2;
+ // move to ttff
+ index+=2;
- return_decoded_msg.ttff = buf[index++];
- return_decoded_msg.ttff |= (buf[index++] << 8);
- return_decoded_msg.ttff |= (buf[index++] << 16);
- return_decoded_msg.ttff |= (buf[index++] << 24);
+ return_decoded_msg.ttff = buf[index++];
+ return_decoded_msg.ttff |= (buf[index++] << 8);
+ return_decoded_msg.ttff |= (buf[index++] << 16);
+ return_decoded_msg.ttff |= (buf[index++] << 24);
- return_decoded_msg.msss = buf[index++];
- return_decoded_msg.msss |= (buf[index++] << 8);
- return_decoded_msg.msss |= (buf[index++] << 16);
- return_decoded_msg.msss |= (buf[index++] << 24);
+ return_decoded_msg.msss = buf[index++];
+ return_decoded_msg.msss |= (buf[index++] << 8);
+ return_decoded_msg.msss |= (buf[index++] << 16);
+ return_decoded_msg.msss |= (buf[index++] << 24);
- return return_decoded_msg;
+ return return_decoded_msg;
}
tUBX_NAV_SAT GnssParser::decode_ubx_nav_sat_msg(char *buf, int length) {
- tUBX_NAV_SAT return_decoded_msg;
- uint8_t index = UBX_PAYLOAD_INDEX;
- uint8_t numberSVs = buf[index + 5];
+ tUBX_NAV_SAT return_decoded_msg;
+ uint8_t index = UBX_PAYLOAD_INDEX;
+ uint8_t numberSVs = buf[index + 5];
- if(length == (UBX_FRAME_SIZE + 8 + (12*numberSVs))) {
- return_decoded_msg.status = true;
- }
- else {
- return_decoded_msg.status = false;
- }
+ if(length == (UBX_FRAME_SIZE + 8 + (12*numberSVs))) {
+ return_decoded_msg.status = true;
+ }
+ else {
+ return_decoded_msg.status = false;
+ }
- return return_decoded_msg;
+ return return_decoded_msg;
}
int GnssParser::ubx_request_batched_data(bool sendMonFirst) {
- unsigned char ubx_log_retrieve_batch[]={0x00, 0x00, 0x00, 0x00};
+ unsigned char ubx_log_retrieve_batch[]= {0x00, 0x00, 0x00, 0x00};
- ubx_log_retrieve_batch[1] = (sendMonFirst == true) ? 0x01 : 0x00;
+ ubx_log_retrieve_batch[1] = (sendMonFirst == true) ? 0x01 : 0x00;
- int conf = RETRY;
- while(conf)
- {
+ int conf = RETRY;
+ while(conf)
+ {
- int length = sendUbx(0x21, 0x10, ubx_log_retrieve_batch, sizeof(ubx_log_retrieve_batch));
- if(length >= (int)(sizeof(ubx_log_retrieve_batch) + UBX_FRAME_SIZE))
- {
- wait(5);
- break;
- }
- else
- {
- conf = conf - 1;
- }
- }
- if(conf == 0)
- {
- return 1;
- }
+ int length = sendUbx(0x21, 0x10, ubx_log_retrieve_batch, sizeof(ubx_log_retrieve_batch));
+ if(length >= (int)(sizeof(ubx_log_retrieve_batch) + UBX_FRAME_SIZE))
+ {
+ wait(1);
+ break;
+ }
+ else
+ {
+ conf = conf - 1;
+ }
+ }
+ if(conf == 0)
+ {
+ return 1;
+ }
- return 0;
+ return 0;
}
-
+
const char GnssParser::_toHex[] = { '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' };
// ----------------------------------------------------------------
-// Serial Implementation
+// Serial Implementation
// ----------------------------------------------------------------
GnssSerial::GnssSerial(PinName tx /*= GNSSTXD */, PinName rx /*= GNSSRXD */, int baudrate /*= GNSSBAUD */,
int rxSize /*= 256 */, int txSize /*= 128 */) :
- SerialPipe(tx, rx, baudrate, rxSize, txSize)
+ SerialPipe(tx, rx, baudrate, rxSize, txSize)
{
baud(baudrate);
}
@@ -625,10 +637,10 @@
{
Timer timer;
int size;
-
+
// Unused (kept only for compatibility with the I2C version)
(void)pn;
-
+
// Power up and enable the module
_powerOn();
@@ -641,7 +653,7 @@
/* Nothing, just wait */
}
timer.stop();
-
+
enable_ubx();
wait_ms(1000);
@@ -649,38 +661,38 @@
baud(115200);
// Send a byte to wakup the device again
- putc(0xFF);
- // Wait until we get some bytes
- size = _pipeRx.size();
- timer.start();
- while ((timer.read_ms() < 1000) && (size == _pipeRx.size())) {
- /* Nothing, just wait */
- }
+ putc(0xFF);
+ // Wait until we get some bytes
+ size = _pipeRx.size();
+ timer.start();
+ while ((timer.read_ms() < 1000) && (size == _pipeRx.size())) {
+ /* Nothing, just wait */
+ }
return (size != _pipeRx.size());
}
int GnssSerial::getMessage(char* buf, int len)
{
- return _getMessage(&_pipeRx, buf, len);
+ return _getMessage(&_pipeRx, buf, len);
}
int GnssSerial::_send(const void* buf, int len)
{
- GET_SDCARD_INSTANCE->write(logging_file_name, (void *)buf, len);
+ GET_SDCARD_INSTANCE->write(logging_file_name, (void *)buf, len);
- return put((const char*)buf, len, true/*=blocking*/);
+ return put((const char*)buf, len, true/*=blocking*/);
}
// ----------------------------------------------------------------
-// I2C Implementation
+// I2C Implementation
// ----------------------------------------------------------------
GnssI2C::GnssI2C(PinName sda /*= NC */, PinName scl /*= NC */,
- unsigned char i2cAdr /*= (66<<1) */, int rxSize /*= 256 */) :
- I2C(sda,scl),
- _pipe(rxSize),
- _i2cAdr(i2cAdr)
+ unsigned char i2cAdr /*= (66<<1) */, int rxSize /*= 256 */) :
+ I2C(sda,scl),
+ _pipe(rxSize),
+ _i2cAdr(i2cAdr)
{
frequency(100000);
}
@@ -708,18 +720,18 @@
{
// Fill the pipe
int sz = _pipe.free();
- if (sz)
+ if (sz)
sz = _get(buf, sz);
- if (sz)
+ if (sz)
_pipe.put(buf, sz);
// Now parse it
- return _getMessage(&_pipe, buf, len);
+ return _getMessage(&_pipe, buf, len);
}
int GnssI2C::send(const char* buf, int len)
{
int sent = 0;
- if (len)
+ if (len)
{
if (!I2C::write(_i2cAdr,®STREAM,sizeof(REGSTREAM),true))
sent = send(buf, len);
@@ -729,7 +741,7 @@
}
int GnssI2C::sendNmea(const char* buf, int len)
-{
+{
int sent = 0;
if (!I2C::write(_i2cAdr,®STREAM,sizeof(REGSTREAM),true))
sent = GnssParser::sendNmea(buf, len);
@@ -738,7 +750,7 @@
}
int GnssI2C::sendUbx(unsigned char cls, unsigned char id, const void* buf, int len)
-{
+{
int sent = 0;
if (!I2C::write(_i2cAdr,®STREAM,sizeof(REGSTREAM),true))
sent = GnssParser::sendUbx(cls, id, buf, len);
@@ -750,16 +762,16 @@
{
int read = 0;
unsigned char sz[2] = {0,0};
- if (!I2C::write(_i2cAdr,®LEN,sizeof(REGLEN),true) &&
- !I2C::read(_i2cAdr,(char*)sz,sizeof(sz)))
+ if (!I2C::write(_i2cAdr,®LEN,sizeof(REGLEN),true) &&
+ !I2C::read(_i2cAdr,(char*)sz,sizeof(sz)))
{
int size = 256 * (int)sz[0] + sz[1];
if (size > len)
size = len;
- if (size > 0)
+ if (size > 0)
{
if (!I2C::write(_i2cAdr,®STREAM,sizeof(REGSTREAM),true) &&
- !I2C::read(_i2cAdr,buf,size)) {
+ !I2C::read(_i2cAdr,buf,size)) {
read = size;
}
}
@@ -768,8 +780,8 @@
}
int GnssI2C::_send(const void* buf, int len)
-{
- return !I2C::write(_i2cAdr,(const char*)buf,len,true) ? len : 0;
+{
+ return !I2C::write(_i2cAdr,(const char*)buf,len,true) ? len : 0;
}
const char GnssI2C::REGLEN = 0xFD;
--- a/gnss.h Wed Apr 24 17:55:48 2019 +0500
+++ b/gnss.h Wed May 29 16:45:00 2019 +0500
@@ -53,68 +53,68 @@
enum eUBX_MESSAGE {UBX_LOG_BATCH, UBX_ACK_ACK, UBX_ACK_NAK, UBX_NAV_ODO, UBX_NAV_PVT, UBX_NAV_STATUS, UBX_NAV_SAT, UNKNOWN_UBX};
typedef struct UBX_ACK_ACK {
- uint8_t msg_class;
- uint8_t msg_id;
+ uint8_t msg_class;
+ uint8_t msg_id;
-}tUBX_ACK_ACK;
+} tUBX_ACK_ACK;
typedef struct UBX_NAV_ODO {
- uint8_t version;
- uint8_t reserved[3];
- uint32_t itow;
- uint32_t distance;
- uint32_t totalDistance;
- uint32_t distanceSTD;
-}tUBX_NAV_ODO;
+ uint8_t version;
+ uint8_t reserved[3];
+ uint32_t itow;
+ uint32_t distance;
+ uint32_t totalDistance;
+ uint32_t distanceSTD;
+} tUBX_NAV_ODO;
typedef struct UBX_NAV_PVT {
- uint32_t itow;
- uint16_t year;
- uint8_t month;
- uint8_t day;
- uint8_t fixType;
+ uint32_t itow;
+ uint16_t year;
+ uint8_t month;
+ uint8_t day;
+ uint8_t fixType;
uint8_t flag1; // gnssFixOK, diffSoln, psmState, headVehValid and carrSoln.
- int32_t lon; // scaling 1e-7
- int32_t lat; // scaling 1e-7
- int32_t height;
- int32_t speed;
+ int32_t lon; // scaling 1e-7
+ int32_t lat; // scaling 1e-7
+ int32_t height;
+ int32_t speed;
-}tUBX_NAV_PVT;
+} tUBX_NAV_PVT;
typedef struct UBX_LOG_BATCH {
- uint32_t itow;
- int32_t lon; // scaling 1e-7
- int32_t lat; // scaling 1e-7
- int32_t height;
- uint32_t distance;
- uint32_t totalDistance;
- uint32_t distanceSTD;
+ uint32_t itow;
+ int32_t lon; // scaling 1e-7
+ int32_t lat; // scaling 1e-7
+ int32_t height;
+ uint32_t distance;
+ uint32_t totalDistance;
+ uint32_t distanceSTD;
-}tUBX_LOG_BATCH;
+} tUBX_LOG_BATCH;
typedef struct UBX_CFG_BATCH {
- uint32_t version;
- uint8_t flags;
- uint32_t bufSize;
- uint32_t notifThrs;
- uint8_t pioId;
- uint8_t reserved1;
+ uint32_t version;
+ uint8_t flags;
+ uint32_t bufSize;
+ uint32_t notifThrs;
+ uint8_t pioId;
+ uint8_t reserved1;
-}tUBX_CFG_BATCH;
+} tUBX_CFG_BATCH;
-typedef struct UBX_NAV_STATUS{
- uint32_t itow;
- uint8_t fix;
- uint8_t flags;
- uint32_t ttff;
- uint32_t msss;
+typedef struct UBX_NAV_STATUS {
+ uint32_t itow;
+ uint8_t fix;
+ uint8_t flags;
+ uint32_t ttff;
+ uint32_t msss;
-}tUBX_NAV_STATUS;
+} tUBX_NAV_STATUS;
-typedef struct UBX_NAV_SAT{
- bool status;
+typedef struct UBX_NAV_SAT {
+ bool status;
-}tUBX_NAV_SAT;
+} tUBX_NAV_SAT;
/** Basic GNSS parser class.
*/
@@ -131,45 +131,45 @@
/** Power-on/wake-up the GNSS.
*/
virtual bool init(PinName pn) = 0;
-
- enum {
+
+ enum {
// getLine Responses
WAIT = -1, //!< wait for more incoming data (the start of a message was found, or no data available)
NOT_FOUND = 0, //!< a parser concluded the the current offset of the pipe doe not contain a valid message
-
- #define LENGTH(x) (x & 0x00FFFF) //!< extract/mask the length
- #define PROTOCOL(x) (x & 0xFF0000) //!< extract/mask the type
- UNKNOWN = 0x000000, //!< message type is unknown
+#define LENGTH(x) (x & 0x00FFFF) //!< extract/mask the length
+#define PROTOCOL(x) (x & 0xFF0000) //!< extract/mask the type
+
+ UNKNOWN = 0x000000, //!< message type is unknown
UBX = 0x100000, //!< message if of protocol NMEA
NMEA = 0x200000 //!< message if of protocol UBX
};
-
+
/** Get a line from the physical interface. This function
* needs to be implemented in the inherited class.
* @param buf the buffer to store it.
* @param len size of the buffer.
- * @return type and length if something was found,
+ * @return type and length if something was found,
* WAIT if not enough data is available,
* NOT_FOUND if nothing was found
- */
+ */
virtual int getMessage(char* buf, int len) = 0;
-
+
/** Send a buffer.
* @param buf the buffer to write.
* @param len size of the buffer to write.
* @return bytes written.
*/
virtual int send(const char* buf, int len);
-
- /** send a NMEA message, this function just takes the
+
+ /** send a NMEA message, this function just takes the
* payload and calculates and adds checksum. ($ and *XX\r\n will be added).
* @param buf the message payload to write.
* @param len size of the message payload to write.
* @return total bytes written.
*/
virtual int sendNmea(const char* buf, int len);
-
+
/** Send a UBX message, this function just takes the
* payload and calculates and adds checksum.
* @param cls the UBX class id.
@@ -178,27 +178,27 @@
* @param len size of the message payload to write.
* @return total bytes written.
*/
- virtual int sendUbx(unsigned char cls, unsigned char id,
+ virtual int sendUbx(unsigned char cls, unsigned char id,
const void* buf = NULL, int len = 0);
-
+
/** Power off the GNSS, it can be again woken up by an
- * edge on the serial port on the external interrupt pin.
+ * edge on the serial port on the external interrupt pin.
*/
void powerOff(void);
-
- /** Cuts off the power supply of GNSS by disabling gnssEnable pin
- * Backup supply is provided, can turn it on again by enabling PA15
- */
+
+ /** Cuts off the power supply of GNSS by disabling gnssEnable pin
+ * Backup supply is provided, can turn it on again by enabling PA15
+ */
void cutOffPower(void);
-
+
/** get the first character of a NMEA field.
* @param ix the index of the field to find.
* @param start the start of the buffer.
* @param end the end of the buffer.
- * @return the pointer to the first character of the field.
+ * @return the pointer to the first character of the field.
*/
static const char* findNmeaItemPos(int ix, const char* start, const char* end);
-
+
/** Extract a double value from a buffer containing a NMEA message.
* @param ix the index of the field to extract.
* @param buf the NMEA message.
@@ -207,7 +207,7 @@
* @return true if successful, false otherwise.
*/
static bool getNmeaItem(int ix, char* buf, int len, double& val);
-
+
/** Extract a interger value from a buffer containing a NMEA message.
* @param ix the index of the field to extract.
* @param buf the NMEA message.
@@ -217,7 +217,7 @@
* @return true if successful, false otherwise.
*/
static bool getNmeaItem(int ix, char* buf, int len, int& val, int base/*=10*/);
-
+
/** Extract a char value from a buffer containing a NMEA message.
* @param ix the index of the field to extract.
* @param buf the NMEA message.
@@ -226,7 +226,7 @@
* @return true if successful, false otherwise.
*/
static bool getNmeaItem(int ix, char* buf, int len, char& val);
-
+
/** Extract a latitude/longitude value from a buffer containing a NMEA message.
* @param ix the index of the field to extract (will extract ix and ix + 1),
* @param buf the NMEA message,
@@ -237,11 +237,11 @@
static bool getNmeaAngle(int ix, char* buf, int len, double& val);
/** Enable UBX messages.
- * @param none
- * @return 1 if successful, false otherwise.
- */
+ * @param none
+ * @return 1 if successful, false otherwise.
+ */
int enable_ubx();
-
+
/** GET Message type of receiver UBX message
* @param buff the UXB message
* @return eUBX_MESSAGE
@@ -261,33 +261,33 @@
tUBX_NAV_ODO decode_ubx_nav_odo_msg(char *);
/** Method to parse contents of UBX_NAV_PVT and return decoded msg
- * @param buff the UXB message
- * @return tUBX_NAV_PVT
- */
+ * @param buff the UXB message
+ * @return tUBX_NAV_PVT
+ */
tUBX_NAV_PVT decode_ubx_nav_pvt_msg(char *);
/** Method to parse contents of UBX_LOG_BATCH and return decoded msg
- * @param buff the UXB message
- * @return tUBX_LOG_BATCH
- */
+ * @param buff the UXB message
+ * @return tUBX_LOG_BATCH
+ */
tUBX_LOG_BATCH decode_ubx_log_batch_msg(char *);
/** Method to parse contents of UBX_NAV_STATUS and return decoded msg
- * @param buff the UXB message
- * @return tUBX_NAV_STATUS
- */
+ * @param buff the UXB message
+ * @return tUBX_NAV_STATUS
+ */
tUBX_NAV_STATUS decode_ubx_nav_status_msg(char *);
/** Method to parse contents of UBX_NAV_SAT and return decoded msg
- * @param buff the UXB message, int length
- * @return tUBX_NAV_SAT
- */
+ * @param buff the UXB message, int length
+ * @return tUBX_NAV_SAT
+ */
tUBX_NAV_SAT decode_ubx_nav_sat_msg(char *, int);
/** Method to send UBX LOG-RETRIEVEBATCH msg. This message is used to request batched data.
- * @param bool
- * @return int
- */
+ * @param bool
+ * @return int
+ */
int ubx_request_batched_data(bool sendMonFirst = false);
protected:
@@ -299,43 +299,43 @@
* @param pipe the receiveing pipe to parse messages .
* @param buf the buffer to store it.
* @param len size of the buffer.
- * @return type and length if something was found,
+ * @return type and length if something was found,
* WAIT if not enough data is available,
* NOT_FOUND if nothing was found.
- */
+ */
static int _getMessage(Pipe<char>* pipe, char* buf, int len);
-
+
/** Check if the current offset of the pipe contains a NMEA message.
* @param pipe the receiveing pipe to parse messages.
* @param len numer of bytes to parse at maximum.
* @return length if something was found (including the NMEA frame),
* WAIT if not enough data is available,
* NOT_FOUND if nothing was found.
- */
+ */
static int _parseNmea(Pipe<char>* pipe, int len);
-
+
/** Check if the current offset of the pipe contains a UBX message.
* @param pipe the receiveing pipe to parse messages.
* @param len numer of bytes to parse at maximum.
* @return length if something was found (including the UBX frame),
* WAIT if not enough data is available,
* NOT_FOUND if nothing was found.
- */
+ */
static int _parseUbx(Pipe<char>* pipe, int len);
-
- /** Write bytes to the physical interface. This function
- * needs to be implemented by the inherited class.
+
+ /** Write bytes to the physical interface. This function
+ * needs to be implemented by the inherited class.
* @param buf the buffer to write.
* @param len size of the buffer to write.
* @return bytes written.
*/
virtual int _send(const void* buf, int len) = 0;
-
+
static const char _toHex[16]; //!< num to hex conversion
DigitalInOut *_gnssEnable; //!< IO pin that enables GNSS
};
-/** GNSS class which uses a serial port as physical interface.
+/** GNSS class which uses a serial port as physical interface.
*/
class GnssSerial : public SerialPipe, public GnssParser
{
@@ -350,29 +350,29 @@
GnssSerial(PinName tx GNSS_IF( = GNSSTXD, = D8 /* = D8 */), // resistor on shield not populated
PinName rx GNSS_IF( = GNSSRXD, = D9 /* = D9 */), // resistor on shield not populated
int baudrate GNSS_IF( = GNSSBAUD, = 9600 ),
- int rxSize = 512 ,
+ int rxSize = 512,
int txSize = 512 );
-
+
/** Destructor.
*/
virtual ~GnssSerial(void);
-
+
/** Initialise the GNSS device.
* @param pn NOT USED.
* @param baudrate
* @return true if successful, otherwise false.
*/
virtual bool init(PinName pn = NC);
-
- /** Get a line from the physical interface.
+
+ /** Get a line from the physical interface.
* @param buf the buffer to store it.
* @param len size of the buffer.
- * @return type and length if something was found,
+ * @return type and length if something was found,
* WAIT if not enough data is available,
* NOT_FOUND if nothing was found.
- */
+ */
virtual int getMessage(char* buf, int len);
-
+
protected:
/** Write bytes to the physical interface.
* @param buf the buffer to write.
@@ -386,7 +386,7 @@
*/
class GnssI2C : public I2C, public GnssParser
{
-public:
+public:
/** Constructor.
* @param sda is the I2C SDA pin (between CPU and GNSS).
* @param scl is the I2C SCL pin (CPU to GNSS).
@@ -400,38 +400,38 @@
/** Destructor
*/
virtual ~GnssI2C(void);
-
+
/** Helper function to probe the i2c device.
* @param pn the power-on pin for the chip.
* @return true if successfully detected the GNSS chip.
- */
+ */
virtual bool init(PinName pn = GNSS_IF( NC, NC /* D7 resistor R67 on shield not mounted */));
-
- /** Get a line from the physical interface.
+
+ /** Get a line from the physical interface.
* @param buf the buffer to store it.
* @param len size of the buffer.
- * @return type and length if something was found,
+ * @return type and length if something was found,
* WAIT if not enough data is available,
* NOT_FOUND if nothing was found.
- */
+ */
virtual int getMessage(char* buf, int len);
-
+
/** Send a buffer.
* @param buf the buffer to write.
* @param len size of the buffer to write.
* @return bytes written.
*/
virtual int send(const char* buf, int len);
-
- /** Send an NMEA message, this function just takes the
+
+ /** Send an NMEA message, this function just takes the
* payload and calculates and adds checksum ($ and *XX\r\n will be added).
* @param buf the message payload to write.
* @param len size of the message payload to write.
* @return total bytes written.
*/
virtual int sendNmea(const char* buf, int len);
-
- /** Send a UBX message, this function just takes the
+
+ /** Send a UBX message, this function just takes the
* payload and calculates and adds checksum.
* @param cls the UBX class id.
* @param id the UBX message id.
@@ -439,35 +439,40 @@
* @param len size of the message payload to write.
* @return total bytes written.
*/
- virtual int sendUbx(unsigned char cls, unsigned char id,
+ virtual int sendUbx(unsigned char cls, unsigned char id,
const void* buf = NULL, int len = 0);
-
+
protected:
/** Check if the port is writeable (like SerialPipe)
- * @return true if writeable
+ * @return true if writeable
*/
- bool writeable(void) {return true;}
-
+ bool writeable(void) {
+ return true;
+ }
+
/** Write a character (like SerialPipe).
* @param c the character to write.
* @return true if succesffully written .
*/
- bool putc(int c) {char ch = c; return send(&ch, 1);}
-
+ bool putc(int c) {
+ char ch = c;
+ return send(&ch, 1);
+ }
+
/** Write bytes to the physical interface.
* @param buf the buffer to write.
* @param len size of the buffer to write.
* @return bytes written.
*/
virtual int _send(const void* buf, int len);
-
+
/** Read bytes from the physical interface.
* @param buf the buffer to read into.
* @param len size of the read buffer .
* @return bytes read.
*/
int _get(char* buf, int len);
-
+
Pipe<char> _pipe; //!< the rx pipe.
unsigned char _i2cAdr; //!< the i2c address.
static const char REGLEN; //!< the length i2c register address.
--- a/gnss_operations.cpp Wed Apr 24 17:55:48 2019 +0500
+++ b/gnss_operations.cpp Wed May 29 16:45:00 2019 +0500
@@ -22,109 +22,109 @@
*/
int GnssOperations::enable_ubx_nav_pvt()
{
- int conf = RETRY;
- unsigned char enable_ubx_nav_pvt[]={0x01, 0x07, 0x01};
- conf = RETRY;
- int length =0;
+ int conf = RETRY;
+ unsigned char enable_ubx_nav_pvt[]= {0x01, 0x07, 0x01};
+ conf = RETRY;
+ int length =0;
- while(conf)
- {
+ while(conf)
+ {
- length = GnssSerial::sendUbx(0x06, 0x01, enable_ubx_nav_pvt, sizeof(enable_ubx_nav_pvt));
- if(length >= (int)(sizeof(enable_ubx_nav_pvt) + UBX_FRAME_SIZE))
- {
- SEND_LOGGING_MESSAGE("UBX-NAV-PVT was enabled\r\n");
- wait(1);
- break;
- }
- else
- {
- SEND_LOGGING_MESSAGE("enabling UBX-NAV-PVT...\r\n");
- conf = conf - 1;
- }
- }
+ length = GnssSerial::sendUbx(0x06, 0x01, enable_ubx_nav_pvt, sizeof(enable_ubx_nav_pvt));
+ if(length >= (int)(sizeof(enable_ubx_nav_pvt) + UBX_FRAME_SIZE))
+ {
+ SEND_LOGGING_MESSAGE("UBX-NAV-PVT was enabled\r\n");
+ wait(0.5);
+ break;
+ }
+ else
+ {
+ SEND_LOGGING_MESSAGE("enabling UBX-NAV-PVT...\r\n");
+ conf = conf - 1;
+ }
+ }
- return (conf == 0) ? 0 : 1;
+ return (conf == 0) ? 0 : 1;
}
int GnssOperations::enable_ubx_nav_status() {
- int conf = RETRY;
- unsigned char enable_ubx_nav_status[]={0x01, 0x03, 0x01};
- conf = RETRY;
- int length =0;
+ int conf = RETRY;
+ unsigned char enable_ubx_nav_status[]= {0x01, 0x03, 0x01};
+ conf = RETRY;
+ int length =0;
- while(conf)
- {
+ while(conf)
+ {
- length = GnssSerial::sendUbx(0x06, 0x01, enable_ubx_nav_status, sizeof(enable_ubx_nav_status));
- if(length >= (int)(sizeof(enable_ubx_nav_status) + UBX_FRAME_SIZE))
- {
- SEND_LOGGING_MESSAGE("UBX-NAV-STATUS was enabled\r\n");
- wait(1);
- break;
- }
- else
- {
- SEND_LOGGING_MESSAGE("enabling UBX-NAV-STATUS...\r\n");
- conf = conf - 1;
- }
- }
+ length = GnssSerial::sendUbx(0x06, 0x01, enable_ubx_nav_status, sizeof(enable_ubx_nav_status));
+ if(length >= (int)(sizeof(enable_ubx_nav_status) + UBX_FRAME_SIZE))
+ {
+ SEND_LOGGING_MESSAGE("UBX-NAV-STATUS was enabled\r\n");
+ wait(0.5);
+ break;
+ }
+ else
+ {
+ SEND_LOGGING_MESSAGE("enabling UBX-NAV-STATUS...\r\n");
+ conf = conf - 1;
+ }
+ }
- return (conf == 0) ? 0 : 1;
+ return (conf == 0) ? 0 : 1;
}
int GnssOperations::enable_ubx_nav_sat() {
- int conf = RETRY;
- unsigned char enable_ubx_nav_sat[]={0x01, 0x35, 0x01};
- conf = RETRY;
- int length =0;
+ int conf = RETRY;
+ unsigned char enable_ubx_nav_sat[]= {0x01, 0x35, 0x01};
+ conf = RETRY;
+ int length =0;
- while(conf)
- {
+ while(conf)
+ {
- length = GnssSerial::sendUbx(0x06, 0x01, enable_ubx_nav_sat, sizeof(enable_ubx_nav_sat));
- if(length >= (int)(sizeof(enable_ubx_nav_sat) + UBX_FRAME_SIZE))
- {
- SEND_LOGGING_MESSAGE("UBX-NAV-STATUS was enabled\r\n");
- wait(1);
- break;
- }
- else
- {
- SEND_LOGGING_MESSAGE("enabling UBX-NAV-STATUS...\r\n");
- conf = conf - 1;
- }
- }
+ length = GnssSerial::sendUbx(0x06, 0x01, enable_ubx_nav_sat, sizeof(enable_ubx_nav_sat));
+ if(length >= (int)(sizeof(enable_ubx_nav_sat) + UBX_FRAME_SIZE))
+ {
+ SEND_LOGGING_MESSAGE("UBX-NAV-STATUS was enabled\r\n");
+ wait(0.5);
+ break;
+ }
+ else
+ {
+ SEND_LOGGING_MESSAGE("enabling UBX-NAV-STATUS...\r\n");
+ conf = conf - 1;
+ }
+ }
- return (conf == 0) ? 0 : 1;
+ return (conf == 0) ? 0 : 1;
}
int GnssOperations::enable_ubx_nav_sol() {
- int conf = RETRY;
- unsigned char enable_ubx_nav_status[]={0x01, 0x06, 0x0A};
- conf = RETRY;
- int length =0;
+ int conf = RETRY;
+ unsigned char enable_ubx_nav_status[]= {0x01, 0x06, 0x0A};
+ conf = RETRY;
+ int length =0;
- while(conf)
- {
+ while(conf)
+ {
- length = GnssSerial::sendUbx(0x06, 0x01, enable_ubx_nav_status, sizeof(enable_ubx_nav_status));
- if(length >= (int)(sizeof(enable_ubx_nav_status) + UBX_FRAME_SIZE))
- {
- SEND_LOGGING_MESSAGE("UBX-NAV-STATUS was enabled\r\n");
- wait(1);
- break;
- }
- else
- {
- SEND_LOGGING_MESSAGE("enabling UBX-NAV-STATUS...\r\n");
- conf = conf - 1;
- }
- }
+ length = GnssSerial::sendUbx(0x06, 0x01, enable_ubx_nav_status, sizeof(enable_ubx_nav_status));
+ if(length >= (int)(sizeof(enable_ubx_nav_status) + UBX_FRAME_SIZE))
+ {
+ SEND_LOGGING_MESSAGE("UBX-NAV-STATUS was enabled\r\n");
+ wait(0.5);
+ break;
+ }
+ else
+ {
+ SEND_LOGGING_MESSAGE("enabling UBX-NAV-STATUS...\r\n");
+ conf = conf - 1;
+ }
+ }
- return (conf == 0) ? 0 : 1;
+ return (conf == 0) ? 0 : 1;
}
@@ -137,59 +137,60 @@
*/
int GnssOperations::disable_ubx_nav_pvt()
{
- int conf = RETRY;
- unsigned char enable_ubx_nav_pvt[]={0x01, 0x07, 0x00};
- conf = RETRY;
- int length =0;
+ int conf = RETRY;
+ unsigned char enable_ubx_nav_pvt[]= {0x01, 0x07, 0x00};
+ conf = RETRY;
+ int length =0;
- while(conf)
- {
+ while(conf)
+ {
- length = GnssSerial::sendUbx(0x06, 0x01, enable_ubx_nav_pvt, sizeof(enable_ubx_nav_pvt));
- if(length >= (int)(sizeof(enable_ubx_nav_pvt) + UBX_FRAME_SIZE))
- {
- SEND_LOGGING_MESSAGE("UBX-NAV-PVT was disabled\r\n");
- wait(5);
- break;
- }
- else
- {
- SEND_LOGGING_MESSAGE("disabling UBX-NAV-PVT...\r\n");
- conf = conf - 1;
- }
- }
+ length = GnssSerial::sendUbx(0x06, 0x01, enable_ubx_nav_pvt, sizeof(enable_ubx_nav_pvt));
+ if(length >= (int)(sizeof(enable_ubx_nav_pvt) + UBX_FRAME_SIZE))
+ {
+ SEND_LOGGING_MESSAGE("UBX-NAV-PVT was disabled\r\n");
+ wait(0.5);
+ break;
+ }
+ else
+ {
+ SEND_LOGGING_MESSAGE("disabling UBX-NAV-PVT...\r\n");
+ conf = conf - 1;
+ }
+ }
- return (conf == 0) ? 0 : 1;
+ return (conf == 0) ? 0 : 1;
}
int GnssOperations::enable_ubx_nav5(unsigned int acc)
{
- int conf = RETRY;
- conf = RETRY;
- int length =0;
- //convert unsigned int acc to hex
- //ask if positioning mask or time accuracy mask
- unsigned char ubx_cfg_nav5[]={0xFF, 0xFF, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x10, 0x27, 0x00, 0x00,
- 0x0A, 0x00, 0xFA, 0x00,0xFA, 0x00, (unsigned char)EXTRACT_BYTE(0, FIRST_BYTE, acc), (unsigned char)EXTRACT_BYTE(1, SECOND_BYTE, acc),
- 0x5E, 0x01, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00};
+ int conf = RETRY;
+ conf = RETRY;
+ int length =0;
+ //convert unsigned int acc to hex
+ //ask if positioning mask or time accuracy mask
+ unsigned char ubx_cfg_nav5[]= {0xFF, 0xFF, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x10, 0x27, 0x00, 0x00,
+ 0x0A, 0x00, 0xFA, 0x00,0xFA, 0x00, (unsigned char)EXTRACT_BYTE(0, FIRST_BYTE, acc), (unsigned char)EXTRACT_BYTE(1, SECOND_BYTE, acc),
+ 0x5E, 0x01, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00
+ };
- while(conf)
- {
- length = GnssSerial::sendUbx(0x06, 0x24, ubx_cfg_nav5, sizeof(ubx_cfg_nav5));
- if(length >= (int)(sizeof(ubx_cfg_nav5) + UBX_FRAME_SIZE))
- {
- SEND_LOGGING_MESSAGE("ubx_cfg_nav5 was enabled\r\n");
- wait(1);
- break;
- }
- else
- {
- SEND_LOGGING_MESSAGE("enabling ubx_cfg_nav5...\r\n");
- conf = conf - 1;
- }
- }
+ while(conf)
+ {
+ length = GnssSerial::sendUbx(0x06, 0x24, ubx_cfg_nav5, sizeof(ubx_cfg_nav5));
+ if(length >= (int)(sizeof(ubx_cfg_nav5) + UBX_FRAME_SIZE))
+ {
+ SEND_LOGGING_MESSAGE("ubx_cfg_nav5 was enabled\r\n");
+ wait(0.5);
+ break;
+ }
+ else
+ {
+ SEND_LOGGING_MESSAGE("enabling ubx_cfg_nav5...\r\n");
+ conf = conf - 1;
+ }
+ }
- return (conf == 0) ? 0 : 1;
+ return (conf == 0) ? 0 : 1;
}
int GnssOperations::enable_ubx_navx5()
@@ -199,8 +200,9 @@
int length =0;
//convert unsigned int acc to hex
//ask if positioning mask or time accuracy mask
- unsigned char ubx_cfg_navx5[]={0x28, 0x00, 0x02, 0x00, 0xFF, 0xFF, 0xFF, 0x02, 0x00, 0x00, 0x03, 0x02, 0x03, 0x20, 0x06, 0x00, 0x01, 0x01, 0x00, 0x00, 0x90,
- 0x07, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x02, 0x64, 0x64, 0x00, 0x00, 0x01, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF9, 0xF7};
+ unsigned char ubx_cfg_navx5[]= {0x28, 0x00, 0x02, 0x00, 0xFF, 0xFF, 0xFF, 0x02, 0x00, 0x00, 0x03, 0x02, 0x03, 0x20, 0x06, 0x00, 0x01, 0x01, 0x00, 0x00, 0x90,
+ 0x07, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x02, 0x64, 0x64, 0x00, 0x00, 0x01, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF9, 0xF7
+ };
while(conf)
{
@@ -208,7 +210,7 @@
if(length >= (int)(sizeof(ubx_cfg_navx5) + UBX_FRAME_SIZE))
{
SEND_LOGGING_MESSAGE("ubx_cfg_navx5 was enabled\r\n");
- wait(1);
+ wait(0.5);
break;
}
else
@@ -229,56 +231,58 @@
*/
int GnssOperations::enable_ubx_odo()
{
- int conf = RETRY;
- unsigned char ubx_cfg_odo[]={0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x19, 0x46, 0x19, 0x66, 0x0A, 0x32, 0x00,
- 0x00, 0x99, 0x4C, 0x00, 0x00};
- conf = RETRY;
- int length =0;
+ int conf = RETRY;
+ unsigned char ubx_cfg_odo[]= {0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x19, 0x46, 0x19, 0x66, 0x0A, 0x32, 0x00,
+ 0x00, 0x99, 0x4C, 0x00, 0x00
+ };
+ conf = RETRY;
+ int length =0;
- while(conf)
- {
- length = GnssSerial::sendUbx(0x06, 0x1E, ubx_cfg_odo, sizeof(ubx_cfg_odo));
- if(length >= (int)(sizeof(ubx_cfg_odo) + UBX_FRAME_SIZE))
- {
- SEND_LOGGING_MESSAGE("UBX-ODO was enabled\r\n");
- wait(1);
- break;
- }
- else
- {
- SEND_LOGGING_MESSAGE("enabling UBX-ODO...\r\n");
- conf = conf - 1;
- }
- }
+ while(conf)
+ {
+ length = GnssSerial::sendUbx(0x06, 0x1E, ubx_cfg_odo, sizeof(ubx_cfg_odo));
+ if(length >= (int)(sizeof(ubx_cfg_odo) + UBX_FRAME_SIZE))
+ {
+ SEND_LOGGING_MESSAGE("UBX-ODO was enabled\r\n");
+ wait(0.5);
+ break;
+ }
+ else
+ {
+ SEND_LOGGING_MESSAGE("enabling UBX-ODO...\r\n");
+ conf = conf - 1;
+ }
+ }
- return (conf == 0) ? 0 : 1;
+ return (conf == 0) ? 0 : 1;
}
int GnssOperations::disable_ubx_odo()
{
- int conf = RETRY;
- unsigned char ubx_cfg_odo[]={0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x19, 0x46, 0x19, 0x66, 0x0A, 0x32, 0x00,
- 0x00, 0x99, 0x4C, 0x00, 0x00};
- conf = RETRY;
- int length =0;
+ int conf = RETRY;
+ unsigned char ubx_cfg_odo[]= {0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x19, 0x46, 0x19, 0x66, 0x0A, 0x32, 0x00,
+ 0x00, 0x99, 0x4C, 0x00, 0x00
+ };
+ conf = RETRY;
+ int length =0;
- while(conf)
- {
- length = GnssSerial::sendUbx(0x06, 0x1E, ubx_cfg_odo, sizeof(ubx_cfg_odo));
- if(length >= (int)(sizeof(ubx_cfg_odo) + UBX_FRAME_SIZE))
- {
- SEND_LOGGING_MESSAGE("UBX-ODO was disabled\r\n");
- wait(5);
- break;
- }
- else
- {
- SEND_LOGGING_MESSAGE("disabling UBX-ODO...\r\n");
- conf = conf - 1;
- }
- }
+ while(conf)
+ {
+ length = GnssSerial::sendUbx(0x06, 0x1E, ubx_cfg_odo, sizeof(ubx_cfg_odo));
+ if(length >= (int)(sizeof(ubx_cfg_odo) + UBX_FRAME_SIZE))
+ {
+ SEND_LOGGING_MESSAGE("UBX-ODO was disabled\r\n");
+ wait(0.5);
+ break;
+ }
+ else
+ {
+ SEND_LOGGING_MESSAGE("disabling UBX-ODO...\r\n");
+ conf = conf - 1;
+ }
+ }
- return (conf == 0) ? 0 : 1;
+ return (conf == 0) ? 0 : 1;
}
/**
* Enabling UBX-NAV-ODO messages using UBX-CFG-MSG
@@ -288,28 +292,28 @@
*/
int GnssOperations::enable_ubx_nav_odo()
{
- int conf = RETRY;
- unsigned char ubx_nav_odo[]={0x01, 0x09, 0x01};
- conf = RETRY;
- int length =0;
+ int conf = RETRY;
+ unsigned char ubx_nav_odo[]= {0x01, 0x09, 0x01};
+ conf = RETRY;
+ int length =0;
- while(conf)
- {
- length = GnssSerial::sendUbx(0x06, 0x01, ubx_nav_odo, sizeof(ubx_nav_odo));
- if(length >= (int)(sizeof(ubx_nav_odo) + UBX_FRAME_SIZE))
- {
- SEND_LOGGING_MESSAGE("UBX-NAV-ODO was enabled\r\n");
- wait(1);
- break;
- }
- else
- {
- SEND_LOGGING_MESSAGE("enabling UBX-NAV-ODO...\r\n");
- conf = conf - 1;
- }
- }
+ while(conf)
+ {
+ length = GnssSerial::sendUbx(0x06, 0x01, ubx_nav_odo, sizeof(ubx_nav_odo));
+ if(length >= (int)(sizeof(ubx_nav_odo) + UBX_FRAME_SIZE))
+ {
+ SEND_LOGGING_MESSAGE("UBX-NAV-ODO was enabled\r\n");
+ wait(0.5);
+ break;
+ }
+ else
+ {
+ SEND_LOGGING_MESSAGE("enabling UBX-NAV-ODO...\r\n");
+ conf = conf - 1;
+ }
+ }
- return (conf == 0) ? 0 : 1;
+ return (conf == 0) ? 0 : 1;
}
/**
@@ -320,86 +324,86 @@
*/
int GnssOperations::disable_ubx_nav_odo()
{
- int conf = RETRY;
- unsigned char ubx_nav_odo[]={0x01, 0x09, 0x00};
- conf = RETRY;
- int length =0;
+ int conf = RETRY;
+ unsigned char ubx_nav_odo[]= {0x01, 0x09, 0x00};
+ conf = RETRY;
+ int length =0;
- while(conf)
- {
- length = GnssSerial::sendUbx(0x06, 0x01, ubx_nav_odo, sizeof(ubx_nav_odo));
- if(length >= (int)(sizeof(ubx_nav_odo) + UBX_FRAME_SIZE))
- {
- SEND_LOGGING_MESSAGE("UBX-NAV-ODO was disabled\r\n");
- wait(5);
- break;
- }
- else
- {
- SEND_LOGGING_MESSAGE("disabling UBX-NAV-ODO...\r\n");
- conf = conf - 1;
- }
- }
+ while(conf)
+ {
+ length = GnssSerial::sendUbx(0x06, 0x01, ubx_nav_odo, sizeof(ubx_nav_odo));
+ if(length >= (int)(sizeof(ubx_nav_odo) + UBX_FRAME_SIZE))
+ {
+ SEND_LOGGING_MESSAGE("UBX-NAV-ODO was disabled\r\n");
+ wait(0.5);
+ break;
+ }
+ else
+ {
+ SEND_LOGGING_MESSAGE("disabling UBX-NAV-ODO...\r\n");
+ conf = conf - 1;
+ }
+ }
- return (conf == 0) ? 0 : 1;
+ return (conf == 0) ? 0 : 1;
}
int GnssOperations::enable_ubx_batch_feature()
{
- int conf = RETRY;
- unsigned char enable_ubx_log_batch[]={0x00, 0x0D, 0x0A, 0x00, 0x07, 0x00, 0x00, 0x01};
- conf = RETRY;
- int length =0;
+ int conf = RETRY;
+ unsigned char enable_ubx_log_batch[]= {0x00, 0x0D, 0x0A, 0x00, 0x07, 0x00, 0x00, 0x01};
+ conf = RETRY;
+ int length =0;
- //Disable NAV-ODO and NAV-PVT
- disable_ubx_nav_odo();
- disable_ubx_nav_pvt();
+ //Disable NAV-ODO and NAV-PVT
+ disable_ubx_nav_odo();
+ disable_ubx_nav_pvt();
- while(conf)
- {
- length = GnssSerial::sendUbx(0x06, 0x93, enable_ubx_log_batch, sizeof(enable_ubx_log_batch));
- if(length >= (int)(sizeof(enable_ubx_log_batch) + UBX_FRAME_SIZE))
- {
- SEND_LOGGING_MESSAGE("UBX_LOG_BATCH was enabled\r\n");
- wait(1);
- break;
- }
- else
- {
- SEND_LOGGING_MESSAGE("enable ubx_batch_log...\r\n");
- conf = conf - 1;
- }
- }
- return (conf == 0) ? 0 : 1;
+ while(conf)
+ {
+ length = GnssSerial::sendUbx(0x06, 0x93, enable_ubx_log_batch, sizeof(enable_ubx_log_batch));
+ if(length >= (int)(sizeof(enable_ubx_log_batch) + UBX_FRAME_SIZE))
+ {
+ SEND_LOGGING_MESSAGE("UBX_LOG_BATCH was enabled\r\n");
+ wait(0.5);
+ break;
+ }
+ else
+ {
+ SEND_LOGGING_MESSAGE("enable ubx_batch_log...\r\n");
+ conf = conf - 1;
+ }
+ }
+ return (conf == 0) ? 0 : 1;
}
int GnssOperations::disable_ubx_batch_feature()
{
- int conf = RETRY;
- unsigned char enable_ubx_log_batch[]={0x00, 0x0C, 0x0A, 0x00, 0x07, 0x00, 0x00, 0x01};
- conf = RETRY;
- int length =0;
+ int conf = RETRY;
+ unsigned char enable_ubx_log_batch[]= {0x00, 0x0C, 0x0A, 0x00, 0x07, 0x00, 0x00, 0x01};
+ conf = RETRY;
+ int length =0;
- //Enable NAV-ODO and NAV-PVT
- enable_ubx_nav_odo();
- enable_ubx_nav_pvt();
+ //Enable NAV-ODO and NAV-PVT
+ enable_ubx_nav_odo();
+ enable_ubx_nav_pvt();
- while(conf)
- {
- length = GnssSerial::sendUbx(0x06, 0x93, enable_ubx_log_batch, sizeof(enable_ubx_log_batch));
- if(length >= (int)(sizeof(enable_ubx_log_batch) + UBX_FRAME_SIZE))
- {
- SEND_LOGGING_MESSAGE("UBX_LOG_BATCH was enabled\r\n");
- wait(5);
- break;
- }
- else
- {
- SEND_LOGGING_MESSAGE("enable ubx_batch_log...\r\n");
- conf = conf - 1;
- }
- }
- return (conf == 0) ? 0 : 1;
+ while(conf)
+ {
+ length = GnssSerial::sendUbx(0x06, 0x93, enable_ubx_log_batch, sizeof(enable_ubx_log_batch));
+ if(length >= (int)(sizeof(enable_ubx_log_batch) + UBX_FRAME_SIZE))
+ {
+ SEND_LOGGING_MESSAGE("UBX_LOG_BATCH was enabled\r\n");
+ wait(0.5);
+ break;
+ }
+ else
+ {
+ SEND_LOGGING_MESSAGE("enable ubx_batch_log...\r\n");
+ conf = conf - 1;
+ }
+ }
+ return (conf == 0) ? 0 : 1;
}
/**
@@ -413,14 +417,15 @@
*/
int GnssOperations::cfg_batch_feature(tUBX_CFG_BATCH *obj)
{
- int length =0;
- const unsigned char cfg_batch_feature[] = {0x00, 0x01, (unsigned char)EXTRACT_BYTE(0, FIRST_BYTE, obj->bufSize),
- (unsigned char) EXTRACT_BYTE(1, SECOND_BYTE, obj->bufSize), (unsigned char) EXTRACT_BYTE(0, FIRST_BYTE, obj->notifThrs),
- (unsigned char) EXTRACT_BYTE(1, SECOND_BYTE, obj->notifThrs), obj->pioId, 0x00};
+ int length =0;
+ const unsigned char cfg_batch_feature[] = {0x00, 0x01, (unsigned char)EXTRACT_BYTE(0, FIRST_BYTE, obj->bufSize),
+ (unsigned char) EXTRACT_BYTE(1, SECOND_BYTE, obj->bufSize), (unsigned char) EXTRACT_BYTE(0, FIRST_BYTE, obj->notifThrs),
+ (unsigned char) EXTRACT_BYTE(1, SECOND_BYTE, obj->notifThrs), obj->pioId, 0x00
+ };
- length = GnssSerial::sendUbx(0x06, 0x93, cfg_batch_feature, sizeof(cfg_batch_feature));
+ length = GnssSerial::sendUbx(0x06, 0x93, cfg_batch_feature, sizeof(cfg_batch_feature));
- return (length >= (int)(sizeof(cfg_batch_feature) + UBX_FRAME_SIZE)) ? 1 : 0;
+ return (length >= (int)(sizeof(cfg_batch_feature) + UBX_FRAME_SIZE)) ? 1 : 0;
}
/*
@@ -432,28 +437,31 @@
*/
int GnssOperations::cfg_power_mode(Powermodes power_mode, bool minimumAcqTimeZero)
{
- int length = 0;
- const int minimumAcqTime_index = 22;
- unsigned char semi_continuous_pms[] = {0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
- unsigned char semi_continuous_pm2[] = {0x02, 0x06, 0x00, 0x00, 0x02, 0x00, 0x43, 0x01, 0x10, 0x27, 0x00, 0x00, 0x10,
- 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2C, 0x01, 0x2C, 0x01, 0x00, 0x00, 0xCF, 0x40, 0x00,
- 0x00, 0x87, 0x5A, 0xA4, 0x46, 0xFE, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
- unsigned char semi_continuous_rate[] = {0xE8, 0x03, 0x01, 0x00, 0x01, 0x00};
+ int length = 0;
+ const int minimumAcqTime_index = 22;
+ unsigned char semi_continuous_pms[] = {0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+ unsigned char semi_continuous_pm2[] = {0x02, 0x06, 0x00, 0x00, 0x02, 0x00, 0x43, 0x01, 0x10, 0x27, 0x00, 0x00, 0x10,
+ 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2C, 0x01, 0x2C, 0x01, 0x00, 0x00, 0xCF, 0x40, 0x00,
+ 0x00, 0x87, 0x5A, 0xA4, 0x46, 0xFE, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+ unsigned char semi_continuous_rate[] = {0xE8, 0x03, 0x01, 0x00, 0x01, 0x00};
- unsigned char aggresive_continuous_pms[] = {0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
- unsigned char aggresive_continuous_pm2[] = {0x02, 0x06, 0x00, 0x00, 0x02, 0x00, 0x43, 0x01, 0xE8, 0x03, 0x00, 0x00,
- 0x10, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2C, 0x01, 0x2C, 0x01, 0x00, 0x00, 0xCF, 0x40,
- 0x00, 0x00, 0x87, 0x5A, 0xA4, 0x46, 0xFE, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
- unsigned char aggressive_continuous_rate[] = {0xE8, 0x03, 0x01, 0x00, 0x01, 0x00};
+ unsigned char aggresive_continuous_pms[] = {0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+ unsigned char aggresive_continuous_pm2[] = {0x02, 0x06, 0x00, 0x00, 0x02, 0x00, 0x43, 0x01, 0xE8, 0x03, 0x00, 0x00,
+ 0x10, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2C, 0x01, 0x2C, 0x01, 0x00, 0x00, 0xCF, 0x40,
+ 0x00, 0x00, 0x87, 0x5A, 0xA4, 0x46, 0xFE, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+ unsigned char aggressive_continuous_rate[] = {0xE8, 0x03, 0x01, 0x00, 0x01, 0x00};
- unsigned char conservative_continuous_pms[] = {0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
- unsigned char conservative_continuous_pm2[] = {0x02, 0x06, 0x00, 0x00, 0x00, 0x00, 0x43, 0x01, 0xE8, 0x03, 0x00, 0x00,
- 0x10, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2C, 0x01, 0x2C, 0x01, 0x00, 0x00, 0xCF, 0x41,
- 0x00, 0x00, 0x88, 0x6A, 0xA4, 0x46, 0xFE, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
- unsigned char conservative_continuous_rate[] = {0xE8, 0x03, 0x01, 0x00, 0x01, 0x00};
+ unsigned char conservative_continuous_pms[] = {0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+ unsigned char conservative_continuous_pm2[] = {0x02, 0x06, 0x00, 0x00, 0x00, 0x00, 0x43, 0x01, 0xE8, 0x03, 0x00, 0x00,
+ 0x10, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2C, 0x01, 0x2C, 0x01, 0x00, 0x00, 0xCF, 0x41,
+ 0x00, 0x00, 0x88, 0x6A, 0xA4, 0x46, 0xFE, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+ unsigned char conservative_continuous_rate[] = {0xE8, 0x03, 0x01, 0x00, 0x01, 0x00};
- unsigned char full_power_pms[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
- unsigned char full_power_rate[] = {0xE8, 0x03, 0x01, 0x00, 0x01, 0x00};
+ unsigned char full_power_pms[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+ unsigned char full_power_rate[] = {0xE8, 0x03, 0x01, 0x00, 0x01, 0x00};
unsigned char full_power_block_level_pms[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
unsigned char full_power_block_level_rate[] = {0xE8, 0x03, 0x01, 0x00, 0x01, 0x00};
@@ -461,111 +469,111 @@
unsigned char full_power_building_level_pms[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
unsigned char full_power_building_level_rate[] = {0xE8, 0x03, 0x01, 0x00, 0x01, 0x00};
- switch (power_mode)
- {
- case SEMI_CONTINOUS:
- SEND_LOGGING_MESSAGE("Configuring SEMI_CONTINOUS");
- length = GnssSerial::sendUbx(0x06, 0x86, semi_continuous_pms, sizeof(semi_continuous_pms));
- wait(1);
+ switch (power_mode)
+ {
+ case SEMI_CONTINOUS:
+ SEND_LOGGING_MESSAGE("Configuring SEMI_CONTINOUS");
+ length = GnssSerial::sendUbx(0x06, 0x86, semi_continuous_pms, sizeof(semi_continuous_pms));
+ wait(0.5);
- if(minimumAcqTimeZero) {
- semi_continuous_pm2[minimumAcqTime_index] = 0x00;
- semi_continuous_pm2[minimumAcqTime_index + 1] = 0x00;
- }
+ if(minimumAcqTimeZero) {
+ semi_continuous_pm2[minimumAcqTime_index] = 0x00;
+ semi_continuous_pm2[minimumAcqTime_index + 1] = 0x00;
+ }
- length = GnssSerial::sendUbx(0x06, 0x3B, semi_continuous_pm2, sizeof(semi_continuous_pm2));
- wait(1);
- length = GnssSerial::sendUbx(0x06, 0x08, semi_continuous_rate, sizeof(semi_continuous_rate));
- wait(1);
- break;
+ length = GnssSerial::sendUbx(0x06, 0x3B, semi_continuous_pm2, sizeof(semi_continuous_pm2));
+ wait(0.5);
+ length = GnssSerial::sendUbx(0x06, 0x08, semi_continuous_rate, sizeof(semi_continuous_rate));
+ wait(0.5);
+ break;
- case AGGRESSIVE_CONTINUOS:
- SEND_LOGGING_MESSAGE("Configuring AGGRESSIVE_CONTINUOS");
- length = GnssSerial::sendUbx(0x06, 0x86, aggresive_continuous_pms, sizeof(aggresive_continuous_pms));
- wait(1);
+ case AGGRESSIVE_CONTINUOS:
+ SEND_LOGGING_MESSAGE("Configuring AGGRESSIVE_CONTINUOS");
+ length = GnssSerial::sendUbx(0x06, 0x86, aggresive_continuous_pms, sizeof(aggresive_continuous_pms));
+ wait(0.5);
- if(minimumAcqTimeZero) {
- semi_continuous_pm2[minimumAcqTime_index] = 0x00;
- semi_continuous_pm2[minimumAcqTime_index + 1] = 0x00;
- }
+ if(minimumAcqTimeZero) {
+ semi_continuous_pm2[minimumAcqTime_index] = 0x00;
+ semi_continuous_pm2[minimumAcqTime_index + 1] = 0x00;
+ }
- length = GnssSerial::sendUbx(0x06, 0x3B, aggresive_continuous_pm2, sizeof(aggresive_continuous_pm2));
- wait(1);
- length = GnssSerial::sendUbx(0x06, 0x08, aggressive_continuous_rate, sizeof(aggressive_continuous_rate));
- wait(1);
- break;
+ length = GnssSerial::sendUbx(0x06, 0x3B, aggresive_continuous_pm2, sizeof(aggresive_continuous_pm2));
+ wait(0.5);
+ length = GnssSerial::sendUbx(0x06, 0x08, aggressive_continuous_rate, sizeof(aggressive_continuous_rate));
+ wait(0.5);
+ break;
- case CONSERVATIVE_CONTINOUS:
- SEND_LOGGING_MESSAGE("Configuring CONSERVATIVE_CONTINOUS");
- length = GnssSerial::sendUbx(0x06, 0x86, conservative_continuous_pms, sizeof(conservative_continuous_pms));
- wait(1);
+ case CONSERVATIVE_CONTINOUS:
+ SEND_LOGGING_MESSAGE("Configuring CONSERVATIVE_CONTINOUS");
+ length = GnssSerial::sendUbx(0x06, 0x86, conservative_continuous_pms, sizeof(conservative_continuous_pms));
+ wait(0.5);
- if(minimumAcqTimeZero) {
- semi_continuous_pm2[minimumAcqTime_index] = 0x00;
- semi_continuous_pm2[minimumAcqTime_index + 1] = 0x00;
- }
+ if(minimumAcqTimeZero) {
+ semi_continuous_pm2[minimumAcqTime_index] = 0x00;
+ semi_continuous_pm2[minimumAcqTime_index + 1] = 0x00;
+ }
- length = GnssSerial::sendUbx(0x06, 0x3B, conservative_continuous_pm2, sizeof(conservative_continuous_pm2));
- wait(1);
- length = GnssSerial::sendUbx(0x06, 0x08, conservative_continuous_rate, sizeof(conservative_continuous_rate));
- wait(1);
- break;
+ length = GnssSerial::sendUbx(0x06, 0x3B, conservative_continuous_pm2, sizeof(conservative_continuous_pm2));
+ wait(0.5);
+ length = GnssSerial::sendUbx(0x06, 0x08, conservative_continuous_rate, sizeof(conservative_continuous_rate));
+ wait(0.5);
+ break;
- case FULL_POWER:
- SEND_LOGGING_MESSAGE("Configuring FULL_POWER");
- length = GnssSerial::sendUbx(0x06, 0x86, full_power_pms, sizeof(full_power_pms));
- wait(1);
- length = GnssSerial::sendUbx(0x06, 0x08, full_power_rate, sizeof(full_power_rate));
- wait(1);
- break;
- case FULL_POWER_BLOCK_LEVEL:
- SEND_LOGGING_MESSAGE("Configuring FULL_POWER_BLOCK_LEVEL");
- length = GnssSerial::sendUbx(0x06, 0x86, full_power_block_level_pms, sizeof(full_power_block_level_pms));
- wait(1);
- length = GnssSerial::sendUbx(0x06, 0x08, full_power_block_level_rate, sizeof(full_power_block_level_rate));
- wait(1);
- break;
- case FULL_POWER_BUILDING_LEVEL:
- SEND_LOGGING_MESSAGE("Configuring FULL_POWER_BUILDING_LEVEL");
- length = GnssSerial::sendUbx(0x06, 0x86, full_power_building_level_pms, sizeof(full_power_building_level_pms));
- wait(1);
- length = GnssSerial::sendUbx(0x06, 0x08, full_power_building_level_rate, sizeof(full_power_building_level_rate));
- wait(1);
- break;
- case AVAILABLE_OPERATION:
- default : {
- SEND_LOGGING_MESSAGE("Invalid power mode");
- }
- break;
- }
+ case FULL_POWER:
+ SEND_LOGGING_MESSAGE("Configuring FULL_POWER");
+ length = GnssSerial::sendUbx(0x06, 0x86, full_power_pms, sizeof(full_power_pms));
+ wait(0.5);
+ length = GnssSerial::sendUbx(0x06, 0x08, full_power_rate, sizeof(full_power_rate));
+ wait(0.5);
+ break;
+ case FULL_POWER_BLOCK_LEVEL:
+ SEND_LOGGING_MESSAGE("Configuring FULL_POWER_BLOCK_LEVEL");
+ length = GnssSerial::sendUbx(0x06, 0x86, full_power_block_level_pms, sizeof(full_power_block_level_pms));
+ wait(0.5);
+ length = GnssSerial::sendUbx(0x06, 0x08, full_power_block_level_rate, sizeof(full_power_block_level_rate));
+ wait(0.5);
+ break;
+ case FULL_POWER_BUILDING_LEVEL:
+ SEND_LOGGING_MESSAGE("Configuring FULL_POWER_BUILDING_LEVEL");
+ length = GnssSerial::sendUbx(0x06, 0x86, full_power_building_level_pms, sizeof(full_power_building_level_pms));
+ wait(0.5);
+ length = GnssSerial::sendUbx(0x06, 0x08, full_power_building_level_rate, sizeof(full_power_building_level_rate));
+ wait(0.5);
+ break;
+ case AVAILABLE_OPERATION:
+ default : {
+ SEND_LOGGING_MESSAGE("Invalid power mode");
+ }
+ break;
+ }
- return (length >= (int)(sizeof(semi_continuous_pms) + UBX_FRAME_SIZE)) ? 1 : 0;
+ return (length >= (int)(sizeof(semi_continuous_pms) + UBX_FRAME_SIZE)) ? 1 : 0;
}
bool GnssOperations::verify_gnss_mode() {
- unsigned char CFG_PMS[] = {0xB5, 0x62, 0x06, 0x86, 0x00, 0x00, 0x8c, 0xAA};
- unsigned char CFG_PM2[] = {0xB5, 0x62, 0x06, 0x3B, 0x00, 0x00, 0x41, 0xC9};
- unsigned char CFG_RATE[] = {0xB5, 0x62, 0x06, 0x08, 0x00, 0x00, 0x0E, 0x30};
- unsigned char CFG_NAV5[] = {0xB5, 0x62, 0x06, 0x24, 0x00, 0x00, 0x2A, 0x84};
- unsigned char CFG_NAVX5[] = {0xB5, 0x62, 0x06, 0x23, 0x00, 0x00, 0x29, 0x81};
+ unsigned char CFG_PMS[] = {0xB5, 0x62, 0x06, 0x86, 0x00, 0x00, 0x8c, 0xAA};
+ unsigned char CFG_PM2[] = {0xB5, 0x62, 0x06, 0x3B, 0x00, 0x00, 0x41, 0xC9};
+ unsigned char CFG_RATE[] = {0xB5, 0x62, 0x06, 0x08, 0x00, 0x00, 0x0E, 0x30};
+ unsigned char CFG_NAV5[] = {0xB5, 0x62, 0x06, 0x24, 0x00, 0x00, 0x2A, 0x84};
+ unsigned char CFG_NAVX5[] = {0xB5, 0x62, 0x06, 0x23, 0x00, 0x00, 0x29, 0x81};
- this->_send(CFG_PMS, sizeof(CFG_PMS));
- wait(1);
+ this->_send(CFG_PMS, sizeof(CFG_PMS));
+ wait(0.5);
- this->_send(CFG_PM2, sizeof(CFG_PM2));
- wait(1);
+ this->_send(CFG_PM2, sizeof(CFG_PM2));
+ wait(0.5);
- this->_send(CFG_RATE, sizeof(CFG_RATE));
- wait(1);
+ this->_send(CFG_RATE, sizeof(CFG_RATE));
+ wait(0.5);
- this->_send(CFG_NAV5, sizeof(CFG_NAV5));
- wait(1);
+ this->_send(CFG_NAV5, sizeof(CFG_NAV5));
+ wait(0.5);
- this->_send(CFG_NAVX5, sizeof(CFG_NAVX5));
- wait(1);
+ this->_send(CFG_NAVX5, sizeof(CFG_NAVX5));
+ wait(0.5);
- return true;
+ return true;
}
/**
@@ -577,35 +585,35 @@
*/
int GnssOperations::start_mode(int start_mode)
{
- int length = 0;
- unsigned char hot_start[] = {0x00, 0x00, 0x02, 0x00};
- unsigned char warm_start[] = {0x01, 0x00, 0x02, 0x00};
- unsigned char cold_start[] = {0xFF, 0xFF, 0x02, 0x00};
+ int length = 0;
+ unsigned char hot_start[] = {0x00, 0x00, 0x02, 0x00};
+ unsigned char warm_start[] = {0x01, 0x00, 0x02, 0x00};
+ unsigned char cold_start[] = {0xFF, 0xFF, 0x02, 0x00};
- switch (start_mode)
- {
- case HOT:
- length = GnssSerial::sendUbx(0x06, 0x04, hot_start, sizeof(hot_start));
- break;
+ switch (start_mode)
+ {
+ case HOT:
+ length = GnssSerial::sendUbx(0x06, 0x04, hot_start, sizeof(hot_start));
+ break;
- case WARM:
- length = GnssSerial::sendUbx(0x06, 0x04, warm_start, sizeof(warm_start));
- break;
+ case WARM:
+ length = GnssSerial::sendUbx(0x06, 0x04, warm_start, sizeof(warm_start));
+ break;
- case COLD:
- length = GnssSerial::sendUbx(0x06, 0x04, cold_start, sizeof(cold_start));
- break;
- }
+ case COLD:
+ length = GnssSerial::sendUbx(0x06, 0x04, cold_start, sizeof(cold_start));
+ break;
+ }
- return (length >= (int)(sizeof(hot_start) + UBX_FRAME_SIZE)) ? 1 : 0;
+ return (length >= (int)(sizeof(hot_start) + UBX_FRAME_SIZE)) ? 1 : 0;
}
void GnssOperations::send_to_gnss(char rChar)
{
- GnssSerial::putc(rChar);
+ GnssSerial::putc(rChar);
}
void GnssOperations::power_on_gnss()
{
- GnssSerial::_powerOn();
+ GnssSerial::_powerOn();
}
--- a/gnss_operations.h Wed Apr 24 17:55:48 2019 +0500
+++ b/gnss_operations.h Wed May 29 16:45:00 2019 +0500
@@ -8,92 +8,92 @@
/** Enums
*/
- enum Command{
- POWER_ON,
- POWER_OFF,
- MON_VER,
- ENABLE_UBX,
- RESTART, // mbed conflict with RESET
- CUSTOMER,
- AVAILABLE_CONFIG
- };
- /** The reset modes
- */
- enum Start{
- HOT,
- COLD,
- WARM,
- MAX_MODE
- };
+enum Command {
+ POWER_ON,
+ POWER_OFF,
+ MON_VER,
+ ENABLE_UBX,
+ RESTART, // mbed conflict with RESET
+ CUSTOMER,
+ AVAILABLE_CONFIG
+};
+/** The reset modes
+*/
+enum Start {
+ HOT,
+ COLD,
+ WARM,
+ MAX_MODE
+};
- /** The operation modes
- */
- enum Powermodes{
+/** The operation modes
+*/
+enum Powermodes {
- CONSERVATIVE_CONTINOUS,
- AGGRESSIVE_CONTINUOS,
- SEMI_CONTINOUS,
- FULL_POWER,
- FULL_POWER_BLOCK_LEVEL,
- FULL_POWER_BUILDING_LEVEL,
- AVAILABLE_OPERATION
- };
+ CONSERVATIVE_CONTINOUS,
+ AGGRESSIVE_CONTINUOS,
+ SEMI_CONTINOUS,
+ FULL_POWER,
+ FULL_POWER_BLOCK_LEVEL,
+ FULL_POWER_BUILDING_LEVEL,
+ AVAILABLE_OPERATION
+};
-class GnssOperations : public GnssSerial{
+class GnssOperations : public GnssSerial {
- //GnssSerial constructor can be called here to configure different baud rate
- //Constructor not required at the moment
- //GnssOperations();
+ //GnssSerial constructor can be called here to configure different baud rate
+ //Constructor not required at the moment
+ //GnssOperations();
public:
- /** Enable GNSS receiver UBX-NAV-PVT messages
- * Navigation Position Velocity Time Solution
- * @param void
- * @return int 1: Successful
- * 0: Failure
- */
- int enable_ubx_nav_pvt();
+ /** Enable GNSS receiver UBX-NAV-PVT messages
+ * Navigation Position Velocity Time Solution
+ * @param void
+ * @return int 1: Successful
+ * 0: Failure
+ */
+ int enable_ubx_nav_pvt();
- /** Enable GNSS receiver UBX-STATUS messages
- * Receiver Navigation Status
- * @param void
- * @return int 1: Successful
- * 0: Failure
- */
- int enable_ubx_nav_status();
+ /** Enable GNSS receiver UBX-STATUS messages
+ * Receiver Navigation Status
+ * @param void
+ * @return int 1: Successful
+ * 0: Failure
+ */
+ int enable_ubx_nav_status();
- /** Enable GNSS receiver UBX-NAV-SAT messages
- * Satellite Information
- * @param void
- * @return int 1: Successful
- * 0: Failure
- */
- int enable_ubx_nav_sat();
+ /** Enable GNSS receiver UBX-NAV-SAT messages
+ * Satellite Information
+ * @param void
+ * @return int 1: Successful
+ * 0: Failure
+ */
+ int enable_ubx_nav_sat();
- /** Enable GNSS receiver UBX-NAV-SOL messages
- * Navigation Solution Information
- * @param void
- * @return int 1: Successful
- * 0: Failure
- */
- int enable_ubx_nav_sol();
+ /** Enable GNSS receiver UBX-NAV-SOL messages
+ * Navigation Solution Information
+ * @param void
+ * @return int 1: Successful
+ * 0: Failure
+ */
+ int enable_ubx_nav_sol();
- /** Disable GNSS receiver UBX-NAV-PVT messages
- * @param void
- * @return int 1: Successful
- * 0: Failure
- */
- int disable_ubx_nav_pvt();
+ /** Disable GNSS receiver UBX-NAV-PVT messages
+ * @param void
+ * @return int 1: Successful
+ * 0: Failure
+ */
+ int disable_ubx_nav_pvt();
- /** Enable GNSS receiver UBX-NAV5 messages
- * Navigation Engine Settings
- * @param uint acc Defines positioning accuracy
- * @return int 1: Successful
- * 0: Failure
- */
- int enable_ubx_nav5(unsigned int acc);
+ /** Enable GNSS receiver UBX-NAV5 messages
+ * Navigation Engine Settings
+ * @param uint acc Defines positioning accuracy
+ * @return int 1: Successful
+ * 0: Failure
+ */
+ int enable_ubx_nav5(unsigned int acc);
/** Enable GNSS receiver UBX-NAVX5 messages
* Navigation Engine Settings
@@ -102,104 +102,104 @@
*/
int enable_ubx_navx5();
- /** Enable GNSS receiver UBX-CFG-ODO messages
- * Odometer, Low-speed COG Engine Settings
- * @param void
- * @return int 1: Successful
- * 0: Failure
- */
- int enable_ubx_odo();
+ /** Enable GNSS receiver UBX-CFG-ODO messages
+ * Odometer, Low-speed COG Engine Settings
+ * @param void
+ * @return int 1: Successful
+ * 0: Failure
+ */
+ int enable_ubx_odo();
- /** Disable GNSS receiver UBX-CFG-ODO messages
- * @param void
- * @return int 1: Successful
- * 0: Failure
- */
- int disable_ubx_odo();
+ /** Disable GNSS receiver UBX-CFG-ODO messages
+ * @param void
+ * @return int 1: Successful
+ * 0: Failure
+ */
+ int disable_ubx_odo();
- /** Enable GNSS receiver UBX-NAV-ODO messages
- * Odometer, Low-speed COG Engine Settings
- * @param void
- * @return int 1: Successful
- * 0: Failure
- */
- int enable_ubx_nav_odo();
+ /** Enable GNSS receiver UBX-NAV-ODO messages
+ * Odometer, Low-speed COG Engine Settings
+ * @param void
+ * @return int 1: Successful
+ * 0: Failure
+ */
+ int enable_ubx_nav_odo();
- /** Disable GNSS receiver UBX-NAV-ODO messages
- * Odometer, Low-speed COG Engine Settings
- * @param void
- * @return int 1: Successful
- * 0: Failure
- */
- int disable_ubx_nav_odo();
+ /** Disable GNSS receiver UBX-NAV-ODO messages
+ * Odometer, Low-speed COG Engine Settings
+ * @param void
+ * @return int 1: Successful
+ * 0: Failure
+ */
+ int disable_ubx_nav_odo();
- /** Enable GNSS receiver UBX-LOG-BATCH messages
- * Batched data
- * @param void
- * @return int 1: Successful
- * 0: Failure
- */
- int enable_ubx_batch_feature();
+ /** Enable GNSS receiver UBX-LOG-BATCH messages
+ * Batched data
+ * @param void
+ * @return int 1: Successful
+ * 0: Failure
+ */
+ int enable_ubx_batch_feature();
- /** Disable GNSS receiver UBX-LOG-BATCH messages
- * Batched data
- * @param void
- * @return int 1: Successful
- * 0: Failure
- */
- int disable_ubx_batch_feature();
+ /** Disable GNSS receiver UBX-LOG-BATCH messages
+ * Batched data
+ * @param void
+ * @return int 1: Successful
+ * 0: Failure
+ */
+ int disable_ubx_batch_feature();
- /** Configure GNSS receiver batching feature
- * Get/Set data batching configuration
- * @param tUBX_CFG_BATCH
- * @return int 1: Successful
- * 0: Failure
- */
- int cfg_batch_feature(tUBX_CFG_BATCH *obj);
+ /** Configure GNSS receiver batching feature
+ * Get/Set data batching configuration
+ * @param tUBX_CFG_BATCH
+ * @return int 1: Successful
+ * 0: Failure
+ */
+ int cfg_batch_feature(tUBX_CFG_BATCH *obj);
- /** Configure GNSS receiver power mode
- * Power mode setup
- * @param Powermodes SEMI_CONTINOUS
- * AGGRESSIVE_CONTINUOS
- * CONSERVATIVE_CONTINOUS
- * FULL_POWER
- * FULL_POWER_BLOCK_LEVEL
- * minimumAcqTime boolean
- *
- * @return int 1: Successful
- * 0: Failure
- */
- int cfg_power_mode(Powermodes power_mode, bool minimumAcqTime);
+ /** Configure GNSS receiver power mode
+ * Power mode setup
+ * @param Powermodes SEMI_CONTINOUS
+ * AGGRESSIVE_CONTINUOS
+ * CONSERVATIVE_CONTINOUS
+ * FULL_POWER
+ * FULL_POWER_BLOCK_LEVEL
+ * minimumAcqTime boolean
+ *
+ * @return int 1: Successful
+ * 0: Failure
+ */
+ int cfg_power_mode(Powermodes power_mode, bool minimumAcqTime);
- /** Method to poll the GNSS configuration
- * @param void
- * @return bool true: Successful
- * false: Failure
- */
- bool verify_gnss_mode();
+ /** Method to poll the GNSS configuration
+ * @param void
+ * @return bool true: Successful
+ * false: Failure
+ */
+ bool verify_gnss_mode();
- /** Configure GNSS startup mode
- * Power mode setup
- * @param start_mode 0: Hot Start
- * 1: Warm Start
- * 2: Cold Start
- *
- * @return int 1: Successful
- * 0: Failure
- */
- int start_mode(int start_mode);
+ /** Configure GNSS startup mode
+ * Power mode setup
+ * @param start_mode 0: Hot Start
+ * 1: Warm Start
+ * 2: Cold Start
+ *
+ * @return int 1: Successful
+ * 0: Failure
+ */
+ int start_mode(int start_mode);
- /** Send char to GNSS receiver
- * @param char
- * @return void
- */
- void send_to_gnss(char);
+ /** Send char to GNSS receiver
+ * @param char
+ * @return void
+ */
+ void send_to_gnss(char);
- /** Power On GNSS receiver
- *
- * @return void
- */
- void power_on_gnss();
+ /** Power On GNSS receiver
+ *
+ * @return void
+ */
+ void power_on_gnss();
};
#ifdef __cplusplus