Own fork of MbedSmartRestMain

Dependencies:   C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed

Fork of MbedSmartRestMain by Cumulocity Official

Committer:
xinlei
Date:
Mon Apr 13 14:24:58 2015 +0000
Revision:
92:0acd11870c6a
Parent:
91:48069375dffa
Child:
95:5dfdc8568e9f
v2.1rc1

Who changed what in which revision?

UserRevisionLine numberNew 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>
xinlei 92:0acd11870c6a 5 #include "LCDDisplay.h"
vwochnik 67:c360a2b2c948 6 #include "DeviceMemory.h"
vwochnik 55:a0f7295ed6b6 7 #include "AbstractSmartRest.h"
Cumulocity 41:804f6a0bda26 8 #include "DeviceInfo.h"
Cumulocity 41:804f6a0bda26 9
Cumulocity 41:804f6a0bda26 10 /** The username used for device bootstrapping. */
Cumulocity 41:804f6a0bda26 11 #define DEVICE_BOOTSTRAP_USERNAME "management/devicebootstrap"
Cumulocity 41:804f6a0bda26 12
Cumulocity 41:804f6a0bda26 13 /** The password used for device bootstrapping. */
Cumulocity 41:804f6a0bda26 14 #define DEVICE_BOOTSTRAP_PASSWORD "Fhdt1bb1f"
Cumulocity 41:804f6a0bda26 15
Cumulocity 41:804f6a0bda26 16 #define DEVICE_BOOTSTRAP_CREDENTIALS_LENGTH 256
Cumulocity 41:804f6a0bda26 17
Cumulocity 41:804f6a0bda26 18 class DeviceBootstrap
Cumulocity 41:804f6a0bda26 19 {
Cumulocity 41:804f6a0bda26 20 public:
xinlei 92:0acd11870c6a 21 DeviceBootstrap(AbstractSmartRest&, LCDDisplay&, DeviceInfo&, DeviceMemory&);
Cumulocity 41:804f6a0bda26 22
Cumulocity 41:804f6a0bda26 23 bool setUpCredentials();
Cumulocity 46:f6976fd64387 24 const char * username();
Cumulocity 46:f6976fd64387 25 const char * password();
Cumulocity 41:804f6a0bda26 26
Cumulocity 41:804f6a0bda26 27 protected:
Cumulocity 41:804f6a0bda26 28 bool obtainFromStorage();
Cumulocity 41:804f6a0bda26 29 bool obtainFromPlatform();
Cumulocity 41:804f6a0bda26 30
Cumulocity 41:804f6a0bda26 31 private:
Cumulocity 41:804f6a0bda26 32 bool writeToStorage();
Cumulocity 41:804f6a0bda26 33 void setCredentials(const char *, const char*, const char*);
Cumulocity 41:804f6a0bda26 34
Cumulocity 41:804f6a0bda26 35 private:
vwochnik 55:a0f7295ed6b6 36 AbstractSmartRest& _client;
Cumulocity 41:804f6a0bda26 37 DeviceInfo& _deviceInfo;
vwochnik 67:c360a2b2c948 38 DeviceMemory& _deviceMemory;
xinlei 92:0acd11870c6a 39 LCDDisplay& _lcdDisplay;
xinlei 91:48069375dffa 40 char _username[DEVICE_BOOTSTRAP_CREDENTIALS_LENGTH];
xinlei 91:48069375dffa 41 char _password[DEVICE_BOOTSTRAP_CREDENTIALS_LENGTH];
Cumulocity 41:804f6a0bda26 42 };
Cumulocity 41:804f6a0bda26 43
Cumulocity 41:804f6a0bda26 44 #endif