this is using the mbed os version 5-13-1

Dependencies:   mbed-http

Branch:
PassingRegression
Revision:
112:a0999ea4ece0
Parent:
110:c722dda4f2ff
Child:
114:b11bb96c09f3
--- a/source/ATCmdManager.cpp	Fri May 10 13:45:50 2019 +0000
+++ b/source/ATCmdManager.cpp	Sat May 11 11:55:29 2019 +0000
@@ -117,9 +117,6 @@
             case AT_SCAN_RESP:
                 // AT_SCAN_RESP response state
                 dbg_printf(LOG, "\n [ATCMD MAN] WIFI SCAN RESPONSE RECEIVED!!\r\n");
-                //_smutex.lock();
-                //sendAtConfirmation(OK_RESP);   //_parser.send(OK_RESP);
-                //_smutex.unlock();
                 respStr = (char *) resp_data->buffer;
                 sendAtConfirmationFreeMpool(respStr);
                 at_resp = AT_RESP_NONE;
@@ -135,7 +132,6 @@
             {
                 // AT_CONNECT_RESP response state 
                 dbg_printf(LOG, "\n [ATCMD MAN] WIFI CONNECT RESPONSE RECEIVED!!\r\n");
-                //_smutex.lock();
                 sendAtConfirmation(OK_RESP);   //_parser.send(OK_RESP);
                 respStr = (char *) resp_data->buffer;
                 sendAtConfirmationFreeMpool(respStr);
@@ -143,33 +139,24 @@
                 sprintf(urc, "\r\n%s:%d\r\n", NETWORK_UP_URC, WIFI_INTERFACE_ID);
                 sendAtEvent(urc);
                 delete urc;
-                //_smutex.unlock();
                 at_resp = AT_RESP_NONE;
                 break;
             }
             case AT_DISCONNECT_RESP:  
                 // AT_DISCONNECT_RESP response state 
-                //////_smutex.lock();
                 dbg_printf(LOG, "\n [ATCMD MAN] WIFI DISCONNECT RESPONSE RECEIVED!!\r\n");
-                //_smutex.lock();
-                //sendAtConfirmation(OK_RESP);   //_parser.send(OK_RESP);
-                //_smutex.unlock();
                 respStr = (char *) resp_data->buffer;
                 sendAtConfirmationFreeMpool(respStr);
                 at_resp = AT_RESP_NONE;
                 break;
             case AT_CONFIG_RESP:  
                 // AT_CONFIG_RESP response state 
-                //////_smutex.lock();
                 dbg_printf(LOG, "\n [ATCMD MAN] WIFI CONFIG RESPONSE RECEIVED!!\r\n");
-                //_smutex.lock();
                 sendAtConfirmation(OK_RESP);   //_parser.send(OK_RESP);
-                //_smutex.unlock();
                 at_resp = AT_RESP_NONE;
                 break;
             case AT_NETWORK_STATUS_RESP:  
                 // AT_CONFIG_RESP response state 
-                //////_smutex.lock();
                 dbg_printf(LOG, "\n [ATCMD MAN] NETWORK STATUS RESPONSE RECEIVED!!\r\n");
                 respStr = (char *) resp_data->buffer;
                 sendAtConfirmationFreeMpool(respStr);
@@ -177,7 +164,6 @@
                 break;
             case AT_WIFI_STATUS_RESP:  
                 // AT_CONFIG_RESP response state 
-                //////_smutex.lock();
                 dbg_printf(LOG, "\n [ATCMD MAN] WIFI RESPONSE RECEIVED!!\r\n");
                 respStr = (char *) resp_data->buffer;
                 sendAtConfirmationFreeMpool(respStr);
@@ -186,47 +172,32 @@
             case AT_INTERNET_CONFIG_RESP:  
                 // AT_CONFIG_RESP response state 
                 dbg_printf(LOG, "\n [ATCMD MAN] WIFI INTERNET_CONFIG RESPONSE RECEIVED!!\r\n");
-                //_smutex.lock();
                 sendAtConfirmation(OK_RESP);   //_parser.send(OK_RESP);
