修改删除bug
This commit is contained in:
parent
96572aeecf
commit
bd04a5a9b3
@ -216,7 +216,9 @@ class BlueManage{
|
||||
|
||||
// 重新连接
|
||||
Future<void> judgeReconnect(String deviceMAC, String deviceName, ConnectStateCallBack? connectStateCallBack, {bool isShowLoading = true}) async {
|
||||
print("11111111$deviceConnectionState");
|
||||
if(deviceConnectionState == DeviceConnectionState.connected){
|
||||
print("2222222:$deviceConnectionState");
|
||||
if(isShowLoading){
|
||||
EasyLoading.show();
|
||||
Future.delayed(const Duration(seconds: 10), () { //asynchronous delay
|
||||
@ -228,8 +230,10 @@ class BlueManage{
|
||||
}
|
||||
connectStateCallBack!(deviceConnectionState!);
|
||||
}else{
|
||||
print("333333333:${deviceConnectionState}");
|
||||
connect(deviceMAC, deviceName, isShowLoading: false, connectStateCallBack: (state){
|
||||
connectStateCallBack!(deviceConnectionState!);
|
||||
print("44444444:${state}");
|
||||
connectStateCallBack!(state);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -237,11 +237,11 @@ class LockSetLogic extends BaseGetXController {
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
blockDeletNumberCheckPasswordCallback();
|
||||
if(state.currentDeviceUUid.value.isEmpty){
|
||||
Toast.show(msg: "未扫描到当前设备,请确保您在设备旁边、设备已开启、设备未被其他人连接");
|
||||
return;
|
||||
}
|
||||
if(state.currentDeviceUUid.value[31] == "1"){
|
||||
// if(state.currentDeviceUUid.value.isEmpty){
|
||||
// Toast.show(msg: "未扫描到当前设备,请确保您在设备旁边、设备已开启、设备未被其他人连接");
|
||||
// return;
|
||||
// }
|
||||
// if(state.currentDeviceUUid.value[31] == "1"){
|
||||
// 已配对
|
||||
if(state.getKeyInfosData.value.isLockOwner == 1){
|
||||
// 调用删除锁协议
|
||||
@ -250,16 +250,16 @@ class LockSetLogic extends BaseGetXController {
|
||||
// 调用删除钥匙协议
|
||||
deletUserAction();
|
||||
}
|
||||
}else if(state.currentDeviceUUid.value[31] == "0"){
|
||||
// 未配对
|
||||
if(state.getKeyInfosData.value.isLockOwner == 1){
|
||||
// 直接调用删除锁接口
|
||||
deletLockInfoData();
|
||||
}else{
|
||||
// 直接调用删除要是接口
|
||||
deletKeyData();
|
||||
}
|
||||
}
|
||||
// }else if(state.currentDeviceUUid.value[31] == "0"){
|
||||
// // 未配对
|
||||
// if(state.getKeyInfosData.value.isLockOwner == 1){
|
||||
// // 直接调用删除锁接口
|
||||
// deletLockInfoData();
|
||||
// }else{
|
||||
// // 直接调用删除要是接口
|
||||
// deletKeyData();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -440,7 +440,7 @@ class LockDetailLogic extends BaseGetXController{
|
||||
BlueManage().connectDeviceMacAddress = v[knownDeviceIndex].id;
|
||||
connectBlue(v[knownDeviceIndex].id, state.keyInfos.value.bluetooth!.bluetoothDeviceName!);
|
||||
eventBus.fire(ScanAllDeviceFindCurrentDeviceConnectedEvent(v[knownDeviceIndex].serviceUuids[0].toString()));
|
||||
// BlueManage().stopScan();
|
||||
BlueManage().stopScan();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -367,7 +367,7 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
||||
bottomItem(
|
||||
'images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr,
|
||||
() {
|
||||
// BlueManage().stopScan();
|
||||
BlueManage().stopScan();
|
||||
Get.toNamed(Routers.lockSetPage, arguments: widget.keyInfo);
|
||||
}),
|
||||
];
|
||||
|
||||
@ -11,7 +11,7 @@ class AddLockLogic extends BaseGetXController {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
|
||||
BlueManage().stopScan();
|
||||
// BlueManage().stopScan();
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@ -29,10 +29,12 @@ class NearbyLockLogic extends BaseGetXController{
|
||||
// 点击连接设备
|
||||
void connect(String lockId, String deviceName){
|
||||
// BlueManage().stopScan();
|
||||
BlueManage().judgeReconnect(lockId, deviceName, (DeviceConnectionState state) async {
|
||||
IoSenderManage.getPublicKey(lockId: deviceName);
|
||||
}, isShowLoading: true);
|
||||
// BlueManage().connect(lockId, deviceName, isFrist: true, isShowLoading: true);
|
||||
// BlueManage().judgeReconnect(lockId, deviceName, (DeviceConnectionState state) async {
|
||||
// if (state == DeviceConnectionState.connected) {
|
||||
// IoSenderManage.getPublicKey(lockId: deviceName);
|
||||
// }
|
||||
// }, isShowLoading: true);
|
||||
BlueManage().connect(lockId, deviceName, isFrist: true, isShowLoading: true);
|
||||
}
|
||||
|
||||
// 获取解析后的数据
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user