Version: 1.0
Status: ⚫⚪⚪
FirmwareControl plugin for Thunder framework.
This document describes purpose and functionality of the FirmwareControl plugin. It includes detailed specification of its configuration, methods and properties provided, as well as notifications sent.
All identifiers on the interfaces described in this document are case-sensitive. Thus, unless stated otherwise, all keywords, entities, properties, relations and actions should be treated as such.
The table below provides and overview of acronyms used in this document and their definitions.
Acronym | Description |
---|---|
API | Application Programming Interface |
HTTP | Hypertext Transfer Protocol |
JSON | JavaScript Object Notation; a data interchange format |
JSON-RPC | A remote procedure call protocol encoded in JSON |
The table below provides and overview of terms and abbreviations used in this document and their definitions.
Term | Description |
---|---|
callsign | The name given to an instance of a plugin. One plugin can be instantiated multiple times, but each instance the instance name, callsign, must be unique. |
Ref ID | Description |
---|---|
HTTP | HTTP specification |
JSON-RPC | JSON-RPC 2.0 specification |
JSON | JSON specification |
Thunder | Thunder API Reference |
Control Firmware upgrade to the device
The plugin is designed to be loaded and executed within the Thunder framework. For more information about the framework refer to [Thunder].
The table below lists configuration options of the plugin.
Name | Type | Description |
---|---|---|
callsign | string | Plugin instance name (default: FirmwareControl) |
classname | string | Class name: FirmwareControl |
locator | string | Library name: libWPEFrameworkFirmwareControl.so |
autostart | boolean | Determines if the plugin is to be started automatically along with the framework |
The following methods are provided by the FirmwareControl plugin:
FirmwareControl interface methods:
Method | Description |
---|---|
upgrade | Upgrade the device to the given firmware |
resume | Resume download from the last paused position |
Upgrade the device to the given firmware. (Note: Ensure size of firmware image should be < 500MB).
Also see: upgradeprogress
Name | Type | Description |
---|---|---|
params | object | |
params.name | string | Name of the firmware |
params?.location | string | (optional) Location or URL of the firmware to be upgraded |
params?.type | string | (optional) Type of the firmware (must be one of the following: CDL, RCDL) |
params?.progressinterval | number | (optional) Number of seconds between progress update events (5 seconds, 10 seconds etc). 0 means invoking callback only once to report final upgrade result |
params?.hmac | string | (optional) HMAC value of firmare |
Name | Type | Description |
---|---|---|
result | null | Always null |
Code | Message | Description |
---|---|---|
12 | ERROR_INPROGRESS |
Operation in progress |
15 | ERROR_INCORRECT_URL |
Invalid location given |
2 | ERROR_UNAVAILABLE |
Error in download |
30 | ERROR_BAD_REQUEST |
Bad file name given |
5 | ERROR_ILLEGAL_STATE |
Invalid state of device |
14 | ERROR_INCORRECT_HASH |
Incorrect hash given |
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "FirmwareControl.1.upgrade",
"params": {
"name": "firmware_v.0",
"location": "http://my.site.com/images",
"type": "RCDL",
"progressinterval": 10,
"hmac": "2834e6d07fa4c7778ef7a4e394f38a5c321afbed51d54ad512bd3fffbc7aa5debc"
}
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": null
}
Resume download from the last paused position.
Also see: upgradeprogress
Name | Type | Description |
---|---|---|
params | object | |
params.name | string | Name of the firmware |
params?.location | string | (optional) Location or URL of the firmware to be upgraded |
Name | Type | Description |
---|---|---|
result | null | Always null |
Code | Message | Description |
---|---|---|
12 | ERROR_INPROGRESS |
Operation in progress |
15 | ERROR_INCORRECT_URL |
Invalid location given |
2 | ERROR_UNAVAILABLE |
Error in download |
30 | ERROR_BAD_REQUEST |
Bad file name given |
5 | ERROR_ILLEGAL_STATE |
Invalid state of device |
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "FirmwareControl.1.resume",
"params": {
"name": "firmware_v.0",
"location": "http://my.site.com/images"
}
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": null
}
The following properties are provided by the FirmwareControl plugin:
FirmwareControl interface properties:
Property | Description |
---|---|
status RO | Current status of a upgrade |
downloadsize RO | Max free space available to download image |
Provides access to the current status of a upgrade.
This property is read-only.
Also see: upgradeprogress
Name | Type | Description |
---|---|---|
(property) | string | Upgrade status (must be one of the following: none, upgradestarted, downloadstarted, downloadaborted, downloadcompleted, installinitiated, installnotstarted, installaborted, installstarted, upgradecompleted, upgradecancelled) |
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "FirmwareControl.1.status"
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": "completed"
}
Provides access to the max free space available to download image.
This property is read-only.
Name | Type | Description |
---|---|---|
(property) | number | Available free space in bytes |
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "FirmwareControl.1.downloadsize"
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": 315576
}
Notifications are autonomous events, triggered by the internals of the implementation, and broadcasted via JSON-RPC to all registered observers. Refer to [Thunder] for information on how to register for a notification.
The following events are provided by the FirmwareControl plugin:
FirmwareControl interface events:
Event | Description |
---|---|
upgradeprogress | Notifies progress of upgrade |
Notifies progress of upgrade.
Name | Type | Description |
---|---|---|
params | object | |
params.status | string | Upgrade status (must be one of the following: none, upgradestarted, downloadstarted, downloadaborted, downloadcompleted, installinitiated, installnotstarted, installaborted, installstarted, upgradecompleted, upgradecancelled) |
params.error | string | Reason of error (must be one of the following: none, generic, invalidparameters, invalidstate, noenoughspace, operationotsupported, incorrecthash, unauthenticated, unavailable, timedout, downloaddirectorynotexist, resumenotsupported, invalidrange, unkown) |
params.progress | number | Progress of upgrade (number of bytes transferred during download or percentage of completion during install |
{
"jsonrpc": "2.0",
"method": "client.events.1.upgradeprogress",
"params": {
"status": "completed",
"error": "operationotsupported",
"progress": 89
}
}