Official reference client implementation for Cumulocity SmartREST on u-blox C027.

Dependencies:   C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed

Fork of MbedSmartRestMain by Vincent Wochnik

DeviceBootstrap.h

Committer:
xinlei
Date:
2015-05-08
Revision:
101:dbcd3bc51758
Parent:
98:9f2de96941c4
Child:
110:b7a403dbceb6

File content as of revision 101:dbcd3bc51758:

#ifndef DEVICEBOOTSTRAP_H
#define DEVICEBOOTSTRAP_H

#include <stddef.h>
#include "AbstractSmartRest.h"
#include "DeviceInfo.h"

#define CREDENTIAL_LENGTH 256

class DeviceBootstrap
{
public:
    DeviceBootstrap(AbstractSmartRest&, DeviceInfo&);

    bool setUpCredentials();
    const char * username();
    const char * password();

protected:
    bool obtainFromStorage();
    bool obtainFromPlatform();

private:
    bool writeToStorage();
    void setCredentials(const char *, const char*, const char*);

private:
    AbstractSmartRest& _client;
    DeviceInfo& _deviceInfo;
    char _username[CREDENTIAL_LENGTH];
    char _password[CREDENTIAL_LENGTH];
};

#endif