Jim Carver / Mbed OS mbed-cloud-workshop-connect
Embed: (wiki syntax)

« Back to documentation index

update-lwm2m-mbed-apis.h File Reference

update-lwm2m-mbed-apis.h File Reference

This file contains forward declarations for all functions used as APIS for the update client. More...

Go to the source code of this file.

Functions

uint32_t ARM_UCS_LWM2M_MONITOR_GetVersion (void)
 Get driver version.
ARM_MONITOR_CAPABILITIES ARM_UCS_LWM2M_MONITOR_GetCapabilities (void)
 Get Source capabilities.
arm_uc_error_t ARM_UCS_LWM2M_MONITOR_Initialize (void(*notification_handler)(void))
 Initialize Monitor.
arm_uc_error_t ARM_UCS_LWM2M_MONITOR_Uninitialize (void)
 Uninitialized Monitor.
arm_uc_error_t ARM_UCS_LWM2M_MONITOR_SendState (arm_uc_monitor_state_t state)
 Send Update Client state.
arm_uc_error_t ARM_UCS_LWM2M_MONITOR_SendUpdateResult (arm_uc_monitor_result_t updateResult)
 Send update result.
arm_uc_error_t ARM_UCS_LWM2M_MONITOR_SendName (arm_uc_buffer_t *name)
 Send current firmware name.
arm_uc_error_t ARM_UCS_LWM2M_MONITOR_SendVersion (uint64_t version)
 Send current firmware version.
arm_uc_error_t ARM_UCS_LWM2M_MONITOR_SetBootloaderHash (arm_uc_buffer_t *hash)
 Set the bootloader hash.
arm_uc_error_t ARM_UCS_LWM2M_MONITOR_SetOEMBootloaderHash (arm_uc_buffer_t *hash)
 Set the OEM bootloader hash.
uint32_t ARM_UCS_LWM2M_SOURCE_GetVersion (void)
 Get driver version.
ARM_SOURCE_CAPABILITIES ARM_UCS_LWM2M_SOURCE_GetCapabilities (void)
 Get Source capabilities.
arm_uc_error_t ARM_UCS_LWM2M_SOURCE_Initialize (ARM_SOURCE_SignalEvent_t cb_event)
 Initialize Source.
arm_uc_error_t ARM_UCS_LWM2M_SOURCE_Uninitialize (void)
 Uninitialized Source.
arm_uc_error_t ARM_UCS_LWM2M_SOURCE_GetManifestDefaultCost (uint32_t *cost)
 Cost estimation for retrieving manifest from the default location.
arm_uc_error_t ARM_UCS_LWM2M_SOURCE_GetManifestDefault (arm_uc_buffer_t *buffer, uint32_t offset)
 Retrieve manifest from the default location.
arm_uc_error_t ARM_UCS_LWM2M_SOURCE_GetManifestURLCost (arm_uc_uri_t *uri, uint32_t *cost)
 Cost estimation for retrieving manifest from URL.
arm_uc_error_t ARM_UCS_LWM2M_SOURCE_GetFirmwareURLCost (arm_uc_uri_t *uri, uint32_t *cost)
 Cost estimation for retrieving firmware from URL.
arm_uc_error_t ARM_UCS_LWM2M_SOURCE_GetKeytableURLCost (arm_uc_uri_t *uri, uint32_t *cost)
 Cost estimation for retrieving key table from URL.
arm_uc_error_t ARM_UCS_LWM2M_SOURCE_GetManifestURL (arm_uc_uri_t *uri, arm_uc_buffer_t *buffer, uint32_t offset)
 Retrieve manifest from URL.
arm_uc_error_t ARM_UCS_LWM2M_SOURCE_GetFirmwareFragment (arm_uc_uri_t *uri, arm_uc_buffer_t *buffer, uint32_t offset)
 Retrieve firmware fragment.
arm_uc_error_t ARM_UCS_LWM2M_SOURCE_GetKeytableURL (arm_uc_uri_t *uri, arm_uc_buffer_t *buffer)
 Retrieve a key table from a URL.

Detailed Description

This file contains forward declarations for all functions used as APIS for the update client.

Because C++ does not support designated initialisers, this file is used to provide linkage from C++ to C structure initialisers. This pattern is necessary to ensure that the APIs are not brittle and prone to breakage if APIs are added or the API structure is changed.

Definition in file update-lwm2m-mbed-apis.h.


Function Documentation

ARM_MONITOR_CAPABILITIES ARM_UCS_LWM2M_MONITOR_GetCapabilities ( void   )

Get Source capabilities.

Returns:
Struct containing capabilites. See definition above.

Definition at line 37 of file lwm2m-monitor.cpp.

uint32_t ARM_UCS_LWM2M_MONITOR_GetVersion ( void   )

Get driver version.

Returns:
Driver version.

Definition at line 28 of file lwm2m-monitor.cpp.

