The program sends the current location over the cellular network.

Dependencies:   aconno_I2C ublox-at-cellular-interface gnss ublox-cellular-base Lis2dh12 ublox-cellular-base-n2xx ublox-at-cellular-interface-n2xx low-power-sleep

Fork of example-gnss by u-blox

Revision:
9:f943c09d9173
Parent:
8:2bf886335fd0
--- a/UBloxSara/uBloxSara.cpp	Fri Nov 30 16:19:41 2018 +0100
+++ b/UBloxSara/uBloxSara.cpp	Wed Dec 19 15:12:25 2018 +0100
@@ -24,8 +24,14 @@
     /* Give modem a little time to settle down */
     wait_ms(250);
 
-    printf("Powering up the modem...\r\n");
-    //onboard_modem_power_up();
+    if(!CUSTOM_BOARD)
+    {
+        // DO NOT CALL THIS IF YOU WORK ON ACONNO CUSTOM MADE BOARD
+        // POWER UP PIN (PE_14) IS CONNECTED ON OC DIGITAL OUTPUT
+        // AND POWER UP PIN IS NOT CONNECTED ON SARA MODULE
+        onboard_modem_power_up();
+    }
+    
     wait_ms(5000);
 
     sendCommand("AT+CFUN=1");
@@ -122,26 +128,35 @@
 	sprintf(myCommandbuffer,"AT+NSOST=0,\"%s\",%d,%d,\"%s\"",
 		_udp._ip, _udp._port, msgSize, data);
 
-    msgSize += strlen(flags);
-    sprintf(myCommandbuffer,"AT+NSOST=0,\"%s\",%d,%d,\"%s%s\"",
-		_udp._ip, _udp._port, msgSize, flagsHex, data);
+    //msgSize += strlen(flags);
+    //sprintf(myCommandbuffer,"AT+NSOST=0,\"%s\",%d,%d,\"%s%s\"",
+	//	_udp._ip, _udp._port, msgSize, flagsHex, data);
 	sendCommand(myCommandbuffer);
 }
 
+#define SHORT_DELAY_MS      (1000)
 uint8_t UBloxSara::connectNB()
 {
 	sendCommand("at+NCONFIG=\"AUTOCONNECT\",\"FALSE\"");
+    wait_ms(SHORT_DELAY_MS);
     sendCommand("at+NCONFIG=\"CR_0354_0338_SCRAMBLING\",\"TRUE\"");
-
+    wait_ms(SHORT_DELAY_MS);
     sendCommand("at+NCONFIG=\"CR_0859_SI_AVOID\",\"TRUE\"");
+    wait_ms(SHORT_DELAY_MS);
     sendCommand("at+NCONFIG?");
+    wait_ms(SHORT_DELAY_MS);
     sendCommand("at+cfun=0");
+    wait_ms(SHORT_DELAY_MS);
     sendCommand("AT+CGDCONT=1, \"IP\",\"nb.inetd.gdsp\"");
+    wait_ms(SHORT_DELAY_MS);
     sendCommand("at+cfun=1");
+    wait_ms(SHORT_DELAY_MS);
 
     sendCommand("at+cimi");
+    wait_ms(SHORT_DELAY_MS);
 
     sendCommand("at+cgatt=1");
+    wait_ms(SHORT_DELAY_MS);
 
     sendCommand("at+cops=1,2,\"26202\"");
     wait_ms(5000);
@@ -152,9 +167,11 @@
     sendCommand("AT+COPS?");
     sendCommand("AT+NBAND?");
     sendCommand("AT+NBAND=20");
+    wait_ms(SHORT_DELAY_MS);
     sendCommand("AT+NUESTATS");
-
+    wait_ms(SHORT_DELAY_MS);
     sendCommand("AT+CGATT?");
     wait_ms(5000);
     sendCommand("AT+CGPADDR");
+    wait_ms(SHORT_DELAY_MS);
 }