Bluetooth (BT)

Created on June 21, 2022


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 RDKFeature Descriptions
Audio EncodingDetail SBC (sub-band coding) and aptX encoding (Bluetooth chip, in software, or in SoC hardware).
Audio Output MutingThe 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.
Audio Output RoutingDetail PCM audio routing to Bluetooth A2DP SRC, It uses H/W accelerations, S/W processing, RMF involvement on streaming audio/video contents.
Audio Output SourcesBluetooth audio may be different than HDMI audio (e.g. secondary audio program, application sourced audio such as Pandora, voice navigation audio, etc).
Dual DecodeSupports ability to simultaneously output one audio stream to HDMI and a different audio stream to Bluetooth
Power ControlIn 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.

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.

BlueZ D-Bus Communication

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

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)

API Documentation

 To know more about SoC/Application level APIs details use in RDK, refer the link  BLUETOOTH API Documentation

Go To Top