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 21:f91c0334d017, committed 2018-10-08
- Comitter:
- fahim.alavi@u-blox.com
- Date:
- Mon Oct 08 14:22:33 2018 +0500
- Parent:
- 20:bc678f383db1
- Child:
- 22:d8cd4cf0fcc0
- Commit message:
- NAV-Status message supported
Changed in this revision
--- a/gnss.cpp Fri Oct 05 18:46:48 2018 +0500
+++ b/gnss.cpp Mon Oct 08 14:22:33 2018 +0500
@@ -330,6 +330,10 @@
return_value = UBX_NAV_ODO;
}
break;
+ case 0x03: {
+ return_value = NAV_STATUS;
+ }
+ break;
default:
{
return_value = UNKNOWN_UBX;
@@ -519,6 +523,37 @@
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;
+
+ 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++];
+
+ return_decoded_msg.flags = buf[index++];
+
+ // 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.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;
+}
+
int GnssParser::ubx_request_batched_data(bool sendMonFirst) {
unsigned char ubx_log_retrieve_batch[]={0x00, 0x00, 0x00, 0x00};
--- a/gnss.h Fri Oct 05 18:46:48 2018 +0500
+++ b/gnss.h Mon Oct 08 14:22:33 2018 +0500
@@ -50,7 +50,7 @@
enum eUBX_MSG_CLASS {NAV = 0x01, ACK = 0x05, LOG = 0x21};
-enum eUBX_MESSAGE {UBX_LOG_BATCH, UBX_ACK_ACK, UBX_ACK_NAK, UBX_NAV_ODO, UBX_NAV_PVT, UNKNOWN_UBX};
+enum eUBX_MESSAGE {UBX_LOG_BATCH, UBX_ACK_ACK, UBX_ACK_NAK, UBX_NAV_ODO, UBX_NAV_PVT, NAV_STATUS, UNKNOWN_UBX};
typedef struct UBX_ACK_ACK {
uint8_t msg_class;
@@ -101,6 +101,15 @@
}tUBX_CFG_BATCH;
+typedef struct UBX_NAV_STATUS{
+ uint32_t itow;
+ uint8_t fix;
+ uint8_t flags;
+ uint32_t ttff;
+ uint32_t msss;
+
+}tUBX_NAV_STATUS;
+
/** Basic GNSS parser class.
*/
class GnssParser
@@ -257,6 +266,12 @@
*/
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
+ */
+ tUBX_NAV_STATUS decode_ubx_nav_status_msg(char *);
+
/** Method to send UBX LOG-RETRIEVEBATCH msg. This message is used to request batched data.
* @param bool
* @return int
--- a/gnss_operations.cpp Fri Oct 05 18:46:48 2018 +0500
+++ b/gnss_operations.cpp Mon Oct 08 14:22:33 2018 +0500
@@ -47,6 +47,33 @@
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;
+
+ 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;
+ }
+ }
+
+ return (conf == 0) ? 0 : 1;
+
+}
+
/**
*
* Disable UBX-NAV-PVT
--- a/gnss_operations.h Fri Oct 05 18:46:48 2018 +0500 +++ b/gnss_operations.h Mon Oct 08 14:22:33 2018 +0500 @@ -49,6 +49,7 @@ public: int enable_ubx_nav_pvt(); + int enable_ubx_nav_status(); int disable_ubx_nav_pvt(); int enable_ubx_nav5(unsigned int acc); int enable_ubx_odo();