Bluetooth-Manager: When receiving a 'device_changes' event, we don't have all informations about the device that just connect
Description
Environment
Activity
Walt Miner January 23, 2019 at 3:16 AM
Closed for GG RC4 and FF 6.0.4

Matt Ranostay December 20, 2018 at 9:26 PM
Changes to 4a-hal-generic are merged

Matt Ranostay December 5, 2018 at 3:23 PM
Patchset Ref: https://gerrit.automotivelinux.org/gerrit/#/c/18559/
This patchset adds proper A2DP endpoint connect/disconnect reporting to clients. See README.md changes for full documentation.
But this has the added advantage of reporting actual media endpoints and not AVRCP profile connections.

Jonathan Aillet November 29, 2018 at 6:15 PM
Yeah, it is totally fine with me if Matt looks at 4a-hal bluetooth plugin code to make it work again.
The plugin is maintain into '4a-hal-generic' repository into 'plugins/lib/bluetooth' directory. Here are some pointers to understand how are used Bluetooth-Manager functionalities/calls into the plugin (for both flounder/master branches) :
Most of the definitions used to call 'Bluetooth-Manager' is defined in 'hal-bt.h' file (api, verbs, event).
The plugin starts by calling a verb to check if a bluetooth adapter is connected to the platform in 'CTLP_INIT(plugin, callbacks)' function of 'hal-bt.c' file.
Then, the plugin registers itself to redirect events from 'Bluetooth-Manager' to 'CTLP_CAPI(events, source, argsJ, queryJ)' function (available in 'hal-bt.c' file). The 'subscribe' call is made in 'CTLP_CAPI(init, source, argsJ, queryJ)'of 'hal-bt.c' file.
After that, a call to 'Bluetooth-Manager' is made to get initial list of bluetooth devices in 'CTLP_CAPI(init, source, argsJ, queryJ)'of 'hal-bt.c' file.
All the received bluetooth objects (coming from the initial list, or from received events) are handled by the same functions ('HalBtDataHandleReceivedMutlipleBtDeviceData' and 'HalBtDataHandleReceivedSingleBtDeviceData') in 'hal-bt-data.c'.
The list of connected compatible bluetooth devices is stored using a linked list of 'struct HalBtDeviceData' structures (defined in 'hal-bt-data.h').
However, I must warn you that the plugin hasn't been updated since the recent changes in 'Bluetooth-Manager', so everything related to 'Bluetooth-Manager' must be updated (verbs names, request form, response parsing, ...). I was working on it but it my development is blocked because I didn't find an event equivalent to the previously provided 'device_updated' event.
I also want to add that I think it will probably faster for you to add an event in 'Bluetooth-Manager'.
Anyway, thanks for the help.

Scott Murray November 29, 2018 at 2:33 PM
I propose that Matt look at the 4a-hal bluetooth code and work up a solution to get it working again. Does that sound okay as a path forward?
Details
Details
Assignee

Reporter

Information provided by 'device_changes' event are not as complete as previously used 'device_updated' event. This is a regression with the new version of 'Bluetooth-Manager'.
In 4a-hal bluetooth plugin, we need to maintain a list of connected bluetooth compatible (A2DP, ...) devices to be able to switch between different streaming devices.
In previous version of 'Bluetooth-Manager', we used 'device_updated' event that communicate all the information about the device with the event.
But with 'device_changes' event, when a device connect/disconnect, we only receive few information. To maintain our list, we need more information than what is currently provided ('address', 'paired', 'uuids', 'name', ...) about the device.