Own fork of MbedSmartRestMain
Dependencies: C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed
Fork of MbedSmartRestMain by
DeviceBootstrap.h@100:dbcd3bc51758, 2015-05-08 (annotated)
- Committer:
- xinlei
- Date:
- Fri May 08 12:19:57 2015 +0000
- Revision:
- 100:dbcd3bc51758
- Parent:
- 97:9f2de96941c4
- Child:
- 109:b7a403dbceb6
v2.1rc3
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 | |
xinlei | 100:dbcd3bc51758 | 8 | #define CREDENTIAL_LENGTH 256 |
Cumulocity | 41:804f6a0bda26 | 9 | |
Cumulocity | 41:804f6a0bda26 | 10 | class DeviceBootstrap |
Cumulocity | 41:804f6a0bda26 | 11 | { |
Cumulocity | 41:804f6a0bda26 | 12 | public: |
xinlei | 97:9f2de96941c4 | 13 | DeviceBootstrap(AbstractSmartRest&, DeviceInfo&); |
xinlei | 97:9f2de96941c4 | 14 | |
Cumulocity | 41:804f6a0bda26 | 15 | bool setUpCredentials(); |
Cumulocity | 46:f6976fd64387 | 16 | const char * username(); |
Cumulocity | 46:f6976fd64387 | 17 | const char * password(); |
Cumulocity | 41:804f6a0bda26 | 18 | |
Cumulocity | 41:804f6a0bda26 | 19 | protected: |
Cumulocity | 41:804f6a0bda26 | 20 | bool obtainFromStorage(); |
Cumulocity | 41:804f6a0bda26 | 21 | bool obtainFromPlatform(); |
Cumulocity | 41:804f6a0bda26 | 22 | |
Cumulocity | 41:804f6a0bda26 | 23 | private: |
Cumulocity | 41:804f6a0bda26 | 24 | bool writeToStorage(); |
Cumulocity | 41:804f6a0bda26 | 25 | void setCredentials(const char *, const char*, const char*); |
Cumulocity | 41:804f6a0bda26 | 26 | |
Cumulocity | 41:804f6a0bda26 | 27 | private: |
vwochnik | 55:a0f7295ed6b6 | 28 | AbstractSmartRest& _client; |
Cumulocity | 41:804f6a0bda26 | 29 | DeviceInfo& _deviceInfo; |
xinlei | 100:dbcd3bc51758 | 30 | char _username[CREDENTIAL_LENGTH]; |
xinlei | 100:dbcd3bc51758 | 31 | char _password[CREDENTIAL_LENGTH]; |
Cumulocity | 41:804f6a0bda26 | 32 | }; |
Cumulocity | 41:804f6a0bda26 | 33 | |
Cumulocity | 41:804f6a0bda26 | 34 | #endif |