From fb1e5d9cf905b9ea520b708b7bdaaaa1c9adda31 Mon Sep 17 00:00:00 2001 From: Russ Butler Date: Thu, 23 Jun 2016 15:34:08 -0500 Subject: [PATCH] Bring in the latest NSAPI changes Pull up on mbed-os to bring in NSAPI changes. Add the esp8266 library since this is no longer in mbed-os. Update main.cpp to use new NetworkInterface rather than NetworkStack. --- esp8266-driver.lib | 1 + main.cpp | 20 ++++++++++---------- mbed-os.lib | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) create mode 100644 esp8266-driver.lib diff --git a/esp8266-driver.lib b/esp8266-driver.lib new file mode 100644 index 000000000..819375ab9 --- /dev/null +++ b/esp8266-driver.lib @@ -0,0 +1 @@ +https://github.com/ARMmbed/esp8266-driver/#636af254ddfee68e83cd550e5184e253efa469a0 diff --git a/main.cpp b/main.cpp index c7c65f2a0..4552bea02 100644 --- a/main.cpp +++ b/main.cpp @@ -35,8 +35,8 @@ #include "ESP8266Interface.h" ESP8266Interface esp(D1, D0); #elif MBED_CONF_APP_NETWORK_INTERFACE == ETHERNET -#include "LWIPInterface.h" -LWIPInterface lwip; +#include "EthernetInterface.h" +EthernetInterface eth; #elif MBED_CONF_APP_NETWORK_INTERFACE == MESH_LOWPAN_ND #define MESH #include "NanostackInterface.h" @@ -252,23 +252,23 @@ int main() { mbed_trace_init(); mbed_trace_print_function_set(trace_printer); - NetworkStack *network_stack = 0; + NetworkInterface *network_interface = 0; int connect_success = -1; #if MBED_CONF_APP_NETWORK_INTERFACE == WIFI output.printf("\n\rUsing WiFi \r\n"); output.printf("\n\rConnecting to WiFi..\r\n"); connect_success = esp.connect(MBED_CONF_APP_WIFI_SSID, MBED_CONF_APP_WIFI_PASSWORD); - network_stack = &esp; + network_interface = &esp; #elif MBED_CONF_APP_NETWORK_INTERFACE == ETHERNET - output.printf("Using Ethernet LWIP\r\n"); - connect_success = lwip.connect(); - network_stack = &lwip; + output.printf("Using Ethernet\r\n"); + connect_success = eth.connect(); + network_interface = ð #endif #ifdef MESH output.printf("Using Mesh\r\n"); output.printf("\n\rConnecting to Mesh..\r\n"); connect_success = mesh.connect(); - network_stack = &mesh; + network_interface = &mesh; #endif if(connect_success == 0) { output.printf("\n\rConnected to Network successfully\r\n"); @@ -276,7 +276,7 @@ int main() { output.printf("\n\rConnection to Network Failed %d! Exiting application....\r\n", connect_success); return 0; } - const char *ip_addr = network_stack->get_ip_address(); + const char *ip_addr = network_interface->get_ip_address(); if (ip_addr) { output.printf("IP address %s\r\n", ip_addr); } else { @@ -296,7 +296,7 @@ int main() { obs_button.fall(&button_clicked); // Create endpoint interface to manage register and unregister - mbed_client.create_interface(MBED_SERVER_ADDRESS, network_stack); + mbed_client.create_interface(MBED_SERVER_ADDRESS, network_interface); // Create Objects of varying types, see simpleclient.h for more details on implementation. M2MSecurity* register_object = mbed_client.create_register_object(); // server object specifying connector info diff --git a/mbed-os.lib b/mbed-os.lib index 341d1f9b2..f4f498f3c 100644 --- a/mbed-os.lib +++ b/mbed-os.lib @@ -1 +1 @@ -https://github.com/ARMmbed/mbed-os/#bd4bfce7a2c8fec8325dbe768ddc43bec2f09c88 +https://github.com/ARMmbed/mbed-os/#c55c09ab21d243279f2370fc0483cc479b9d1262