pelion-example-common

Dependencies:   ublox-at-cellular-interface ublox-cellular-base

Revision:
10:4c2ed226f5a8
Parent:
7:230af466efc4
Child:
11:7cdc7397d270
--- a/main.cpp	Tue Jun 11 13:28:20 2019 +0500
+++ b/main.cpp	Mon Jun 24 17:29:58 2019 +0500
@@ -21,6 +21,9 @@
 #include "simple-mbed-cloud-client.h"
 #include "FATFileSystem.h"
 #include "LittleFileSystem.h"
+#include "UbloxATCellularInterface.h"
+
+#define PIN "0000"
 
 // Default network interface object. Don't forget to change the WiFi SSID/password in mbed_app.json if you're using WiFi.
 NetworkInterface *net = NetworkInterface::get_default_instance();
@@ -131,7 +134,28 @@
 
     // Connect to the Internet (DHCP is expected to be on)
     printf("Connecting to the network using the default network interface...\n");
+#ifdef TARGET_UBLOX_C030_R41XM
+    net = new UbloxATCellularInterface();
+
+	if (((UbloxATCellularInterface*)net)->init(PIN)) {
+
+	    if ( (((UbloxATCellularInterface*)net)->is_registered_csd() || ((UbloxATCellularInterface*)net)->is_registered_psd() || ((UbloxATCellularInterface*)net)->is_registered_eps()) ) {
+	        printf("De-registering...\n\n");
+	        ((UbloxATCellularInterface*)net)->nwk_deregistration();
+        }
+
+
+        if (((UbloxATCellularInterface*)net)->set_modem_rat(UbloxATCellularInterface::GPRS_EGPRS)) {
+            printf("GPRS_EGPRS RAT configured\n");
+        }
+
+	    if (((UbloxATCellularInterface*)net)->reboot_modem()) {
+            printf("Rebooting modem\n");
+	    }
+	}
+#else
     net = NetworkInterface::get_default_instance();
+#endif
 
     nsapi_error_t net_status = NSAPI_ERROR_NO_CONNECTION;
     while ((net_status = net->connect()) != NSAPI_ERROR_OK) {