Example program for the BSDInterface
Dependencies: BSDInterface NetworkSocketAPI
Fork of HelloLWIPInterface by
Diff: main.cpp
- Revision:
- 47:ac3cc44106cb
- Parent:
- 46:cf5ab96729e1
- Child:
- 49:e1689f3f04f3
--- a/main.cpp Thu Feb 25 11:11:25 2016 -0600 +++ b/main.cpp Sun Feb 28 02:02:32 2016 +0000 @@ -14,26 +14,23 @@ * limitations under the License. */ -#include "mbed.h" -#include "LWIPInterface.h" +#include "BSDInterface.h" #include "TCPSocket.h" DigitalOut myled(LED_GREEN); void flash(){ myled = !myled; } -LWIPInterface eth; -TCPSocket socket(ð); +BSDInterface iface; +TCPSocket socket(&iface); int main() { - Ticker t; - t.attach(flash, 0.4f); printf("NetworkSocketAPI Example\r\n"); - eth.connect(); + iface.connect(); - const char *ip = eth.getIPAddress(); - const char *mac = eth.getMACAddress(); + const char *ip = iface.getIPAddress(); + const char *mac = iface.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 +42,7 @@ size = socket.recv(recieved, sizeof(recieved)); socket.close(); - eth.disconnect(); + iface.disconnect(); printf("Recieved: %ld bytes, %02x%02x%02x%02x\r\n", size, recieved[0], recieved[1], recieved[2], recieved[3]);