Initial setup for TheKsystem.
Dependencies: mbed-http HTS221
Diff: source/main-https.cpp
- Branch:
- mbed-os-5.10
- Revision:
- 30:4825e4f38844
- Parent:
- 29:5ad8f931e4ff
- Child:
- 31:66704f6f17c5
--- a/source/main-https.cpp Tue Mar 27 11:57:33 2018 +0200
+++ b/source/main-https.cpp Mon Oct 29 14:34:43 2018 +0800
@@ -3,11 +3,11 @@
#if DEMO == DEMO_HTTPS
#include "mbed.h"
-#include "easy-connect.h"
#include "https_request.h"
+#include "network-helper.h"
/* List of trusted root CA certificates
- * currently two: GlobalSign, the CA for developer.mbed.org and Let's Encrypt, the CA for httpbin.org
+ * currently two: GlobalSign, the CA for os.mbed.com and Let's Encrypt, the CA for httpbin.org
*
* To add more root certificates, just concatenate them.
*/
@@ -71,12 +71,13 @@
}
int main() {
- NetworkInterface* network = easy_connect(true);
+ NetworkInterface* network = connect_to_default_network_interface();
if (!network) {
+ printf("Cannot connect to the network, see serial output\n");
return 1;
}
- // GET request to developer.mbed.org
+ // GET request to os.mbed.com
{
printf("\n----- HTTPS GET request -----\n");
@@ -86,7 +87,7 @@
HttpResponse* get_res = get_req->send();
if (!get_res) {
printf("HttpRequest failed (error code %d)\n", get_req->get_error());
- return 1;
+ goto demo2;
}
printf("\n----- HTTPS GET response -----\n");
dump_response(get_res);
@@ -94,6 +95,7 @@
delete get_req;
}
+demo2:
// POST request to httpbin.org
{
printf("\n----- HTTPS POST request -----\n");
Daniel Lee