arm_uc_error_t ARM_UCS_LWM2M_MONITOR_Initialize ( void(*)(void)  notification_handler )

Initialize Monitor.

Returns:
Error code.

Definition at line 51 of file lwm2m-monitor.cpp.

arm_uc_error_t ARM_UCS_LWM2M_MONITOR_SendName ( arm_uc_buffer_t *  name )

Send current firmware name.

The firmware name is the SHA256 hash.

Parameters:
namePointer to buffer struct. Hash is stored as byte array.
Returns:
Error code.

Definition at line 240 of file lwm2m-monitor.cpp.

arm_uc_error_t ARM_UCS_LWM2M_MONITOR_SendState ( arm_uc_monitor_state_t  state )

Send Update Client state.

From the OMA LWM2M Technical Specification:

Indicates current state with respect to this firmware update. This value is set by the LWM2M Client. 0: Idle (before downloading or after successful updating) 1: Downloading (The data sequence is on the way) 2: Downloaded 3: Updating

If writing the firmware package to Package Resource is done, or, if the device has downloaded the firmware package from the Package URI the state changes to Downloaded.

If writing an empty string to Package Resource is done or writing an empty string to Package URI is done, the state changes to Idle.

When in Downloaded state, and the executable Resource Update is triggered, the state changes to Updating. If the Update Resource failed, the state returns at Downloaded. If performing the Update Resource was successful, the state changes from Updating to Idle.

Parameters:
stateValid states: ARM_UC_MONITOR_STATE_IDLE ARM_UC_MONITOR_STATE_DOWNLOADING ARM_UC_MONITOR_STATE_DOWNLOADED ARM_UC_MONITOR_STATE_UPDATING
Returns:
Error code.

Definition at line 106 of file lwm2m-monitor.cpp.

arm_uc_error_t ARM_UCS_LWM2M_MONITOR_SendUpdateResult ( arm_uc_monitor_result_t  updateResult )

Send update result.

From the OMA LWM2M Technical Specification:

Contains the result of downloading or updating the firmware 0: Initial value. Once the updating process is initiated (Download /Update), this Resource MUST be reset to Initial value. 1: Firmware updated successfully, 2: Not enough storage for the new firmware package. 3. Out of memory during downloading process. 4: Connection lost during downloading process. 5: CRC check failure for new downloaded package. 6: Unsupported package type. 7: Invalid URI 8: Firmware update failed

This Resource MAY be reported by sending Observe operation.

Parameters:
resultValid results: ARM_UC_MONITOR_RESULT_INITIAL ARM_UC_MONITOR_RESULT_SUCCESS ARM_UC_MONITOR_RESULT_ERROR_STORAGE ARM_UC_MONITOR_RESULT_ERROR_MEMORY ARM_UC_MONITOR_RESULT_ERROR_CONNECTION ARM_UC_MONITOR_RESULT_ERROR_CRC ARM_UC_MONITOR_RESULT_ERROR_TYPE ARM_UC_MONITOR_RESULT_ERROR_URI ARM_UC_MONITOR_RESULT_ERROR_UPDATE
Returns:
Error code.

Definition at line 173 of file lwm2m-monitor.cpp.

arm_uc_error_t ARM_UCS_LWM2M_MONITOR_SendVersion ( uint64_t  version )

Send current firmware version.

The firmware version is the timestamp from the manifest that authorized the firmware.

Parameters:
versionTimestamp, 64 bit unsigned integer.
Returns:
Error code.

Definition at line 267 of file lwm2m-monitor.cpp.

arm_uc_error_t ARM_UCS_LWM2M_MONITOR_SetBootloaderHash ( arm_uc_buffer_t *  hash )

Set the bootloader hash.

The bootloader hash is a hash of the bootloader. This is used for tracking the version of the bootloader used.

Parameters:
namePointer to buffer struct. Hash is stored as byte array.
Returns:
Error code.

Definition at line 289 of file lwm2m-monitor.cpp.

arm_uc_error_t ARM_UCS_LWM2M_MONITOR_SetOEMBootloaderHash ( arm_uc_buffer_t *  hash )

Set the OEM bootloader hash.

If the end-user has modified the bootloader the hash of the modified bootloader can be set here.

Parameters:
namePointer to buffer struct. Hash is stored as byte array.
Returns:
Error code.

Definition at line 311 of file lwm2m-monitor.cpp.

arm_uc_error_t ARM_UCS_LWM2M_MONITOR_Uninitialize ( void   )

Uninitialized Monitor.

Returns:
Error code.

Definition at line 67 of file lwm2m-monitor.cpp.

ARM_SOURCE_CAPABILITIES ARM_UCS_LWM2M_SOURCE_GetCapabilities ( void   )

Get Source capabilities.

Returns:
Struct containing capabilites. See definition above.

Definition at line 51 of file lwm2m-source.cpp.

