Official reference client implementation for Cumulocity SmartREST on u-blox C027.
Dependencies: C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed
Fork of MbedSmartRestMain by
Revision 29:853741b9ea3b, committed 2014-05-26
- Comitter:
- vwochnik
- Date:
- Mon May 26 08:10:27 2014 +0000
- Parent:
- 28:2004400abeec
- Child:
- 30:daa499571db7
- Commit message:
- minor fixes for modem connection
Changed in this revision
--- a/apndb.cpp Sun May 25 17:46:19 2014 +0000 +++ b/apndb.cpp Mon May 26 08:10:27 2014 +0000 @@ -7,7 +7,7 @@ // Contains all tuples apndb_t apndb[] = { - { .mcc = "204", .mnc = "04", .apn = "public4.m2minternet.com", .user = "", .pass = "" } + { .mcc = "204", .mnc = "04", .carrier = "Vodafone NL", .apn = "public4.m2minternet.com" } }; apndb_t * apndb_get(const char * imsi)
--- a/apndb.h Sun May 25 17:46:19 2014 +0000 +++ b/apndb.h Mon May 26 08:10:27 2014 +0000 @@ -4,11 +4,10 @@ // Defiles the base type for storing mcc/mnc-apn/user/pass tuples typedef struct { - char mcc[4]; // mobile country code - char mnc[4]; // mobile network code - char apn[32]; - char user[32]; - char pass[32]; + const char *mcc; // mobile country code + const char *mnc; // mobile network code + const char *carrier; + const char *apn; } apndb_t; apndb_t * apndb_get(const char * imsi);
--- a/main.cpp Sun May 25 17:46:19 2014 +0000 +++ b/main.cpp Mon May 26 08:10:27 2014 +0000 @@ -2,8 +2,6 @@ #include "apndb.h" #include "io.h" -#define SIMPIN NULL - C027 c027; MDMSerial mdm; sigq_t sigQ = {}; @@ -25,7 +23,7 @@ Thread::wait(2000); puts("Initializing modem."); - if (!mdm.init(SIMPIN, &devStatus)) { + if (!mdm.init(NULL, &devStatus)) { puts("Modem initialization failed. Check your PIN number."); return 1; } @@ -36,6 +34,10 @@ puts("No APN found. Stop."); return 1; } + + // print out basic device data + printf("IMEI: %s\n", devStatus.imei); + printf("IMSI: %s\n", devStatus.imsi); // wait until we are connected int i = 60; @@ -50,9 +52,10 @@ return 1; } + printf("Carrier: %s\n", apn->carrier); puts("Joining Network."); - if (mdm.join(apn->apn, apn->user, apn->pass) == NOIP) { - puts("Could not join network. Check APN and credentials."); + if (mdm.join(apn->apn) == NOIP) { + puts("Could not join network. Make sure chosen carrier is correct and no credentials are required."); return 1; }