From 3394e2dc0c32f02306dad7bf492cd46ba4693fff Mon Sep 17 00:00:00 2001 From: handongxun Date: Tue, 28 Jul 2020 20:55:05 +0800 Subject: [PATCH] docs: new bluetooth API: uni.setBLEMTU uni.getBLEDeviceRSSI --- docs/api/system/ble.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/docs/api/system/ble.md b/docs/api/system/ble.md index d39bf3e9b..f1efde643 100644 --- a/docs/api/system/ble.md +++ b/docs/api/system/ble.md @@ -4,6 +4,22 @@ |:-:|:-:|:-:|:-:|:-:|:-:|:-:| |√|x|√|√|x|x|x| +### uni.setBLEMTU(OBJECT) + +2.8.4+ + +设置蓝牙最大传输单元。需在 uni.createBLEConnection调用成功后调用,mtu 设置范围 (22,512)。安卓5.1以上有效。 + +**OBJECT 参数说明** + +|属性|类型|默认值|必填|说明| +|---|---|---|---|---| +|deviceId|string||是|用于区分设备的 id| +|mtu|number||是|最大传输单元(22,512) 区间内,单位 bytes| +|success|function||否|接口调用成功的回调函数| +|fail|function||否|接口调用失败的回调函数| +|complete|function||否|接口调用结束的回调函数(调用成功、失败都会执行)| + ### uni.writeBLECharacteristicValue(OBJECT) 向低功耗蓝牙设备特征值中写入二进制数据。注意:必须设备的特征值支持 write 才可以成功调用。 @@ -282,6 +298,23 @@ uni.getBLEDeviceServices({ }) ``` + +### uni.getBLEDeviceRSSI(OBJECT) + +2.8.4+ + +获取蓝牙设备的信号强度。 + +**OBJECT 参数说明** + +|属性|类型|默认值|必填|说明| +|---|---|---|---|---| +|deviceId|string||是|蓝牙设备 id| +|success|function||否|接口调用成功的回调函数| +|fail|function||否|接口调用失败的回调函数| +|complete|function||否|接口调用结束的回调函数(调用成功、失败都会执行)| + + ### uni.getBLEDeviceCharacteristics(OBJECT) 获取蓝牙设备某个服务中所有特征值(characteristic)。 -- GitLab