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 Jun 14 11:56:57 2017 +0000
Parent:
2:49b5c377d2ca
Child:
4:0a1c9deefa19
Commit message:
All the basics in place: necessary libraries and template mbed_app.json files.

Changed in this revision

c027_template_mbed_app_json.txt Show annotated file Show diff for this revision Revisions of this file
c030_template_mbed_app_json.txt Show annotated file Show diff for this revision Revisions of this file
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
simpleclient.h 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.lib Show annotated file Show diff for this revision Revisions of this file
ublox-ppp-cellular-interface.lib Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/c027_template_mbed_app_json.txt	Wed Jun 14 11:56:57 2017 +0000
@@ -0,0 +1,14 @@
+{
+    "macros": [
+        "MBEDTLS_USER_CONFIG_FILE=\"mbedtls_mbed_client_config.h\"",
+        "MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES",
+        "MBEDTLS_TEST_NULL_ENTROPY"
+    ],
+    "target_overrides": {
+        "*": {
+            "target.features_add": ["COMMON_PAL"],
+            "lwip.ethernet-enabled": false,
+            "lwip.ppp-enabled": true
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/c030_template_mbed_app_json.txt	Wed Jun 14 11:56:57 2017 +0000
@@ -0,0 +1,12 @@
+{
+    "macros": [
+        "MBEDTLS_USER_CONFIG_FILE=\"mbedtls_mbed_client_config.h\""
+    ],
+    "target_overrides": {
+        "*": {
+            "target.features_add": ["COMMON_PAL"],
+            "lwip.ppp-enabled": true,
+            "platform.stdio-convert-newlines": true
+        }
+    }
+}
\ No newline at end of file
--- a/main.cpp	Fri Jun 09 14:42:47 2017 +0000
+++ b/main.cpp	Wed Jun 14 11:56:57 2017 +0000
@@ -23,11 +23,21 @@
 #include "mbed.h"
 #include "mbedtls/entropy_poll.h"
 #include "UbloxATCellularInterface.h"
+#include "UbloxPPPCellularInterface.h"
 #include "simpleclient.h"
 #include "security.h"
 #include "mbed_trace.h"
 #include "mbed.h"
 
+// If you wish to use LWIP and the PPP cellular interface, select
+// the line UbloxPPPCellularInterface, otherwise select the line
+// UbloxATCellularInterface.  Using the AT cellular interface does not
+// require LWIP and hence uses less RAM (significant on C027).  It also
+// allows other AT command operations (e.g. sending an SMS) to happen
+// during a data transfer.
+#define INTERFACE_CLASS  UbloxATCellularInterface
+//#define INTERFACE_CLASS  UbloxPPPCellularInterface
+
 // The credentials of the SIM in the board.  If PIN checking is enabled
 // for your SIM card you must set this to the required PIN.
 #define PIN "0000"
@@ -142,7 +152,12 @@
 
 int main()
 {
-    UbloxATCellularInterface *interface = new UbloxATCellularInterface();
+    INTERFACE_CLASS *interface = new INTERFACE_CLASS();
+// If you need to debug the cellular interface, comment out the
+// instantiation above and uncomment the one below.
+//    INTERFACE_CLASS *interface = new INTERFACE_CLASS(MDMTXD, MDMRXD,
+//                                                     MBED_CONF_UBLOX_CELL_BAUD_RATE,
+//                                                     true);
     MbedClient *mbedClient = new MbedClient(device);
     M2MObjectList objectList;
     M2MSecurity *registerObject;
@@ -159,11 +174,10 @@
     srand(seed);
 
     // Randomize source port
-#ifdef TARGET_UBLOX_C030
-    mbedtls_hardware_poll(NULL, (unsigned char *) &seed, sizeof(seed), &len);
+#ifdef MBEDTLS_TEST_NULL_ENTROPY
+    mbedtls_null_entropy_poll(NULL, (unsigned char *) &seed, sizeof seed, &len);
 #else
-    // NULL entropy, since C027 does not have a true random number generator
-    mbedtls_null_entropy_poll(NULL, (unsigned char *) &seed, sizeof(seed), &len);
+    mbedtls_hardware_poll(NULL, (unsigned char *) &seed, sizeof seed, &len);
 #endif
 
     good();
--- a/mbed-os.lib	Fri Jun 09 14:42:47 2017 +0000
+++ b/mbed-os.lib	Wed Jun 14 11:56:57 2017 +0000
@@ -1,1 +1,1 @@
-https://github.com/u-blox/mbed-os/#470c3f22f77b35aece70ff67b2fd77bb13f1fb36
+https://github.com/u-blox/mbed-os/#fb19851b1ac19ed46a49513acbda9a76cb9d3f2d
--- a/simpleclient.h	Fri Jun 09 14:42:47 2017 +0000
+++ b/simpleclient.h	Wed Jun 14 11:56:57 2017 +0000
@@ -29,15 +29,6 @@
 #include "security.h"
 #include "mbed.h"
 
-#define ETHERNET        1
-#define WIFI            2
-#define MESH_LOWPAN_ND  3
-#define MESH_THREAD     4
-#define ATMEL           5
-#define MCR20           6
-#define SPIRIT1         7
-#define CELL            8
-
 #define STRINGIFY(s) #s
 
 M2MInterface::NetworkStack NETWORK_STACK = M2MInterface::LwIP_IPv4;
@@ -57,9 +48,6 @@
 *
 * The end user should only have to care about configuring the parameters at the
 * top of this file and making sure they add the security.h file correctly.
-* To add resources you can copy the _TODO__ function and add as many instances as
-* you want.
-*
 */
 class MbedClient: public M2MInterfaceObserver {
     
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ublox-at-cellular-interface.lib	Wed Jun 14 11:56:57 2017 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/teams/ublox/code/ublox-at-cellular-interface/#f6706249d076
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ublox-cellular-base.lib	Wed Jun 14 11:56:57 2017 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/teams/ublox/code/ublox-cellular-base/#73fcc33c9400
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ublox-ppp-cellular-interface.lib	Wed Jun 14 11:56:57 2017 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/teams/ublox/code/ublox-ppp-cellular-interface/#44dd95724bc2