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
DeviceBootstrap.h@98:9f2de96941c4, 2015-04-27 (annotated)
- Committer:
- xinlei
- Date:
- Mon Apr 27 13:30:21 2015 +0000
- Revision:
- 98:9f2de96941c4
- Parent:
- 96:5dfdc8568e9f
- Child:
- 101:dbcd3bc51758
Get rid of useless DeviceMemory class wrapper
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Cumulocity | 41:804f6a0bda26 | 1 | #ifndef DEVICEBOOTSTRAP_H |
Cumulocity | 41:804f6a0bda26 | 2 | #define DEVICEBOOTSTRAP_H |
Cumulocity | 41:804f6a0bda26 | 3 | |
Cumulocity | 41:804f6a0bda26 | 4 | #include <stddef.h> |
vwochnik | 55:a0f7295ed6b6 | 5 | #include "AbstractSmartRest.h" |
Cumulocity | 41:804f6a0bda26 | 6 | #include "DeviceInfo.h" |
Cumulocity | 41:804f6a0bda26 | 7 | |
Cumulocity | 41:804f6a0bda26 | 8 | /** The username used for device bootstrapping. */ |
Cumulocity | 41:804f6a0bda26 | 9 | #define DEVICE_BOOTSTRAP_USERNAME "management/devicebootstrap" |
Cumulocity | 41:804f6a0bda26 | 10 | |
Cumulocity | 41:804f6a0bda26 | 11 | /** The password used for device bootstrapping. */ |
Cumulocity | 41:804f6a0bda26 | 12 | #define DEVICE_BOOTSTRAP_PASSWORD "Fhdt1bb1f" |
Cumulocity | 41:804f6a0bda26 | 13 | |
Cumulocity | 41:804f6a0bda26 | 14 | #define DEVICE_BOOTSTRAP_CREDENTIALS_LENGTH 256 |
Cumulocity | 41:804f6a0bda26 | 15 | |
Cumulocity | 41:804f6a0bda26 | 16 | class DeviceBootstrap |
Cumulocity | 41:804f6a0bda26 | 17 | { |
Cumulocity | 41:804f6a0bda26 | 18 | public: |
xinlei | 98:9f2de96941c4 | 19 | DeviceBootstrap(AbstractSmartRest&, DeviceInfo&); |
xinlei | 98:9f2de96941c4 | 20 | |
Cumulocity | 41:804f6a0bda26 | 21 | bool setUpCredentials(); |
Cumulocity | 46:f6976fd64387 | 22 | const char * username(); |
Cumulocity | 46:f6976fd64387 | 23 | const char * password(); |
Cumulocity | 41:804f6a0bda26 | 24 | |
Cumulocity | 41:804f6a0bda26 | 25 | protected: |
Cumulocity | 41:804f6a0bda26 | 26 | bool obtainFromStorage(); |
Cumulocity | 41:804f6a0bda26 | 27 | bool obtainFromPlatform(); |
Cumulocity | 41:804f6a0bda26 | 28 | |
Cumulocity | 41:804f6a0bda26 | 29 | private: |
Cumulocity | 41:804f6a0bda26 | 30 | bool writeToStorage(); |
Cumulocity | 41:804f6a0bda26 | 31 | void setCredentials(const char *, const char*, const char*); |
Cumulocity | 41:804f6a0bda26 | 32 | |
Cumulocity | 41:804f6a0bda26 | 33 | private: |
vwochnik | 55:a0f7295ed6b6 | 34 | AbstractSmartRest& _client; |
Cumulocity | 41:804f6a0bda26 | 35 | DeviceInfo& _deviceInfo; |
xinlei | 92:48069375dffa | 36 | char _username[DEVICE_BOOTSTRAP_CREDENTIALS_LENGTH]; |
xinlei | 92:48069375dffa | 37 | char _password[DEVICE_BOOTSTRAP_CREDENTIALS_LENGTH]; |
Cumulocity | 41:804f6a0bda26 | 38 | }; |
Cumulocity | 41:804f6a0bda26 | 39 | |
Cumulocity | 41:804f6a0bda26 | 40 | #endif |