KDDI Fx0 hackathon / Mbed 2 deprecated HTTPClient_WiFi_HelloWorld

Dependencies:   HTTPClient PowerControl SNICInterface mbed-rtos mbed

Fork of HTTPClient_WiFi_HelloWorld by Toyomasa Watarai

Files at this revision

API Documentation at this revision

Comitter:
MACRUM
Date:
Fri Jan 23 09:56:32 2015 +0000
Parent:
2:270e2d0bb85a
Child:
4:1cb3225666d2
Commit message:
Initial release

Changed in this revision

EthernetInterface.lib Show diff for this revision Revisions of this file
HTTPClient.lib Show annotated file Show diff for this revision Revisions of this file
PowerControl.lib Show annotated file Show diff for this revision Revisions of this file
SNICInterface_mod.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
mbed-rtos.lib Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- a/EthernetInterface.lib	Thu Aug 30 15:42:06 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/mbed_official/code/EthernetInterface/#a0ee3ae75cfa
--- a/HTTPClient.lib	Thu Aug 30 15:42:06 2012 +0000
+++ b/HTTPClient.lib	Fri Jan 23 09:56:32 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/donatien/code/HTTPClient/#1f743885e7de
+http://mbed.org/users/donatien/code/HTTPClient/#3c7789c521df
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PowerControl.lib	Fri Jan 23 09:56:32 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/JST2011/code/PowerControl/#d0fa2aeb02a4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SNICInterface_mod.lib	Fri Jan 23 09:56:32 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/ban4jp/code/SNICInterface_PullReq/#62ba69ff80d2
--- a/main.cpp	Thu Aug 30 15:42:06 2012 +0000
+++ b/main.cpp	Fri Jan 23 09:56:32 2015 +0000
@@ -1,20 +1,49 @@
 #include "mbed.h"
-#include "EthernetInterface.h"
+#include "SNIC_WifiInterface.h"
 #include "HTTPClient.h"
 
-EthernetInterface eth;
+#if defined(TARGET_LPC1768)
+#include "PowerControl/EthernetPowerControl.h"
+#endif
+
+#define DEMO_AP_SSID                  "SSID"
+#define DEMO_AP_SECURITY_TYPE         e_SEC_WPA2_AES
+#define DEMO_AP_SECUTIRY_KEY          "PASSWORD"
+
+C_SNIC_WifiInterface     wifi( p9, p10, NC, NC, p30 );
+
 HTTPClient http;
 char str[512];
 
 int main() 
 {
-    eth.init(); //Use DHCP
+#if defined(TARGET_LPC1768)
+    PHY_PowerDown();
+#endif
+
+    wifi.init(); //Use DHCP
 
-    eth.connect();
+    wait(0.5);
+    int s = wifi.disconnect();
+    if( s != 0 ) {
+        return -1;
+    }
+    
+    wait(0.3);
+    // Connect AP
+    wifi.connect( DEMO_AP_SSID
+                        , strlen(DEMO_AP_SSID)
+                        , DEMO_AP_SECURITY_TYPE
+                        , DEMO_AP_SECUTIRY_KEY
+                        , strlen(DEMO_AP_SECUTIRY_KEY) );
+    wait(0.5);
+    wifi.setIPConfig( true );    
+    wait(0.5);    
+    printf("IP Address is %s\n", wifi.getIPAddress());
     
     //GET data
     printf("\nTrying to fetch page...\n");
-    int ret = http.get("http://mbed.org/media/uploads/donatien/hello.txt", str, 128);
+    int ret = http.get("http://developer.mbed.org/media/uploads/donatien/hello.txt", str, 128);
     if (!ret)
     {
       printf("Page fetched successfully - read %d characters\n", strlen(str));
@@ -72,7 +101,7 @@
       printf("Error - ret = %d - HTTP return code = %d\n", ret, http.getHTTPResponseCode());
     }
     
-    eth.disconnect();  
+    wifi.disconnect();  
 
     while(1) {
     }
--- a/mbed-rtos.lib	Thu Aug 30 15:42:06 2012 +0000
+++ b/mbed-rtos.lib	Fri Jan 23 09:56:32 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed-rtos/#9654a71f5a90
+http://mbed.org/users/mbed_official/code/mbed-rtos/#34e80e862021
--- a/mbed.bld	Thu Aug 30 15:42:06 2012 +0000
+++ b/mbed.bld	Fri Jan 23 09:56:32 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/976df7c37ad5
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/6213f644d804
\ No newline at end of file