Source API
Version: 1.0.0
Status:
Source interface for Thunder framework.
(Defined with IBluetoothAudio::ISource in IBluetoothAudio.h)
Table of Contents
Introduction
Scope
This document describes purpose and functionality of the Source interface (version 1.0.0). It includes detailed specification about its properties provided and notifications sent.
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
Source JSON-RPC interface.
This interface uses legacy
lowercase
naming convention. With the next major release the naming convention will change tocamelCase
.
Properties
The following properties are provided by the Source interface:
BluetoothAudio Source interface properties:
Property | R/W | Description |
---|---|---|
source::state | read-only | Current state of the source device |
source::device | read-only | Bluetooth address of the source device |
source::type | read-only | Type of the audio source device |
source::codec | read-only | Properites of the currently used codec |
source::drm | read-only | Properties of the currently used DRM scheme |
source::stream | read-only | Properites of the currently transmitted audio stream |
source::state property
Provides access to the current state of the source device.
This property is read-only.
Value
Name | Type | M/O | Description |
---|---|---|---|
(property) | string | mandatory | Current state of the source 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.source::state"
}
Get Response
{
"jsonrpc": "2.0",
"id": 42,
"result": "Disconnected"
}
source::device property
Provides access to the bluetooth address of the source device.
This property is read-only.
Value
Name | Type | M/O | Description |
---|---|---|---|
(property) | string | mandatory | Bluetooth address of the source device |
Errors
Message | Description |
---|---|
ERROR_ILLEGAL_STATE |
No source device is currently connected |
Example
Get Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.source::device"
}
Get Response
{
"jsonrpc": "2.0",
"id": 42,
"result": "..."
}
source::type property
Provides access to the type of the audio source device.
This property is read-only.
Value
Name | Type | M/O | Description |
---|---|---|---|
(property) | string | mandatory | Type of the audio source device (must be one of the following: Microphone, Mixer, Player, Tuner, Unknown) |
Errors
Message | Description |
---|---|
ERROR_ILLEGAL_STATE |
No source device is currently connected |
Example
Get Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.source::type"
}
Get Response
{
"jsonrpc": "2.0",
"id": 42,
"result": "Player"
}
source::codec property
Provides access to the properites of the currently used codec.
This property is read-only.
Value
Name | Type | M/O | Description |
---|---|---|---|
(property) | object | mandatory | Properites of the currently used 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 |
No source device is not connected or sink is not yet configured |
Example
Get Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.source::codec"
}
Get Response
{
"jsonrpc": "2.0",
"id": 42,
"result": {
"codec": "LC-SBC",
"settings": {}
}
}
source::drm property
Provides access to the properties of the currently used DRM scheme.
This property is read-only.
Value
Name | Type | M/O | Description |
---|---|---|---|
(property) | object | mandatory | Properties 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 |
No source device is connected or sink is not yet configured |
Example
Get Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.source::drm"
}
Get Response
{
"jsonrpc": "2.0",
"id": 42,
"result": {
"drm": "SCMS-T",
"settings": {}
}
}
source::stream property
Provides access to the properites of the currently transmitted audio stream.
This property is read-only.
Value
Name | Type | M/O | Description |
---|---|---|---|
(property) | object | mandatory | Properites 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 |
No source device is connected or sink is not yet configured |
Example
Get Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.source::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 Source interface:
BluetoothAudio Source interface events:
Notification | Description |
---|---|
source::statechanged | Signals audio source state change |
source::statechanged notification
Signals audio source 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": "source::statechanged",
"id": "myid"
}
}
Notification
{
"jsonrpc": "2.0",
"method": "myid.source::statechanged",
"params": {
"state": "Disconnected"
}
}
The client ID parameter is passed within the notification designator, i.e.
<client-id>.source::statechanged
.