Own fork of MbedSmartRestMain
Dependencies: C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed
Fork of MbedSmartRestMain by
DeviceBootstrap.h@95:5dfdc8568e9f, 2015-04-27 (annotated)
- Committer:
- xinlei
- Date:
- Mon Apr 27 10:50:21 2015 +0000
- Revision:
- 95:5dfdc8568e9f
- Parent:
- 92:0acd11870c6a
- Child:
- 97:9f2de96941c4
LCDDisplay now is singleton
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 | 67:c360a2b2c948 | 5 | #include "DeviceMemory.h" |
vwochnik | 55:a0f7295ed6b6 | 6 | #include "AbstractSmartRest.h" |
Cumulocity | 41:804f6a0bda26 | 7 | #include "DeviceInfo.h" |
Cumulocity | 41:804f6a0bda26 | 8 | |
Cumulocity | 41:804f6a0bda26 | 9 | /** The username used for device bootstrapping. */ |
Cumulocity | 41:804f6a0bda26 | 10 | #define DEVICE_BOOTSTRAP_USERNAME "management/devicebootstrap" |
Cumulocity | 41:804f6a0bda26 | 11 | |
Cumulocity | 41:804f6a0bda26 | 12 | /** The password used for device bootstrapping. */ |
Cumulocity | 41:804f6a0bda26 | 13 | #define DEVICE_BOOTSTRAP_PASSWORD "Fhdt1bb1f" |
Cumulocity | 41:804f6a0bda26 | 14 | |
Cumulocity | 41:804f6a0bda26 | 15 | #define DEVICE_BOOTSTRAP_CREDENTIALS_LENGTH 256 |
Cumulocity | 41:804f6a0bda26 | 16 | |
Cumulocity | 41:804f6a0bda26 | 17 | class DeviceBootstrap |
Cumulocity | 41:804f6a0bda26 | 18 | { |
Cumulocity | 41:804f6a0bda26 | 19 | public: |
xinlei | 95:5dfdc8568e9f | 20 | DeviceBootstrap(AbstractSmartRest&, DeviceInfo&, DeviceMemory&); |
Cumulocity | 41:804f6a0bda26 | 21 | |
Cumulocity | 41:804f6a0bda26 | 22 | bool setUpCredentials(); |
Cumulocity | 46:f6976fd64387 | 23 | const char * username(); |
Cumulocity | 46:f6976fd64387 | 24 | const char * password(); |
Cumulocity | 41:804f6a0bda26 | 25 | |
Cumulocity | 41:804f6a0bda26 | 26 | protected: |
Cumulocity | 41:804f6a0bda26 | 27 | bool obtainFromStorage(); |
Cumulocity | 41:804f6a0bda26 | 28 | bool obtainFromPlatform(); |
Cumulocity | 41:804f6a0bda26 | 29 | |
Cumulocity | 41:804f6a0bda26 | 30 | private: |
Cumulocity | 41:804f6a0bda26 | 31 | bool writeToStorage(); |
Cumulocity | 41:804f6a0bda26 | 32 | void setCredentials(const char *, const char*, const char*); |
Cumulocity | 41:804f6a0bda26 | 33 | |
Cumulocity | 41:804f6a0bda26 | 34 | private: |
vwochnik | 55:a0f7295ed6b6 | 35 | AbstractSmartRest& _client; |
Cumulocity | 41:804f6a0bda26 | 36 | DeviceInfo& _deviceInfo; |
vwochnik | 67:c360a2b2c948 | 37 | DeviceMemory& _deviceMemory; |
xinlei | 91:48069375dffa | 38 | char _username[DEVICE_BOOTSTRAP_CREDENTIALS_LENGTH]; |
xinlei | 91:48069375dffa | 39 | char _password[DEVICE_BOOTSTRAP_CREDENTIALS_LENGTH]; |
Cumulocity | 41:804f6a0bda26 | 40 | }; |
Cumulocity | 41:804f6a0bda26 | 41 | |
Cumulocity | 41:804f6a0bda26 | 42 | #endif |