diff --git a/lib/blue/blue_manage.dart b/lib/blue/blue_manage.dart index d3d4d587..29ea09f3 100755 --- a/lib/blue/blue_manage.dart +++ b/lib/blue/blue_manage.dart @@ -348,21 +348,43 @@ class BlueManage { } else { // 128位,判断前8位的第3、第4位 if (cleanUuid.length >= 32) { - final String thirdAndFourth = cleanUuid.substring(2, 4); // 索引2和3 - for (final prefix in prefixes) { - if (thirdAndFourth == prefix) { - if (isSingle) { - return true; // isSingle为true,前缀匹配即返回true - } else { - // 判断配对状态(带横杠UUID的第31、32位,从1开始计数) - if (cleanUuid.length >= 32) { - String pairStatus = - cleanUuid.substring(30, 32); // 第31、32位(从1开始计数) - // 00=未配对,01=已配对 - if (pairStatus == '00') { - return true; // 未配对才返回true + if (deviceType == DeviceType.blue) { + final String thirdAndFourth = cleanUuid.substring(6, 8); // 索引2和3 + for (final prefix in prefixes) { + if (thirdAndFourth == prefix) { + if (isSingle) { + return true; // isSingle为true,前缀匹配即返回true + } else { + // 判断配对状态(带横杠UUID的第31、32位,从1开始计数) + if (cleanUuid.length >= 32) { + String pairStatus = + cleanUuid.substring(30, 32); // 第31、32位(从1开始计数) + // 00=未配对,01=已配对 + if (pairStatus == '00') { + return true; // 未配对才返回true + } + // 已配对(01)不返回true,继续判断下一个uuid + } + } + } + } + } else if (deviceType == DeviceType.gateway) { + final String thirdAndFourth = cleanUuid.substring(6, 8); // 索引2和3 + for (final prefix in prefixes) { + if (thirdAndFourth == prefix) { + if (isSingle) { + return true; // isSingle为true,前缀匹配即返回true + } else { + // 判断配对状态(带横杠UUID的第31、32位,从1开始计数) + if (cleanUuid.length >= 32) { + String pairStatus = + cleanUuid.substring(30, 32); // 第31、32位(从1开始计数) + // 00=未配对,01=已配对 + if (pairStatus == '00') { + return true; // 未配对才返回true + } + // 已配对(01)不返回true,继续判断下一个uuid } - // 已配对(01)不返回true,继续判断下一个uuid } } } diff --git a/lib/blue/io_type.dart b/lib/blue/io_type.dart index 6a4ceffa..ac261daf 100755 --- a/lib/blue/io_type.dart +++ b/lib/blue/io_type.dart @@ -9,10 +9,10 @@ List getDeviceType(DeviceType deviceType) { List t = ['758824']; switch (deviceType) { case DeviceType.blue: - t = ['758824', '75', '768824', '76']; + t = ['758824', '75', '768824', '76','24']; break; case DeviceType.gateway: - t = ['758825']; + t = ['758825','25']; break; } return t; diff --git a/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart b/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart index 0b0952f5..34d9b240 100755 --- a/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart +++ b/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart @@ -337,17 +337,15 @@ class NearbyLockLogic extends BaseGetXController { // 'featureSettingValue': state.featureSettingValue, // 'featureSettingParams': state.featureSettingParams, // }); - Get.toNamed(Routers.saveLockPage, - arguments: { - 'addressInfo': {}, - 'pwdTimestamp': state.timestampValue * 1000, - 'lockInfo': state.lockInfo, - 'featureValue': state.featureValue, - 'featureSettingValue': state.featureSettingValue, - 'featureSettingParams': state.featureSettingParams, - 'isFromMap': 0, - }); - + Get.toNamed(Routers.saveLockPage, arguments: { + 'addressInfo': {}, + 'pwdTimestamp': state.timestampValue * 1000, + 'lockInfo': state.lockInfo, + 'featureValue': state.featureValue, + 'featureSettingValue': state.featureSettingValue, + 'featureSettingParams': state.featureSettingParams, + 'isFromMap': 0, + }); break; case 0x06: diff --git a/lib/mine/gateway/addGateway/selectGateway/selectGatewayList_logic.dart b/lib/mine/gateway/addGateway/selectGateway/selectGatewayList_logic.dart index 3de08509..db6b4565 100644 --- a/lib/mine/gateway/addGateway/selectGateway/selectGatewayList_logic.dart +++ b/lib/mine/gateway/addGateway/selectGateway/selectGatewayList_logic.dart @@ -25,6 +25,7 @@ class SelectGatewayListLogic extends BaseGetXController { // 监听设备返回的数据 late StreamSubscription _replySubscription; + void _initReplySubscription() { _replySubscription = EventBusManager().eventBus!.on().listen((Reply reply) async { @@ -35,7 +36,6 @@ class SelectGatewayListLogic extends BaseGetXController { }); } - // WIFI配网结果 Future _replyGatewayGetStatusReply(Reply reply) async { final int status = reply.data[2]; @@ -99,7 +99,7 @@ class SelectGatewayListLogic extends BaseGetXController { void startScanBlueList() { state.devices.clear(); BlueManage().startScan(2000, DeviceType.gateway, (List list) { - AppLog.log('ScanResultList:$list'); + // AppLog.log('ScanResultList:$list'); for (int i = 0; i < list.length; i++) { final ScanResult device = list[i]; // if ((device.advertisementData.serviceUuids.isNotEmpty @@ -211,7 +211,12 @@ class SelectGatewayListLogic extends BaseGetXController { @override void dispose() { - super.dispose(); _replySubscription.cancel(); + super.dispose(); + } + @override + void onClose() { + _replySubscription.cancel(); + super.onClose(); } }