Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

bluetooth.connect with autoDiscoverAll hangs on iOS for BT Assigned Numbers

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

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

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
38/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
typescript
領域
mobile-dev

調査の方向性

src/bluetooth.ios.ts の discoverCharacteristics から始め、prepareArgs デコレーターが args.serviceUUID をどのように変更するかを追跡します。autoDiscoverAll を有効にした Assigned Numbers のケースを再現し、UUID の比較によって discovery が完了して onConnected が呼び出され、promise が未解決のままにならないことを確認します。

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

説明

I'm investigating an issue where bluetooth.connect() fails to resolve the promise when a serviceUUID falls under the Bluetooth Assigned Numbers list:

my project versions:

{
        "@nativescript/core": "^8.4.1",
        "@nativescript-community/ble": "^3.1.11",
}

the call to bluetooth.connect():

            await this.bluetooth.connect({
                UUID: deviceUuid,
                // autoDiscoverAll causes the hang... but only for those Assigned Number serviceUUIDs (link above)
                autoDiscoverAll: true, 
                onConnected: (peripheral) => {
                    // the onConnected() callback is never called... 
                },
                onDisconnected: function (peripheral) {
                    // onDisconnected IS called, on disconnect
                }
            });

I have tracked the problem down to:
https://github.com/nativescript-community/ble/blob/master/src/bluetooth.ios.ts#L1643-L1644

    @bluetoothEnabled
    @prepareArgs
    public discoverCharacteristics(args: DiscoverCharacteristicsOptions) {
        // ...
                    const sUUID = CBUUIDToString(service.UUID);
                    if (UUID === pUUID && sUUID === args.serviceUUID) {
                        // ...
                    }
        // ...
    }

the issue is the following comparison fails:

# "0000181a-0000-1000-8000-00805f9b34fb" == "181a"
sUUID === args.serviceUUID

args.serviceUUID is being be modified by the decorator prepareArgs() to a "Short UUID", if the service's UUID matches a Bluetooth Assigned Number of the form

const pattern = /0000(.{4})-0000-1000-8000-00805f9b34fb/;

however, sUUID returned by CBUUIDToString(service.UUID) is a "Long UUID"

Long vs Short UUIDs:

I'll work on a fix and submit a PR today hopefully...

主要言語
TypeScript
スター
202
フォーク
79
PR マージ指標
30日以内にマージされた PR はありません

環境構築

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

はじめの一歩

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

nativescript-community/ble のほかの issue

nativescript-community/ble の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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