Okundu Omeni
/
wifi-https-ble-sm-uart-atcmd-5-13-1
this is using the mbed os version 5-13-1
Diff: source/ATCmdManager.cpp
- Branch:
- PassingRegression
- Revision:
- 108:3c8fb2c6e7bf
- Parent:
- 107:f1a83fd41b17
- Child:
- 109:c274780ff609
--- 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;