u-blox / gnss

Dependents:   example-ublox-at-cellular-interface-ext example-low-power-sleep example-C030-out-of-box-demo example-C030-out-of-box-demo ... more

Files at this revision

API Documentation at this revision

Comitter:
fahim.alavi@u-blox.com
Date:
Mon May 21 17:18:35 2018 +0500
Parent:
9:cff83b9f5093
Child:
11:514ea8bf1dc8
Commit message:
Retrieve log batch added

Changed in this revision

gnss.cpp Show annotated file Show diff for this revision Revisions of this file
gnss.h Show annotated file Show diff for this revision Revisions of this file
--- a/gnss.cpp	Fri May 18 13:29:00 2018 +0500
+++ b/gnss.cpp	Mon May 21 17:18:35 2018 +0500
@@ -295,6 +295,10 @@
 			conf = conf - 1;
 		}
 	}
+	if(conf == 0)
+	{
+		return 1;
+	}
 
 	unsigned char enable_ubx_nav_pvt[]={0x01, 0x07, 0x01};
 	conf = RETRY;
@@ -536,6 +540,34 @@
 
 	return return_decoded_msg;
 }
+
+int GnssParser::ubx_request_batched_data(bool sendMonFirst) {
+	unsigned char ubx_log_retrieve_batch[]={0x00, 0x00, 0x00, 0x00};
+
+	ubx_log_retrieve_batch[1] = (sendMonFirst == true) ? 0x01 : 0x00;
+
+	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;
+	}
+
+	return 0;
+}
                 
 const char GnssParser::_toHex[] = { '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' };
 
--- a/gnss.h	Fri May 18 13:29:00 2018 +0500
+++ b/gnss.h	Mon May 21 17:18:35 2018 +0500
@@ -240,6 +240,12 @@
 	 */
     tUBX_LOG_BATCH decode_ubx_log_batch_msg(char *);
 
+    /** Method to send UBX LOG-RETRIEVEBATCH msg. This message is used to request batched data.
+	 * @param bool
+	 * @return int
+	 */
+    int ubx_request_batched_data(bool sendMonFirst = false);
+
 protected:
     /** Power on the GNSS module.
     */