Version: 1.0
Status: ⚫⚪⚪
BluetoothRemoteControl plugin for Thunder framework.
This document describes purpose and functionality of the BluetoothRemoteControl plugin. It includes detailed specification of its configuration, methods and properties provided, as well as notifications sent.
All identifiers on the interface 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 |
The Bluetooth Remote Control plugin allows configuring and enabling Bluetooth remote control units.
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: BluetoothRemoteControl) |
classname | string | Class name: BluetoothRemoteControl |
locator | string | Library name: libWPEFrameworkBluetoothRemoteControl.so |
autostart | boolean | Determines if the plugin is to be started automatically along with the framework |
The following methods are provided by the BluetoothRemoteControl plugin:
BluetoothRemoteControl interface methods:
Method | Description |
---|---|
assign | Assigns a bluetooth device as a remote control unit |
revoke | Revokes the current remote control assignment |
Assigns a bluetooth device as a remote control unit.
Name | Type | Description |
---|---|---|
params | object | |
params.address | string | Bluetooth address |
Name | Type | Description |
---|---|---|
result | null | Always null |
Code | Message | Description |
---|---|---|
2 | ERROR_UNAVAILABLE |
Bluetooth unavailable |
22 | ERROR_UNKNOWN_KEY |
Device unknown |
1 | ERROR_GENERAL |
Failed to assign the device |
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "BluetoothRemoteControl.1.assign",
"params": {
"address": "81:6F:B0:91:9B:FE"
}
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": null
}
Revokes the current remote control assignment.
This method takes no parameters.
Name | Type | Description |
---|---|---|
result | null | Always null |
Code | Message | Description |
---|---|---|
5 | ERROR_ILLEGAL_STATE |
Remote not assigned |
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "BluetoothRemoteControl.1.revoke"
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": null
}
The following properties are provided by the BluetoothRemoteControl plugin:
BluetoothRemoteControl interface properties:
Property | Description |
---|---|
name RO | Unit name |
address RO | Bluetooth address of the unit |
info RO | Unit auxiliary information |
batterylevel RO | Battery level |
audioprofile RO | Audio profile details |
Provides access to the unit name.
This property is read-only.
Name | Type | Description |
---|---|---|
(property) | string | Name of the remote control unit |
Code | Message | Description |
---|---|---|
5 | ERROR_ILLEGAL_STATE |
No remote has been assigned |
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "BluetoothRemoteControl.1.name"
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": "Acme Bluetooth RCU"
}
Provides access to the bluetooth address of the unit.
This property is read-only.
Name | Type | Description |
---|---|---|
(property) | string | Bluetooth address |
Code | Message | Description |
---|---|---|
5 | ERROR_ILLEGAL_STATE |
No remote has been assigned |
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "BluetoothRemoteControl.1.address"
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": "81:6F:B0:91:9B:FE"
}
Provides access to the unit auxiliary information.
This property is read-only.
Name | Type | Description |
---|---|---|
(property) | object | Unit auxiliary information |
(property)?.model | string | (optional) Unit model name or number |
(property)?.serial | string | (optional) Unit serial number |
(property)?.firmware | string | (optional) Unit firmware revision |
(property)?.software | string | (optional) Unit software revision |
(property)?.manufacturer | string | (optional) Unit manufacturer name |
Code | Message | Description |
---|---|---|
5 | ERROR_ILLEGAL_STATE |
No remote has been assigned |
1 | ERROR_GENERAL |
Failed to retrieve information |
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "BluetoothRemoteControl.1.info"
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": {
"model": "Acme 1500 Plus",
"serial": "1234567890",
"firmware": "1.0",
"software": "1.0",
"manufacturer": "Acme Inc."
}
}
Provides access to the battery level.
This property is read-only.
Name | Type | Description |
---|---|---|
(property) | number | Remote control unit's battery level in percentage |
Code | Message | Description |
---|---|---|
5 | ERROR_ILLEGAL_STATE |
No remote has been assigned |
1 | ERROR_GENERAL |
Failed to retrieve battery level |
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "BluetoothRemoteControl.1.batterylevel"
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": 50
}
Provides access to the audio profile details.
This property is read-only.
Name | Type | Description |
---|---|---|
(property) | object | Audio profile details |
(property).codec | string | Name of the audio codec (pcm for uncompressed audio) (must be one of the following: PCM, ADPCM) |
(property).channels | number | Number of audio channels (1: mono, 2: stereo, etc.) |
(property).rate | number | Sample rate (in Hz) |
(property).resolution | number | Sample resolution (in bits per sample) |
Code | Message | Description |
---|---|---|
5 | ERROR_ILLEGAL_STATE |
No remote has been assigned |
22 | ERROR_UNKNOWN_KEY |
The supplied audio profile is unknown |
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "BluetoothRemoteControl.1.audioprofile"
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": {
"codec": "ADPCM",
"channels": 1,
"rate": 16000,
"resolution": 16
}
}
Notifications are autonomous events, triggered by the internals of the plugin, 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 BluetoothRemoteControl plugin:
BluetoothRemoteControl interface events:
Event | Description |
---|---|
audiotransmission | Notifies about audio data transmission |
audioframe | Notifies about new audio data available |
batterylevelchange | Notifies about battery level changes |
Notifies about audio data transmission.
Register to this event to be notified about audio transmission status
Name | Type | Description |
---|---|---|
params | object | |
params?.profile | string | (optional) Type of audio profile, marking start of transmission; empty in case of end of transmission |
{
"jsonrpc": "2.0",
"method": "client.events.1.audiotransmission",
"params": {
"profile": "pcm"
}
}
Notifies about new audio data available.
Register to this event to be notified about audio data
Name | Type | Description |
---|---|---|
params | object | |
params?.seq | number | (optional) Sequence number of the audio frame within current audio transmission |
params.data | string | Base64 representation of the binary data of the audio frame; format of the data is specified by the audio profile denoted by the most recent audiotransmission notification |
{
"jsonrpc": "2.0",
"method": "client.events.1.audioframe",
"params": {
"seq": 1,
"data": "yKMHiYh6qJiDspB6S7ihlKOAbivApYEQDCgY0aECCQhpkAqZogP1ECk9GbHGEAkwG8Ax8wArgaAtEMjGQIoYCKKgGCuzBSA/iuWkKEwamLKzOKoCeR2hwQQZKqgBKKqELoGQwQ=="
}
}
Notifies about battery level changes.
Register to this event to be notified about battery level drops
Name | Type | Description |
---|---|---|
params | object | |
params.level | number | Battery level (in percentage) |
{
"jsonrpc": "2.0",
"method": "client.events.1.batterylevelchange",
"params": {
"level": 50
}
}