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

Dependencies:   mbed-http

Files at this revision

API Documentation at this revision

Comitter:
ocomeni
Date:
Mon May 06 20:18:02 2019 +0000
Branch:
PassingRegression
Parent:
107:f1a83fd41b17
Child:
109:c274780ff609
Commit message:
this version is passing regression

Changed in this revision

source/ATCmdManager.cpp Show annotated file Show diff for this revision Revisions of this file
source/ATCmdManager.h Show annotated file Show diff for this revision Revisions of this file
source/BleManager.cpp Show annotated file Show diff for this revision Revisions of this file
source/WiFiManager.cpp Show annotated file Show diff for this revision Revisions of this file
source/main-https.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/source/ATCmdManager.cpp	Mon May 06 16:44:40 2019 +0000
+++ b/source/ATCmdManager.cpp	Mon May 06 20:18:02 2019 +0000
@@ -85,9 +85,10 @@
     dataMode = AT_CMD_DATA_MODE;
     debug_flag = 0;
     wifiStateControl = AT_RESP_NONE;
-    _event_queue.call_in(10, &print_heap_and_isr_stack_info);
+    //_event_queue.call_in(10, &print_heap_and_isr_stack_info);
     //print_heap_and_isr_stack_info();
-    _event_queue.call_every(3600000,&print_memory_info);
+    //_event_queue.call_every(3600000,&print_memory_info);
+    _event_queue.call_every(10000,&blinkLEDs);
 #ifdef BOX_UBLOX_DEMO_TESTING
     check_for_at_cmd = false;
 #endif
@@ -108,19 +109,11 @@
         dequeueATresponse();
         dequeueWiFidataResponse();
         updateWiFiMgrStatus();
