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 24:8f9b678a7932, committed 2014-04-15
- Comitter:
- vwochnik
- Date:
- Tue Apr 15 16:59:56 2014 +0000
- Parent:
- 23:0a48eebaaba8
- Child:
- 25:8604bef314c1
- Commit message:
- fix
Changed in this revision
--- a/MbedSmartRest.lib Mon Mar 24 09:58:46 2014 +0000 +++ b/MbedSmartRest.lib Tue Apr 15 16:59:56 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/vwochnik/code/MbedSmartRest/#844856ab160d +http://mbed.org/users/vwochnik/code/MbedSmartRestStreaming/#0ce90c525e7a
--- a/UbloxUSBModem.lib Mon Mar 24 09:58:46 2014 +0000 +++ b/UbloxUSBModem.lib Tue Apr 15 16:59:56 2014 +0000 @@ -1,1 +1,1 @@ -https://mbed.org/users/mbed_official/code/UbloxUSBModem/#6e9d98f8c237 +http://mbed.org/users/vwochnik/code/UbloxUSBModem/#07887ecfc6f2
--- a/main.cpp Mon Mar 24 09:58:46 2014 +0000 +++ b/main.cpp Tue Apr 15 16:59:56 2014 +0000 @@ -13,7 +13,7 @@ int main() { - int ret; + int ret; size_t c; puts("Started..."); io_init(); @@ -25,29 +25,29 @@ UbloxUSBGSMModem modem; cmdIface = modem.getATCommandsInterface(); - puts("Connecting..."); - if (modem.connect("")) { - puts("Searching for login..."); - // get imsi number - printf("IMSI: %s\n", imsi()); - apndb_t *apn = apndb_get(imsi()); - if (apn == NULL) - puts("No APN found."); - else - printf("APN: %s\n", apn->apn); - - if (modem.connect("public4.m2minternet.com")) { - puts("GPRS connection failure."); - return 2; - } - printf("IMSI: %s\n", imsi()); - apn = apndb_get(imsi()); - if (apn == NULL) - puts("No APN found."); - else - printf("APN: %s\n", apn->apn); + /*puts("Searching for login..."); + // get imsi number + printf("IMSI: %s\n", imsi()); + apndb_t *apn = apndb_get(imsi()); + if (apn == NULL) + puts("No APN found."); + else + printf("APN: %s\n", apn->apn); + */ + + if (modem.connect("public4.m2minternet.com")) { + puts("GPRS connection failure."); + return 2; } - + + /*printf("IMSI: %s\n", imsi()); + apn = apndb_get(imsi()); + if (apn == NULL) + puts("No APN found."); + else + printf("APN: %s\n", apn->apn); + */ + // get before starting program as they're permanent if ((!strlen(imei())) || (!strlen(iccid()))) { puts("Couldn't read IMEI or ICCID.");
--- a/program.cpp Mon Mar 24 09:58:46 2014 +0000 +++ b/program.cpp Tue Apr 15 16:59:56 2014 +0000 @@ -51,7 +51,8 @@ ); float interval = 120.0; // send measurements every two minutes -MbedSmartRest client("http://developer.cumulocity.com/s", "vaillant/admin", "klanpi", "com_u-blox_C027_REV-A_0.10"); +MbedSmartRest client("developer.cumulocity.com", 80, "vaillant/admin", "klanpi", "com_u-blox_C027_REV-A_0.10_Test1233123"); +//MbedSmartRest client("vsrv41584.customer.xenway.de", 8888, "vaillant/admin", "klanpi", "com_u-blox_C027_REV-A_0.10_Test123"); int program(void) { @@ -59,7 +60,7 @@ lcd_tenant("vaillant"); puts("Hello!"); - + puts("Bootstrapping"); lcd_status("Bootstrapping"); if (client.bootstrap(srtpl) != SMARTREST_SUCCESS) { @@ -67,7 +68,7 @@ lcd_status("Bootstrapping failed."); return 2; } - + puts("Starting action..."); if ((deviceId = existing()) == 0) { @@ -327,4 +328,3 @@ measurement.add(msgId).add(devId).add(x).add(y).add(z); aggr.add(measurement); } -