Bluetooth Provides an interface to port any Bluetooth application on RDK. 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.

In RDK, Bluetooth is comprised of a Core module (BTCore) and a Manager module (BTMgr).  The BTCore module controls basic Bluetooth functionality such as scanning, pairing, and connecting.  The BTMgr module uses the services of the BTCore module for performing audio streaming.  RDK has two utilities for testing.  A btrCoreTest utility tests the BTCore functions.  A btrMgrStreamOutCoreTest utility tests BTMgr functions.  Both utilities share some common functionality.  For example, it is possible to perform a device scan using either utility.

Bluez

In its current implementation, the RDK Bluetooth uses the Bluez stack.  It is possible that another stack (e.g. Broadcom’s BSA) could be used in the future. 

DBUS

The Bluez stack uses DBus to facilitate communication between the user application and the kernel level Bluetooth functions.

gStreamer

BTMgr utilizes gStreamer to process incoming Bluetooth data

Basic Bluetooth Architecture in RDK 



Connecting to a device

In order to connect, the device must first be discovered. The source device (e.g. tablet or phone) can be put into a discoverable mode. This can be accomplished with the btrCoreTest utility.  The current options are shown below:

Sequence of Steps

Note, the agent seems to inhibit pairing from the settop, so if you need to pair more devices from the settop, you can use option 35 to unregister the agent.

btrMgrStreamOutCoreTest

The current btrMgrStreamOutCoreTest having following option in RDK

Once bluetooth connected with your tablet, start the player on your tablet, then do option 21 (this gets needed parameters for playback.  Note, this functionality is automatically invoked in the btrCore utility, but has not, as of this time, been implemented in the btrMgr utility). 

Once you do option 21, you can do option 26 to start Bluetooth audio, in a full gstreamer implementation.

gStreamer

Gstreamer contains several plugins for the Bluetooth In process. The gstreamer used is version 1.0.


rtpsbcdepay | sbcparse | sbcdecode | brcmpcmsink
rtpsbcdepay: takes RTP encapsulated data from Bluetooth, and removes the RTP headers.  The payload is sbc encoded data.


Note it has been observed that some devices such as Ubuntu and the iPhone 5s use a constant RTP packet size, whereas some Samsung tablets have been observed to use a variable RTP packet size.

sbcparse & sbcdecode:  together, these two plugins convert the sbc data to pcm data.

brcmpcmsink: outputs pcm data to HDMI (or other source if configured, such as SPDIF out).  This plugin is made by Broadcom.  To date, only HDMI out has been tested.

One important note for using these utilities:  Before you can use them, you must first kill a process that will be used for providing the Comcast XRE app with Bluetooth capability.  You can do this as follows:

systemctl stop btmgr

Be sure to do systemctl stop btmgr before using the btrCore or btrMgr utilities.


API Documentation

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