Cloud Driver

The cloud driver is used to enable access to Atmosphere through cloud event and cloud command elements.

Enumerations

enum ATMO_CLOUD_Status_t

Atmosphere cloud driver return enumerations.

Name Value Description
ATMO_CLOUD_Status_Success 0x00u Common - Operation was successful
ATMO_CLOUD_Status_Fail 0x01u Common - Operation failed
ATMO_CLOUD_Status_Initialized 0x02u Common - Peripheral already initialized
ATMO_CLOUD_Status_Invalid 0x03u Common - Invalid operation or result
ATMO_CLOUD_Status_NotSupported 0x04u Common - Feature not supported by platform
ATMO_CLOUD_Status_Unknown 0x05u Common - Some other status not defined
ATMO_CLOUD_Status_Timeout 0x06u The request timed out before completing

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)

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
instanceNumber in ATMO_DriverInstanceHandle_t
Return Type
ATMO_CLOUD_Status_t

ATMO_CLOUD_Status_t ATMO_CLOUD_InitFilesystemData(ATMO_DriverInstanceHandle_t filesystemDriverHandle)

Initialize any saved data in the file system.

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 file sysem 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_DriverInstanceHandle_t instanceNumber, ATMO_CLOUD_RegistrationInfo_t *info)

This will set the registration info for the driver instance.

Parameter Direction Type
info in ATMO_CLOUD_RegistrationInfo_t *
instanceNumber in ATMO_DriverInstanceHandle_t
Return Type
ATMO_CLOUD_Status_t

ATMO_CLOUD_Status_t ATMO_CLOUD_GetRegistration(ATMO_DriverInstanceHandle_t instanceNumber, ATMO_CLOUD_RegistrationInfo_t *info)

This will get the current registration info from the driver instance.

Parameter Direction Type
info out ATMO_CLOUD_RegistrationInfo_t *
instanceNumber in ATMO_DriverInstanceHandle_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_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