Skip to content

Latest commit

 

History

History
279 lines (207 loc) · 6.79 KB

File metadata and controls

279 lines (207 loc) · 6.79 KB

FirmwareUpdate Plugin

Version: 1.0.0

A FirmwareUpdate plugin for Thunder framework.

Table of Contents

Abbreviation, Acronyms and Terms

[Refer to this link]

Description

The FirmwareUpdate plugin provides an interface for FirmwareUpdate.

The plugin is designed to be loaded and executed within the Thunder framework. For more information about the framework refer to [Thunder].

Configuration

The table below lists configuration options of the plugin.

Name Type Description
callsign string Plugin instance name (default: org.rdk.FirmwareUpdate)
classname string Class name: FirmwareUpdate
locator string Library name: libWPEFrameworkFirmwareUpdate.so
autostart boolean Determines if the plugin shall be started automatically along with the framework

Methods

The following methods are provided by the FirmwareUpdate plugin:

FirmwareUpdate interface methods:

Method Description
getUpdateState Firmware update consists of 2 major steps: 1. Firmware Validation, and 2. Firmware Flashing. This method returns the "status" of these steps in the firmware update process that was triggered by updateFirmware
setAutoReboot Enable or disable the AutoReboot feature.
updateFirmware Initiates a firmware update.

getUpdateState

Firmware update consists of 2 major steps: 1. Firmware Validation, and 2. Firmware Flashing. This method returns the "status" of these steps in the firmware update process that was triggered by updateFirmware

Events

Event details will be updated soon.

Parameters

This method takes no parameters.

Results

Name Type Description
result object
result.getUpdateStateResult GetUpdateStateResult
result.getUpdateStateResult.state string state
result.getUpdateStateResult.substate string substate

Examples

Request

{
    "jsonrpc": 2.0,
    "id": 0,
    "method": "org.rdk.FirmwareUpdate.getUpdateState"
}

CURL Command

curl -H 'content-type:text/plain;' --data-binary '{"jsonrpc": 2.0, "id": 0, "method": "org.rdk.FirmwareUpdate.getUpdateState"}' http://127.0.0.1:9998/jsonrpc

Response

{
    "jsonrpc": 2.0,
    "id": 0,
    "result": {
        "state": "VALIDATION_FAILED",
        "substate": "NOT_APPLICABLE"
    }
}

setAutoReboot

Enable or disable the AutoReboot feature.

Events

Event details will be updated soon.

Parameters

Name Type Description
params object
params.enable bool Boolean to enable or disable AutoReboot

Results

Name Type Description
result object
result.success bool success

Examples

Request

{
    "jsonrpc": 2.0,
    "id": 1,
    "method": "org.rdk.FirmwareUpdate.setAutoReboot",
    "params": {
        "enable": true
    }
}

CURL Command

curl -H 'content-type:text/plain;' --data-binary '{"jsonrpc": 2.0, "id": 1, "method": "org.rdk.FirmwareUpdate.setAutoReboot", "params": {"enable": true}}' http://127.0.0.1:9998/jsonrpc

Response

{
    "jsonrpc": 2.0,
    "id": 1,
    "result": {
        "success": true
    }
}

updateFirmware

Initiates a firmware update.

Events

Event details will be updated soon.

Parameters

Name Type Description
params object
params.firmwareFilepath string The complete path of the firmware file to which the device needs to be updated to.
params.firmwareType string Type of firmware. One of the following (PCI,DRI)

Results

Name Type Description
result object
result.success bool success

Examples

Request

{
    "jsonrpc": 2.0,
    "id": 2,
    "method": "org.rdk.FirmwareUpdate.updateFirmware",
    "params": {
        "firmwareFilepath": "",
        "firmwareType": ""
    }
}

CURL Command

curl -H 'content-type:text/plain;' --data-binary '{"jsonrpc": 2.0, "id": 2, "method": "org.rdk.FirmwareUpdate.updateFirmware", "params": {"firmwareFilepath": "", "firmwareType": ""}}' http://127.0.0.1:9998/jsonrpc

Response

{
    "jsonrpc": 2.0,
    "id": 2,
    "result": {
        "success": true
    }
}

Notifications

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 FirmwareUpdate plugin:

FirmwareUpdate interface events:

Event Description
onFlashingStateChange This notification is raised between flashing started state and flashing succeeded/failed.
onUpdateStateChange notify Firmware update state change.

onFlashingStateChange

This notification is raised between flashing started state and flashing succeeded/failed.

Parameters

Name Type Description
params object
params.percentageComplete integer Number between 0 and 100 indicating the "percentage complete" of the flashing process.

Examples

{
    "jsonrpc": 2.0,
    "id": 3,
    "method": "org.rdk.FirmwareUpdate.onFlashingStateChange",
    "params": {
        "percentageComplete": 0
    }
}

onUpdateStateChange

notify Firmware update state change.

Parameters

Name Type Description
params object
params.state string state
params.substate string substate

Examples

{
    "jsonrpc": 2.0,
    "id": 4,
    "method": "org.rdk.FirmwareUpdate.onUpdateStateChange",
    "params": {
        "state": "VALIDATION_FAILED",
        "substate": "NOT_APPLICABLE"
    }
}