Host library for controlling a WiConnect enabled Wi-Fi module.

Dependents:   wiconnect-ota_example wiconnect-web_setup_example wiconnect-test-console wiconnect-tcp_server_example ... more

Revision:
6:8a87a59d0d21
Parent:
5:8d91a87ebba2
Child:
7:41d456a65f14
--- a/internal/network/NetworkWebSetup.cpp	Mon Aug 11 04:00:39 2014 -0700
+++ b/internal/network/NetworkWebSetup.cpp	Mon Aug 11 13:55:07 2014 -0700
@@ -117,14 +117,15 @@
 /*************************************************************************************************/
 void NetworkInterface::webSetupStatusMonitor()
 {
+    static char responseBuffer[4];
+    static uint8_t cmdBuffer[sizeof(QueuedCommand)];
+    QueuedCommand *cmd = (QueuedCommand*)cmdBuffer;
+
     monitorTimer.stop();
-    QueuedCommand *cmd = new QueuedCommand(32, NULL, "setup status");
-    if(cmd == NULL)
-        return;
-    if(wiconnect->enqueueCommand(cmd, Callback(this, &NetworkInterface::webSetupStatusCheckCallback)) != WICONNECT_SUCCESS)
-    {
-        delete cmd;
-    }
+
+    *cmd = QueuedCommand(sizeof(responseBuffer), responseBuffer, "setup status");
+
+    wiconnect->enqueueCommand(cmd, Callback(this, &NetworkInterface::webSetupStatusCheckCallback));
 }
 
 /*************************************************************************************************/
@@ -147,8 +148,6 @@
         }
     }
 
-    delete cmd;
-
     if(isComplete)
     {
         completeHandler.call(result, NULL, NULL);