addBleDevice method
dynamic
addBleDevice(})
添加 waitSettingsState 等待设备进入设置状态
Implementation
addBleDevice(String deviceId, String deviceName,
{Function(String deviceId)? waitSettingsState}) async {
if (waitSettingsState != null) {
methodChannel.setMethodCallHandler((call) {
if (call.method == "waitSettingsState") {
waitSettingsState(call.arguments);
methodChannel.setMethodCallHandler(null);
}
return Future.value("SUCCESS");
});
}
final map = {"deviceId": deviceId, "deviceName": deviceName};
try {
return await methodChannel.invokeMethod(MethodName.addBleDevice, map);
} catch (e) {
methodChannel.setMethodCallHandler(null);
rethrow;
}
}