this is using the mbed os version 5-13-1
Diff: source/WiFiManager.cpp
- Branch:
- PassingRegression
- Revision:
- 113:888e262ff0a9
- Parent:
- 112:a0999ea4ece0
- Child:
- 114:b11bb96c09f3
--- a/source/WiFiManager.cpp Sat May 11 11:55:29 2019 +0000
+++ b/source/WiFiManager.cpp Sat May 18 10:50:49 2019 +0000
@@ -39,6 +39,7 @@
chunkNum = 0;
socket = NULL;
https_connection_active = false;
+ use_full_hostname = false;
wifiBusy = 0;
wifiWatchdogTimer.start();
watchdogCnt = 0;
@@ -510,7 +511,7 @@
#endif
char * serverAddress = new char[100];
char *p = strstr(internet_config.url, "//");
- if(p != NULL)
+ if(p != NULL && use_full_hostname == false)
{
strcpy(serverAddress,p+2);
}
@@ -758,15 +759,8 @@
return error;
}
-
-void WiFiManager::gethostbyname_callback(nsapi_error_t res, SocketAddress *addr)
+void WiFiManager::processGetHostByNameResult(nsapi_error_t result, SocketAddress *address)
{
- nsapi_error_t result = res;
- SocketAddress *address = new SocketAddress;
- address = addr;
-#ifdef DNANUDGE_DEBUG
- callback_semaphore.release();
-#endif
dbg_printf(LOG, "gethostbyname_callback called... result = %d \r\n", result);
print_memory_info();
responseBytes = new uint8_t[HOSTNAME_RESPONSE_LEN]; //malloc(HOSTNAME_RESPONSE_LEN);
@@ -795,8 +789,7 @@
responseBytes[i++] = 0;
responseBytes[i] = 0;
printBufferInHex(responseBytes, HOSTNAME_RESPONSE_LEN);
- _event_queue.call_in(10, this, &WiFiManager::sendATresponseBytes,
- CONNECT_EVENT, HOSTNAME_RESPONSE_LEN);
+ sendATresponseBytes(CONNECT_EVENT, HOSTNAME_RESPONSE_LEN);
}
else
{
@@ -810,10 +803,24 @@
sprintf(responseString, "\r\nHOSTNAME TRANSLATION FAILURE : error code = %d \r\n", result);
sendATresponseString(AT_EVENT);
}
+ use_full_hostname = not use_full_hostname;
}
wifiBusy = 0;
backgroundTaskCompleted = true;
+
+}
+void WiFiManager::gethostbyname_callback(nsapi_error_t res, SocketAddress *addr)
+{
+ nsapi_error_t result = res;
+ SocketAddress *address = new SocketAddress;
+ address = addr;
+ _event_queue.call(this, &WiFiManager::processGetHostByNameResult,
+ result, address);
+
+#ifdef DNANUDGE_DEBUG
+ callback_semaphore.release();
+#endif
}
void WiFiManager::sendSocketConnectionEvent()