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 37:4a7f58dd03d2, committed 2014-07-07
- Comitter:
- Cumulocity
- Date:
- Mon Jul 07 15:13:46 2014 +0000
- Parent:
- 36:2f6a023f0504
- Child:
- 38:464feb06b961
- Commit message:
- use authorization api
Changed in this revision
MbedSmartRest.lib | Show annotated file Show diff for this revision Revisions of this file |
program.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/MbedSmartRest.lib Mon Jul 07 14:20:42 2014 +0000 +++ b/MbedSmartRest.lib Mon Jul 07 15:13:46 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/Cumulocity/code/MbedSmartRest/#9a11a331e340 +http://mbed.org/users/Cumulocity/code/MbedSmartRest/#aab51c468511
--- a/program.cpp Mon Jul 07 14:20:42 2014 +0000 +++ b/program.cpp Mon Jul 07 15:13:46 2014 +0000 @@ -71,7 +71,7 @@ float interval = 120.0; // send measurements every two minutes -MbedSmartRest client("developer.cumulocity.com", 80, credentials.username, credentials.password, TEMPLATE_DEVICE_IDENTIFIER); +MbedSmartRest client("developer.cumulocity.com", 80, TEMPLATE_DEVICE_IDENTIFIER); int program(void) { @@ -86,10 +86,9 @@ return 1; } } + client.setAuthorization(credentials.username, credentials.password); #else - // copy hardcoded credentials - strcpy(credentials.username, CREDENTIALS_USERNAME); - strcpy(credentials.password, CREDENTIALS_PASSWORD); + client.setAuthorization(CREDENTIALS_USERNAME, CREDENTIALS_PASSWORD); #endif lcd_tenant(credentials.username); @@ -140,8 +139,7 @@ return false; // copy credentials - strcpy(credentials.username, DEVICEBOOTSTRAP_USERNAME); - strcpy(credentials.password, DEVICEBOOTSTRAP_PASSWORD); + client.setAuthorization(DEVICEBOOTSTRAP_USERNAME, DEVICEBOOTSTRAP_PASSWORD); while (true) { if (client.send(record, "") != SMARTREST_SUCCESS) {