-        if(debug_flag>0){
-            //debug_flag--;
-            dbg_printf(LOG, " back to ProcessResponses in Main loop... at_resp = %d\r\n", at_resp);
-        }
         char * respStr;
         //if(at_resp > AT_COMMAND_FAILED)
         //return;
         switch(at_resp){
             case AT_RESP_NONE:
-                if(debug_flag>0){
-                    debug_flag--;
-                    dbg_printf(LOG, " In IDLE state \r\n");
-                }
                 // IDLE response state
                 break;
             case AT_SCAN_RESP:
@@ -332,12 +325,7 @@
 
 void ATCmdManager::printBufferInHex(const uint8_t *buf, int pLen)
 {
-    //for(int i =0;i<pLen;i++){
-    //    if(i%8==0) dbg_printf(LOG, "\n[%3d]",i);
-    //    dbg_printf(LOG, "%02x ", buf[i]);
-    //}
     print_debug_hex(buf, pLen);
-    //dbg_printf(LOG, "\n");
 }
 
 bool ATCmdManager::validate(edm_header_t edm_header)
@@ -376,15 +364,13 @@
 }
 bool ATCmdManager::createHttpRequest()
 {
-    static int busyResponseJitter = 0;
-    if(wifiStateControl != AT_RESP_NONE) // wifi busy!
+    static int wifiBusyTimeOut = 0;
+    if(wifiStateControl != AT_RESP_NONE && wifiBusyTimeOut < 10) // wifi busy!
     {
-        busyResponseJitter++;
-        if(busyResponseJitter%7==5 || busyResponseJitter%11==6)
-            return false;
-        else
-            return true;
+        wifiBusyTimeOut++;
+        return false;
     }
+    wifiBusyTimeOut = 0;
     http_request_t *http_req; // = new http_request_t;
     wifi_data_msg_t data_msg;
     http_req = (http_request_t *)data_msg.buffer;
@@ -522,7 +508,7 @@
 // OOB processing
 void ATCmdManager::_process_oob(uint32_t timeout, bool all){
     set_timeout(timeout);
-    int cnt = 0;
+    //int cnt = 0;
     int start;
     //channel_id_t chan_id;
     if(dataMode == AT_EXT_DATA_MODE)
@@ -605,15 +591,9 @@
                         {
                             dbg_printf(LOG, "DATA_COMMAND received!\n");
                             //sendAtConfirmation(OK_RESP);   //_parser.send(OK_RESP);
-                            if(createHttpRequest() == true){
-                                //_smutex.lock();
-                                //sendAtConfirmation(OK_RESP);   //sendAtConfirmation(OK_RESP);   //_parser.send(OK_RESP);
-                                //_smutex.unlock();
-                            }
-                            else{
-                                //_smutex.lock();
+                            if(createHttpRequest() == false)
+                            {
                                 sendAtConfirmation(WIFI_BUSY_RESP);
-                                //_smutex.unlock();
                             }
                             free(rx_buf_ptr);
                             rx_buf_ptr = NULL;
--- a/source/ATCmdManager.h	Mon May 06 16:44:40 2019 +0000
+++ b/source/ATCmdManager.h	Mon May 06 20:18:02 2019 +0000
@@ -17,6 +17,7 @@
 #define WIFI_BUSY_RESP "\r\nWIFI BUSY\r\n"
 #define BOX_UBLOX_DEMO_TESTING
 extern void print_memory_info();
+extern void blinkLEDs();
 class ATCmdManager {
 public:
     ATCmdManager(PinName tx, PinName rx, SMDevicePeripheral *blePeripheral, 
--- a/source/BleManager.cpp	Mon May 06 16:44:40 2019 +0000
+++ b/source/BleManager.cpp	Mon May 06 20:18:02 2019 +0000
@@ -84,8 +84,8 @@
 
     ble_error_t error;
 
-    /* to show we're running we'll blink every 500ms */
-    _event_queue.call_every(500, this, &SMDevice::blink);
+    /* to show we're running we'll blink every 10secs */
+    _event_queue.call_every(10000, this, &SMDevice::blink);
 
     /* to show we're advertising we'll print status every minute */
     _event_queue.call_every(60000, this, &SMDevice::reportGapState);
--- a/source/WiFiManager.cpp	Mon May 06 16:44:40 2019 +0000
+++ b/source/WiFiManager.cpp	Mon May 06 20:18:02 2019 +0000
@@ -2,7 +2,7 @@
 #include "WiFiManager.h"
 #include "common_config.h"
 #define FILE_CODE       "wifi"
-
+#define USE_EVENTS_FOR_HTTPS_REQUESTS
 
 WiFiManager::WiFiManager(wifi_config_t wifi_config, WiFiInterface *wifi, 
                          events::EventQueue &event_queue, 
--- a/source/main-https.cpp	Mon May 06 16:44:40 2019 +0000
+++ b/source/main-https.cpp	Mon May 06 20:18:02 2019 +0000
@@ -25,8 +25,11 @@
 #include "mbed_memory_status.h"
 UARTService *uart;
 
-DigitalOut alivenessLED(LED1, 0);
-DigitalOut actuatedLED(LED2, 0);
+//DigitalOut alivenessLED(LED1, 0);
+//DigitalOut actuatedLED(LED2, 0);
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+DigitalOut led3(LED3);
 
 #define FILE_CODE       "main"
 
@@ -194,7 +197,7 @@
     uartCharRcvCount++;
     if(uartCharRcvCount >= uartExpectedRcvCount)
     {
-        alivenessLED = !alivenessLED; /* Do blinky on LED1 to indicate system aliveness. */
+        //alivenessLED = !alivenessLED; /* Do blinky on LED1 to indicate system aliveness. */
         eventQueue.call(printUartRxResult);
     }
 }
@@ -367,6 +370,23 @@
 #endif
 }
 
+void blinkLEDs()
+{
+    static int cnt =0;
+    cnt++;
+    if(cnt == 3){
+        cnt = 0;
+    }
+    if(cnt==0)
+        led1 = !led1;
+    //wait(1.0);
+    if(cnt==1)
+        led2 = !led2;
+    //wait(1.0);
+    if(cnt==2)
+        led3 = !led3;
+}
+
 //#define DISABLE_WIFI
 #define DISABLE_WIFI_DEMO
 #define SKIP_WIFI_SCAN_DEMO
@@ -527,7 +547,10 @@
     print_memory_info();
     //SCB->SHCSR |= 0x00070000;//Enable fault handler.
     //wiFiManager->runMain();
-    while(1) wait(0.1);
+    while(1)
+    {
+        wait(0.1);
+    }
     //performFreeMemoryCheck();
 
     //eventQueue.dispatch_forever();