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

Dependencies:   WiConnect mbed

Files at this revision

API Documentation at this revision

Comitter:
dan_ackme
Date:
Thu Nov 27 10:28:46 2014 +0000
Parent:
6:b425959b75f0
Commit message:
updated for latest wiconnect

Changed in this revision

Wiconnect.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r b425959b75f0 -r f70f91038918 Wiconnect.lib
--- a/Wiconnect.lib	Thu Nov 27 00:02:12 2014 -0800
+++ b/Wiconnect.lib	Thu Nov 27 10:28:46 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/teams/ACKme/code/Wiconnect/#7b67c3f94de9
+http://mbed.org/teams/ACKme/code/Wiconnect/#a858f161cb0c
diff -r b425959b75f0 -r f70f91038918 main.cpp
--- 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)
     {