expo-ble模块测试demo 联调BLE模块 take 8 新增空数据包测试
This commit is contained in:
@@ -95,9 +95,11 @@ export class BleClient {
|
||||
autoConnect: false,
|
||||
requestMTU: BLE_UUIDS.REQUEST_MTU
|
||||
});
|
||||
if (device.mtu !== BLE_UUIDS.REQUEST_MTU) {
|
||||
if (device.mtu < BLE_UUIDS.REQUEST_MTU) {
|
||||
console.log("MTU not supported, requesting default to ", BLE_UUIDS.REQUEST_MTU);
|
||||
device = await device.requestMTU(BLE_UUIDS.REQUEST_MTU)
|
||||
device = await device.requestMTU(BLE_UUIDS.REQUEST_MTU);
|
||||
// Give some time for the stack to stabilize after MTU change
|
||||
await new Promise(resolve => setTimeout(resolve, 500));
|
||||
}
|
||||
console.log("Connected to device with MTU = ", device.mtu);
|
||||
this.connectedDevice = await device.discoverAllServicesAndCharacteristics();
|
||||
|
||||
Reference in New Issue
Block a user