Cloud Driver

The cloud driver is used to enable access to Atmosphere through cloud event and cloud command elements. The base cloud driver only provides filesystem initialization and shared functionality, while all transport is handled by the cloud sub-drivers (eg. cloud_tcp and cloud_ble).

Enumerations

enum ATMO_CLOUD_Status_t

Atmosphere Cloud Driver Return Enumerations

Name Value
ATMO_CLOUD_Status_Success 0x00u
ATMO_CLOUD_Status_Fail 0x01u
ATMO_CLOUD_Status_Initialized 0x02u
ATMO_CLOUD_Status_Invalid 0x03u
ATMO_CLOUD_Status_NotSupported 0x04u
ATMO_CLOUD_Status_Unknown 0x05u
ATMO_CLOUD_Status_Timeout 0x06u
ATMO_CLOUD_Status_NoData 0x07u

enum ATMO_CLOUD_ExtraSettings_t

Name Value
ATMO_CLOUD_ExtraSettings_BLE 0x1
ATMO_CLOUD_ExtraSettings_WIFI 0x02
ATMO_CLOUD_ExtraSettings_LORA 0x04
ATMO_CLOUD_ExtraSettings_CELLULAR 0x08
ATMO_CLOUD_ExtraSettings_THREAD 0x10
ATMO_CLOUD_ExtraSettings_6LOWPAN 0x20
ATMO_CLOUD_ExtraSettings_ETHERNET 0x40
ATMO_CLOUD_ExtraSettings_ZIGBEE 0x80
ATMO_CLOUD_ExtraSettings_ZWAVE 0x100
ATMO_CLOUD_ExtraSettings_SIGFOX 0x200
ATMO_CLOUD_ExtraSettings_NEUL 0x400

Functions

ATMO_Status_t ATMO_CLOUD_AddDriverInstance(const ATMO_CLOUD_DriverInstance_t *driverInstance, ATMO_DriverInstanceData_t *driverInstanceData, ATMO_DriverInstanceHandle_t *instanceNumber)

Register Cloud driver instance with underlying driver framework

Parameter Direction Type
instanceNumber out ATMO_DriverInstanceHandle_t *
driverInstanceData in ATMO_DriverInstanceData_t *
driverInstance in const ATMO_CLOUD_DriverInstance_t *
Return Type
ATMO_Status_t

ATMO_CLOUD_Status_t ATMO_CLOUD_Init(ATMO_DriverInstanceHandle_t instanceNumber, bool provision)

This will initialize the cloud driver instance. Normally this would include loading registration from non-volitile memory and then storing into RAM. from there the driver would then begin it’s usual advertising methods to communicate with the app and cloud.

Parameter Direction Type
provision in bool
instanceNumber in ATMO_DriverInstanceHandle_t
Return Type
ATMO_CLOUD_Status_t

ATMO_CLOUD_Status_t ATMO_CLOUD_SetExtraRequiredSettings(uint16_t extraSettings)

Set extra required provisioning settings for specific hardware platform.

Parameter Direction Type
extraSettings N/A uint16_t
Return Type
ATMO_CLOUD_Status_t

ATMO_CLOUD_Status_t ATMO_CLOUD_ClearExtraRequiredSettings(uint16_t extraSettings)

Clear extra required provisioning settings for specific hardware platform.

Parameter Direction Type
extraSettings N/A uint16_t
Return Type
ATMO_CLOUD_Status_t

uint16_t ATMO_CLOUD_GetExtraRequiredSettings()

Get extra required provisioning settings for specific hardware platform.

Return Type
uint16_t

ATMO_CLOUD_Status_t ATMO_CLOUD_InitFilesystemData(ATMO_DriverInstanceHandle_t filesystemDriverHandle)

Initialize any saved data in the filesystem

Parameter Direction Type
filesystemDriverHandle in ATMO_DriverInstanceHandle_t
Return Type
ATMO_CLOUD_Status_t

ATMO_CLOUD_Status_t ATMO_CLOUD_SetOtaFlag(ATMO_DriverInstanceHandle_t filesystemDriverHandle)

Write flag to the FS indicating that an OTA upgrade just occured

Parameter Direction Type
filesystemDriverHandle in ATMO_DriverInstanceHandle_t
Return Type
ATMO_CLOUD_Status_t

ATMO_CLOUD_Status_t ATMO_CLOUD_InitRegistrationInfo(ATMO_CLOUD_RegistrationInfo_t *info)

Initialize registration info structure

Parameter Direction Type
info N/A ATMO_CLOUD_RegistrationInfo_t *
Return Type
ATMO_CLOUD_Status_t

ATMO_CLOUD_Status_t ATMO_CLOUD_SetRegistration(ATMO_CLOUD_RegistrationInfo_t *info)

This will set the registration info for the driver instance.

Parameter Direction Type
info in ATMO_CLOUD_RegistrationInfo_t *
Return Type
ATMO_CLOUD_Status_t

ATMO_CLOUD_RegistrationInfo_t* ATMO_CLOUD_GetRegistration(void)

This will get a pointer to current registration info from the driver instance

Parameter Direction Type
undefined N/A void
Return Type
ATMO_CLOUD_RegistrationInfo_t *

ATMO_CLOUD_Status_t ATMO_CLOUD_ClearRegistration()

This will clear the registration data