-                //_smutex.unlock();
-                //respStr = (char *) resp_data->buffer;
-                //sendAtConfirmationFreeMpool(respStr);
                 at_resp = AT_RESP_NONE;
                 break;
             case AT_HTTPS_RESP:  
                 // AT_HTTP_RESP response state 
                 dbg_printf(LOG, "\n [ATCMD MAN] WIFI HTTPS RESPONSE RECEIVED!!\r\n");
                 return_response();
-                //_smutex.lock();
                 sendAtConfirmation(OK_RESP);   //_parser.send(OK_RESP);
-                //_smutex.unlock();
                 at_resp = AT_RESP_NONE;
                 break;
             case AT_HTTPS_RESP_DOWNLOAD:  
                 // AT_HTTPS_RESP_DOWNLOAD response state 
                 dbg_printf(LOG, "\n [ATCMD MAN] WIFI HTTPS DOWNLOAD RESPONSE RECEIVED!!\r\n");
                 return_response(true); // set download paramter to true
-                //_smutex.lock();
-                //sendAtConfirmation(OK_RESP);   //_parser.send(OK_RESP);
-                //_smutex.unlock();
                 at_resp = AT_RESP_NONE;
                 break;
             case AT_HTTP_RESP:  
                 // AT_HTTP_RESP response state 
                 dbg_printf(LOG, "\n [ATCMD MAN] WIFI HTTP RESPONSE RECEIVED!!\r\n");
                 return_response(); 
-                //_smutex.lock();
-                //sendAtConfirmation(OK_RESP);   //_parser.send(OK_RESP);
-                //_smutex.unlock();
                 at_resp = AT_RESP_NONE;
                 break;
             case AT_HTTP_RESP_DOWNLOAD:  
                 // AT_HTTP_RESP response state 
                 dbg_printf(LOG, "\n [ATCMD MAN] WIFI HTTP RESPONSE RECEIVED!!\r\n");
                 return_response(true); // set download paramter to true
-                //_smutex.lock();
-                //sendAtConfirmation(OK_RESP);   //_parser.send(OK_RESP);
-                //_smutex.unlock();
                 at_resp = AT_RESP_NONE;
                 break;
             case CONNECT_EVENT:  
@@ -250,9 +221,6 @@
             {
                 // AT_HTTP_RESP response state 
                 dbg_printf(LOG, "\n [ATCMD MAN] WIFI Watchdog message!!\r\n");
-                //_smutex.lock();
-                //_parser.send("\r\nNACK\r\n");
-                //_smutex.unlock();
                 respStr = (char *) resp_data->buffer;
                 sendConnectIndicationFreeMpool(respStr);
                 at_resp = AT_RESP_NONE;
@@ -262,9 +230,6 @@
             {
                 // AT_HTTP_RESP response state 
                 dbg_printf(LOG, "\n [ATCMD MAN] WIFI COMMAND FAILED!!\r\n");
-                //_smutex.lock();
-                //_parser.send("\r\nNACK\r\n");
-                //_smutex.unlock();
                 respStr = (char *) resp_data->buffer;
                 sendAtConfirmationFreeMpool(respStr);
                 at_resp = AT_RESP_NONE;
@@ -272,10 +237,8 @@
             }
             default:
                  //UNKNOWN response state
-                //_smutex.lock();
                 dbg_printf(LOG, "\n [ATCMD MAN] UNKNOWN RESPONSE RECEIVED!!\r\n");
                 sendAtConfirmationFreeMpool(ERROR_RESP);   //_parser.send(OK_RESP);
-                //_smutex.unlock();
                 at_resp = AT_RESP_NONE;
                 break;
         }
