|
|
@ -922,6 +922,7 @@ class PairingController extends GetxController with WidgetsBindingObserver { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
List<int> macBytes = []; |
|
|
List<int> macBytes = []; |
|
|
|
|
|
List<int> tempBytes = []; |
|
|
if (Platform.isIOS) { |
|
|
if (Platform.isIOS) { |
|
|
for (int i = 7; i <= 12; i++) { |
|
|
for (int i = 7; i <= 12; i++) { |
|
|
// 每个字节异或0x5A |
|
|
// 每个字节异或0x5A |
|
|
@ -930,6 +931,7 @@ class PairingController extends GetxController with WidgetsBindingObserver { |
|
|
} |
|
|
} |
|
|
} else if (Platform.isAndroid) { |
|
|
} else if (Platform.isAndroid) { |
|
|
for (int i = 9; i <= 14; i++) { |
|
|
for (int i = 9; i <= 14; i++) { |
|
|
|
|
|
tempBytes.add(bytes[i]); |
|
|
// 每个字节异或0x5A |
|
|
// 每个字节异或0x5A |
|
|
int decodedByte = bytes[i] ^ 0x5A; |
|
|
int decodedByte = bytes[i] ^ 0x5A; |
|
|
macBytes.add(decodedByte); |
|
|
macBytes.add(decodedByte); |
|
|
@ -940,13 +942,15 @@ class PairingController extends GetxController with WidgetsBindingObserver { |
|
|
String extractedMac = macBytes |
|
|
String extractedMac = macBytes |
|
|
.map((b) => b.toRadixString(16).padLeft(2, '0').toUpperCase()) |
|
|
.map((b) => b.toRadixString(16).padLeft(2, '0').toUpperCase()) |
|
|
.join(':'); |
|
|
.join(':'); |
|
|
|
|
|
String tempMac = tempBytes |
|
|
|
|
|
.map((b) => b.toRadixString(16).padLeft(2, '0').toUpperCase()) |
|
|
|
|
|
.join(':'); |
|
|
// 格式化当前设备MAC地址(确保格式一致) |
|
|
// 格式化当前设备MAC地址(确保格式一致) |
|
|
String formattedDeviceMac = deviceMac.replaceAll(':', '').toUpperCase(); |
|
|
String formattedDeviceMac = deviceMac.replaceAll(':', '').toUpperCase(); |
|
|
String formattedExtractedMac = |
|
|
String formattedExtractedMac = |
|
|
extractedMac.replaceAll(':', '').toUpperCase(); |
|
|
extractedMac.replaceAll(':', '').toUpperCase(); |
|
|
|
|
|
|
|
|
print('设备MAC: $deviceMac, 提取的MAC: $extractedMac'); |
|
|
print('设备MAC: $deviceMac, 提取的MAC: $extractedMac tempMac: $tempMac'); |
|
|
|
|
|
|
|
|
// 对比MAC地址 |
|
|
// 对比MAC地址 |
|
|
if (formattedDeviceMac == formattedExtractedMac) { |
|
|
if (formattedDeviceMac == formattedExtractedMac) { |
|
|
|