New issue
Advanced search Search tips

Issue 698852 link

Starred by 0 users

Issue metadata

Status: Archived
Owner: ----
Closed: Sep 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug



Sign in to add a comment

bluetooth: Unknown exception when enabling notifications on Mi Band

Project Member Reported by ortuno@chromium.org, Mar 6 2017

Issue description


cpBurn:
I am trying to create a simple connection with my Mi Band 2 so I can read Heart Rate. I followed an example here but after requesting device, nothing appears on the list.

I also tried to use the example from the Demos folder. Using the Heart Rate Sensor Demo I observed the same problem, the device doesn't appear at all.

The only way I could connect it was setting acceptAllDevices: true, like this:
navigator.bluetooth.requestDevice({"acceptAllDevices":true, optionalServices: ['heart_rate']})

In this way I can pair and connect the device, but when I try to startNotifications() I get following:

DOMException: GATT operation failed for unknown reason.
Any ideas?

Tested on Chrome 56 and Chrome 59, MacOS 10.12.3
and Chrome Android 56.
 
There appear to be two separate problems here:

1. Can't find the device
2. Can't start notifications.

1. Even if a peripheral includes a heart rate service it doesn't mean it advertises its UUID. Peripheral are constantly broadcasting Advertisement Packets. When websites call requestDevice(), Chrome starts scanning for these advertisements based on the filters passed to requestDevice(). In your case, chances are that the Mi Band does not include the hear rate service UUID in its advertisement packet. You can use an app like nrfConnect to find out what the device is advertising and make your filter more precise.

2. The second problem is tricker and we need some logs. The instructions on how to get them are here: https://www.chromium.org/developers/how-tos/file-web-bluetooth-bugs

Good luck!
1. Gio is right. You may also want to use namePrefix filter instead of acceptAllDevices. See https://developers.google.com/web/updates/2015/07/interact-with-ble-devices-on-the-web#request_bluetooth_devices

2. IIRC, with Miband 1 (not 2), I had to send some proper commands before reading Heart rate notifications: https://github.com/beaufortfrancois/sandbox/blob/gh-pages/web-bluetooth/mi-band/miBand.js

Comment 3 by scheib@chromium.org, Sep 13 2017

Status: Archived (was: Unconfirmed)
cpBurn doesn't appear to be monitoring this or likely to respond.  If it's still an issue re-open or re-file please.

Sign in to add a comment