@@ -410,7 +373,6 @@
             outPtr = http_req->http_version + len; // point output buffer ptr to after 2nd string
         }
         else{ // scan header pairs
-            //n = sscanf(nxtPtr,"%s %s", &s1[0], &s2[0]);
             n = sscanf(nxtPtr,"%s %s", s1, s2);
             if(n!=2) return false; // error in input abort
             p = strstr(s1,":");
@@ -456,7 +418,6 @@
                 outPtr += len; // point output buffer ptr to after current string
             }
             else if(strstr(s1, "Content-Length")!= NULL){
-                //http_req.contentLen.assign(s2);
                 http_req->contentLen = outPtr;
                 len = strlen(s2)+1;                
                 strncpy(outPtr, s2, len);
@@ -506,13 +467,10 @@
 // OOB processing
 void ATCmdManager::_process_oob(uint32_t timeout, bool all){
     set_timeout(timeout);
-    //int cnt = 0;
     int start;
-    //channel_id_t chan_id;
     if(dataMode == AT_EXT_DATA_MODE)
     {
         int n;
-        //if(cnt++ % 10 == 0)dbg_printf(LOG, "In EDM mode\n");
         uint8_t edm[EDM_HDR_LEN];
         char cmdType[16];
         // Poll for edm packets
@@ -537,7 +495,6 @@
                 pT = 1;
                 strcpy(cmdType, "AT REQUEST");
             }
-            //dbg_printf(LOG, "%d bytes read! : type = %s\n", n, cmdType2str(edm_hdr.payloadID));
             dbg_printf(LOG, "%d bytes read! : CMD type = %s\n", n, cmdType);
             if(n==(EDM_HDR_LEN-pT))
             dbg_printf(LOG, "Start = %d, payloadID = %d len = %d chan_id = %d\n", edm_hdr.startByte, 
@@ -548,7 +505,6 @@
             {
                 if(edm_hdr.payloadID == AT_REQUEST_ID)
                 {
-                    //_parser.process_oob();
                     while (_parser.process_oob() && all) {
                     }
                     break;
@@ -585,7 +541,6 @@
                         case DATA_COMMAND_ID:
                         {
                             dbg_printf(LOG, "DATA_COMMAND received!\n");
-                            //sendAtConfirmation(OK_RESP);   //_parser.send(OK_RESP);
                             if(createHttpRequest() == false)
                             {
 #ifdef SEND_DEBUG_MESSAGES
@@ -612,7 +567,6 @@
                             break;
                     }
                 }
-                //_parser.process_oob();
             }
             else // incorrect # of bytes received abort!!
             {
@@ -623,10 +577,9 @@
     else
     {
         // Poll for inbound packets
-        static int msgCnt = 0;
+#ifdef BOX_UBLOX_DEMO_TESTING
         static char * ATCMD = new char[32];
         int n = 0;
-#ifdef BOX_UBLOX_DEMO_TESTING
         if(check_for_at_cmd)
         {
             while (n>=0 && all) {
@@ -683,9 +636,7 @@
 }
 
 void ATCmdManager::_oob_ok_hdlr(){
-    //_smutex.lock();
     sendAtConfirmation(OK_RESP);   //_parser.send(OK_RESP);
-    //_smutex.unlock();
 }
 
 
@@ -718,18 +669,14 @@
 #define TTP_DEBUGGING_UART_NOCHANGE
 void ATCmdManager::_oob_uart_setup(){
     int uOpts[NUM_UART_OPTIONS];
-    //if(_parser.recv("=%d,%d,%d,%d,%d,%d", &uOpts[0], &uOpts[1], &uOpts[2], &uOpts[3], &uOpts[4], &uOpts[5])) {
     if(_parser.scanf("=%d,%d,%d,%d,%d,%d", &uOpts[0], &uOpts[1], &uOpts[2], &uOpts[3], &uOpts[4], &uOpts[5]) >0) {
         dbg_printf(LOG, "\nATCmdParser: Uart Options=%d,%d,%d,%d,%d,%d\n", uOpts[0], uOpts[1], uOpts[2], uOpts[3], uOpts[4], uOpts[5]);
-        //printf("\nATCmdParser: Uart Options=%d,%d,%d,%d,%d,%d\n", uOpts[0], uOpts[1], uOpts[2], uOpts[3], uOpts[4], uOpts[5]);
-       //AT+UMRS=230400,2,8,1,1,1
         dbg_printf(LOG, "\n Changing Baud Rate to %d\n", uOpts[0]);
 #ifdef TTP_DEBUGGING_UART_NOCHANGE
     sendAtConfirmation(OK_RESP);
 #else
 
         sendAtConfirmation(OK_RESP);   //_parser.send(OK_RESP);
-        //wait(0.1);
         _serial.set_baud(uOpts[0]);
         wait(0.1);
         dbg_printf(LOG, "\n Baud Rate now %d\n", uOpts[0]);
@@ -751,29 +698,23 @@
 
 void ATCmdManager::_oob_echo_off()
 {
-    //_smutex.lock();
     dbg_printf(LOG, "\n Received ATEO OOB command!!\n");
     dbg_printf(LOG, "\n turning echo OFF!!\n");
-    //printf("\n turning echo OFF!!\n");
     _parser.debug_on(false);
     sendAtConfirmation(OK_RESP);   //_parser.send(OK_RESP);
-    //_smutex.unlock();
 }
 
 
 void ATCmdManager::_oob_echo_on()
 {
-    //_smutex.lock();
     dbg_printf(LOG, "\n Received ATE1 OOB command!!\n");
     dbg_printf(LOG, "\n turning echo ON!!\n");
     _parser.debug_on(true);
     sendAtConfirmation(OK_RESP);   //_parser.send(OK_RESP);
-    //_smutex.unlock();
 }
 
 
 void ATCmdManager::_oob_data_mode(){
-    //_smutex.lock();
     dbg_printf(LOG, "\n Received EDM mode command!!\n");
     int dmode;
     if(_parser.scanf("%d", &dmode) >0) {
@@ -802,12 +743,10 @@
     } else {
         dbg_printf(LOG, "\nATCmdParser: Retrieving Uart Options failed\n");
     }
-    //_smutex.unlock();
 }
 
 void ATCmdManager::_oob_get_mac_addr(){
     int bleOrWifi;
-    //_smutex.lock();
     if(_parser.scanf("=%d", &bleOrWifi) >0) {
         switch(bleOrWifi)
         {
@@ -825,31 +764,22 @@
         dbg_printf(LOG, "\nATCmdParser: Retrieving Uart Options failed");
     }
     sendAtConfirmation(OK_RESP);   //_parser.send(OK_RESP);
-    //_smutex.unlock();
 }
 
 void ATCmdManager::_oob_get_ble_role(){
-    //_smutex.lock();
     dbg_printf(LOG, "\n Received get BLE role command!!\n");
-    //printf("\n Received get BLE role command!!\n");
     sendAtConfirmation("+UBTLE:2\r\nOK\r\n");   //_parser.send(OK_RESP);
-    //_smutex.unlock();
 }
 
 void ATCmdManager::_oob_ena_ble_peri(){
-    //_smutex.lock();
     dbg_printf(LOG, "\n Received enable BLE Peripheral command!!\n");
     sendAtConfirmation(OK_RESP);   //_parser.send(OK_RESP);
-    //_smutex.unlock();
 }
 
 void ATCmdManager::_oob_reboot(){
-    //_smutex.lock();
     dbg_printf(LOG, "\n Received reboot command!!\n");
     sendAtConfirmation(OK_RESP);   //_parser.send(OK_RESP);
-    //_parser.send("System Resetting....\n");
     system_reset();
-    //_smutex.unlock();
 }
 
 const char * ATCmdManager::sec2str(nsapi_security_t sec)
@@ -882,10 +812,8 @@
 
 
 void ATCmdManager::_oob_scanWiFiNetworks(){
-    //_smutex.lock();
     dbg_printf(LOG, "\n Received scanWiFiNetworks command!!\n");
     sendAtConfirmation(OK_RESP);   //_parser.send(OK_RESP);
-    //_smutex.unlock();
     wifi_cmd_t cmd = WIFI_CMD_SCAN;
     // queue next command
     queueWiFiCommand(cmd);
@@ -899,9 +827,7 @@
     int if_id; // interface id for request
     int aId; // interface id for request
     _parser.recv("%d,%d", &if_id, &aId);
-    //_smutex.lock();
     dbg_printf(LOG, "\n Received WiFi Configuration Action command %d %d!!\r\n", if_id, aId);
-    //sendAtConfirmation(OK_RESP);   //_parser.send(OK_RESP);
     if(if_id == WIFI_CONFIG_ID && aId <5){
         wifi_cmd_t cmd;
         action_id_t action_id = (action_id_t) aId;
@@ -915,36 +841,26 @@
             case WIFI_CONFIG_ACTIVATE:
                 cmd = WIFI_CMD_CONNECT;
                 dbg_printf(LOG, "\n About to Queue wifi cmd = %d!!\n", cmd);
-                //_smutex.unlock();
-                // queue next command
                 queueWiFiCommand(cmd);
                 break;
             case WIFI_CONFIG_DEACTIVATE:
                 cmd = WIFI_CMD_DISCONNECT;
                 dbg_printf(LOG, "\n About to Queue wifi cmd = %d!!\n", cmd);
-                //_smutex.unlock();
-                // queue next command
                 queueWiFiCommand(cmd);
                 break;
             default:
                 break;
         }
     }
-    if(debug_flag>0){
-        dbg_printf(LOG, "finished queuing WIFI CONNECT CMD \r\n");
-    }
     return;
 }
 
 
 void ATCmdManager::_oob_disconnectWiFiNetwork()
 {
-    //_smutex.lock();
     dbg_printf(LOG, "\n Received WiFi Disconnect command!!\n");
     sendAtConfirmation(OK_RESP);   //_parser.send(OK_RESP);
     wifi_cmd_t cmd = WIFI_CMD_DISCONNECT;
-    //_smutex.unlock();
-    // queue next command
     queueWiFiCommand(cmd);
     return;
 }
@@ -955,15 +871,17 @@
     char url[MAX_URL_LEN];
     int n;
     internet_config_t internet_config;
-    //_smutex.lock();
     dbg_printf(LOG, "sizeof internet_config_t = %d\n", sizeof(internet_config_t));
     n = ReadBytes((uint8_t *)str, MAX_URL_LEN);
     str[n]=NULL;
+    int id;
+    int scheme;
     dbg_printf(LOG, "\n read string = %s , n = %d\n", str, n);
-    //n = sscanf(str, "=%1d,%199[^,],%1d", &(uint8_t)internet_config.peer_id, 
-    n = sscanf(str, "=%1d,%99[^,],%1d", &internet_config.peer_id, 
+    n = sscanf(str, "=%1d,%99[^,],%1d", &id, 
                                          url, //internet_config.url,    
-                                        &internet_config.connectionScheme);
+                                        &scheme);
+    internet_config.peer_id = (uint8_t) id;
+    internet_config.connectionScheme = (conn_scheme_t) scheme;
 #ifdef BOX_UBLOX_DEMO_TESTING
     char *p = strstr(url,"/https:"); 
 #else
@@ -991,7 +909,6 @@
         data_msg.dataLen = sizeof(internet_config_t); // + strlen(internet_config.url);
         dbg_printf(LOG, "\n url size = %d url str = %s\n",strlen(internet_config.url), internet_config.url );
         memcpy(data_msg.buffer,&internet_config, data_msg.dataLen);
-        //sendAtConfirmation(OK_RESP);   //_parser.send(OK_RESP);
         // queue next data request
         queueWiFiDataRequest(data_msg);
         print_memory_info();
@@ -999,7 +916,6 @@
         dbg_printf(LOG, "\n[ATCMD MAN]: internet configuration failed %d fields parsed \r\n", n);
         _parser.send("NAK\n");
     }
-    //_smutex.unlock();
 }
 
 wifi_config_t ATCmdManager::init_wifi_config()
@@ -1010,6 +926,7 @@
     wifi_cfg.security = NSAPI_SECURITY_UNKNOWN;
     return wifi_cfg;    
 }
+
 /*  read ASCII characters into buffer and null terminate */
 int ATCmdManager::readStringBytes(uint8_t *buf, int maxBytes)
 { 
@@ -1048,7 +965,6 @@
 {
     int n;
     wifi_config_t wifi_cfg = init_wifi_config();
-    //_smutex.lock();
     n = readStringBytes((uint8_t *)wifi_cfg.ssid, 32);
     dbg_printf(LOG, "[ATCMD MAN]: number of bytes read = %d\n", n);
     if(n>0) 
@@ -1059,21 +975,17 @@
         data_msg.wifi_cmd = WIFI_CMD_CONFIG;
         data_msg.dataLen = sizeof(wifi_config_t);
         memcpy(data_msg.buffer,&wifi_cfg, data_msg.dataLen);
-        //sendAtConfirmation(OK_RESP);   //_parser.send(OK_RESP);
         queueWiFiDataRequest(data_msg);
     } else {
         dbg_printf(LOG, "\n[ATCMD MAN]: wifi configuration failed  \n");
         _parser.send("NAK\n");
     }
-    //_smutex.unlock();
 }
 
 void ATCmdManager::_oob_setWiFiPWD()
 {
     int n;
     wifi_config_t wifi_cfg = init_wifi_config();
-    //_smutex.lock();
-    //n = _parser.scanf("%31[^\r\n]", wifi_cfg.pass);
     n = readStringBytes((uint8_t *)wifi_cfg.pass, 32);
     if(n>0) 
     {
@@ -1083,31 +995,28 @@
         data_msg.wifi_cmd = WIFI_CMD_CONFIG;
         data_msg.dataLen = sizeof(wifi_config_t);
         memcpy(data_msg.buffer,&wifi_cfg, data_msg.dataLen);
-        //sendAtConfirmation(OK_RESP);   //_parser.send(OK_RESP);
         queueWiFiDataRequest(data_msg);
     } else {
         dbg_printf(LOG, "\n[ATCMD MAN]: wifi configuration failed  \n");
         _parser.send("NAK\n");
     }
-    //_smutex.unlock();
 }
 
 void ATCmdManager::_oob_setWiFiSecurity()
 {
     int n;
     wifi_config_t wifi_cfg = init_wifi_config();
-    _smutex.lock();
-    n = _parser.scanf(",%d", &wifi_cfg.security);
-    _smutex.unlock();
+    int security;
+    n = _parser.scanf(",%d", &security);
     if(n>0) 
     {
+        wifi_cfg.security = (nsapi_security_t) security;
         dbg_printf(LOG, "ATCMD MAN]: wifi_cfg.security = %s\n", sec2str(wifi_cfg.security));
         // package and send on wifi data queue
         wifi_data_msg_t data_msg;
         data_msg.wifi_cmd = WIFI_CMD_CONFIG;
         data_msg.dataLen = sizeof(wifi_config_t);
         memcpy(data_msg.buffer,&wifi_cfg, data_msg.dataLen);
-        //sendAtConfirmation(OK_RESP);   //_parser.send(OK_RESP);
         queueWiFiDataRequest(data_msg);
     } else {
         dbg_printf(LOG, "\n[ATCMD MAN]: wifi configuration failed  \n");
@@ -1115,23 +1024,18 @@
         _parser.send("NAK\n");
         _smutex.unlock();
     }
-    //_smutex.unlock();
 }
 
 
 
 void ATCmdManager::_oob_getNetworkStatus()
 {
-    uint8_t if_id; // interface id for request
+    int if_id; // interface id for request
     _parser.scanf(",%d", &if_id);
-    //_smutex.lock();
     dbg_printf(LOG, "\n Received Get Network Status command!!\n");
-    //sendAtConfirmation(OK_RESP);   //_parser.send(OK_RESP);
     if(if_id == WIFI_INTERFACE_ID){
         wifi_cmd_t cmd = WIFI_CMD_NETWORK_STATUS;
         dbg_printf(LOG, "\n About to Queue wifi cmd = %d!!\n", cmd);
-        //_smutex.unlock();
-        // queue next command
         queueWiFiCommand(cmd);
     }
     return;
@@ -1140,12 +1044,9 @@
 
 void ATCmdManager::_oob_WiFiNetworkStatus()
 {
-    //_smutex.lock();
     dbg_printf(LOG, "\n Received Get WiFi Network Status command!!\n");
-    //sendAtConfirmation(OK_RESP);   //_parser.send(OK_RESP);
     wifi_cmd_t cmd = WIFI_CMD_WIFI_STATUS;
     dbg_printf(LOG, "\n About to Queue wifi cmd = %d!!\n", cmd);
-    //_smutex.unlock();
     // queue next command
     queueWiFiCommand(cmd);
     return;
@@ -1153,28 +1054,6 @@
 
 void ATCmdManager::_oob_sendHttpMessage()
 {
-    int n;
-    http_request_t http_post_request;
-    //_smutex.lock();
-    /*
-    n = _parser.scanf(",%d", &wifi_cfg.security);
-    if(n>0) 
-    {
-        dbg_printf(LOG, "ATCMD MAN]: wifi_cfg.security = %s\n", sec2str(wifi_cfg.security));
-        // package and send on wifi data queue
-        wifi_data_msg_t data_msg;
-        data_msg.wifi_cmd = WIFI_CMD_CONFIG;
-        data_msg.dataLen = sizeof(wifi_config_t);
-        memcpy(data_msg.buffer,&wifi_cfg, data_msg.dataLen);
-        queueWiFiDataRequest(data_msg);
-        sendAtConfirmation(OK_RESP);   //_parser.send(OK_RESP);
-    } else {
-        dbg_printf(LOG, "\n[ATCMD MAN]: wifi configuration failed  \n");
-        _parser.send("NAK\n");
-    }
-    */
-    //_smutex.unlock();
-
 }
 
 bool  ATCmdManager::queueWiFiCommand(wifi_cmd_t cmd){
@@ -1189,10 +1068,6 @@
     wifi_cmd_message_t *wifiCmd = (wifi_cmd_message_t *) malloc(sizeof(wifi_cmd_message_t));
     if(wifiCmd == NULL){
         dbg_printf(LOG, "[ATCMD MAN] try malloc() : queued memory allocation failed\n");
-        //_event_queue.call_in(10, &print_memory_info);
-        //_event_queue.call_in(10, &print_heap_and_isr_stack_info);
-        //print_memory_info();
-        //print_heap_and_isr_stack_info();
         return false;
     }
 #endif
@@ -1224,13 +1099,9 @@
 
 bool  ATCmdManager::queueWiFiDataRequest(wifi_data_msg_t data_req){
     static bool memFull = false;
-    //print_memory_info();
-    //_event_queue.call_in(10, &print_heap_and_isr_stack_info);
-    //print_heap_and_isr_stack_info();
     wifi_data_msg_t *wifiData = _aT2WiFiDatamPool->alloc();
     if(wifiData == NULL)
     {
-        //_parser.send("\r\nQUEUE MEMORY FULL\r\n");
 #ifdef SEND_DEBUG_MESSAGES
         sendAtConfirmation("\r\nQUEUE MEMORY FULL\r\n");
 #endif
@@ -1249,7 +1120,6 @@
     memcpy(wifiData->buffer, data_req.buffer, data_req.dataLen);
     _aT2WiFiDataQueue->put(wifiData);
     dbg_printf(LOG, "[ATCMD MAN] queued data size = %d : wifi_cmd = %d\n", data_req.dataLen, data_req.wifi_cmd);
-    //free(&data_req);
     return true;
 }
 
@@ -1260,8 +1130,6 @@
         resp_data = (at_data_msg_t*)evt.value.p;
         setNextResponse(resp_data->at_resp);
         dbg_printf(LOG, "[ATCMD MAN] dequeued data size = %d : at_resp = %d\n", resp_data->dataLen, resp_data->at_resp);
-        //_event_queue.call_in(10, &print_heap_and_isr_stack_info);
-        //print_heap_and_isr_stack_info();
     }
     return true;
 }
@@ -1287,7 +1155,6 @@
             _parser.send("%s", buf);
             break;
     }
-    //wait_ms(1);
     _smutex.unlock();
 }
 void ATCmdManager::sendAtEvent(const char *buf)
@@ -1318,7 +1185,6 @@
 
 void ATCmdManager::sendConnectEvent(const uint8_t *buf, int len)
 {
-    //_smutex.lock();
     switch(dataMode){
         case AT_CMD_DATA_MODE:
             _parser.send((const char*) buf);
@@ -1366,7 +1232,6 @@
 
 void ATCmdManager::return_response(bool download) {
     char * resp = (char *) resp_data->buffer;
-    //_smutex.lock();
     dbg_printf(LOG, "\n[ATCMD MAN] received response:\n");
     if(download == false) // not download must be ascii header
     {
@@ -1376,13 +1241,8 @@
     {
         printBufferInHex((uint8_t *)resp, resp_data->dataLen);
     }
-    //_parser.write(resp, resp_data->dataLen);
     outputEDMdata((const uint8_t *)resp, resp_data->dataLen, DATA_MSG_ID, 
                   EVENT_MSG_TYPE, WIFI_CHANNEL);
-    //_smutex.unlock();
     _wiFi2ATDatamPool->free(resp_data);
     resp_data = NULL;
-    //print_memory_info();
-    //_event_queue.call_in(10, &print_heap_and_isr_stack_info);
-    //print_heap_and_isr_stack_info();   
 }