Sink API
Version: 1.0.0
Status:
Sink interface for Thunder framework.
(Defined with IBluetoothAudio::ISink in IBluetoothAudio.h)
Table of Contents
Introduction
Scope
This document describes purpose and functionality of the Sink interface (version 1.0.0). It includes detailed specification about its methods and properties as well as sent notifications.
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 |
Description
Sink JSON-RPC interface.
This interface uses legacy
lowercase
naming convention. With the next major release the naming convention will change tocamelCase
.
Methods
The following methods are provided by the Sink interface:
BluetoothAudio Sink interface methods:
Method | Description |
---|---|
sink::assign | Assigns a Bluetooth sink device for audio playback |
sink::revoke | Revokes a Bluetooth sink device from audio playback |
sink::assign method
Assigns a Bluetooth sink device for audio playback.
Parameters
Name | Type | M/O | Description |
---|---|---|---|
params | object | mandatory | ... |
params.address | string | mandatory | Address of the bluetooth device to assign |
Result
Name | Type | M/O | Description |
---|---|---|---|
result | null | mandatory | Always null |
Errors
Message | Description |
---|---|
ERROR_BAD_REQUEST |
Device address value is invalid |
ERROR_ALREADY_CONNECTED |
A sink device is already assigned |
Example
Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.sink::assign",
"params": {
"address": "..."
}
}
Response
{
"jsonrpc": "2.0",
"id": 42,
"result": null
}
sink::revoke method
Revokes a Bluetooth sink device from audio playback.
Parameters
This method takes no parameters.
Result
Name | Type | M/O | Description |
---|---|---|---|
result | null | mandatory | Always null |
Errors
Message | Description |
---|---|
ERROR_ALREADY_RELEASED |
No device is currently assigned as sink |
Example
Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.sink::revoke"
}
Response
{
"jsonrpc": "2.0",
"id": 42,
"result": null
}
Properties
The following properties are provided by the Sink interface:
BluetoothAudio Sink interface properties:
Property | R/W | Description |
---|---|---|
sink::state | read-only | Current state o the audio sink device |
sink::device | read-only | Bluetooth address of the audio sink device |
sink::type | read-only | Type of the audio sink device |
sink::latency | read/write | Latency of the audio sink device |
sink::supportedcodecs | read-only | Audio codecs supported by the audio sink device |
sink::supporteddrms | read-only | DRM schemes supported by the audio sink device |
sink::codec | read-only | Properites of the currently used audio codec |
sink::drm | read-only | Properites of the currently used DRM scheme |
sink::stream | read-only | Properties of the currently transmitted audio stream |
sink::state property
Provides access to the current state o the audio sink device.
This property is read-only.
Value
Name | Type | M/O | Description |
---|---|---|---|
(property) | string | mandatory | Current state o the audio sink device (must be one of the following: Connected, ConnectedBad, ConnectedRestricted, Connecting, Disconnected, Ready, Streaming, Unassigned) |
Example
Get Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.sink::state"
}
Get Response
{
"jsonrpc": "2.0",
"id": 42,
"result": "Disconnected"
}
sink::device property
Provides access to the bluetooth address of the audio sink device.
This property is read-only.
Value
Name | Type | M/O | Description |
---|---|---|---|
(property) | string | mandatory | Bluetooth address of the audio sink device |
Errors
Message | Description |
---|---|
ERROR_ILLEGAL_STATE |
The sink device currently is not assigned |
Example
Get Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.sink::device"
}
Get Response
{
"jsonrpc": "2.0",
"id": 42,
"result": "..."
}
sink::type property
Provides access to the type of the audio sink device.
This property is read-only.
Value
Name | Type | M/O | Description |
---|---|---|---|
(property) | string | mandatory | Type of the audio sink device (must be one of the following: Amplifier, Headphone, Recorder, Speaker, Unknown) |
Errors
Message | Description |
---|---|
ERROR_ILLEGAL_STATE |
The sink device currently is not connected |
Example
Get Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.sink::type"
}
Get Response
{
"jsonrpc": "2.0",
"id": 42,
"result": "Headphone"
}
sink::latency property
Provides access to the latency of the audio sink device.
Value
Name | Type | M/O | Description |
---|---|---|---|
(property) | object | mandatory | Latency of the audio sink device |
(property).value | integer | mandatory | Audio latency in milliseconds |
Name | Type | M/O | Description |
---|---|---|---|
(property) | integer | mandatory | Latency of the audio sink device |
Errors
Message | Description |
---|---|
ERROR_BAD_REQUEST |
Latency value is invalid |
Example
Get Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.sink::latency"
}
Get Response
{
"jsonrpc": "2.0",
"id": 42,
"result": 0
}
Set Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.sink::latency",
"params": {
"value": 20
}
}
Set Response
{
"jsonrpc": "2.0",
"id": 42,
"result": "null"
}
sink::supportedcodecs property
Provides access to the audio codecs supported by the audio sink device.
This property is read-only.
Value
Name | Type | M/O | Description |
---|---|---|---|
(property) | array | mandatory | Audio codecs supported by the audio sink device |
(property)[#] | string | mandatory | ... (must be one of the following: LC-SBC) |
Errors
Message | Description |
---|---|
ERROR_ILLEGAL_STATE |
The sink device currently is not connected |
Example
Get Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.sink::supportedcodecs"
}
Get Response
{
"jsonrpc": "2.0",
"id": 42,
"result": [
"LC-SBC"
]
}
sink::supporteddrms property
Provides access to the DRM schemes supported by the audio sink device.
This property is read-only.
Value
Name | Type | M/O | Description |
---|---|---|---|
(property) | array | mandatory | DRM schemes supported by the audio sink device |
(property)[#] | string | mandatory | ... (must be one of the following: DTCP, SCMS-T) |
Errors
Message | Description |
---|---|
ERROR_ILLEGAL_STATE |
The sink device currently is not connected |
Example
Get Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.sink::supporteddrms"
}
Get Response
{
"jsonrpc": "2.0",
"id": 42,
"result": [
"SCMS-T"
]
}
sink::codec property
Provides access to the properites of the currently used audio codec.
This property is read-only.
Value
Name | Type | M/O | Description |
---|---|---|---|
(property) | object | mandatory | Properites of the currently used audio codec |
(property).codec | string | mandatory | Audio codec used (must be one of the following: LC-SBC) |
(property).settings | opaque object | mandatory | Codec-specific audio quality preset, compression profile, etc |
Errors
Message | Description |
---|---|
ERROR_ILLEGAL_STATE |
The sink device currently is not configured |
Example
Get Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.sink::codec"
}
Get Response
{
"jsonrpc": "2.0",
"id": 42,
"result": {
"codec": "LC-SBC",
"settings": {}
}
}
sink::drm property
Provides access to the properites of the currently used DRM scheme.
This property is read-only.
Value
Name | Type | M/O | Description |
---|---|---|---|
(property) | object | mandatory | Properites of the currently used DRM scheme |
(property).drm | string | mandatory | Content protection scheme used (must be one of the following: DTCP, SCMS-T) |
(property).settings | opaque object | mandatory | DRM-specific content protection level, encoding rules, etc |
Errors
Message | Description |
---|---|
ERROR_ILLEGAL_STATE |
The sink device currently is not connected or not yet configured |
Example
Get Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.sink::drm"
}
Get Response
{
"jsonrpc": "2.0",
"id": 42,
"result": {
"drm": "SCMS-T",
"settings": {}
}
}
sink::stream property
Provides access to the properties of the currently transmitted audio stream.
This property is read-only.
Value
Name | Type | M/O | Description |
---|---|---|---|
(property) | object | mandatory | Properties of the currently transmitted audio stream |
(property).samplerate | integer | mandatory | Sample rate in Hz |
(property).bitrate | integer | mandatory | Target bitrate in bits per second (eg. 320000) |
(property).channels | integer | mandatory | Number of audio channels |
(property).resolution | integer | mandatory | Sampling resolution in bits per sample |
(property).isresampled | boolean | mandatory | Indicates if the source stream is being resampled by the stack to match sink capabilities |
Errors
Message | Description |
---|---|
ERROR_ILLEGAL_STATE |
The sink device currently is not connected or not yet configured |
Example
Get Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.sink::stream"
}
Get Response
{
"jsonrpc": "2.0",
"id": 42,
"result": {
"samplerate": 44100,
"bitrate": 0,
"channels": 2,
"resolution": 16,
"isresampled": false
}
}
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 Sink interface:
BluetoothAudio Sink interface events:
Notification | Description |
---|---|
sink::statechanged | Signals audio sink state change |
sink::statechanged notification
Signals audio sink state change.
Notification Parameters
Name | Type | M/O | Description |
---|---|---|---|
params | object | mandatory | ... |
params.state | string | mandatory | Changed BluetoothAudio State (must be one of the following: Connected, ConnectedBad, ConnectedRestricted, Connecting, Disconnected, Ready, Streaming, Unassigned) |
Example
Registration
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.register",
"params": {
"event": "sink::statechanged",
"id": "myid"
}
}
Notification
{
"jsonrpc": "2.0",
"method": "myid.sink::statechanged",
"params": {
"state": "Disconnected"
}
}
The client ID parameter is passed within the notification designator, i.e.
<client-id>.sink::statechanged
.