Okundu Omeni
/
wifi-https-ble-sm-uart-atcmd-5-13-1
this is using the mbed os version 5-13-1
Diff: source/WiFiManager.cpp
- Branch:
- PassingRegression
- Revision:
- 123:a49e9ffbaca6
- Parent:
- 122:62166886db5f
- Child:
- 124:eae4512b131b
--- a/source/WiFiManager.cpp Tue Jun 11 20:23:43 2019 +0000 +++ b/source/WiFiManager.cpp Fri Jun 14 21:13:46 2019 +0000 @@ -49,7 +49,8 @@ wifiWatchdogTimer.start(); watchdogCnt = 0; //_event_queue.call_every(10000, this, &WiFiManager::callWifiWatchDog); - keep_alive_id = _event_queue.call_every(CLOUD_KEEP_ALIVE_INTERVAL, this, &WiFiManager::callInternetKeepAlive); + //keep_alive_id = _event_queue.call_every(CLOUD_KEEP_ALIVE_INTERVAL, this, &WiFiManager::callInternetKeepAlive); + keep_alive_id = 0; //watchDogTick.attach(callback(this, &WiFiManager::callWifiWatchDogIsr), 10.0); // call flip function every 10 seconds } @@ -122,6 +123,7 @@ https_connection_active = false; socket->close(); delete socket; + socket = NULL; return; } @@ -344,7 +346,10 @@ case WIFI_CMD_SEND_HTTPS_REQ: { // cancel keep alive event as not needed since new request has come in. - _event_queue.cancel(keep_alive_id); + if(keep_alive_id != 0) // only cancel if it has been activated + { + _event_queue.cancel(keep_alive_id); + } wifiBusy = 1; #ifdef SEND_DEBUG_MESSAGES if(outputBuffersAvailable()) @@ -423,6 +428,8 @@ if(https_connection_active == false) { queueATresponse(AT_SOCKET_KEEP_ALIVE_FAILED); + delete socket; + socket = NULL; } } wifiCmd = WIFI_CMD_NONE; @@ -435,6 +442,16 @@ wifiCmd = WIFI_CMD_NONE; wifiBusy = 0; break; + case WIFI_CMD_WIFI_MAC_ADDR: + wifiBusy = 1; + if(outputBuffersAvailable()) + { + getWiFiMACaddress(); + sendATresponseString(AT_WIFI_MAC_RESP); + } + wifiCmd = WIFI_CMD_NONE; + wifiBusy = 0; + break; case WIFI_CMD_SEND_HTTP_REQ: break; default: @@ -796,6 +813,13 @@ sprintf(nextStrPtr, "%s", UDDRP_WRITE_OK); } +void WiFiManager::getWiFiMACaddress() +{ + responseString = (char *) malloc(100); + sprintf(responseString, "\r\n%s%d,%s\r\n", LOCAL_ADDRESS_RESP, + WIFI_IF_ID, + network->get_mac_address()); +} void WiFiManager::getWiFiStatus(){