Introduction
Bluetooth in RDK, provides short range wireless connectivity between RDK devices and consumer electronics devices. RDK Bluetooth architecture is designed to support any Bluetooth stack.
The Bluetooth stack currently supports common Bluetooth profile such as A2DP, AVRCP, and can be extended to various profiles such as HID, PAN, etc.. Bluetooth may be enabled directly on capable RDK boxes or indirectly via USB-to-Bluetooth adaptor.
Features supported in RDK
Bluetooth feature in RDK | Feature Descriptions |
---|
Audio Output Sources | Bluetooth audio may be different than HDMI audio (e.g. secondary audio program, application sourced audio such as Pandora, voice navigation audio, etc). |
Audio Output Routing | Detail PCM audio routing to Bluetooth A2DP SRC, It uses H/W accelerations, S/W processing, RMF involvement on streaming audio/video contents. |
Audio Encoding | Detail SBC (sub-band coding) and aptX encoding (Bluetooth chip, in software, or in SoC hardware). |
Audio Output Muting | The Bluetooth audio output may be muted independently of other audio outputs (e.g. HDMI) |
Audio Input (Settop as AD2P SNK) | Using RDK device speakers over bluetooth i.e transmitting audio input back to a speaker connected with RDK device. |
Dual Decode | Supports ability to simultaneously output one audio stream to HDMI and a different audio stream to Bluetooth |
Power Control | In future, the power state of each Bluetooth connected device and the Bluetooth subsystem can be controlled |
Audio/Video Remote Control Profile (AVRCP) | Controller (Remote Control) sends mute and volume commands to target. AV/C commands are defined by the 1394 trade association |
Bluetooth in RDK - Block Diagram
Bluetooth in RDK provides Interface API and implementation to abstract Bluetooth stack and it provides 5 layers in the BTR (Bluetooth-RDK) stack.
1. Bluetooth daemon (Bluez based) - Interacts with kernel layer bluetooth modules
2. Bt-Ifce (Abstracts Bluez versions and servers as a HAL for other Bluetooth stacks) - Interacts with Bluez over DBus
3. Bluetooth HAL (BTRCore) - Provide API to perform Bluetooth operations by abstracting and simplifying the complexities of Bt-Ifce (& BLuez)
4. BTRMgr - Utilize API's exposed by BTRCore to perform high level Bluetooth ops like Scan, Pair, Connect and achieve usecases like AudioOut.
Exposes interfaces for external entities to perform BTRMgr related operation using IARM
5. ServiceManager [BluetoothService] - Interacts with BTRMgr based on Application requirements using IARM. Guide applications are interact with Service Manager.
6. RDK Apps/Diagnostics - HTML-5 based UI applications to make use of Bluetooth service using Service Manager APIs.
eyJleHRTcnZJbnRlZ1R5cGUiOiIiLCJnQ2xpZW50SWQiOiIiLCJjcmVhdG9yTmFtZSI6IlotWW9nb21heWEgTWFoYXJhbmEiLCJvdXRwdXRUeXBlIjoiYmxvY2siLCJsYXN0TW9kaWZpZXJOYW1lIjoiQXNocmFmIEJoYW51IEtvdGhhcGV0YSIsImxhbmd1YWdlIjoiZW4iLCJ1aUNvbmZpZyI6Int9IiwiZGlhZ3JhbURpc3BsYXlOYW1lIjoiIiwic0ZpbGVJZCI6IiIsImF0dElkIjoiMTQ0OTAxMzQ2IiwiZGlhZ3JhbU5hbWUiOiJCbHVldG9vdGhCbG9ja0RpYWdyYW0uZHJhd2lvIiwiYXNwZWN0IjoiIiwibGlua3MiOiJhdXRvIiwiY2VvTmFtZSI6IkJsdWV0b290aCBTdWJzeXN0ZW0iLCJ0YnN0eWxlIjoidG9wIiwiY2FuQ29tbWVudCI6ZmFsc2UsImRpYWdyYW1VcmwiOiIiLCJjc3ZGaWxlVXJsIjoiIiwiYm9yZGVyIjp0cnVlLCJtYXhTY2FsZSI6IjEiLCJvd25pbmdQYWdlSWQiOjM0MDQ2MTQwLCJlZGl0YWJsZSI6ZmFsc2UsImNlb0lkIjoxOTgyNDc2MDYsInBhZ2VJZCI6IiIsImxib3giOnRydWUsInNlcnZlckNvbmZpZyI6eyJlbWFpbHByZXZpZXciOiIxIn0sIm9kcml2ZUlkIjoiIiwicmV2aXNpb24iOjEsIm1hY3JvSWQiOiI0ODg5ZTUzYS0yYzY1LTQyMGYtOWY0MC1hNWU1YTc1OWFiMjgiLCJwcmV2aWV3TmFtZSI6IkJsdWV0b290aEJsb2NrRGlhZ3JhbS5kcmF3aW8ucG5nIiwibGljZW5zZVN0YXR1cyI6Ik9LIiwic2VydmljZSI6IiIsImlzVGVtcGxhdGUiOiIiLCJ3aWR0aCI6Im51bGwiLCJzaW1wbGVWaWV3ZXIiOmZhbHNlLCJsYXN0TW9kaWZpZWQiOjE2NDY3MjIyNzgwMDAsImV4Y2VlZFBhZ2VXaWR0aCI6ZmFsc2UsIm9DbGllbnRJZCI6IiJ9
Bluetooth Architecture
Bluetooth Manager and Bluetooth HAL [BTRCore] is that Bluetooth Manager implements the BT HAL [BTRCore] API. Then BT HAL [BTRCore] integrates and manages the BlueZ stack though the D-BUS interface.
eyJleHRTcnZJbnRlZ1R5cGUiOiIiLCJnQ2xpZW50SWQiOiIiLCJjcmVhdG9yTmFtZSI6IlotWW9nb21heWEgTWFoYXJhbmEiLCJvdXRwdXRUeXBlIjoiYmxvY2siLCJsYXN0TW9kaWZpZXJOYW1lIjoiWi1Zb2dvbWF5YSBNYWhhcmFuYSIsImxhbmd1YWdlIjoiZW4iLCJ1aUNvbmZpZyI6Int9IiwiZGlhZ3JhbURpc3BsYXlOYW1lIjoiIiwic0ZpbGVJZCI6IiIsImF0dElkIjoiMTQ0OTAxMzQ0IiwiZGlhZ3JhbU5hbWUiOiJCbHVldG9vdGgtQXJjaGl0ZWN0dXJlLmRyYXdpbyIsImFzcGVjdCI6IiIsImxpbmtzIjoiYXV0byIsImNlb05hbWUiOiJCbHVldG9vdGggU3Vic3lzdGVtIiwidGJzdHlsZSI6InRvcCIsImNhbkNvbW1lbnQiOmZhbHNlLCJkaWFncmFtVXJsIjoiIiwiY3N2RmlsZVVybCI6IiIsImJvcmRlciI6dHJ1ZSwibWF4U2NhbGUiOiIxIiwib3duaW5nUGFnZUlkIjozNDA0NjE0MCwiZWRpdGFibGUiOmZhbHNlLCJjZW9JZCI6MTk4MjQ3NjA2LCJwYWdlSWQiOiIiLCJsYm94Ijp0cnVlLCJzZXJ2ZXJDb25maWciOnsiZW1haWxwcmV2aWV3IjoiMSJ9LCJvZHJpdmVJZCI6IiIsInJldmlzaW9uIjoxLCJtYWNyb0lkIjoiMTY2YThkZjItMzVlMC00YzIyLWE2ZDItNzRlMDcyY2EzZWJjIi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b0lkIjoiNzhmNGIxOGItMWU5Ny00M2Y3LWI4YTQtMDA4ZmY1ZGM0MmJjIiwicHJldmlld05hbWUiOiJCbHVlWiBELUJ1cyBDb21tdW5pY2F0aW9uLmRyYXdpby5wbmciLCJsaWNlbnNlU3RhdHVzIjoiT0siLCJzZXJ2aWNlIjoiIiwiaXNUZW1wbGF0ZSI6IiIsIndpZHRoIjoibnVsbCIsInNpbXBsZVZpZXdlciI6ZmFsc2UsImxhc3RNb2RpZmllZCI6MTYxNDY5NDU1MDAwMCwiZXhjZWVkUGFnZVdpZHRoIjpmYWxzZSwib0NsaWVudElkIjoiIn0=
Bluetooth - Service Manager
Bluetooth Service Manager component in RDK exposes Java scripts APIs against each of the Core Bluetooth features supported in the current implementation Javascript API's have been exposed to invoke IARM communication in the context of a browser which have a Javascript engine when we have HTML/HTML5/Browser based applications. Applications which don't have a Java-script engine should also be able to invoke Service manager methods/IARM methods to communicate with BTRMgr.
Provides methods and events to support the following features,
- Device discovery
- Pairing with the remote device
- Connecting to the device after authentication.
- Choose Audio stream to be streamed to other bluetooth device.
- Provides method to select appropriate audio sink
Contains Methods and Events to communicate with the Bluetooth manager
Service Manager will send event in case external Bluetooth adapter is inserted or removed, or it is requested for pairing.
List of API & Events
Refer to Bluetooth APIs for a complete list of Bluetooth APIs and events exposed by service manager.
Bluetooth Manager (BTRMgr)
Bluetooth Manager (An RDK component) interfaces with BlueZ through the D-Bus API, so there is no direct linking of the BlueZ library with Bluetooth Manager. BTRCore uses Bt-Ifce (which serves as Bluetooth HAL) interfaces with BlueZ.
BTRMgr Provides an interface to port any Bluetooth stack on RDK Provides an interface to port any Bluetooth application on RDK
The bluetooth_mgr daemon manages Bluetooth services in RDK. It uses IARM Bus to facilitate communication between the application and Bluetooth driver through Bluetooth Manager component.
Bluetooth HAL Interface:
Bluetooth HAL interface Provides an software abstraction layer that interfaces with the actual Bluetooth implementation and/or drivers. RDK Bluetooth HAL layer enables projects to pick whatever Bluetooth profiles as per their requirements. Bluetooth HAL uses BlueZ5.42 stack which is a quite popular Linux Bluetooth library.
BlueZ In RDK
- BlueZ is a well known Open Source project used to support core Bluetooth layers and protocols on Linux systems.
- BlueZ is multi processing safe, supports multiple Bluetooth devices, and provides device and service level security.
- Supported Profiles: A2DP 1.3, AVRCP 1.5, DI 1.3, HDP 1.0, HID 1.0, PAN 1.0, SPP 1.1
- The interface layer is based off of DBUS, so there is no direct linking with the BlueZ daemon.
- Currently BlueZ5.42 stack is integrated with RDK & it is managed by Bluetooth HAL component.
Some Bluetooth supported gstreamer plugins used by BlueZ 5:
Gstreamer Elements | Descriptions |
sbcenc | Bluetooth SBC (sub-band coding) encoder |
sbcdec | Bluetooth SBC (sub-band coding) decoder |
sbcparse | The sbcparse element will parse a Bluetooth SBC audio stream into frames and timestamp them properly |
avdtpsink | Bluetooth AVDTP sink |
a2dpsink | Bluetooth A2DP sink for streaming audio |
rtpsbcpay | RTP packet payload maker |
Use Case : Bluetooth Device Discovery
eyJleHRTcnZJbnRlZ1R5cGUiOiIiLCJnQ2xpZW50SWQiOiIiLCJjcmVhdG9yTmFtZSI6IlotWW9nb21heWEgTWFoYXJhbmEiLCJvdXRwdXRUeXBlIjoiYmxvY2siLCJsYXN0TW9kaWZpZXJOYW1lIjoiWi1Zb2dvbWF5YSBNYWhhcmFuYSIsImxhbmd1YWdlIjoiZW4iLCJ1aUNvbmZpZyI6Int9IiwiZGlhZ3JhbURpc3BsYXlOYW1lIjoiIiwic0ZpbGVJZCI6IiIsImF0dElkIjoiMTQ0OTAxMzQ4IiwiZGlhZ3JhbU5hbWUiOiJCbHVldG9vdGggRGV2aWNlIERpc2NvdmVyeS5kcmF3aW8iLCJhc3BlY3QiOiIiLCJsaW5rcyI6ImF1dG8iLCJjZW9OYW1lIjoiQmx1ZXRvb3RoIFN1YnN5c3RlbSIsInRic3R5bGUiOiJ0b3AiLCJjYW5Db21tZW50IjpmYWxzZSwiZGlhZ3JhbVVybCI6IiIsImNzdkZpbGVVcmwiOiIiLCJib3JkZXIiOnRydWUsIm1heFNjYWxlIjoiMSIsIm93bmluZ1BhZ2VJZCI6MzQwNDYxNDAsImVkaXRhYmxlIjpmYWxzZSwiY2VvSWQiOjE5ODI0NzYwNiwicGFnZUlkIjoiIiwibGJveCI6dHJ1ZSwic2VydmVyQ29uZmlnIjp7ImVtYWlscHJldmlldyI6IjEifSwib2RyaXZlSWQiOiIiLCJyZXZpc2lvbiI6MSwibWFjcm9JZCI6IjYxYjdiMjAxLTkzNjUtNDhkNi1iNGMxLWU0NWQ3MzAwZmU5MSIsInByZXZpZXdOYW1lIjoiQmx1ZXRvb3RoIERldmljZSBEaXNjb3ZlcnkuZHJhd2lvLnBuZyIsImxpY2Vuc2VTdGF0dXMiOiJPSyIsInNlcnZpY2UiOiIiLCJpc1RlbXBsYXRlIjoiIiwid2lkdGgiOiJudWxsIiwic2ltcGxlVmlld2VyIjpmYWxzZSwibGFzdE1vZGlmaWVkIjoxNjE0Njk0NTUwMDAwLCJleGNlZWRQYWdlV2lkdGgiOmZhbHNlLCJvQ2xpZW50SWQiOiIifQ==
RDK Bluetooth A2DP Use Case - Audio Streaming
- Set-top enables Bluetooth audio output (A2DP SRC).
- Set-top uses Bluetooth periodic Inquiry procedure to discover A2DP SNK.
- If user enables Bluetooth audio output, set-top discovers A2DP SNK but set-top and application has not registered to take control of Bluetooth pairing then:
- set-top prompts user to select A2DP SNK device to pair and pairs upon user selection.
- Set-top encodes audio output to A2DP SNK according to A2DP SNK's capabilities.
- Set-top streams primary audio to A2DP SNK.
- Set-top provides application layer control over Bluetooth enable/disable state.
- Set-top notifies application via Bluetooth Service API when Bluetooth device is discovered.
- Set-top logs connect/disconnect to/from Bluetooth device (A2DP SNK)