mbed os 5 http example by nazrin

Fork of http-example by sandbox

Files at this revision

API Documentation at this revision

Comitter:
Jan Jongboom
Date:
Tue Mar 27 11:57:33 2018 +0200
Parent:
28:9bccd981a393
Child:
30:318e8c07b0f9
Commit message:
Move serial baud rate config into mbed_app.json

Changed in this revision

mbed_app.json Show annotated file Show diff for this revision Revisions of this file
source/main-http-ipv6.cpp Show annotated file Show diff for this revision Revisions of this file
source/main-http-socket-reuse.cpp Show annotated file Show diff for this revision Revisions of this file
source/main-http.cpp Show annotated file Show diff for this revision Revisions of this file
source/main-https-chunked-request.cpp Show annotated file Show diff for this revision Revisions of this file
source/main-https-socket-reuse.cpp Show annotated file Show diff for this revision Revisions of this file
source/main-https.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/mbed_app.json	Tue Mar 27 11:13:48 2018 +0200
+++ b/mbed_app.json	Tue Mar 27 11:57:33 2018 +0200
@@ -50,6 +50,8 @@
                "MBEDTLS_TEST_NULL_ENTROPY", "MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES" ],
     "target_overrides": {
         "*": {
+            "platform.stdio-baud-rate": 115200,
+            "platform.stdio-convert-newlines": true,
             "target.features_add": ["NANOSTACK", "LOWPAN_ROUTER", "COMMON_PAL"],
             "mbed-mesh-api.6lowpan-nd-channel-page": 0,
             "mbed-mesh-api.6lowpan-nd-channel": 12,
--- a/source/main-http-ipv6.cpp	Tue Mar 27 11:13:48 2018 +0200
+++ b/source/main-http-ipv6.cpp	Tue Mar 27 11:57:33 2018 +0200
@@ -6,8 +6,6 @@
 #include "easy-connect.h"
 #include "http_request.h"
 
-Serial pc(USBTX, USBRX);
-
 void dump_response(HttpResponse* res) {
     printf("Status: %d - %s\n", res->get_status_code(), res->get_status_message().c_str());
 
@@ -19,8 +17,6 @@
 }
 
 int main() {
-    pc.baud(115200);
-
     // Connect to the network (see mbed_app.json for the connectivity method used)
     NetworkInterface* network = easy_connect(true);
     if (!network) {
--- a/source/main-http-socket-reuse.cpp	Tue Mar 27 11:13:48 2018 +0200
+++ b/source/main-http-socket-reuse.cpp	Tue Mar 27 11:57:33 2018 +0200
@@ -6,8 +6,6 @@
 #include "easy-connect.h"
 #include "http_request.h"
 
-Serial pc(USBTX, USBRX);
-
 void dump_response(HttpResponse* res) {
     printf("Status: %d - %s\n", res->get_status_code(), res->get_status_message().c_str());
 
@@ -19,7 +17,6 @@
 }
 
 int main() {
-    pc.baud(115200);
     // Connect to the network (see mbed_app.json for the connectivity method used)
     NetworkInterface* network = easy_connect(true);
     if (!network) {
--- a/source/main-http.cpp	Tue Mar 27 11:13:48 2018 +0200
+++ b/source/main-http.cpp	Tue Mar 27 11:57:33 2018 +0200
@@ -6,8 +6,6 @@
 #include "easy-connect.h"
 #include "http_request.h"
 
-Serial pc(USBTX, USBRX);
-
 void dump_response(HttpResponse* res) {
     printf("Status: %d - %s\n", res->get_status_code(), res->get_status_message().c_str());
 
@@ -19,8 +17,6 @@
 }
 
 int main() {
-    pc.baud(115200);
-
     // Connect to the network (see mbed_app.json for the connectivity method used)
     NetworkInterface* network = easy_connect(true);
     if (!network) {
--- a/source/main-https-chunked-request.cpp	Tue Mar 27 11:13:48 2018 +0200
+++ b/source/main-https-chunked-request.cpp	Tue Mar 27 11:57:33 2018 +0200
@@ -11,8 +11,6 @@
 #include "https_request.h"
 #include "easy-connect.h"
 
-Serial pc(USBTX, USBRX);
-
 /* List of trusted root CA certificates
  * currently one: Comodo, the CA for reqres.in
  *
@@ -69,8 +67,6 @@
 }
 
 int main() {
-    pc.baud(115200);
-
     NetworkInterface* network = easy_connect(true);
     if (!network) {
         return 1;
--- a/source/main-https-socket-reuse.cpp	Tue Mar 27 11:13:48 2018 +0200
+++ b/source/main-https-socket-reuse.cpp	Tue Mar 27 11:57:33 2018 +0200
@@ -10,8 +10,6 @@
 #include "easy-connect.h"
 #include "https_request.h"
 
-Serial pc(USBTX, USBRX);
-
 /* List of trusted root CA certificates
  * currently one: Let's Encrypt, the CA for httpbin.org
  *
@@ -56,8 +54,6 @@
 }
 
 int main() {
-    pc.baud(115200);
-
     NetworkInterface* network = easy_connect(true);
     if (!network) {
         return 1;
--- a/source/main-https.cpp	Tue Mar 27 11:13:48 2018 +0200
+++ b/source/main-https.cpp	Tue Mar 27 11:57:33 2018 +0200
@@ -6,8 +6,6 @@
 #include "easy-connect.h"
 #include "https_request.h"
 
-Serial pc(USBTX, USBRX);
-
 /* List of trusted root CA certificates
  * currently two: GlobalSign, the CA for developer.mbed.org and Let's Encrypt, the CA for httpbin.org
  *
@@ -73,8 +71,6 @@
 }
 
 int main() {
-    pc.baud(115200);
-
     NetworkInterface* network = easy_connect(true);
     if (!network) {
         return 1;