[web-bluetooth] Bluetooth device connection promise not resolving if device times out

オープン
#668 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 13 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
38/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
javascript
領域
api, web-dev

調査の方向性

automatic-reconnect.html にある web-bluetooth/automatic-reconnect の例を開き、macOS 上の Chrome 79 で Wahoo センサーのタイムアウトシーケンスを再現します。まず、gattserverdisconnected の後の再接続フローと、bluetoothDevice.gatt.disconnect() の後の動作を比較します。タイムアウトした bluetoothDevice.gatt.connect() によって requestDevice() の chooser が停止したままにならず、接続 promise が定義された結果に到達すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

There seems to be a bug in the web-bluetooth/automatic-reconnect example or in the way web bluetooth is implemented in Chrome.
I have already filed a bug-report for Chrome, but since this may relate to API changes the bug may be caused by the fact that the sample code is out of date.

The problem:
Bluetooth device connection promise not resolving if device times out.

Steps to reproduce the problem:

  1. Launch Chrome
  2. Go to: https://googlechrome.github.io/samples/web-bluetooth/automatic-reconnect.html
  3. Click Scan button
  4. Select BTLE device
    (Tested with Wahoo Cadence Sensor and Wahoo Heart Rate Sensor)
  5. Wait for the device to connect
  6. Let the sensor rest until it disconnects
  7. Wait for the 'gattserverdisconnected' event to be triggered and the first reconnect cycle to start
  8. The program will stall and the requestDevice() chooser will stop responding

What is the expected behavior?
The bluetoothDevice.gatt.connect() call should time out after some time if the client can not connect to the server. This does happen if the client disconnects but not the server (The BT device).

What went wrong?
The bluetoothDevice.gatt.connect() Promise seems to never get resolved. This does only happen if the device times out. If the device is removed via bluetoothDevice.gatt.disconnect() the API behaves as expected.

Chrome version: 79.0.3945.130 Channel: stable
OS Version: OS X 10.15.2

主要言語
JavaScript
スター
5.9k
フォーク
2.4k
平均マージ
12日 12時間
マージ済み PR(30日)
1

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

GoogleChrome/samples のほかの issue

GoogleChrome/samples の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。