portable version of the cumulocity demo
Dependencies: C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed
Fork of MbedSmartRestMain by
DeviceBootstrap.h
00001 #ifndef DEVICEBOOTSTRAP_H 00002 #define DEVICEBOOTSTRAP_H 00003 00004 #include <stddef.h> 00005 #include "MDM.h" 00006 #include "DeviceIO.h" 00007 #include "SmartRest.h" 00008 #include "DeviceInfo.h" 00009 00010 /** The username used for device bootstrapping. */ 00011 #define DEVICE_BOOTSTRAP_USERNAME "management/devicebootstrap" 00012 00013 /** The password used for device bootstrapping. */ 00014 #define DEVICE_BOOTSTRAP_PASSWORD "Fhdt1bb1f" 00015 00016 #define DEVICE_BOOTSTRAP_CREDENTIALS_LENGTH 256 00017 00018 #define CREDENTIALS_FILE "001_CREDENTIALS" 00019 00020 class DeviceBootstrap 00021 { 00022 public: 00023 DeviceBootstrap(SmartRest&, MDMSerial&, DeviceIO&, DeviceInfo&); 00024 00025 bool setUpCredentials(); 00026 const char * username(); 00027 const char * password(); 00028 00029 protected: 00030 bool obtainFromStorage(); 00031 bool obtainFromPlatform(); 00032 00033 private: 00034 bool writeToStorage(); 00035 void setCredentials(const char *, const char*, const char*); 00036 00037 private: 00038 SmartRest& _client; 00039 MDMSerial& _mdm; 00040 DeviceInfo& _deviceInfo; 00041 DeviceIO& _io; 00042 char _username[DEVICE_BOOTSTRAP_CREDENTIALS_LENGTH], 00043 _password[DEVICE_BOOTSTRAP_CREDENTIALS_LENGTH]; 00044 }; 00045 00046 #endif
Generated on Tue Jul 12 2022 21:10:53 by 1.7.2