Example program running mbedClient over UbloxATCellularInterface or OnboardCellularInterface for the C030 platform.

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

Files at this revision

API Documentation at this revision

Comitter:
RobMeades
Date:
Wed Feb 28 14:58:04 2018 +0000
Parent:
15:21e0bf60dd0c
Commit message:
Update to latest libraries and replace UbloxPPPCellularInterface with OnboardCellularInterface.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
ublox-at-cellular-interface-n2xx.lib Show annotated file Show diff for this revision Revisions of this file
ublox-at-cellular-interface.lib Show annotated file Show diff for this revision Revisions of this file
ublox-cellular-base-n2xx.lib Show annotated file Show diff for this revision Revisions of this file
ublox-cellular-base.lib Show annotated file Show diff for this revision Revisions of this file
ublox-ppp-cellular-interface.lib Show diff for this revision Revisions of this file
--- a/main.cpp	Fri Nov 03 13:04:06 2017 +0000
+++ b/main.cpp	Wed Feb 28 14:58:04 2018 +0000
@@ -23,7 +23,7 @@
 #include "mbed.h"
 #include "mbedtls/entropy_poll.h"
 #include "UbloxATCellularInterface.h"
-#include "UbloxPPPCellularInterface.h"
+#include "OnboardCellularInterface.h"
 #include "UbloxATCellularInterfaceN2xx.h"
 #include "simpleclient.h"
 #include "security.h"
@@ -35,12 +35,12 @@
 // indicated with a "Y" in the table below.
 //
 //                            C030_U201   C030_N211
-// UbloxPPPCellularInterface      Y            -
 // UbloxATCellularInterface       Y            -
+// OnboardCellularInterface       Y            -
 // UbloxATCellularInterfaceN2xx   -            Y
 // Note: the N211 module supports only UDP, not TCP
 
-// UbloxPPPCellularInterface uses LWIP and the PPP cellular interface
+// OnboardCellularInterface uses LWIP and the PPP cellular interface
 // on the mbed MCU, while using UbloxATCellularInterface and
 // UbloxATCellularInterfaceN2xx uses an IP stack on the cellular
 // module and hence uses less RAM.  This also allows other AT command
@@ -50,7 +50,7 @@
 // using the LWIP/PPP on the mbed MCU interface since more string parsing
 // is required.
 #define INTERFACE_CLASS  UbloxATCellularInterface
-//#define INTERFACE_CLASS  UbloxPPPCellularInterface
+//#define INTERFACE_CLASS  OnboardCellularInterface
 //#define INTERFACE_CLASS  UbloxATCellularInterfaceN2xx
 
 // The credentials of the SIM in the board.  If PIN checking is enabled
