NuMaker connection with AWS IoT thru MQTT/HTTPS

Dependencies:   MQTT_ON_AWS

Revision:
36:1bec082ad582
Parent:
35:36578356ed8a
Child:
39:a26be070a2b1
--- 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);
+    }
 }