Power Plugin
Version: 1.0
Status:
Power plugin for Thunder framework.
Table of Contents
Introduction
Scope
This document describes purpose and functionality of the Power plugin. It includes detailed specification about its configuration, methods and properties provided.
Case Sensitivity
All identifiers of 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.
Acronyms, Abbreviations and Terms
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. |
References
Ref ID | Description |
---|---|
HTTP | HTTP specification |
JSON-RPC | JSON-RPC 2.0 specification |
JSON | JSON specification |
Thunder | Thunder API Reference |
Configuration
The table below lists configuration options of the plugin.
Name | Type | M/O | Description |
---|---|---|---|
callsign | string | mandatory | Plugin instance name (default: Power) |
classname | string | mandatory | Class name: Power |
locator | string | mandatory | Library name: libThunderPower.so |
startmode | string | mandatory | Determines in which state the plugin should be moved to at startup of the framework |
configuration | object | optional | ... |
configuration?.powerkey | integer | optional | Key associated as powerkey |
configuration?.offmode | string | optional | Type of offmode |
configuration?.control | boolean | optional | Enable control clients |
configuration?.gpiopin | integer | optional | GGIO pin (Broadcom) |
configuration?.gpiotype | sting | optional | GPIO type (Broadcom) |
configuration?.statechange | integer | optional | Statechange (Broadcom) |
Interfaces
This plugin implements the following interfaces:
- Power.json (version 1.0.0) (compliant format)
Methods
The following methods are provided by the Power plugin:
Power interface methods:
Method | Description |
---|---|
set | Sets power state |
set method
Sets power state.
Parameters
Name | Type | M/O | Description |
---|---|---|---|
params | object | mandatory | ... |
params.powerstate | string | mandatory | Power state (must be one of the following: activestandby, hibernate, on, passivestandby, poweroff, suspendtoram) |
params.timeout | integer | mandatory | Time to wait for power state change |
Result
Name | Type | M/O | Description |
---|---|---|---|
result | null | mandatory | Always null (default: None) |
Errors
Message | Description |
---|---|
ERROR_GENERAL |
General failure |
ERROR_DUPLICATE_KEY |
Trying to set the same power mode |
ERROR_ILLEGAL_STATE |
Power state is not supported |
ERROR_BAD_REQUEST |
Invalid Power state or Bad JSON param data format |
Example
Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "Power.1.set",
"params": {
"powerstate": "on",
"timeout": 0
}
}
Response
{
"jsonrpc": "2.0",
"id": 42,
"result": null
}
Properties
The following properties are provided by the Power plugin:
Power interface properties:
Property | R/W | Description |
---|---|---|
state | read-only | Power state |
state property
Provides access to the power state.
This property is read-only.
Value
Name | Type | M/O | Description |
---|---|---|---|
(property) | string | mandatory | Power state (must be one of the following: activestandby, hibernate, on, passivestandby, poweroff, suspendtoram) |
Example
Get Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "Power.1.state"
}
Get Response
{
"jsonrpc": "2.0",
"id": 42,
"result": "on"
}