fix:修复无法搜索到网关的问题

This commit is contained in:
liyi 2025-07-23 10:58:03 +08:00
parent 4045adf0b2
commit 139d16387c
2 changed files with 39 additions and 16 deletions

View File

@ -348,21 +348,43 @@ class BlueManage {
} else {
// 128834
if (cleanUuid.length >= 32) {
final String thirdAndFourth = cleanUuid.substring(2, 4); // 23
for (final prefix in prefixes) {
if (thirdAndFourth == prefix) {
if (isSingle) {
return true; // isSingle为truetrue
} else {
// UUID的第31321
if (cleanUuid.length >= 32) {
String pairStatus =
cleanUuid.substring(30, 32); // 31321
// 00=01=
if (pairStatus == '00') {
return true; // true
if (deviceType == DeviceType.blue) {
final String thirdAndFourth = cleanUuid.substring(2, 4); // 23
for (final prefix in prefixes) {
if (thirdAndFourth == prefix) {
if (isSingle) {
return true; // isSingle为truetrue
} else {
// UUID的第31321
if (cleanUuid.length >= 32) {
String pairStatus =
cleanUuid.substring(30, 32); // 31321
// 00=01=
if (pairStatus == '00') {
return true; // true
}
// 01trueuuid
}
}
}
}
} else if (deviceType == DeviceType.gateway) {
final String thirdAndFourth = cleanUuid.substring(2, 8); // 23
for (final prefix in prefixes) {
if (thirdAndFourth == prefix) {
if (isSingle) {
return true; // isSingle为truetrue
} else {
// UUID的第31321
if (cleanUuid.length >= 32) {
String pairStatus =
cleanUuid.substring(30, 32); // 31321
// 00=01=
if (pairStatus == '00') {
return true; // true
}
// 01trueuuid
}
// 01trueuuid
}
}
}

View File

@ -99,7 +99,7 @@ class SelectGatewayListLogic extends BaseGetXController {
void startScanBlueList() {
state.devices.clear();
BlueManage().startScan(2000, DeviceType.gateway, (List<ScanResult> 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,8 @@ class SelectGatewayListLogic extends BaseGetXController {
@override
void dispose() {
super.dispose();
_replySubscription.cancel();
super.dispose();
}
}