使用 cordova-plugin-ble-central 无需扫描即可连接 BLE

问题描述 投票:0回答:1

我在 Cordova 应用程序中使用 cordova-plugin-ble-central 插件。它使用 BT 连接到 ESP32 板。如果我使用序列:

1) ble.scan
2) ble.connect

效果很好。当我存储在扫描操作期间找到的设备 ID 并用于连接功能并且在没有事先扫描的情况下使用它时,连接功能失败并出现错误:

Could not find peripheral

如果我执行 ble.scan 并使用先前会话中存储的 ID 进行连接,则连接会成功。有没有办法,如何在不扫描设备的情况下进行连接?

cordova bluetooth bluetooth-lowenergy
1个回答
1
投票

不,这通常不能可靠地完成,至少在 Android 上不能。请参阅我的答案中的完整解释https://stackoverflow.com/a/43482099

© www.soinside.com 2019 - 2024. All rights reserved.