pelion-example-common
Dependencies: ublox-at-cellular-interface ublox-cellular-base
Diff: main.cpp
- Revision:
- 13:f5b874c31495
- Parent:
- 12:dd17519b5e30
- Child:
- 16:6ce2f11ceb3f
--- a/main.cpp Thu Jul 04 14:47:10 2019 +0500
+++ b/main.cpp Thu Sep 26 16:23:46 2019 +0500
@@ -22,6 +22,12 @@
#include "FATFileSystem.h"
#include "LittleFileSystem.h"
+#ifdef TARGET_UBLOX_C030_R41XM
+#include "UbloxATCellularInterface.h"
+#endif
+
+#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 +137,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) {