Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MbedJSONValue mbed-http HTS221
Diff: source/network-helper.h
- Revision:
- 35:4b847971db1b
- Parent:
- 31:66704f6f17c5
--- a/source/network-helper.h Wed Dec 05 17:16:00 2018 +0900
+++ b/source/network-helper.h Fri Jan 04 13:32:26 2019 +0100
@@ -2,9 +2,7 @@
#define _MBED_HTTP_EXAMPLE_H_
#include "mbed.h"
-#ifdef TARGET_SIMULATOR
-#include "EthernetInterface.h"
-#endif
+#include "NetworkInterface.h"
/**
* Connect to the network using the default networking interface,
@@ -14,11 +12,12 @@
NetworkInterface *connect_to_default_network_interface() {
printf("[NWKH] Connecting to network...\n");
-#ifdef TARGET_SIMULATOR
- NetworkInterface* network = new EthernetInterface();
-#else
NetworkInterface* network = NetworkInterface::get_default_instance();
-#endif
+
+ if (!network) {
+ printf("[NWKH] No network interface found, select an interface in 'network-helper.h'\n");
+ return NULL;
+ }
nsapi_error_t connect_status = network->connect();