changed at for testing

Fork of example-reading-imei-imsi by u-blox

Revision:
2:c845f4f6c2b6
Parent:
1:63483ec4d0ff
Child:
3:103f58fac4cf
--- a/main.cpp	Thu Feb 15 11:48:51 2018 +0000
+++ b/main.cpp	Fri Oct 12 06:34:14 2018 +0000
@@ -72,7 +72,22 @@
         }
     }
 }
+void sendATCommandAndPrintResponse(char* command){
+char buffer[505];//sa crtom
+for (int i=0;i<505;i++)buffer[i]=0;
+printf ("Sending following command:");
+printf(command);
+printf ("\r\n");
 
+if (!at->send(command)){
+printf("failed!!!!\r\n");
+return;
+}
+printf ("RESPONSE:\r\n");    
+at->read(buffer,500);
+        printf(buffer);
+        printf ("\r\n");   
+}
 // Setup the modem
 bool setup_modem(){
 
@@ -117,9 +132,11 @@
         printf("Configuring the modem\r\n");
 
 #ifdef TARGET_UBLOX_C030_N211
+        printf("TARGET IS N211");
         // Turn off modem echoing and turn on verbose responses
         success = at->send("AT+CMEE=1");
 #else
+        printf("TARGET IS NOT N211");
         // Set the final baud rate
         if (at->send("AT+IPR=%d", 115200) && at->recv("OK")) {
             // Need to wait for things to be sorted out on the modem side
@@ -169,12 +186,14 @@
         printf("...DONE\r\nThe modem powered up\r\n");
         char imei[25+1];
         char imsi[15+1];
+        char buffer[512];
         printf("Reading IMEI and IMSI\r\n");
         
 #ifdef TARGET_UBLOX_C030_N211
         if (at->send("AT+CGSN=1") && at->recv("\nOK\n%25[^\n]\nOK\n", imei)){
             printf("IMEI: %s\r\n",imei + 6); // Avoid the "+CGSN:" prefix
         }
+       
 #else
         if (at->send("AT+CGSN") && at->recv("%15[^\n]\nOK\n", imei)){
             printf("IMEI: %s\r\n",imei);
@@ -195,9 +214,46 @@
     } else {
         printf("Unable to intialize modem\r\n");
     }
-    
+    char buffer[500+5];
     printf("FINISHED...\r\n");
+     printf ("sending nconfig");
+     printf ("\r\n");
+     
+     
+     
+     
+     sendATCommandAndPrintResponse("at+NCONFIG=\"AUTOCONNECT\",\"FALSE\"");
+      sendATCommandAndPrintResponse("at+NCONFIG=\"CR_0354_0338_SCRAMBLING\",\"TRUE\"");
+       
+        
+ sendATCommandAndPrintResponse("at+NCONFIG=\"CR_0859_SI_AVOID\",\"TRUE\"");
+ sendATCommandAndPrintResponse("at+NCONFIG?");    
+sendATCommandAndPrintResponse("at+cfun=0");
+sendATCommandAndPrintResponse("AT+CGDCONT=1, \"IP\",\"nb.inetd.gdsp\"");     
+sendATCommandAndPrintResponse("at+cfun=1");
+   
+ sendATCommandAndPrintResponse("at+cimi");
+  
+        
+sendATCommandAndPrintResponse("at+cgatt=1");
+
+  
+        
+ sendATCommandAndPrintResponse("at+cops=1,2,\"26202\"");
     
+ sendATCommandAndPrintResponse("AT+CSQ");
+  sendATCommandAndPrintResponse("AT+CGAT?");
+ sendATCommandAndPrintResponse("AT+COPS?");
+ sendATCommandAndPrintResponse("AT+NBAND?");
+ sendATCommandAndPrintResponse("AT+NBAND=20");
+ sendATCommandAndPrintResponse("AT+NUESTATS?");
+ sendATCommandAndPrintResponse("AT+CGAT=1");
+  sendATCommandAndPrintResponse("AT+CGAT?");
+
+sendATCommandAndPrintResponse("AT+NSOCR=DGRAM,17,3333");
+
+sendATCommandAndPrintResponse("AT> AT+NSOST=0,52.215.10.12,17,4,AAAAAAAA");      
+     
     // Create threadUserButtonCheck thread
     Thread threadUserButtonCheck(threadBodyUserButtonCheck);