pelion-example-common
Dependencies: ublox-at-cellular-interface ublox-cellular-base
Revision 10:4c2ed226f5a8, committed 2019-06-24
- Comitter:
- fahimalavi
- Date:
- Mon Jun 24 17:29:58 2019 +0500
- Parent:
- 9:b00e45dffe1a
- Child:
- 11:7cdc7397d270
- Commit message:
- Updating example to use ublox-at-cellular-interface
Changed in this revision
--- 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) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ublox-at-cellular-interface.lib Mon Jun 24 17:29:58 2019 +0500 @@ -0,0 +1,1 @@ +https://developer.mbed.org/teams/ublox/code/ublox-at-cellular-interface/#aef4a3de0de3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ublox-cellular-base.lib Mon Jun 24 17:29:58 2019 +0500 @@ -0,0 +1,1 @@ +https://developer.mbed.org/teams/ublox/code/ublox-cellular-base/#e67d3d9d2e7e