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
Diff: main.cpp
- Revision:
- 3:5b8623c17906
- Parent:
- 1:9f355da25904
- Child:
- 5:d81fdd2c89f2
--- 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();