sandbox / Mbed OS http-example

Dependencies:   mbed-http

Files at this revision

API Documentation at this revision

Comitter:
Jan Jongboom
Date:
Fri Jan 04 13:32:26 2019 +0100
Parent:
34:7da6cfc032fc
Commit message:
Update to Mbed OS 5.11

Changed in this revision

.hgignore Show annotated file Show diff for this revision Revisions of this file
README.md Show annotated file Show diff for this revision Revisions of this file
mbed-http.lib Show annotated file Show diff for this revision Revisions of this file
mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
mbed_app.json Show annotated file Show diff for this revision Revisions of this file
source/network-helper.h Show annotated file Show diff for this revision Revisions of this file
source/select-demo.h Show annotated file Show diff for this revision Revisions of this file
diff -r 7da6cfc032fc -r 4b847971db1b .hgignore
--- a/.hgignore	Wed Dec 05 17:16:00 2018 +0900
+++ b/.hgignore	Fri Jan 04 13:32:26 2019 +0100
@@ -7,4 +7,5 @@
 easy-connect/
 mbed-http/
 .git/
-
+wifi-ism43362/
+wifi-ism43362.lib
diff -r 7da6cfc032fc -r 4b847971db1b README.md
--- a/README.md	Wed Dec 05 17:16:00 2018 +0900
+++ b/README.md	Fri Jan 04 13:32:26 2019 +0100
@@ -46,10 +46,23 @@
 
 to the `macros` array.
 
+## Running tests
+
+You can run the integration tests from this project via Mbed CLI.
+
+1. In `select-demo.h` set the `DEMO` macro to `DEMO_TESTS`.
+1. Set your WiFi credentials in `mbed_app.json`.
+1. Then run the tests via:
+
+```
+$ mbed test -v -n mbed-http-tests-tests-*
+```
+
 ## Tested on
 
 * K64F with Ethernet.
 * NUCLEO_F411RE with ESP8266.
 * ODIN-W2 with WiFi.
 * K64F with Atmel 6LoWPAN shield.
+* DISCO-L475VG-IOT01A with WiFi (requires the [wifi-ism43362](https://github.com/ARMmbed/wifi-ism43362/) driver).
 * [Mbed Simulator](https://github.com/janjongboom/mbed-simulator).
diff -r 7da6cfc032fc -r 4b847971db1b mbed-http.lib
--- a/mbed-http.lib	Wed Dec 05 17:16:00 2018 +0900
+++ b/mbed-http.lib	Fri Jan 04 13:32:26 2019 +0100
@@ -1,1 +1,1 @@
-https://developer.mbed.org/teams/sandbox/code/mbed-http/#fa4d71265625
+https://developer.mbed.org/teams/sandbox/code/mbed-http/#6daf67a96a91
diff -r 7da6cfc032fc -r 4b847971db1b mbed-os.lib
--- a/mbed-os.lib	Wed Dec 05 17:16:00 2018 +0900
+++ b/mbed-os.lib	Fri Jan 04 13:32:26 2019 +0100
@@ -1,1 +1,1 @@
-https://github.com/ARMmbed/mbed-os/#e1bea44212b8275f7d8ce7253e758c2e25c57482
+https://github.com/ARMmbed/mbed-os/#c966348d3f9ca80843be7cdc9b748f06ea73ced0
diff -r 7da6cfc032fc -r 4b847971db1b mbed_app.json
--- a/mbed_app.json	Wed Dec 05 17:16:00 2018 +0900
+++ b/mbed_app.json	Fri Jan 04 13:32:26 2019 +0100
@@ -18,12 +18,14 @@
             "platform.stdio-convert-newlines": true,
             "mbed-mesh-api.6lowpan-nd-channel-page": 0,
             "mbed-mesh-api.6lowpan-nd-channel": 12,
-            "mbed-trace.enable": 1,
+            "mbed-trace.enable": null,
             "mbed-http.http-buffer-size": 2048,
-            "tls-socket.debug-level": 0,
             "nsapi.default-wifi-security": "WPA_WPA2",
             "nsapi.default-wifi-ssid": "\"SSID\"",
             "nsapi.default-wifi-password": "\"Password\""
+        },
+        "DISCO_L475VG_IOT01A": {
+            "target.network-default-interface-type" : "WIFI"
         }
     }
 }
diff -r 7da6cfc032fc -r 4b847971db1b source/network-helper.h
--- 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();
 
diff -r 7da6cfc032fc -r 4b847971db1b source/select-demo.h
--- a/source/select-demo.h	Wed Dec 05 17:16:00 2018 +0900
+++ b/source/select-demo.h	Fri Jan 04 13:32:26 2019 +0100
@@ -7,6 +7,7 @@
 #define         DEMO_HTTPS                  4
 #define         DEMO_HTTPS_SOCKET_REUSE     5
 #define         DEMO_HTTPS_CHUNKED_REQUEST  6
+#define         DEMO_TESTS                  7
 
 #define         DEMO            DEMO_HTTP