TCP echo client using the WiConnect library and mbed TCP Socket API.

Dependencies:   WiConnect mbed

Revision:
7:f70f91038918
Parent:
6:b425959b75f0
--- a/main.cpp	Thu Nov 27 00:02:12 2014 -0800
+++ b/main.cpp	Thu Nov 27 10:28:46 2014 +0000
@@ -20,18 +20,21 @@
     Wiconnect wiconnect(serialConfig, 256, NULL, WICONNECT_RESET_PIN);
 
     consoleSerial.baud(115200);
+    printf("Initializing WiConnect...\r\n");
 
     if(WICONNECT_FAILED(result, wiconnect.init(true)))
     {
         printf("Failed to initialize Wiconnect: %s\r\n", Wiconnect::getWiconnectResultStr(result));
         if(result == WICONNECT_FIRMWARE_OUTDATED)
         {
-            printf("The WiFi firmware is not supported. Run the ota example to update the firmware:\r\n");
-            printf("https://developer.mbed.org/teams/ACKme/code/wiconnect-ota_example");
+            printf("** The WiFi firmware is not supported. Run the ota example to update the firmware:\r\n");
+            printf("https://developer.mbed.org/teams/ACKme/code/wiconnect-ota_example\r\n");
         }
         for(;;);
     }
-    else if(WICONNECT_FAILED(result, wiconnect.join(NETWORK_SSID, NETWORK_PASSWORD)))
+    
+    printf("Joining network: %s\r\n", NETWORK_SSID);
+    if(WICONNECT_FAILED(result, wiconnect.join(NETWORK_SSID, NETWORK_PASSWORD)))
     {
         printf("Failed to join network: %s\r\n", Wiconnect::getWiconnectResultStr(result));
         for(;;);
@@ -39,6 +42,7 @@
 
     printf("IP Address is %s\n", wiconnect.getIpAddress());
 
+    printf("Connecting to server...\r\n");
     TCPSocketConnection socket;
     while (socket.connect(ECHO_SERVER_ADDRESS, ECHO_SERVER_PORT) < 0)
     {
@@ -46,6 +50,7 @@
         wait(1);
     }
 
+    printf("Sending message...\r\n");
     char hello[] = "Hello World\n";
     if(socket.send_all(hello, sizeof(hello) - 1) == -1)
     {
@@ -53,6 +58,7 @@
         for(;;);
     }
 
+    printf("Receiving response...\r\n");
     int n = socket.receive(buf, 256);
     if(n == -1)
     {