From bd04a5a9b30dbeb463745680ecf52fd9831a5e11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AD=8F=E5=B0=91=E9=98=B3?= <786612630@qq.com> Date: Fri, 20 Oct 2023 14:25:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=A0=E9=99=A4bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- star_lock/lib/blue/blue_manage.dart | 6 +++- .../lcokSet/lockSet/lockSet_logic.dart | 30 +++++++++---------- .../lockDetail/lockDetail_logic.dart | 2 +- .../lockDetail/lockDetail_page.dart | 2 +- .../mine/addLock/addLock/addLock_logic.dart | 2 +- .../addLock/nearbyLock/nearbyLock_logic.dart | 10 ++++--- 6 files changed, 29 insertions(+), 23 deletions(-) diff --git a/star_lock/lib/blue/blue_manage.dart b/star_lock/lib/blue/blue_manage.dart index 0fcd976f..7737392b 100644 --- a/star_lock/lib/blue/blue_manage.dart +++ b/star_lock/lib/blue/blue_manage.dart @@ -216,7 +216,9 @@ class BlueManage{ // 重新连接 Future 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); }); } } diff --git a/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_logic.dart index 9248b41b..e6186e02 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_logic.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_logic.dart @@ -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(); + // } + // } } } diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart index 6d21141c..c4ebb6dc 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart @@ -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(); } }); } diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart index ead1aaa9..46fb1122 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart @@ -367,7 +367,7 @@ class _LockDetailPageState extends State with TickerProviderStat bottomItem( 'images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr, () { - // BlueManage().stopScan(); + BlueManage().stopScan(); Get.toNamed(Routers.lockSetPage, arguments: widget.keyInfo); }), ]; diff --git a/star_lock/lib/mine/addLock/addLock/addLock_logic.dart b/star_lock/lib/mine/addLock/addLock/addLock_logic.dart index 7f43b2b0..f54c9bf9 100644 --- a/star_lock/lib/mine/addLock/addLock/addLock_logic.dart +++ b/star_lock/lib/mine/addLock/addLock/addLock_logic.dart @@ -11,7 +11,7 @@ class AddLockLogic extends BaseGetXController { // TODO: implement onReady super.onReady(); - BlueManage().stopScan(); + // BlueManage().stopScan(); } @override diff --git a/star_lock/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart b/star_lock/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart index b85f58ec..9a3d6623 100644 --- a/star_lock/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart +++ b/star_lock/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart @@ -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); } // 获取解析后的数据