Example program for the BSDInterface

Dependencies:   BSDInterface NetworkSocketAPI

Fork of HelloLWIPInterface by NetworkSocketAPI

Files at this revision

API Documentation at this revision

Comitter:
geky
Date:
Fri Feb 26 17:40:48 2016 +0000
Parent:
43:932c5ddd7860
Child:
45:35ab4a323206
Commit message:
Created stubbed implementation

Changed in this revision

LWIPInterface.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
--- a/LWIPInterface.lib	Fri Feb 26 17:30:00 2016 +0000
+++ b/LWIPInterface.lib	Fri Feb 26 17:40:48 2016 +0000
@@ -1,1 +1,1 @@
-LWIPInterface#3795160dfeac
+LWIPInterface#2fbcfc9c12dd
--- a/main.cpp	Fri Feb 26 17:30:00 2016 +0000
+++ b/main.cpp	Fri Feb 26 17:40:48 2016 +0000
@@ -15,14 +15,14 @@
  */
 
 #include "mbed.h"
-#include "ESP8266Interface.h"
+#include "LWIPInterface.h"
 #include "TCPSocket.h"
 
 DigitalOut myled(LED_GREEN);
 void flash(){ myled = !myled; }
 
-//LWIPInterface wifi(D1, D0);
-TCPSocket socket(0); // TODO
+LWIPInterface eth;
+TCPSocket socket(&eth); // TODO
 
 int main()
 {
@@ -30,10 +30,10 @@
     t.attach(flash, 0.4f);
     printf("NetworkSocketAPI Example\r\n");
 
-    wifi.connect("ssid", "password");
+    eth.connect();
     
-    const char *ip = wifi.getIPAddress();
-    const char *mac = wifi.getMACAddress();
+    const char *ip = eth.getIPAddress();
+    const char *mac = eth.getMACAddress();
     printf("IP Address is: %s\r\n", (ip) ? ip : "No IP");
     printf("MAC Address is: %s\r\n", (mac) ? mac : "No MAC");
 
@@ -45,7 +45,7 @@
     size = socket.recv(recieved, sizeof(recieved));
 
     socket.close();
-    wifi.disconnect();
+    eth.disconnect();
 
     printf("Recieved: %ld bytes, %02x%02x%02x%02x\r\n", size,
             recieved[0], recieved[1], recieved[2], recieved[3]);