Modified example with AT command traces for AT%MEAS, AT%PCONI and AT%CGEQOS. Loading times calculated for each cloud transfer

Dependencies:   FXOS8700CQ MODSERIAL mbed

Fork of Avnet_ATT_Cellular_IOT by Avnet

Files at this revision

API Documentation at this revision

Comitter:
nrithya
Date:
Thu Dec 14 00:23:22 2017 +0000
Parent:
81:f236ef0ee0c5
Commit message:
added AT% commands PCONI,MEAS,CGEQOS and loading times in cell_modem.cpp

Changed in this revision

cell_modem.cpp Show annotated file Show diff for this revision Revisions of this file
config_me.h Show annotated file Show diff for this revision Revisions of this file
wnc_control.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r f236ef0ee0c5 -r 340a51ed8760 cell_modem.cpp
--- a/cell_modem.cpp	Thu Nov 17 18:21:52 2016 +0000
+++ b/cell_modem.cpp	Thu Dec 14 00:23:22 2017 +0000
@@ -48,6 +48,8 @@
 
 #define MAX_AT_RSP_LEN                          255
 
+Timer t;
+
 ssize_t mdm_getline(char *buff, size_t size, int timeout_ms) {
     int cin = -1;
     int cin_last;
@@ -316,6 +318,7 @@
 {
     int iStatus = 0; //error by default
     PRINTF(DEF "\r\n");
+    t.start();
     PRINTF(BLU "Sending to modem : %s" DEF "\r\n", &tx_string[0]); 
     sockwrite_mdm(&tx_string[0]);
     if (sockread_mdm(&MySocketData, 1024, 20))
@@ -341,7 +344,13 @@
     {
         PRINTF(RED "No response..." DEF "\r\n");
     }
+    
+    t.stop();
+    PRINTF("loading time: %f \n",t.read());
+    PRINTF("DELIMIT");
+    t.reset();
     return iStatus;
+    
 }
 
 void display_wnc_firmware_rev(void)
diff -r f236ef0ee0c5 -r 340a51ed8760 config_me.h
--- a/config_me.h	Thu Nov 17 18:21:52 2016 +0000
+++ b/config_me.h	Thu Dec 14 00:23:22 2017 +0000
@@ -26,10 +26,10 @@
 // This is the server's base URL name.  Example "www.google.com"
 // Note that when you Fork a FLOW, it will typically assign  either
 // "run-east.att.io" or "run-west.att.io", so be sure to check this.
-static const char * MY_SERVER_URL       = "run-west.att.io";
+static const char * MY_SERVER_URL       = "run-east.att.io";
 
 // These are FLOW fields from the Endpoints tab:
-#define FLOW_BASE_URL                   "/1e464b19cdcde/774c88d68202/86694923d5bf28a/in/flow"
+#define FLOW_BASE_URL                   "/05f25477b22e4/5d78886087e3/ea2353170171bb0/in/flow"
 #define FLOW_INPUT_NAME                 "/climate"
 
 // Unless you want to use a different protocol, this field should be left as is:
@@ -39,7 +39,7 @@
 // If you only have one devive there then you can just leave this as is.
 // Once your FLOW device has been initialized (Virtual Device Initialize clicked),
 // the Virtual Device will show up in M2X.  This is its "DEVICE SERIAL" field
-#define FLOW_DEVICE_NAME                "vstarterkit001"
+#define FLOW_DEVICE_NAME                "starterkit001"
 
 // This constant defines how often sensors are read and sent up to FLOW
 #define SENSOR_UPDATE_INTERVAL_MS       5000; //5 seconds
@@ -56,7 +56,7 @@
 #define TEMP_HUMIDITY_ACCELEROMETER_GPS                         3
 #define TEMP_HUMIDITY_ACCELEROMETER_PMODSENSORS                 4
 #define TEMP_HUMIDITY_ACCELEROMETER_PMODSENSORS_VIRTUALSENSORS  5
-static int iSensorsToReport = TEMP_HUMIDITY_ACCELEROMETER; //modify this to change your selection
+static int iSensorsToReport = TEMP_HUMIDITY_ONLY; //modify this to change your selection
 
 // This is the APN name for the cellular network, you will need to change this, check the instructions included with your SIM card kit:
 static const char * MY_APN_STR          = "m2m.com.attz";
diff -r f236ef0ee0c5 -r 340a51ed8760 wnc_control.cpp
--- a/wnc_control.cpp	Thu Nov 17 18:21:52 2016 +0000
+++ b/wnc_control.cpp	Thu Dec 14 00:23:22 2017 +0000
@@ -26,8 +26,8 @@
 #define WNC_CMD_DEBUG_ON
 
 // Full debug output, longer cmds and extra cellular status checking
-#undef WNC_CMD_DEBUG_ON_VERBOSE
-
+#define WNC_CMD_DEBUG_ON_VERBOSE
+Timer t1;
 extern string MyServerIpAddress;
 extern string MySocketData;
 
@@ -271,6 +271,7 @@
 
 int check_wnc_ready(void)
 {
+    t1.start();
     string * pRespStr;
     size_t pos;
     int regSts;
@@ -301,6 +302,7 @@
   
     // SIM card OK, now check for signal and cellular network registration
     cmdRes1 = at_send_wnc_cmd("AT+CREG?", &pRespStr, WNC_TIMEOUT_MS);      // Check if registered on network
+
     if (pRespStr->size() > 0)
     {
     pos = pRespStr->find("CREG: ");
@@ -330,7 +332,15 @@
 #endif
         return (-2);
     }
-
+    int cmdRes4 = at_send_wnc_cmd("AT%MEAS=\"8\"", &pRespStr, WNC_TIMEOUT_MS);
+     float m=t1.read();
+     PRINTF("\n time for Meas: %f \n",m);
+    int cmdRes3 = at_send_wnc_cmd("AT+CGEQOS?", &pRespStr, WNC_TIMEOUT_MS);
+    float n=t1.read();
+     PRINTF("\n time for CGEQOS: %f \n",n);
+    int cmdRes5 = at_send_wnc_cmd("AT%PCONI", &pRespStr, WNC_TIMEOUT_MS);
+    float o=t1.read();
+     PRINTF("\n time for PCONI: %f \n",o);
     return (0);
 }