Return Type
ATMO_CLOUD_Status_t

ATMO_CLOUD_Status_t ATMO_CLOUD_RegisterNotifyConfigChange(unsigned int configHandle, ATMO_Callback_t callback)

Register for a notification when a config item changes

Parameter Direction Type
callback in ATMO_Callback_t
configHandle in unsigned int
Return Type
ATMO_CLOUD_Status_t

ATMO_CLOUD_Status_t ATMO_CLOUD_SetConfig(unsigned int configHandle, ATMO_Value_t *data)

Set configuration item

Parameter Direction Type
data in ATMO_Value_t *
configHandle in unsigned int
Return Type
ATMO_CLOUD_Status_t

ATMO_CLOUD_Status_t ATMO_CLOUD_GetConfig(unsigned int configHandle, ATMO_Value_t *data)

Get configuration item

Parameter Direction Type
data out ATMO_Value_t *
configHandle in unsigned int
Return Type
ATMO_CLOUD_Status_t

ATMO_CLOUD_Status_t ATMO_CLOUD_RegisterRegistrationSetCallback(ATMO_Callback_t cb)

Register to receive a notification when the registration changes

Parameter Direction Type
cb N/A ATMO_Callback_t
Return Type
ATMO_CLOUD_Status_t

ATMO_CLOUD_Status_t ATMO_CLOUD_SendEvent(ATMO_DriverInstanceHandle_t instanceNumber, const char *eventName, ATMO_Value_t *data, uint32_t timeout)

This will request the driver to attempt to send the value to the cloud.

Parameter Direction Type
timeout in uint32_t
data in ATMO_Value_t *
eventName in const char *
instanceNumber in ATMO_DriverInstanceHandle_t
Return Type
ATMO_CLOUD_Status_t

ATMO_CLOUD_Status_t ATMO_CLOUD_PopCommand(ATMO_DriverInstanceHandle_t instanceNumber, const char *commandName, ATMO_Value_t *data, uint32_t timeout)

This will request the driver to go pop the next command off the cloud’s command buffer with the provided command name.

Parameter Direction Type
timeout in uint32_t
data out ATMO_Value_t *
commandName in const char *
instanceNumber in ATMO_DriverInstanceHandle_t
Return Type
ATMO_CLOUD_Status_t

ATMO_CLOUD_Status_t ATMO_CLOUD_RegisterCommandRxAbilityHandle(const char *commandName, unsigned int abilityHandle)

Register ability handle to be executed when Cloud Command is received

Parameter Direction Type
abilityHandle in unsigned int
commandName in const char *
Return Type
ATMO_CLOUD_Status_t

ATMO_CLOUD_Status_t ATMO_CLOUD_RegisterCommandRxCallback(const char *commandName, ATMO_Callback_t cb)

Register callback to be executed when Cloud Command is received

Parameter Direction Type
cb N/A ATMO_Callback_t
commandName in const char *
Return Type
ATMO_CLOUD_Status_t

ATMO_CLOUD_Status_t ATMO_CLOUD_DispatchCommandResult(const char *command, ATMO_Value_t *result)

Parameter Direction Type
result N/A ATMO_Value_t *
command N/A const char *
Return Type
ATMO_CLOUD_Status_t

ATMO_CLOUD_Status_t ATMO_CLOUD_GetRegistrationInfoUuid(ATMO_CLOUD_RegistrationInfo_t *info, char *buffer, size_t size)

This function will return the UUIDv4 value formatted in standard lower case UUIDv4 string format in the buffer. Buffer size must be at least 37 bytes to contain the string.

Parameter Direction Type
size N/A size_t
buffer N/A char *
info N/A ATMO_CLOUD_RegistrationInfo_t *
Return Type
ATMO_CLOUD_Status_t

ATMO_CLOUD_Status_t ATMO_CLOUD_SetRegistrationInfoToken(ATMO_CLOUD_RegistrationInfo_t *info, const char *token)

Set token in registration info structure

Parameter Direction Type
token N/A const char *
info N/A ATMO_CLOUD_RegistrationInfo_t *
Return Type
ATMO_CLOUD_Status_t

ATMO_CLOUD_Status_t ATMO_CLOUD_GetRegistrationInfoToken(ATMO_CLOUD_RegistrationInfo_t *info, char *buffer, size_t size)

This will return the registration token as a string contained in buffer that the registration info is using.

Parameter Direction Type
size in size_t
buffer out char *
info in ATMO_CLOUD_RegistrationInfo_t *
Return Type
ATMO_CLOUD_Status_t

ATMO_CLOUD_Status_t ATMO_CLOUD_SetRegistrationInfoUrl(ATMO_CLOUD_RegistrationInfo_t *info, const char *url)

Set URL in registration info structure

Parameter Direction Type
url N/A const char *
info N/A ATMO_CLOUD_RegistrationInfo_t *
Return Type
ATMO_CLOUD_Status_t

ATMO_CLOUD_Status_t ATMO_CLOUD_GetRegistrationInfoUrl(ATMO_CLOUD_RegistrationInfo_t *info, char *buffer, size_t size)

This function will return the url as a string that the registration info is set to communicate with.

Parameter Direction Type
size in size_t
buffer out char *
info in ATMO_CLOUD_RegistrationInfo_t *
Return Type
ATMO_CLOUD_Status_t