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

Dependencies:   mbed-http

Revision:
75:08eff6258e1b
Parent:
74:f26e846adfe9
Child:
78:07bb86e3ce14
--- a/source/ATCmdManager.cpp	Sun Mar 10 09:46:06 2019 +0000
+++ b/source/ATCmdManager.cpp	Thu Mar 14 21:34:06 2019 +0000
@@ -11,8 +11,23 @@
     _serial.set_baud(DEFAULT_BAUD_RATE);
     _parser.debug_on(debug);
     _parser.set_delimiter("\r\n");
-    _parser.oob("ATE0", callback(this, &ATCmdManager::_oob_startup_hdlr));
+    _parser.send("+STARTUP");
+    _parser.oob("ATE0", callback(this, &ATCmdManager::_oob_echo_off));
+    _parser.oob("ATE1", callback(this, &ATCmdManager::_oob_echo_on));
+    _parser.oob("AT+UMRS", callback(this, &ATCmdManager::_oob_uart_setup));
+    
+    _parser.oob("ATO", callback(this, &ATCmdManager::_oob_data_mode));
+    _parser.oob("AT+UMLA", callback(this, &ATCmdManager::_oob_get_mac_addr));
+    _parser.oob("AT+UBTLE?", callback(this, &ATCmdManager::_oob_get_ble_role));
+    _parser.oob("AT+UBTLE=2", callback(this, &ATCmdManager::_oob_ena_ble_peri));
+    _parser.oob("AT+CPWROFF", callback(this, &ATCmdManager::_oob_reboot));
+    _parser.oob("AT+CGMR", callback(this, &ATCmdManager::_oob_get_fw_ver));
+    
+
+    //_parser.oob("ATE0", callback(this, &ATCmdManager::_oob_startup_hdlr));
     printf("\n --- ATCmdManager constructor completed ---\n");
+    
+    //AT+UMRS=230400,2,8,1,1,1
     // AT+UBTLE
 }
 
@@ -56,8 +71,122 @@
 void ATCmdManager::_oob_err(){
 }
 
+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) {
+        printf("\nATCmdParser: Uart Options=%d,%d,%d,%d,%d,%d\n", uOpts[0], uOpts[1], uOpts[2], uOpts[3], uOpts[4], uOpts[5]);
+    } else {
+        printf("\nATCmdParser: Retrieving Uart Options failed");
+    }
+}
+
 void ATCmdManager::set_timeout(uint32_t timeout_ms)
 {
     _parser.set_timeout(timeout_ms);
 }
 
+
+void ATCmdManager::_oob_echo_off()
+{
+    _smutex.lock();
+    printf("\n Received ATEO OOB command!!\n");
+    printf("\n turning echo OFF!!\n");
+    _parser.debug_on(false);
+    _parser.send("OK\n");
+    _smutex.unlock();
+}
+
+
+void ATCmdManager::_oob_echo_on()
+{
+    _smutex.lock();
+    printf("\n Received ATE1 OOB command!!\n");
+    printf("\n turning echo ON!!\n");
+    _parser.debug_on(true);
+    _parser.send("OK\n");
+    _smutex.unlock();
+}
+
+
+void ATCmdManager::_oob_data_mode(){
+    int dataMode;
+    _smutex.lock();
+    printf("\n Received EDM mode command!!\n");
+    if(_parser.scanf("%d", &dataMode) >0) {
+        printf("\nATCmdParser: Data mode=%d\n", dataMode);
+        switch(dataMode)
+        {
+            case 0:
+                printf("\nATCmdParser: Command Mode request received");
+                break;
+            case 1:
+                printf("\nATCmdParser: Data Mode request received");
+                break;
+            case 2:
+                printf("\nATCmdParser: Extended data Mode request received");
+                break;
+            default:
+                printf("\nATCmdParser: ERROR - UNKNOWN DATA MODE RECEIVED!!! \n");
+                break;
+        }
+    } else {
+        printf("\nATCmdParser: Retrieving Uart Options failed");
+    }
+    _parser.send("OK\n");
+    _smutex.unlock();
+}
+
+void ATCmdManager::_oob_get_mac_addr(){
+    int bleOrWifi;
+    _smutex.lock();
+    if(_parser.scanf("=%d", &bleOrWifi) >0) {
+        switch(bleOrWifi)
+        {
+            case 1:
+                printf("\nATCmdParser: BLE MAC Address request received");
+                break;
+            case 2:
+                printf("\nATCmdParser: WiFi MAC Address request received");
+                break;
+            default:
+                printf("\nATCmdParser: ERROR - UNKNOWN MAC ADDRESS REQUEST RECEIVED!!! \n");
+                break;
+        }
+    } else {
+        printf("\nATCmdParser: Retrieving Uart Options failed");
+    }
+    _parser.send("OK\n");
+    _smutex.unlock();
+}
+
+void ATCmdManager::_oob_get_ble_role(){
+    _smutex.lock();
+    printf("\n Received get BLE role command!!\n");
+    _parser.send("OK\n");
+    _smutex.unlock();
+}
+
+void ATCmdManager::_oob_ena_ble_peri(){
+    _smutex.lock();
+    printf("\n Received enable BLE Peripheral command!!\n");
+    _parser.send("OK\n");
+    _smutex.unlock();
+}
+
+void ATCmdManager::_oob_reboot(){
+    _smutex.lock();
+    printf("\n Received reboot command!!\n");
+    _parser.send("OK\n");
+    _parser.send("System Resetting....\n");
+    system_reset();
+    _smutex.unlock();
+}
+
+void ATCmdManager::_oob_get_fw_ver(){
+    _smutex.lock();
+    printf("\n Received Firmware Version command!!\n");
+    _parser.send("OK\n");
+    _smutex.unlock();
+}
+