更新ios蓝牙连接
This commit is contained in:
@@ -989,97 +989,97 @@ class _MHTBlueteethDevicePageState extends State<MHTBlueteethDevicePage> {
|
|||||||
}
|
}
|
||||||
return result.device.remoteId.str.toUpperCase();
|
return result.device.remoteId.str.toUpperCase();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void advertisDataFormatter(var a, item) {
|
void advertisDataFormatter(var a, item) {
|
||||||
Map<String, dynamic> obj = {};
|
Map<String, dynamic> obj = {};
|
||||||
try {
|
try {
|
||||||
if (a[2] == 1) {
|
if (a[2] == 1) {
|
||||||
obj['sn'] = a[3];
|
obj['sn'] = a[3];
|
||||||
obj['deviceId'] = ab2str(a.sublist(4, 10)).toUpperCase();
|
obj['deviceId'] = ab2str(a.sublist(4, 10)).toUpperCase();
|
||||||
obj['b'] = a[10];
|
obj['b'] = a[10];
|
||||||
obj['h'] = a[11];
|
obj['h'] = a[11];
|
||||||
obj['t'] = a[12];
|
obj['t'] = a[12];
|
||||||
item['adData'] = obj;
|
item['adData'] = obj;
|
||||||
} else if (a[2] == 2) {
|
} else if (a[2] == 2) {
|
||||||
obj['sn'] = a[3];
|
obj['sn'] = a[3];
|
||||||
obj['deviceId'] = ab2str(a.sublist(4, 10)).toUpperCase();
|
obj['deviceId'] = ab2str(a.sublist(4, 10)).toUpperCase();
|
||||||
obj['b'] = a[10];
|
obj['b'] = a[10];
|
||||||
obj['h'] = a[11];
|
obj['h'] = a[11];
|
||||||
obj['t'] = a[12];
|
obj['t'] = a[12];
|
||||||
obj['net'] = (a[13] & 1) == 1 ? '在线' : '离线';
|
obj['net'] = (a[13] & 1) == 1 ? '在线' : '离线';
|
||||||
obj['flag'] = (a[13] & 2) == 2 ? '异常' : '正常';
|
obj['flag'] = (a[13] & 2) == 2 ? '异常' : '正常';
|
||||||
ByteData byteData = ByteData.sublistView(
|
ByteData byteData = ByteData.sublistView(
|
||||||
Uint8List.fromList(a.sublist(14, 18).reversed.toList()));
|
Uint8List.fromList(a.sublist(14, 18).reversed.toList()));
|
||||||
obj['version'] = byteData.getUint32(0);
|
obj['version'] = byteData.getUint32(0);
|
||||||
item['adData'] = obj;
|
item['adData'] = obj;
|
||||||
} else if (a[2] == 3) {
|
} else if (a[2] == 3) {
|
||||||
List<String> otherstr = [];
|
List<String> otherstr = [];
|
||||||
obj['sn'] = a[3];
|
obj['sn'] = a[3];
|
||||||
obj['deviceId'] = ab2str(a.sublist(4, 10)).toUpperCase();
|
obj['deviceId'] = ab2str(a.sublist(4, 10)).toUpperCase();
|
||||||
obj['b'] = a[10];
|
obj['b'] = a[10];
|
||||||
obj['h'] = a[11];
|
obj['h'] = a[11];
|
||||||
obj['t'] = a[12];
|
obj['t'] = a[12];
|
||||||
obj['net'] = (a[13] & 1) == 1 ? '在线' : '离线';
|
obj['net'] = (a[13] & 1) == 1 ? '在线' : '离线';
|
||||||
obj['flag'] = (a[13] & 2) == 2 ? '异常' : '正常';
|
obj['flag'] = (a[13] & 2) == 2 ? '异常' : '正常';
|
||||||
|
|
||||||
if ((a[13] & 4) == 4) {
|
if ((a[13] & 4) == 4) {
|
||||||
otherstr.add('呼吸暂停');
|
otherstr.add('呼吸暂停');
|
||||||
}
|
|
||||||
|
|
||||||
if ((a[13] & 8) == 8 && (a[13] & 1) == 1) {
|
|
||||||
obj['isbed'] = '在床';
|
|
||||||
} else {
|
|
||||||
obj['isbed'] = '离床';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((a[13] & 16) == 16) {
|
|
||||||
otherstr.add('授权过期');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((a[13] & 64) == 64) {
|
|
||||||
otherstr.add('设备休眠');
|
|
||||||
}
|
|
||||||
|
|
||||||
obj['other'] = otherstr.join('、');
|
|
||||||
|
|
||||||
ByteData byteData = ByteData.sublistView(
|
|
||||||
Uint8List.fromList(a.sublist(14, 18).reversed.toList()));
|
|
||||||
obj['version'] = byteData.getUint32(0);
|
|
||||||
|
|
||||||
ByteData qsnData =
|
|
||||||
ByteData.sublistView(Uint8List.fromList(a.sublist(17, 19)));
|
|
||||||
obj['qsn'] = qsnData.getUint16(0) * 256 + obj['sn'];
|
|
||||||
|
|
||||||
item['adData'] = obj;
|
|
||||||
} else if (a.length > 17) {
|
|
||||||
obj['sn'] = a[3];
|
|
||||||
obj['deviceId'] = ab2str(a.sublist(4, 10)).toUpperCase();
|
|
||||||
obj['b'] = a[10];
|
|
||||||
obj['h'] = a[11];
|
|
||||||
obj['t'] = a[12];
|
|
||||||
obj['net'] = (a[13] & 1) == 1 ? '在线' : '离线';
|
|
||||||
obj['flag'] = (a[13] & 2) == 2 ? '异常' : '正常';
|
|
||||||
|
|
||||||
ByteData byteData = ByteData.sublistView(
|
|
||||||
Uint8List.fromList(a.sublist(14, 18).reversed.toList()));
|
|
||||||
obj['version'] = byteData.getUint32(0);
|
|
||||||
|
|
||||||
item['adData'] = obj;
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
|
||||||
print(e);
|
if ((a[13] & 8) == 8 && (a[13] & 1) == 1) {
|
||||||
|
obj['isbed'] = '在床';
|
||||||
|
} else {
|
||||||
|
obj['isbed'] = '离床';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((a[13] & 16) == 16) {
|
||||||
|
otherstr.add('授权过期');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((a[13] & 64) == 64) {
|
||||||
|
otherstr.add('设备休眠');
|
||||||
|
}
|
||||||
|
|
||||||
|
obj['other'] = otherstr.join('、');
|
||||||
|
|
||||||
|
ByteData byteData = ByteData.sublistView(
|
||||||
|
Uint8List.fromList(a.sublist(14, 18).reversed.toList()));
|
||||||
|
obj['version'] = byteData.getUint32(0);
|
||||||
|
|
||||||
|
ByteData qsnData =
|
||||||
|
ByteData.sublistView(Uint8List.fromList(a.sublist(17, 19)));
|
||||||
|
obj['qsn'] = qsnData.getUint16(0) * 256 + obj['sn'];
|
||||||
|
|
||||||
|
item['adData'] = obj;
|
||||||
|
} else if (a.length > 17) {
|
||||||
|
obj['sn'] = a[3];
|
||||||
|
obj['deviceId'] = ab2str(a.sublist(4, 10)).toUpperCase();
|
||||||
|
obj['b'] = a[10];
|
||||||
|
obj['h'] = a[11];
|
||||||
|
obj['t'] = a[12];
|
||||||
|
obj['net'] = (a[13] & 1) == 1 ? '在线' : '离线';
|
||||||
|
obj['flag'] = (a[13] & 2) == 2 ? '异常' : '正常';
|
||||||
|
|
||||||
|
ByteData byteData = ByteData.sublistView(
|
||||||
|
Uint8List.fromList(a.sublist(14, 18).reversed.toList()));
|
||||||
|
obj['version'] = byteData.getUint32(0);
|
||||||
|
|
||||||
|
item['adData'] = obj;
|
||||||
}
|
}
|
||||||
}
|
} catch (e) {
|
||||||
|
print(e);
|
||||||
bool isQuanShiDevice(name) {
|
|
||||||
return "$name".contains("S4-ZM-M94-4") ||
|
|
||||||
"$name".contains("S4-ZM-N94-4") ||
|
|
||||||
"$name".contains("MHT-SWES-D");
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isMHTSWES(name) {
|
|
||||||
return "$name".contains("MHT-") ||
|
|
||||||
"$name".contains("MHT-SWES-M") ||
|
|
||||||
"$name".contains("MHT-SWES-S");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isQuanShiDevice(name) {
|
||||||
|
return "$name".contains("S4-ZM-M94-4") ||
|
||||||
|
"$name".contains("S4-ZM-N94-4") ||
|
||||||
|
"$name".contains("MHT-SWES-D");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isMHTSWES(name) {
|
||||||
|
return "$name".contains("MHT-") ||
|
||||||
|
"$name".contains("MHT-SWES-M") ||
|
||||||
|
"$name".contains("MHT-SWES-S");
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user