NuMaker connection with AWS IoT thru MQTT/HTTPS

Dependencies:   MQTT

Files at this revision

API Documentation at this revision

Comitter:
ccli8
Date:
Thu Mar 19 14:35:49 2020 +0800
Parent:
35:36578356ed8a
Child:
37:e439a8e0d514
Commit message:
Add network disconnect at end of program

Some cellular modems e.g.: QUECTEL EC2X need graceful exit; otherwise, they will break in next reboot.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Mar 18 15:18:19 2020 +0800
+++ b/main.cpp	Thu Mar 19 14:35:49 2020 +0800
@@ -745,4 +745,10 @@
     https_test->start_test();
     delete https_test;
 #endif  // End of AWS_IOT_HTTPS_TEST
+
+    /* Some cellular modems e.g.: QUECTEL EC2X need graceful exit; otherwise, they will break in next reboot. */
+    status = net->disconnect();
+    if (status != NSAPI_ERROR_OK) {
+        printf("\n\nDisconnect from network interface failed %d\n", status);
+    }
 }