arm_uc_error_t ARM_UCS_LWM2M_SOURCE_GetFirmwareFragment ( arm_uc_uri_t *  uri,
arm_uc_buffer_t *  buffer,
uint32_t  offset 
)

Retrieve firmware fragment.

Firmware fragment is stored in supplied buffer. Event is generated once fragment is in buffer.

Parameters:
uriURI struct with firmware location.
bufferStruct containing byte array, maximum size, and actual size.
offsetFirmware offset to retrieve fragment from.
Returns:
Error code.

Definition at line 360 of file lwm2m-source.cpp.

arm_uc_error_t ARM_UCS_LWM2M_SOURCE_GetFirmwareURLCost ( arm_uc_uri_t *  uri,
uint32_t *  cost 
)

Cost estimation for retrieving firmware from URL.

The estimation can vary over time and should not be cached too long. 0x00000000 - The firmware is already downloaded. 0xFFFFFFFF - Cannot retrieve firmware from this Source.

Parameters:
uriURI struct with firmware location.
costPointer to variable for the return value.
Returns:
Error code.

Definition at line 281 of file lwm2m-source.cpp.

arm_uc_error_t ARM_UCS_LWM2M_SOURCE_GetKeytableURL ( arm_uc_uri_t *  uri,
arm_uc_buffer_t *  buffer 
)

Retrieve a key table from a URL.

Key table is stored in supplied buffer. Event is generated once fragment is in buffer.

Parameters:
uriURI struct with keytable location.
bufferStruct containing byte array, maximum size, and actual size.
Returns:
Error code.

Definition at line 382 of file lwm2m-source.cpp.

arm_uc_error_t ARM_UCS_LWM2M_SOURCE_GetKeytableURLCost ( arm_uc_uri_t *  uri,
uint32_t *  cost 
)

Cost estimation for retrieving key table from URL.

The estimation can vary over time and should not be cached too long. 0x00000000 - The firmware is already downloaded. 0xFFFFFFFF - Cannot retrieve firmware from this Source.

Parameters:
uriURI struct with keytable location.
costPointer to variable for the return value.
Returns:
Error code.

Definition at line 309 of file lwm2m-source.cpp.

arm_uc_error_t ARM_UCS_LWM2M_SOURCE_GetManifestDefault ( arm_uc_buffer_t *  buffer,
uint32_t  offset 
)

Retrieve manifest from the default location.

Manifest is stored in supplied buffer. Event is generated once manifest is in buffer.

Parameters:
bufferStruct containing byte array, maximum size, and actual size.
Returns:
Error code.

Definition at line 154 of file lwm2m-source.cpp.

arm_uc_error_t ARM_UCS_LWM2M_SOURCE_GetManifestDefaultCost ( uint32_t *  cost )

Cost estimation for retrieving manifest from the default location.

The estimation can vary over time and should not be cached too long. 0x00000000 - The manifest is already downloaded. 0xFFFFFFFF - Cannot retrieve manifest from this Source.

Parameters:
costPointer to variable for the return value.
Returns:
Error code.

Definition at line 123 of file lwm2m-source.cpp.

arm_uc_error_t ARM_UCS_LWM2M_SOURCE_GetManifestURL ( arm_uc_uri_t *  uri,
arm_uc_buffer_t *  buffer,
uint32_t  offset 
)

Retrieve manifest from URL.

Manifest is stored in supplied buffer. Event is generated once manifest is in buffer.

Parameters:
uriURI struct with manifest location.
bufferStruct containing byte array, maximum size, and actual size.
Returns:
Error code.

Definition at line 337 of file lwm2m-source.cpp.

arm_uc_error_t ARM_UCS_LWM2M_SOURCE_GetManifestURLCost ( arm_uc_uri_t *  uri,
uint32_t *  cost 
)

Cost estimation for retrieving manifest from URL.

The estimation can vary over time and should not be cached too long. 0x00000000 - The manifest is already downloaded. 0xFFFFFFFF - Cannot retrieve manifest from this Source.

Parameters:
uriURI struct with manifest location.
costPointer to variable for the return value.
Returns:
Error code.

Definition at line 253 of file lwm2m-source.cpp.

uint32_t ARM_UCS_LWM2M_SOURCE_GetVersion ( void   )

Get driver version.

Returns:
Driver version.

Definition at line 42 of file lwm2m-source.cpp.

arm_uc_error_t ARM_UCS_LWM2M_SOURCE_Initialize ( ARM_SOURCE_SignalEvent_t  cb_event )

Initialize Source.

Function pointer to event handler is passed as argument.

Parameters:
cb_eventFunction pointer to event handler. See events above.
Returns:
Error code.

Definition at line 77 of file lwm2m-source.cpp.

arm_uc_error_t ARM_UCS_LWM2M_SOURCE_Uninitialize ( void   )

Uninitialized Source.

Returns:
Error code.

Definition at line 105 of file lwm2m-source.cpp.