Notify the application of a new software update and perform the update.
More...
|
enum | oc_swupdate_result_t {
OC_SWUPDATE_RESULT_IDLE = 0
, OC_SWUPDATE_RESULT_SUCCESS
, OC_SWUPDATE_RESULT_LESS_RAM
, OC_SWUPDATE_RESULT_LESS_FLASH
,
OC_SWUPDATE_RESULT_CONN_FAIL
, OC_SWUPDATE_RESULT_SVV_FAIL
, OC_SWUPDATE_RESULT_INVALID_URL
, OC_SWUPDATE_RESULT_UNSUPPORTED_PROT
,
OC_SWUPDATE_RESULT_UPGRADE_FAIL
} |
| OCF defined software update results. More...
|
|
enum | oc_swupdate_validate_update_error_t {
OC_SWUPDATE_VALIDATE_UPDATE_ERROR_INVALID_IMPLEMENTATION
, OC_SWUPDATE_VALIDATE_UPDATE_ERROR_INVALID_PROPERTY = -8
, OC_SWUPDATE_VALIDATE_UPDATE_ERROR_READONLY_PROPERTY
, OC_SWUPDATE_VALIDATE_UPDATE_ERROR_INVALID_PROPERTY_VALUE
,
OC_SWUPDATE_VALIDATE_UPDATE_ERROR_UPDATETIME_NOT_SET
, OC_SWUPDATE_VALIDATE_UPDATE_ERROR_UPDATETIME_INVALID
, OC_SWUPDATE_VALIDATE_UPDATE_ERROR_PURL_NOT_SET
, OC_SWUPDATE_VALIDATE_UPDATE_ERROR_PURL_INVALID
} |
| Validation error codes. More...
|
|
|
long | oc_swupdate_dump (size_t device) |
| Save device swupdate to storage. More...
|
|
long | oc_swupdate_load (size_t device) |
| Load device swupdate from storage. More...
|
|
void | oc_swupdate_notify_done (size_t device, oc_swupdate_result_t result) |
| callback to notify if a new software version is complete More...
|
|
void | oc_swupdate_notify_downloaded (size_t device, const char *version, oc_swupdate_result_t result) |
| callback to notify if a new software version is downloaded More...
|
|
void | oc_swupdate_notify_new_version_available (size_t device, const char *version, oc_swupdate_result_t result) |
| callback to notify if a new software version is available More...
|
|
void | oc_swupdate_notify_upgrading (size_t device, const char *version, oc_clock_time_t timestamp, oc_swupdate_result_t result) |
| callback to notify if a new software version is upgrading More...
|
|
void | oc_swupdate_set_impl (const oc_swupdate_cb_t *swupdate_impl) |
| sets the callbacks for software upgrade More...
|
|
bool | oc_swupdate_validate_update (size_t device, const oc_rep_t *rep, oc_swupdate_on_validate_update_error_fn_t on_error, void *data) |
| validates the payload of a software update request More...
|
|
Notify the application of a new software update and perform the update.
◆ oc_swupdate_on_validate_update_error_fn_t
callback invoked by oc_swupdate_validate_update when an error is encountered
- Parameters
-
rep | property that caused the error (for OC_SWUPDATE_VALIDATE_UPDATE_ERROR_INVALID_PROPERTY, OC_SWUPDATE_VALIDATE_UPDATE_ERROR_READONLY_PROPERTY, OC_SWUPDATE_VALIDATE_UPDATE_ERROR_INVALID_PROPERTY_VALUE), NULL for other errors |
error | error code |
data | user data |
- Returns
- true if oc_swupdate_validate_update should continue
-
false if oc_swupdate_validate_update should stop
◆ oc_swupdate_result_t
OCF defined software update results.
Enumerator |
---|
OC_SWUPDATE_RESULT_IDLE | Idle.
|
OC_SWUPDATE_RESULT_SUCCESS | software update successful
|
OC_SWUPDATE_RESULT_LESS_RAM | not enough RAM
|
OC_SWUPDATE_RESULT_LESS_FLASH | not enough FLASH
|
OC_SWUPDATE_RESULT_CONN_FAIL | connection failure
|
OC_SWUPDATE_RESULT_SVV_FAIL | version failure
|
OC_SWUPDATE_RESULT_INVALID_URL | invalid URL
|
OC_SWUPDATE_RESULT_UNSUPPORTED_PROT | unsupported protocol for URL
|
OC_SWUPDATE_RESULT_UPGRADE_FAIL | upgrade failure
|
◆ oc_swupdate_validate_update_error_t
Validation error codes.
Enumerator |
---|
OC_SWUPDATE_VALIDATE_UPDATE_ERROR_INVALID_IMPLEMENTATION | software update callbacks not assigned correctly
|
OC_SWUPDATE_VALIDATE_UPDATE_ERROR_INVALID_PROPERTY | invalid property
|
OC_SWUPDATE_VALIDATE_UPDATE_ERROR_READONLY_PROPERTY | trying to update a read-only property
|
OC_SWUPDATE_VALIDATE_UPDATE_ERROR_INVALID_PROPERTY_VALUE | invalid property value
|
OC_SWUPDATE_VALIDATE_UPDATE_ERROR_UPDATETIME_NOT_SET | updatetime property is not set
|
OC_SWUPDATE_VALIDATE_UPDATE_ERROR_UPDATETIME_INVALID | updatetime property has invalid value
|
OC_SWUPDATE_VALIDATE_UPDATE_ERROR_PURL_NOT_SET | purl property not set
|
OC_SWUPDATE_VALIDATE_UPDATE_ERROR_PURL_INVALID | purl property has invalid value
|
◆ oc_swupdate_dump()
long oc_swupdate_dump |
( |
size_t |
device | ) |
|
Save device swupdate to storage.
- Parameters
-
device | index of the device |
- Returns
- <0 on error
-
>=0 on success, number of bytes written to storage
◆ oc_swupdate_load()
long oc_swupdate_load |
( |
size_t |
device | ) |
|
Load device swupdate from storage.
- Parameters
-
device | index of the device |
- Returns
- <0 on error
-
>=0 on success, number of bytes read from storage
◆ oc_swupdate_notify_done()
callback to notify if a new software version is complete
- Parameters
-
device | the device identifier |
result | status |
◆ oc_swupdate_notify_downloaded()
void oc_swupdate_notify_downloaded |
( |
size_t |
device, |
|
|
const char * |
version, |
|
|
oc_swupdate_result_t |
result |
|
) |
| |
callback to notify if a new software version is downloaded
- Parameters
-
device | the device identifier |
version | version of the software (cannot be NULL) |
result | status |
◆ oc_swupdate_notify_new_version_available()
void oc_swupdate_notify_new_version_available |
( |
size_t |
device, |
|
|
const char * |
version, |
|
|
oc_swupdate_result_t |
result |
|
) |
| |
callback to notify if a new software version is available
- Parameters
-
device | the device identifier |
version | version of the software (cannot be NULL) |
result | status |
◆ oc_swupdate_notify_upgrading()
void oc_swupdate_notify_upgrading |
( |
size_t |
device, |
|
|
const char * |
version, |
|
|
oc_clock_time_t |
timestamp, |
|
|
oc_swupdate_result_t |
result |
|
) |
| |
callback to notify if a new software version is upgrading
- Parameters
-
device | the device identifier |
version | version of the software (cannot be NULL) |
timestamp | timestamp when the upgrade starts |
result | status |
◆ oc_swupdate_set_impl()
void oc_swupdate_set_impl |
( |
const oc_swupdate_cb_t * |
swupdate_impl | ) |
|
sets the callbacks for software upgrade
- Parameters
-
swupdate_impl | the structure with the software update callbacks |
- Note
- the callbacks are copied to runtime variable, so the validity of the structure is only required during the call to this function
◆ oc_swupdate_validate_update()
validates the payload of a software update request
- Parameters
-
device | device index |
rep | parsed payload of sofware update request to verify |
on_error | callback invoked when an error is encountered |
data | custom user data passed to on_error |
- Returns
- true if the payload is valid
-
false if the payload is invalid