portable version of the cumulocity demo
Dependencies: C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed
Fork of MbedSmartRestMain by
Diff: DeviceBootstrap.h
- Revision:
- 41:804f6a0bda26
- Child:
- 46:f6976fd64387
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DeviceBootstrap.h Tue Jul 15 12:44:34 2014 +0000 @@ -0,0 +1,42 @@ +#ifndef DEVICEBOOTSTRAP_H +#define DEVICEBOOTSTRAP_H + +#include <stddef.h> +#include "MDM.h" +#include "SmartRest.h" +#include "DeviceInfo.h" + +/** The username used for device bootstrapping. */ +#define DEVICE_BOOTSTRAP_USERNAME "management/devicebootstrap" + +/** The password used for device bootstrapping. */ +#define DEVICE_BOOTSTRAP_PASSWORD "Fhdt1bb1f" + +#define DEVICE_BOOTSTRAP_CREDENTIALS_LENGTH 256 + +#define CREDENTIALS_FILE "001_CREDENTIALS" + +class DeviceBootstrap +{ +public: + DeviceBootstrap(SmartRest&, MDMSerial&, DeviceInfo&); + + bool setUpCredentials(); + +protected: + bool obtainFromStorage(); + bool obtainFromPlatform(); + +private: + bool writeToStorage(); + void setCredentials(const char *, const char*, const char*); + +private: + SmartRest& _client; + MDMSerial& _mdm; + DeviceInfo& _deviceInfo; + char _username[DEVICE_BOOTSTRAP_CREDENTIALS_LENGTH], + _password[DEVICE_BOOTSTRAP_CREDENTIALS_LENGTH]; +}; + +#endif \ No newline at end of file