startNotifications fails with "GATT operation failed for unknown reason" (BBQ Thermometer, Android)
Reported by
orp...@gmail.com,
Nov 14 2016
|
|
Issue descriptionChrome Version : Chrome Canary (56.0.2915.0) on Nexus 7 (2013), Android 6.0.1 URLs (if applicable) : https://bl.ocks.org/mattdsteele/raw/0fa9cafc4a95738181137547eae21fc8/ Other browsers tested: Chrome Stable on Nexus 7, Chrome Stable on Galaxy S7. Also failed with same error message Add OK or FAIL, along with the version, after other browsers where you have tested this issue: Safari/FF/IE: n/a Chrome on OS X: works fine What steps will reproduce the problem? (0) Turn on BBQ thermometer (1) Visit https://bl.ocks.org/mattdsteele/raw/0fa9cafc4a95738181137547eae21fc8/ (2) Click "Scan". Requests device, connects to server, get primary service, characteristics, etc. See code for details. (3) Call `startNotifications()` on a sub-characteristic; it will fail (in attached code, on line 66 of app.js) What is the expected result? Notifications should start and I should be able to begin listening to 'characteristicvaluechanged' events What happens instead? Throws an exception with the message "DOMException: GATT operation failed for unknown reason." This error occurs on the first connection attempt. On the second connection attempt, it continues past the startNotifications() error and the app works fine Please provide any additional information below. Attach a screenshot if possible. Logcat attached. First attempt (failure) occurs at 19:45:50. Second attempt (success) occurs at 19:46:02. The BBQ Thermometer: http://www.oregonscientificstore.com/p-6-oregon-scientific-aw133-grill-right-bluetooth-bbq-thermometer.aspx Bluetooth information (these are custom GATT services, it appears): https://drive.google.com/drive/folders/0B8G38QzKbaKdSFF0dkhaYlJZX00 Code is here: http://bl.ocks.org/mattdsteele/0fa9cafc4a95738181137547eae21fc8 See a demo here: https://youtu.be/Zrtf1LhRy-E
,
Nov 14 2016
Yup, running the notifications in series fixes it. Updated the code for posterity. Thanks for your help!
,
Nov 14 2016
No problem! Feel free to open an issue for any problems you find with the implementation or if you have any questions! |
|
►
Sign in to add a comment |
|
Comment 1 by ortuno@chromium.org
, Nov 14 2016Thanks for the detailed report and logs. Looking at the code it seems you are trying to start notifications for two characteristics at the same time. That causes two write descriptor operations at the same time which is not allowed, so you get an error. Instead of: .then(_ => { const char1 = getSensor(chars, sensor1); const char2 = getSensor(chars, sensor2); return Promise.all([char1, char2].map(c => c.startNotifications())); }) The following should work: .then(_ => getSensor(chars, sensor1).startNotifications()) .then(_ => getSensor(chars, sensor2).startNotifications()) That said the error is not useful at all; Issue 657921 tracks progress for that problem.