bluetooth: device.gatt.connect() in the handler for gattserverdisconnected should work. |
|||||
Issue descriptionGoogle Chrome 53.0.2768.0 (Official Build) dev (64-bit) Revision 9cd2e77b728d6d5ac115acd944b37df70423c355-refs/heads/master@{#399800} Platform 8459.0.0 (Official Build) dev-channel link What steps will reproduce the problem? (1) Go to https://beaufortfrancois.github.io/samples/web-bluetooth/automatic-reconnect.html (2) Click "Scan" button, Pick nearby device, click "Connect" (3) Device is now connected, Turn it off (4) Device is now disconnected, Turn it on (5) Device is now connected (automatically), Turn it off What is the expected output? The device should be disconnected and I should receive a disconnected event. What do you see instead? It looks like device is not disconnected. See logs: [15406:15406:0617/101048:VERBOSE1:bluetooth_discovery_session.cc(45)] Stopping device discovery session. [15406:15406:0617/101048:VERBOSE1:bluetooth_adapter_bluez.cc(1310)] RemoveDiscoverySession [15406:15406:0617/101048:VERBOSE1:bluetooth_allowed_devices_map.cc(45)] Adding a device to Map of Allowed Devices. [15406:15406:0617/101048:VERBOSE1:bluetooth_allowed_devices_map.cc(63)] Id generated for device: KM1//XTjguzjsIK3shq9ow== [15406:15406:0617/101048:VERBOSE1:web_bluetooth_service_impl.cc(767)] Device: PLAYBULB Candle [15406:15406:0617/101048:VERBOSE1:web_bluetooth_service_impl.cc(768)] UUIDs: [15406:15406:0617/101048:VERBOSE1:web_bluetooth_service_impl.cc(777)] Not Allowed: 00001800-0000-1000-8000-00805f9b34fb [15406:15406:0617/101048:VERBOSE1:web_bluetooth_service_impl.cc(777)] Not Allowed: 00001801-0000-1000-8000-00805f9b34fb [15406:15406:0617/101048:VERBOSE1:web_bluetooth_service_impl.cc(777)] Not Allowed: 0000180a-0000-1000-8000-00805f9b34fb [15406:15406:0617/101048:VERBOSE1:web_bluetooth_service_impl.cc(777)] Not Allowed: 0000180f-0000-1000-8000-00805f9b34fb [15406:15406:0617/101048:VERBOSE1:web_bluetooth_service_impl.cc(777)] Not Allowed: 0000ff02-0000-1000-8000-00805f9b34fb [15406:15406:0617/101048:VERBOSE1:bluetooth_adapter_bluez.cc(1475)] OnStopDiscovery [15406:15406:0617/101048:VERBOSE1:bluetooth_adapter_bluez.cc(971)] Discovering changed: 0 [15406:15406:0617/101048:VERBOSE1:bluetooth_event_router.cc(221)] Releasing Adapter. [15406:15406:0617/101048:VERBOSE1:bluetooth_event_router.cc(221)] Releasing Adapter. [15406:15406:0617/101048:VERBOSE1:bluetooth_device_bluez.cc(383)] /org/bluez/hci0/dev_AC_E6_4B_05_88_2D: Connecting, 1 in progress [15406:15406:0617/101048:VERBOSE1:bluetooth_device_bluez.cc(682)] /org/bluez/hci0/dev_AC_E6_4B_05_88_2D: Connecting [15406:15406:0617/101048:VERBOSE1:bluetooth_device_bluez.cc(698)] /org/bluez/hci0/dev_AC_E6_4B_05_88_2D: Connected, 0 still in progress [15406:15406:0617/101049:VERBOSE1:web_bluetooth_service_impl.cc(255)] Services discovered for device: AC:E6:4B:05:88:2D [15406:15406:0617/101049:VERBOSE3:bluetooth_device_bluez.cc(565)] All services were discovered for device: /org/bluez/hci0/dev_AC_E6_4B_05_88_2D [15406:15406:0617/101100:VERBOSE1:bluetooth_device_bluez.cc(471)] /org/bluez/hci0/dev_AC_E6_4B_05_88_2D: Disconnecting [15406:15406:0617/101100:VERBOSE1:bluetooth_device_bluez.cc(826)] /org/bluez/hci0/dev_AC_E6_4B_05_88_2D: Disconnected [15406:15406:0617/101100:VERBOSE1:bluetooth_device_bluez.cc(383)] /org/bluez/hci0/dev_AC_E6_4B_05_88_2D: Connecting, 1 in progress [15406:15406:0617/101100:VERBOSE1:bluetooth_device_bluez.cc(682)] /org/bluez/hci0/dev_AC_E6_4B_05_88_2D: Connecting [15406:15406:0617/101104:VERBOSE1:bluetooth_device_bluez.cc(698)] /org/bluez/hci0/dev_AC_E6_4B_05_88_2D: Connected, 0 still in progress [15406:15406:0617/101105:VERBOSE1:web_bluetooth_service_impl.cc(255)] Services discovered for device: AC:E6:4B:05:88:2D [15406:15406:0617/101105:VERBOSE3:bluetooth_device_bluez.cc(565)] All services were discovered for device: /org/bluez/hci0/dev_AC_E6_4B_05_88_2D [15406:15406:0617/101107:VERBOSE1:bluetooth_device_bluez.cc(471)] /org/bluez/hci0/dev_AC_E6_4B_05_88_2D: Disconnecting [15406:15406:0617/101107:VERBOSE1:bluetooth_device_bluez.cc(826)] /org/bluez/hci0/dev_AC_E6_4B_05_88_2D: Disconnected
,
Jun 17 2016
This is fixed when adding a timeout before device.gatt.connect after gattserverdisconnected. I wonder why though...
,
Jun 17 2016
,
Jun 17 2016
A simple fix like "setTimeout(connect, 0)" works.
,
Jun 17 2016
WIP at https://codereview.chromium.org/2076103002
,
Jun 17 2016
Thanks for tracking this down Francois! I have another patch based on yours at: https://codereview.chromium.org/2072423002
,
Jun 18 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/efe33416c5109c9d155eb081a4894201519d902e commit efe33416c5109c9d155eb081a4894201519d902e Author: ortuno <ortuno@chromium.org> Date: Sat Jun 18 21:23:13 2016 bluetooth: Remove device before dispatching event Changes the order in which we removed the device and dispatched the disconnected event. The previous order (dispatch -> remove), could result in removing a device that was added by the event handler. BUG= 621022 Review-Url: https://codereview.chromium.org/2072423002 Cr-Commit-Position: refs/heads/master@{#400601} [modify] https://crrev.com/efe33416c5109c9d155eb081a4894201519d902e/content/renderer/bluetooth/web_bluetooth_impl.cc [modify] https://crrev.com/efe33416c5109c9d155eb081a4894201519d902e/third_party/WebKit/LayoutTests/TestExpectations [add] https://crrev.com/efe33416c5109c9d155eb081a4894201519d902e/third_party/WebKit/LayoutTests/bluetooth/gattserverdisconnected-event/reconnect-during-disconnected-event.html
,
Jun 20 2016
|
|||||
►
Sign in to add a comment |
|||||
Comment 1 by fbeaufort@chromium.org
, Jun 17 2016