BluetoothGatt issues on Chrome OS

32 views
Skip to first unread message

Keith Nagle

unread,
Aug 26, 2019, 10:14:20 AM8/26/19
to android-midi
Hi all,
I have a Bluetooth MIDI device that I'm connecting to Chrome OS using a custom Android app. I am testing on an ASUS C300 running the latest Developer release of Chrome OS with Android 7.1.1 and a Viglen 360 (also running Android 7.1.1).

The curious thing about my BLE MIDI device is that as well as sending MIDI packets over bluetooth, it also accepts messages over BluetoothGatt (particularly a message to recalibrate the onboard sensors). 

The problem I'm experiencing on Chrome OS is if I connect the device as a MIDI device, then ask for a BluetoothGatt connection (for sending a calibration, or requesting the Battery or Device Info services) the device gets removed from the MIDI system. If I delay the request for a BluetoothGatt connection for something like 1 to 1.5 seconds the MIDI connection holds and the BluetoothGatt connection appears to be successful but none of the normal callbacks fire (onConnectionStateChanged() onServicesDiscovered()).

If I don't request a MIDI connection using MidiManager.openBluetoothDevice() then the BluetoothGatt connection works and all the callbacks fire as expected.

If I run the same code on an Android phone (Samsung Galaxy S7 running Android 7.0) there are no issues, the MIDI device connects and sends packets, the BluetoothGatt connection is made, and all callbacks fire as expected, meaning I can accept MIDI signals as well as discover Dev Info Service (firmware version etc) Battery service, and send messages to the device to recalibrate etc.

I have dug into the system as much as I can, and I can see that the MidiManager perhaps starts a BluetoothMidiService, which creates a BluetoothMidiDevice object when it gets a MIDI bluetooth connection (openBluetoothDevice()). BluetoothMidiDevice has its own BluetoothGatt object, and here I think is where the conflict arises (despite both instances of BluetoothGatt being private and having different variable names). When the BluetoothMidiDevice object's BluetoothGatt is done doing what it needs to do it closes, making itself null and killing the callbacks for the other BluetoothGatt object (potentially making it null also). 

The end result is that, on Chrome OS, I can connect to the device and accept MIDI messages, but not send BluetoothGatt messages or receive dev info service values or battery service updates, or vice versa. The problem does not occur on an actual Android device.

Has anyone experienced something similar and overcome the issue?

All the best,
Keith

Phil Burk

unread,
Aug 26, 2019, 2:44:01 PM8/26/19
to android-midi
Hello Keith,

Thanks for this report and the detailed analysis. I was not aware of this issue.
This will require the ARC++, Audio and BT teams together.

I can create an internal bug but then you cannot track its progress or contribute further.
So please file a bug under Framework at:

Also please include the BLE-MIDI device name and info if not confidential.

Then post the link here.

Phil Burk

--
You received this message because you are subscribed to the Google Groups "android-midi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-midi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-midi/6331f10f-bbd4-4f4e-afe7-59f6cdfe2dc5%40googlegroups.com.

Keith Nagle

unread,
Aug 27, 2019, 5:12:48 AM8/27/19
to android-midi
Thanks Phil,
Heres the link to the issue tracker: https://issuetracker.google.com/issues/140057001
All the best,
Keith.
To unsubscribe from this group and stop receiving emails from it, send an email to androi...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages