Simplest MurataWifi ping server

Dependencies:   NySNICInterface mbed-rtos mbed

Fork of SNIC-xively-jumpstart-demo by muRata

Revision:
19:4e2900daad59
Parent:
18:62daece493a9
Child:
20:f0c7f5ca7e8a
--- a/main.cpp	Wed Jun 11 05:29:07 2014 +0000
+++ b/main.cpp	Thu Jun 19 10:16:36 2014 +0000
@@ -15,27 +15,19 @@
 
 #include "PowerControl/EthernetPowerControl.h"
 
-#include "UDPSocket.h"
-
 MMA7660 axl(p28, p27);
 LM75B tmp(p28, p27);
 C12832_LCD lcd;
 
 #include "logo.h"
 
-#if 0
-#define DEMO_AP_SSID                  "muRata12345"
-#define DEMO_AP_SECURITY_TYPE         e_SEC_WPA2_AES
-#define DEMO_AP_SECUTIRY_KEY          "12345678"
-#define DEMO_AP_SECUTIRY_KEY_LEN      8
-#else
 #define DEMO_AP_SSID                  "E2N1-Lab-Buffalo-D302"
 //#define DEMO_AP_SECURITY_TYPE         e_SEC_OPEN
 //#define DEMO_AP_SECUTIRY_KEY          ""
 #define DEMO_AP_SECURITY_TYPE         e_SEC_WPA2_AES
 #define DEMO_AP_SECUTIRY_KEY          "12345678"
 #define DEMO_AP_SECUTIRY_KEY_LEN      8
-#endif
+
 /** Wi-Fi SNIC UART Interface*/
 C_SNIC_WifiInterface     mSNICwifi( p9, p10, NC, NC, p30 );
 Serial pc(USBTX, USBRX);
@@ -58,24 +50,22 @@
         lcd_printf( "Could not initialise. Will halt!\n" );        
         return -1;
     }    
-        
-    wait(0.5);
-    mSNICwifi.disconnect();
+    
     lcd_printf("disconnect();\r\n");
     
-    wait(0.5);
+    wait(0.3);
     // Connect AP
-    s = mSNICwifi.connect( DEMO_AP_SSID
+    mSNICwifi.connect( DEMO_AP_SSID
                         , strlen(DEMO_AP_SSID)
                         , DEMO_AP_SECURITY_TYPE
                         , DEMO_AP_SECUTIRY_KEY
                         , DEMO_AP_SECUTIRY_KEY_LEN );
     lcd_printf("connect();\r\n");
-   if( s != 0 )
-    {
-        lcd_printf( "Could not connect. Will halt!\n" );
-        return -1;
-    }
+    wait(0.5);
+    
+    lcd_printf("IP Config();\r\n");
+    mSNICwifi.setIPConfig( true );
+    
     wait(0.5);
 
     xi_feed_t feed;