Example program for the BSDInterface

Dependencies:   BSDInterface NetworkSocketAPI

Fork of HelloLWIPInterface by NetworkSocketAPI

Files at this revision

API Documentation at this revision

Comitter:
sam_grove
Date:
Thu May 28 20:01:52 2015 +0000
Parent:
3:95de30d399d8
Child:
5:455deb196c7f
Commit message:
Update example: Now functional but failing implementation

Changed in this revision

NetworkSocketAPI.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.bld Show annotated file Show diff for this revision Revisions of this file
wifi_interface.lib Show annotated file Show diff for this revision Revisions of this file
--- a/NetworkSocketAPI.lib	Thu May 28 16:48:17 2015 +0000
+++ b/NetworkSocketAPI.lib	Thu May 28 20:01:52 2015 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/teams/NetworkSocketAPI/code/NetworkSocketAPI/#ce08986b18b5
+http://developer.mbed.org/teams/NetworkSocketAPI/code/NetworkSocketAPI/#167dd63981b6
--- a/main.cpp	Thu May 28 16:48:17 2015 +0000
+++ b/main.cpp	Thu May 28 20:01:52 2015 +0000
@@ -24,28 +24,30 @@
 // or
 //NetworkInterface *wifi = new WiFiInterface;
 
-TCPSocket tcp(wifi.getInstance());
+//TCPSocket tcp(wifi.getInstance());
 // or
 //SocketInterface tcp = new TCPSocket(wifi->getInstance();
 
-UDPSocket udp(wifi.getInstance());
+//UDPSocket udp(wifi.getInstance());
 // or
 //SocketInterface udp = new UDPSocket(wifi->getInstance();
 
 int main()
 {
     puts("NetworkSocketAPI Example");
-    
+
     wifi.init();
-    wifi.connect("apname", "phrase", WPA2);
+    wifi.connect("apname", "phrase", NetworkInterface::NI_WPA2);
     
+    printf("Wifi is %s\n", (wifi.isConnected() > 0) ? "Connected" : "Disconnected");
+
     printf("IP: %s\n", wifi.getIPAddress());
     printf("Gateway: %s\n", wifi.getGateway());
     printf("Mask: %s\n", wifi.getNetworkMask());
     printf("MAC: %s\n", wifi.getMACAddress());
 
     wifi.disconnect();
-    
+
     while(1) {
         myled = !myled;
     }
--- a/mbed.bld	Thu May 28 16:48:17 2015 +0000
+++ b/mbed.bld	Thu May 28 20:01:52 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/8ab26030e058
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/cbbeb26dbd92
\ No newline at end of file
--- a/wifi_interface.lib	Thu May 28 16:48:17 2015 +0000
+++ b/wifi_interface.lib	Thu May 28 20:01:52 2015 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/teams/NetworkSocketAPI/code/wifi_interface/#4d5d60de745a
+http://developer.mbed.org/teams/NetworkSocketAPI/code/wifi_interface/#323f42baa75a