@@ -149,7 +149,7 @@
 }
 
 /* This example program for the u-blox C030 board instantiates mbedClient
- * and runs it over a UbloxATCellularInterface or a UbloxPPPCellularInterface to
+ * and runs it over a UbloxATCellularInterface or a OnboardCellularInterface to
  * the mbed connector.
  * Progress may be monitored with a serial terminal running at 9600 baud.
  * The LED on the C030 board will turn green when this program is
@@ -200,58 +200,51 @@
 
     good();
     printf("Starting up, please wait up to 180 seconds for network registration to complete...\n");
-    if (interface->init(PIN)) {
-        pulseEvent();
-        printf("Registered with network.\n");
+    pulseEvent();
         
-        // Create endpoint interface to manage register and unregister
-        mbedClient->create_interface("coap://api.connector.mbed.com:5684", interface);
+    // Create endpoint interface to manage register and unregister
+    mbedClient->create_interface("coap://api.connector.mbed.com:5684", interface);
 
-        // Create objects of varying types, see simpleclient.h for more details on implementation.
-        registerObject = mbedClient->create_register_object(); // Server object specifying connector info
-        deviceObject = mbedClient->create_device_object();     // Device resources object
+    // Create objects of varying types, see simpleclient.h for more details on implementation.
+    registerObject = mbedClient->create_register_object(); // Server object specifying connector info
+    deviceObject = mbedClient->create_device_object();     // Device resources object
 
-        // Add objects to list
-        objectList.push_back(deviceObject);
-        objectList.push_back(ledResource.get_object());
+    // Add objects to list
+    objectList.push_back(deviceObject);
+    objectList.push_back(ledResource.get_object());
 
-        // Set endpoint registration object
-        mbedClient->set_register_object(registerObject);
+    // Set endpoint registration object
+    mbedClient->set_register_object(registerObject);
 
-        printf("Updating object registration in a loop (with a 30 second refresh period) until the user button is presed...\n");
-        interface->set_credentials(APN, USERNAME, PASSWORD);
-        while (!buttonPressed) {
-            // Make sure cellular is connected
-            if (interface->connect() == 0) {
-                pulseEvent();
-                printf("[Still] connected to packet network.\n");
-                if (mbedClient->register_successful()) {
-                    printf("Updating registration (follow progress at https://connector.mbed.com/#home)...\n");
-                    mbedClient->test_update_register();
-                } else {
-                    printf("Registering with connector (follow progress at https://connector.mbed.com/#home)...\n");
-                    mbedClient->test_register(registerObject, objectList);
-                }
+    printf("Updating object registration in a loop (with a 30 second refresh period) until the user button is presed...\n");
+    interface->set_credentials(APN, USERNAME, PASSWORD);
+    while (!buttonPressed) {
+        // Make sure cellular is connected
+        if (interface->connect(PIN) == 0) {
+            pulseEvent();
+            printf("[Still] connected to packet network.\n");
+            if (mbedClient->register_successful()) {
+                printf("Updating registration (follow progress at https://connector.mbed.com/#home)...\n");
+                mbedClient->test_update_register();
             } else {
-                bad();
-                printf("Failed to connect, will retry (have you checked that an antenna is plugged in and your APN is correct?)...\n");
+                printf("Registering with connector (follow progress at https://connector.mbed.com/#home)...\n");
+                mbedClient->test_register(registerObject, objectList);
             }
-            Thread::wait(30000);
-            printf("[Checking if user button has been pressed]\n");
+        } else {
+            bad();
+            printf("Failed to connect, will retry (have you checked that an antenna is plugged in and your APN is correct?)...\n");
         }
-        
-        pulseEvent();
-        printf("User button was pressed, stopping...\n");
-        mbedClient->test_unregister();
-        interface->disconnect();
-        interface->deinit();
-        ledOff();
-        printf("Stopped.\n");
-        M2MDevice::delete_instance();
-    } else {
-        bad();
-        printf("Unable to initialise the interface.\n");
+        Thread::wait(30000);
+        printf("[Checking if user button has been pressed]\n");
     }
+    
+    pulseEvent();
+    printf("User button was pressed, stopping...\n");
+    mbedClient->test_unregister();
+    interface->disconnect();
+    ledOff();
+    printf("Stopped.\n");
+    M2MDevice::delete_instance();
 }
 
 // End Of File
--- a/mbed-os.lib	Fri Nov 03 13:04:06 2017 +0000
+++ b/mbed-os.lib	Wed Feb 28 14:58:04 2018 +0000
@@ -1,1 +1,1 @@
-https://github.com/ARMmbed/mbed-os/#78a1eddf61efa705ef1e99fc597dcaa5e737fb4c
+https://github.com/ARMmbed/mbed-os/#eaf6f8153d8b8c2d3136f288ca3c5d4fbc1ae18f
--- a/ublox-at-cellular-interface-n2xx.lib	Fri Nov 03 13:04:06 2017 +0000
+++ b/ublox-at-cellular-interface-n2xx.lib	Wed Feb 28 14:58:04 2018 +0000
@@ -1,1 +1,1 @@
-https://developer.mbed.org/teams/ublox/code/ublox-at-cellular-interface-n2xx/#4be20bab5138
+https://developer.mbed.org/teams/ublox/code/ublox-at-cellular-interface-n2xx/#b0757007cc72
--- a/ublox-at-cellular-interface.lib	Fri Nov 03 13:04:06 2017 +0000
+++ b/ublox-at-cellular-interface.lib	Wed Feb 28 14:58:04 2018 +0000
@@ -1,1 +1,1 @@
-https://developer.mbed.org/teams/ublox/code/ublox-at-cellular-interface/#edac5187d765
+https://developer.mbed.org/teams/ublox/code/ublox-at-cellular-interface/#39264b492ce7
--- a/ublox-cellular-base-n2xx.lib	Fri Nov 03 13:04:06 2017 +0000
+++ b/ublox-cellular-base-n2xx.lib	Wed Feb 28 14:58:04 2018 +0000
@@ -1,1 +1,1 @@
-https://developer.mbed.org/teams/ublox/code/ublox-cellular-base-n2xx/#66451d314225
+https://developer.mbed.org/teams/ublox/code/ublox-cellular-base-n2xx/#1afe5ed24f0c
--- a/ublox-cellular-base.lib	Fri Nov 03 13:04:06 2017 +0000
+++ b/ublox-cellular-base.lib	Wed Feb 28 14:58:04 2018 +0000
@@ -1,1 +1,1 @@
-https://developer.mbed.org/teams/ublox/code/ublox-cellular-base/#8fadf1e49487
+https://developer.mbed.org/teams/ublox/code/ublox-cellular-base/#e420232ee4e7
--- a/ublox-ppp-cellular-interface.lib	Fri Nov 03 13:04:06 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-https://developer.mbed.org/teams/ublox/code/ublox-ppp-cellular-interface/#4c533665168c