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
- Revision:
- 91:d6b6319ad681
- Parent:
- 90:ed0267eca7b5
- Child:
- 92:ec9550034276
--- a/source/WiFiManager.cpp Sun Apr 07 10:52:37 2019 +0000 +++ b/source/WiFiManager.cpp Sun Apr 07 17:31:56 2019 +0000 @@ -121,6 +121,33 @@ } + +void WiFiManager::sentATresponseString(at_cmd_resp_t at_cmd, + const char *responseString, + int strLen) +{ + at_data_resp = new at_data_msg_t; + // create message pointer for response header generation + char * msgPtr = (char *)at_data_resp->buffer; + // set string length + at_data_resp->dataLen = strLen; + memcpy(at_data_resp->buffer, responseString, strLen); + // package and send on wifi data queue + at_data_resp->at_resp = at_cmd; + bool queueResult = true; + int wait_count = 0; + do + { + if(!queueResult){ + wait_count++; + printf("ATCMD Queue full waiting %d ms so far...\n", wait_count*10); + wait_ms(10); + } + queueResult = queueWiFiDataResponse(*at_data_resp); + }while(queueResult == false); + delete at_data_resp; +} + bool WiFiManager::dequeueWiFiCommands(){ if(wifiCmd != WIFI_CMD_NONE) return false; // busy osEvent evt = _aT2WiFiCmdQueue->get(0); @@ -234,6 +261,7 @@ strcpy(wifi_config.ssid, wifi_ssid); printf("[WIFI-MAN] wifi_ssid set to %s\n", wifi_config.ssid); https_connection_active = false; // reset whenever any of the security credentials change + delete socket; } @@ -242,6 +270,7 @@ strcpy(wifi_config.pass, wifi_pass); printf("[WIFI-MAN] wifi_pass set to %s\n", wifi_config.pass); https_connection_active = false; // reset whenever any of the security credentials change + delete socket; } @@ -250,6 +279,7 @@ wifi_config.security = wifi_security; printf("[WIFI-MAN] wifi_security set to %s\n", sec2str(wifi_config.security)); https_connection_active = false; // reset whenever any of the security credentials change + delete socket; } @@ -266,6 +296,7 @@ internet_config.url, internet_config.connectionScheme); https_connection_active = false; // reset whenever any of the security credentials change + delete socket; } void WiFiManager::free_DataMsg() @@ -300,7 +331,7 @@ if(internet_config.connectionScheme == ALWAYS_CONNECTED) { nsapi_error_t error; - error = scanNetworks(); + error = connect(); queueATresponse(WIFI_RECONNECT_INFO); } break;