Firmware Update
Firmware update operations. More...
Functions | |
gos_result_t | gos_dms_dfu_query (gos_dms_query_status_t *status_ptr, gos_buffer_t *server_msg) |
Query DMS if a firmware update is available. More... | |
gos_result_t | gos_dms_ota_update (const char *version_str, bool allow_multi_pass) |
Update device's firmware. More... | |
gos_dfu_status_t | gos_dms_get_dfu_status (void) |
Return result of last firmware update (if available) More... | |
void | gos_dms_clear_dfu_status (void) |
Clear the DFU status to GOS_DFU_STATUS_NONE. More... | |
Detailed Description
Firmware update operations.
Function Documentation
◆ gos_dms_clear_dfu_status()
void gos_dms_clear_dfu_status | ( | void |
| ) |
Clear the DFU status to GOS_DFU_STATUS_NONE.
- See also
- gos_dms_get_dfu_status() for retrieving the current DFU status.
- Examples:
- dms/ota_update/main.c.
◆ gos_dms_dfu_query()
gos_result_t gos_dms_dfu_query | ( | gos_dms_query_status_t * | status_ptr, |
gos_buffer_t * | server_msg |
||
) |
Query DMS if a firmware update is available.
This queries the DMS and returns if an update is available. If thie API returns GOS_SUCCESS and status_ptr
is:
- GOS_DMS_QUERY_STATUS_UP_TO_DATE - the device's current firmware is up-to-date
- GOS_DMS_QUERY_STATUS_AVAILABLE - an update is available, and
server_msg
argument will contain the available firmware version string - GOS_DMS_QUERY_STATUS_ERROR - the DMS returned an error and
server_msg
argument will contain the error message from the DMS
See the Gecko OS command documentation for more information: dfu_query
- Note
- The
server_msg
argument, a gos_buffer_t, should be pre-configured to point to a buffer that will be populated with a message from the server. The.data
member should point to a string buffer. Thesize
to be the size of the string buffer.
- Parameters
-
[out] status_ptr
Pointer to gos_dms_query_status_t which will contain if an update is available [out] server_msg
gos_buffer_t pointer to buffer to hold message from server, leave NULL if unused
- Returns
- Result of API, see gos_result_t
- Examples:
- dms/ota_update/main.c.
◆ gos_dms_get_dfu_status()
gos_dfu_status_t gos_dms_get_dfu_status | ( | void |
| ) |
Return result of last firmware update (if available)
This returns the result of the last firmware update. This is typically called after calling gos_dms_ota_update()
Refer to gos_dfu_status_t for the available results codes.
- Note
- The result codes are reset after a power-cycle or another DFU attempt
- Returns
- Result of DFU, see gos_dfu_status_t
- Examples:
- dms/ota_update/main.c.
◆ gos_dms_ota_update()
gos_result_t gos_dms_ota_update | ( | const char * | version_str, |
bool | allow_multi_pass |
||
) |
Update device's firmware.
This API will invoke an OTA DFU update. The firmware the device is update to is determined by the supplied version
argument.
If version
is:
- GOS_DMS_UPDATE_LATEST - update to latest firmware only if out-dated.
- else version string - update to specified version (e.g. "3.3.2")
The DMS uses the device's current product
to determine the available firmware. The device's product
can be configured via web0based DMS GUI or gos_dms_activate().
If successful, this API does NOT return. This API will immediately invoke the Gecko OS Kernel to perform the update. After attempting/performing the update, the Kernel will return control to the Gecko OS Services.
To determine the result of the update, use gos_dms_get_dfu_status().
See the Gecko OS command documentation for more information: dfu_update
- Note
- The API requires valid network credentials with an internet connection. If successful, this API does NOT return. After the update the app begins execution from the beginning.
- Parameters
-
[in] version_str
Version to update firmware to, see this function's description for more information [in] allow_multi_pass
Enable/disab;e 'multi-pass' updates
- Returns
- Result of API, see gos_result_t
- Examples:
- dms/ota_update/main.c.