概述
概述部分Capacitor 蓝牙低能耗插件用于 BLE 通信。
核心功能
概述部分initialize- 初始化 BLE 插件。必须在调用任何其他方法之前调用。shimWebBluetooth- 安装 Capacitor Web Bluetooth shimnavigator.bluetooth. Call this manually before using the Web Bluetooth API from a Capacitor native app.isAvailable- 设备上是否有蓝牙功能。isEnabled- 设备蓝牙是否已启用。
公共 API
公共 API| 方法 | 描述 |
|---|---|
initialize | 初始化 BLE 插件。必须在调用任何其他方法之前调用。 |
shimWebBluetooth | 安装 Capacitor Web Bluetooth shim。 navigator.bluetooth. Call this manually before using the Web Bluetooth API from a Capacitor native app. |
isAvailable | - 设备上是否有蓝牙功能。 |
isEnabled | - 设备蓝牙是否已启用。 |
isLocationEnabled | 检查是否启用位置服务 (仅限 Android). |
openAppSettings | 打开应用设置页面. |
openBluetoothSettings | 打开蓝牙设置页面 (仅限 Android). |
openLocationSettings | 打开位置设置页面 (仅限 Android). |
checkPermissions | 检查当前权限状态. |
requestPermissions | 请求蓝牙权限. |
startScan | 开始扫描 BLE 设备. |
stopScan | 停止扫描 BLE 设备. |
connect | 连接到 BLE 设备. |
disconnect | 断开与 BLE 设备的连接. |
createBond | 与 BLE 设备建立绑定关系 (仅限 Android). |
isBonded | 检查设备是否已绑定 (仅限 Android). |
discoverServices | 在连接设备上发现服务。 |
getServices | 获取一个设备的已发现服务。 |
getConnectedDevices | 获取已连接设备的列表。 |
readCharacteristic | 读取特征值。 |
writeCharacteristic | 将值写入特征。 |
startCharacteristicNotifications | 为特征启动通知。 |
stopCharacteristicNotifications | 为特征停止通知。 |
readDescriptor | 读取描述符值。 |
writeDescriptor | 将值写入描述符。 |
readRssi | 读取连接设备的RSSI(信号强度)。 |
requestMtu | 仅限Android,请求MTU大小更改。 |
requestConnectionPriority | 仅限Android,请求连接优先级。 |
startAdvertising | 开始作为外设进行广告(BLE 服务器)。 |
stopAdvertising | 停止广告。 |
startForegroundService | 启动前台服务以在后台维持BLE连接(仅Android)。 |
stopForegroundService | 停止前台服务(仅Android)。 |
getPluginVersion | 获取本地Capacitor插件版本。 |
addListener | 添加设备扫描事件的监听器。 |
addListener | 添加设备连接事件的监听器。 |
addListener | 添加设备断开连接事件的监听器。 |
addListener | 添加特征值改变事件的监听器。 |
removeAllListeners | 移除此插件的所有监听器。 |
真实数据来源
标题:真实数据来源本参考文档是从 src/definitions.ts 在 capacitor-蓝牙低功耗.
继续从 @capgo/capacitor-蓝牙低功耗
标题:继续从 @capgo/capacitor-蓝牙低功耗”如果您正在使用 @capgo/capacitor-蓝牙低功耗 来规划迁移和企业运营,连接它与 使用 @capgo/capacitor-蓝牙低功耗 来使用本地能力的 Using @capgo/capacitor-蓝牙低功耗, Capgo企业 来使用产品工作流程的 Capgo企业, Ionic Enterprise Plugin Alternatives Ionic Enterprise Plugin替代方案 Capgo替代方案 在Capgo替代方案中, Capgo咨询 在Capgo咨询中,