
{"id":9870,"date":"2022-06-21T09:10:26","date_gmt":"2022-06-21T09:10:26","guid":{"rendered":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/documentation\/rdk_video_documentation\/components\/open-sourced_components\/bluetooth_mgr\/"},"modified":"2025-03-25T05:18:35","modified_gmt":"2025-03-25T05:18:35","slug":"bluetooth_mgr","status":"publish","type":"page","link":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/bluetooth_mgr\/","title":{"rendered":"bluetooth_mgr"},"content":{"rendered":"<p><br \/>\n <\/p>\n<div class=\"toc-macro client-side-toc-macro  conf-macro output-block\" data-headerelements=\"H1,H2,H3,H4,H5,H6,H7\" data-hasbody=\"false\" data-macro-name=\"toc\"> <\/div>\n<p>Bluetooth Provides an interface to port any Bluetooth application on RDK.&nbsp;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.<\/p>\n<p>In RDK, Bluetooth is comprised of a Core module (BTCore) and a Manager module (BTMgr).&nbsp; The BTCore module controls basic Bluetooth functionality such as scanning, pairing, and connecting.&nbsp; The BTMgr module uses the services of the BTCore module for performing audio streaming.&nbsp; RDK has two utilities for testing.&nbsp; A btrCoreTest utility tests the BTCore functions.&nbsp; A btrMgrStreamOutCoreTest utility tests BTMgr functions.&nbsp; Both utilities share some common functionality.&nbsp; For example, it is possible to perform a device scan using either utility.<\/p>\n<p><strong>Bluez<\/strong><\/p>\n<p>In its current implementation, the RDK Bluetooth uses the Bluez stack.&nbsp; It is possible that another stack (e.g. Broadcom&rsquo;s BSA) could be used in the future.&nbsp;<\/p>\n<p><strong>DBUS<\/strong><\/p>\n<p>The Bluez stack uses DBus to facilitate communication between the user application and the kernel level Bluetooth functions.<\/p>\n<p><strong>gStreamer<\/strong><\/p>\n<p>BTMgr utilizes gStreamer to process incoming Bluetooth data<\/p>\n\n\n<h2 class=\"wp-block-heading wp-main-header\">Basic Bluetooth Architecture in RDK&nbsp;<\/h2>\n\n\n<p><\/p>\n<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/sites\/16\/2023\/09\/Basic%20Bluetooth%20Architecture%20in%20RDK.drawio.png\"><\/p>\n<p><\/p>\n<p><strong>Connecting to a device<\/strong><\/p>\n<p>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.&nbsp; The current options are shown below:<\/p>\n<ul>\n<li>1. Get Current Adapter<\/li>\n<li>2. Scan<\/li>\n<li>3. Show found devices<\/li>\n<li>4. Pair<\/li>\n<li>5. UnPair\/Forget a device<\/li>\n<li>6. Show known devices<\/li>\n<li>7. Connect to Headset\/Speakers<\/li>\n<li>8. Disconnect to Headset\/Speakers<\/li>\n<li>9. Connect as Headset\/Speakerst<\/li>\n<li>10. Disconnect as Headset\/Speakerst<\/li>\n<li>11. Show all Bluetooth Adapters<\/li>\n<li>12. Enable Bluetooth Adapter<\/li>\n<li>13. Disable Bluetooth Adapter<\/li>\n<li>14. Set Discoverable Timeout<\/li>\n<li>15. Set Discoverable<\/li>\n<li>16. Set friendly name<\/li>\n<li>17. Check for audio sink capability<\/li>\n<li>18. Check for existance of a service<\/li>\n<li>19. Find service details<\/li>\n<li>20. Check if Device Paired<\/li>\n<li>21. Get Connected Dev Data path<\/li>\n<li>22. Release Connected Dev Data path<\/li>\n<li>23. Send SBC data to BT Headset\/Speakers<\/li>\n<li>29. BT audio input test<\/li>\n<li>30. install agent for accepting connections NoInputNoOutput<\/li>\n<li>31. install agent for accepting connections DisplayYesNo<\/li>\n<li>32. Accept a connection request<\/li>\n<li>33. Deny a connection request<\/li>\n<li>34. Register connection callback to allow accepting or rejection of connections.<\/li>\n<li>35. Uninstall agent &#8211; allows device-initiated pairing<\/li>\n<li>88. debug test<\/li>\n<li>99. Exit<\/li>\n<\/ul>\n<h3 class=\"wp-sub-header\">Sequence of Steps<\/h3>\n<ul>\n<li>User can use option 2 to start a device scan. The scan takes about 10 seconds to complete, then use option 3 to see the list of devices that the settop found.&nbsp; If your device is in the list, you can use option 4 to perform a pairing.&nbsp; In some cases, you may have to confirm the pairing on the tablet\/phone.Once the device is paired, the next step is to establish an audio connection between the settop and your source device (e.g. tablet).<\/li>\n<li>In most cases, the connection must be initiated from the source device.&nbsp; Ubuntu is an exception to this, so if playing music from Ubuntu, you can start the connection from the settop.&nbsp; To do this, use option 9.&nbsp; You may have to confirm the connection on Ubuntu.<\/li>\n<li>If you are initiating the connection from the tablet, you must first start an agent.&nbsp; The agent allows accepting of connections from remote devices.&nbsp; You can do this using option 31. After invoking option 31, connect to the settop from your tablet.<\/li>\n<\/ul>\n<p>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.<\/p>\n<ul>\n<li>Once you have connected the device once (during the settop lifetime or with the device in persistent memory) you will not need to use the agent again.&nbsp; The connection will automatically be established upon attempt by Bluez, with no agent required.<\/li>\n<li>Optionally, before attempting to connect, you can run option 34 to install an authentication callback.&nbsp; This allows the settop to accept or refuse the connection from the tablet. If you run option 34, then attempt a first time connection from a tablet, you will be prompted to enter option 32 to accept, or 33 to deny the request.<\/li>\n<li>Once connected, you can start your player on your tablet. There is an option 29 in the btrCoreTest menu that retrieves data from Bluetooth, and pipes it into a gst-launch command to start the gstreamer elements to perform playback.&nbsp; However, it is not a full gstreamer implementation.&nbsp; To run the full gstreamer implementation, use the btrMgrStreamOutCoreTest, after first having paired and connected the device.<\/li>\n<\/ul>\n\n\n<h2 class=\"wp-block-heading wp-main-header\">btrMgrStreamOutCoreTest<\/h2>\n\n\n<p>The current btrMgrStreamOutCoreTest having following option in RDK<\/p>\n<ul>\n<li>1. Get Current Adapter<\/li>\n<li>2. Scan<\/li>\n<li>3. Show found devices<\/li>\n<li>4. Pair<\/li>\n<li>5. UnPair\/Forget a device<\/li>\n<li>6. Show known devices<\/li>\n<li>7. Connect to Headset\/Speakers<\/li>\n<li>8. Disconnect to Headset\/Speakers<\/li>\n<li>9. Connect as Headset\/Speakerst<\/li>\n<li>10. Disconnect as Headset\/Speakerst<\/li>\n<li>11. Show all Bluetooth Adapters<\/li>\n<li>12. Enable Bluetooth Adapter<\/li>\n<li>13. Disable Bluetooth Adapter<\/li>\n<li>14. Set Discoverable Timeout<\/li>\n<li>15. Set Discoverable<\/li>\n<li>16. Set friendly name<\/li>\n<li>17. Check for audio sink capability<\/li>\n<li>18. Check for existance of a service<\/li>\n<li>19. Find service details<\/li>\n<li>20. Check if Device Paired<\/li>\n<li>21. Get Connected Dev Data path<\/li>\n<li>22. Release Connected Dev Data path<\/li>\n<li>23. Send SBC data to BT Headset\/Speakers<\/li>\n<li>24. Send WAV to BT Headset\/Speakers &#8211; btrMgrStreamOutTest<\/li>\n<li>25. Send Live Audio to BT Headset\/Speakers<\/li>\n<li>26. Send audio data from device to settop with BT<\/li>\n<li>88. debug test<\/li>\n<li>99. Exit<\/li>\n<\/ul>\n<p>Once bluetooth connected with your tablet, start the player on your tablet, then do option 21 (this gets needed parameters for playback.&nbsp; Note, this functionality is automatically invoked in the btrCore utility, but has not, as of this time, been implemented in the btrMgr utility).&nbsp;<\/p>\n<p>Once you do option 21, you can do option 26 to start Bluetooth audio, in a full gstreamer implementation.<\/p>\n<p><strong>gStreamer<\/strong><\/p>\n<p>Gstreamer contains several plugins for the Bluetooth In process. The gstreamer used is version 1.0.<\/p>\n<p><\/p>\n<div class=\"code panel pdl conf-macro output-block\" data-hasbody=\"true\" data-macro-name=\"code\">\n<div class=\"codeHeader panelHeader pdl\"><b>Pipeline<\/b><\/div>\n<div class=\"codeContent panelContent pdl\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">rtpsbcdepay | sbcparse | sbcdecode | brcmpcmsink\nrtpsbcdepay: takes RTP encapsulated data from Bluetooth, and removes the RTP headers.  The payload is sbc encoded data.<\/pre>\n<\/div>\n<\/div>\n<p><\/p>\n<p>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.<\/p>\n<p>sbcparse &amp; sbcdecode:&nbsp; together, these two plugins convert the sbc data to pcm data.<\/p>\n<p>brcmpcmsink: outputs pcm data to HDMI (or other source if configured, such as SPDIF out).&nbsp; This plugin is made by Broadcom.&nbsp; To date, only HDMI out has been tested.<\/p>\n<p>One important note for using these utilities:&nbsp; Before you can use them, you must first kill a process that will be used for providing the reference app with Bluetooth capability.&nbsp; You can do this as follows:<\/p>\n<p>systemctl stop btmgr<\/p>\n<p>Be sure to do <strong>systemctl stop btmgr<\/strong> before using the btrCore or btrMgr utilities.<\/p>\n<p><\/p>\n\n\n<h2 class=\"wp-block-heading wp-main-header\">API Documentation<\/h2>\n\n\n<p>&nbsp;To know more about SoC\/Application level APIs details use in RDK, refer the link&nbsp;&nbsp;<a href=\"https:\/\/wiki.rdkcentral.com\/doxygen\/rdkv-opensourced\/da\/d6c\/group___b_t_r___m_g_r.html\" rel=\"nofollow\">Bluetooth Manager API Documentation<\/a><\/p>\n<p><\/p>\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>Bluetooth Provides an interface to port any Bluetooth application on RDK.&nbsp;Bluetooth Manager (An RDK component) [&hellip;]<\/p>\n","protected":false},"author":28,"featured_media":0,"parent":9844,"menu_order":3,"comment_status":"open","ping_status":"closed","template":"","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"class_list":["post-9870","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>bluetooth_mgr - RDK Documentation Portal | Documentation<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/bluetooth_mgr\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"bluetooth_mgr - RDK Documentation Portal | Documentation\" \/>\n<meta property=\"og:description\" content=\"Bluetooth Provides an interface to port any Bluetooth application on RDK.&nbsp;Bluetooth Manager (An RDK component) [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/bluetooth_mgr\/\" \/>\n<meta property=\"og:site_name\" content=\"RDK Documentation Portal | Documentation\" \/>\n<meta property=\"article:modified_time\" content=\"2025-03-25T05:18:35+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/bluetooth_mgr\/\",\"url\":\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/bluetooth_mgr\/\",\"name\":\"bluetooth_mgr - RDK Documentation Portal | Documentation\",\"isPartOf\":{\"@id\":\"https:\/\/developer.rdkcentral.com\/documentation\/#website\"},\"datePublished\":\"2022-06-21T09:10:26+00:00\",\"dateModified\":\"2025-03-25T05:18:35+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/bluetooth_mgr\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/bluetooth_mgr\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/bluetooth_mgr\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/developer.rdkcentral.com\/documentation\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Documentation\",\"item\":\"https:\/\/developer.rdkcentral.com\/documentation\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"RDK Entertainment\",\"item\":\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Components\",\"item\":\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"bluetooth_mgr\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/developer.rdkcentral.com\/documentation\/#website\",\"url\":\"https:\/\/developer.rdkcentral.com\/documentation\/\",\"name\":\"RDK Documentation Portal | Documentation\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/developer.rdkcentral.com\/documentation\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"bluetooth_mgr - RDK Documentation Portal | Documentation","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/bluetooth_mgr\/","og_locale":"en_US","og_type":"article","og_title":"bluetooth_mgr - RDK Documentation Portal | Documentation","og_description":"Bluetooth Provides an interface to port any Bluetooth application on RDK.&nbsp;Bluetooth Manager (An RDK component) [&hellip;]","og_url":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/bluetooth_mgr\/","og_site_name":"RDK Documentation Portal | Documentation","article_modified_time":"2025-03-25T05:18:35+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/bluetooth_mgr\/","url":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/bluetooth_mgr\/","name":"bluetooth_mgr - RDK Documentation Portal | Documentation","isPartOf":{"@id":"https:\/\/developer.rdkcentral.com\/documentation\/#website"},"datePublished":"2022-06-21T09:10:26+00:00","dateModified":"2025-03-25T05:18:35+00:00","breadcrumb":{"@id":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/bluetooth_mgr\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/bluetooth_mgr\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/bluetooth_mgr\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/developer.rdkcentral.com\/documentation\/"},{"@type":"ListItem","position":2,"name":"Documentation","item":"https:\/\/developer.rdkcentral.com\/documentation\/"},{"@type":"ListItem","position":3,"name":"RDK Entertainment","item":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/"},{"@type":"ListItem","position":4,"name":"Components","item":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/"},{"@type":"ListItem","position":5,"name":"bluetooth_mgr"}]},{"@type":"WebSite","@id":"https:\/\/developer.rdkcentral.com\/documentation\/#website","url":"https:\/\/developer.rdkcentral.com\/documentation\/","name":"RDK Documentation Portal | Documentation","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/developer.rdkcentral.com\/documentation\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/pages\/9870","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/users\/28"}],"replies":[{"embeddable":true,"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/comments?post=9870"}],"version-history":[{"count":4,"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/pages\/9870\/revisions"}],"predecessor-version":[{"id":12199,"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/pages\/9870\/revisions\/12199"}],"up":[{"embeddable":true,"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/pages\/9844"}],"wp:attachment":[{"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/media?parent=9870"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}