取消注释厂商名称写死为--XL
This commit is contained in:
parent
7b1bda144f
commit
f8efe06412
@ -22,7 +22,8 @@ class NearbyLockLogic extends BaseGetXController {
|
|||||||
// 点击连接设备
|
// 点击连接设备
|
||||||
void connect(String deviceName) {
|
void connect(String deviceName) {
|
||||||
showEasyLoading();
|
showEasyLoading();
|
||||||
BlueManage().bludSendData(deviceName, (BluetoothConnectionState state) async {
|
BlueManage().bludSendData(deviceName,
|
||||||
|
(BluetoothConnectionState state) async {
|
||||||
if (state == BluetoothConnectionState.connected) {
|
if (state == BluetoothConnectionState.connected) {
|
||||||
IoSenderManage.getPublicKey(lockId: deviceName);
|
IoSenderManage.getPublicKey(lockId: deviceName);
|
||||||
} else if (state == BluetoothConnectionState.disconnected) {
|
} else if (state == BluetoothConnectionState.disconnected) {
|
||||||
@ -34,7 +35,8 @@ class NearbyLockLogic extends BaseGetXController {
|
|||||||
// 获取解析后的数据
|
// 获取解析后的数据
|
||||||
late StreamSubscription<Reply> _replySubscription;
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
void _initReplySubscription() {
|
void _initReplySubscription() {
|
||||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) {
|
_replySubscription =
|
||||||
|
EventBusManager().eventBus!.on<Reply>().listen((reply) {
|
||||||
if (reply is GetPublicKeyReply) {
|
if (reply is GetPublicKeyReply) {
|
||||||
_replyGetPublicKey(reply);
|
_replyGetPublicKey(reply);
|
||||||
}
|
}
|
||||||
@ -141,8 +143,8 @@ class NearbyLockLogic extends BaseGetXController {
|
|||||||
// 厂商名称
|
// 厂商名称
|
||||||
var vendor = reply.data.sublist(3, 23);
|
var vendor = reply.data.sublist(3, 23);
|
||||||
var vendorStr = utf8String(vendor);
|
var vendorStr = utf8String(vendor);
|
||||||
// state.lockInfo["vendor"] = vendorStr;
|
state.lockInfo["vendor"] = vendorStr;
|
||||||
state.lockInfo["vendor"] = "XL";
|
// state.lockInfo["vendor"] = "XL";
|
||||||
Get.log("vendor:$vendor vendorStr:$vendorStr reply.data:${reply.data}");
|
Get.log("vendor:$vendor vendorStr:$vendorStr reply.data:${reply.data}");
|
||||||
|
|
||||||
// 锁设备类型
|
// 锁设备类型
|
||||||
@ -173,7 +175,8 @@ class NearbyLockLogic extends BaseGetXController {
|
|||||||
var serialNum0Str = utf8String(serialNum0);
|
var serialNum0Str = utf8String(serialNum0);
|
||||||
state.lockInfo["serialNum0"] = serialNum0Str;
|
state.lockInfo["serialNum0"] = serialNum0Str;
|
||||||
// state.lockInfo["serialNum0"] = "${DateTime.now().millisecondsSinceEpoch ~/ 10}";
|
// state.lockInfo["serialNum0"] = "${DateTime.now().millisecondsSinceEpoch ~/ 10}";
|
||||||
Get.log("serialNum0Str:$serialNum0Str serialNum0Str:${serialNum0Str.length}");
|
Get.log(
|
||||||
|
"serialNum0Str:$serialNum0Str serialNum0Str:${serialNum0Str.length}");
|
||||||
|
|
||||||
// 成品商序列号
|
// 成品商序列号
|
||||||
var serialNum1 = reply.data.sublist(100, 116);
|
var serialNum1 = reply.data.sublist(100, 116);
|
||||||
@ -240,7 +243,8 @@ class NearbyLockLogic extends BaseGetXController {
|
|||||||
showToast("锁数据异常,请重试");
|
showToast("锁数据异常,请重试");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var featureValue = reply.data.sublist(index + 1, index + featureValueLength + 1);
|
var featureValue =
|
||||||
|
reply.data.sublist(index + 1, index + featureValueLength + 1);
|
||||||
String featureValueStr = asciiString(featureValue);
|
String featureValueStr = asciiString(featureValue);
|
||||||
state.featureValue = featureValueStr;
|
state.featureValue = featureValueStr;
|
||||||
// List allFeatureValueTwoList = charListChangeIntList(featureValue);
|
// List allFeatureValueTwoList = charListChangeIntList(featureValue);
|
||||||
@ -255,7 +259,8 @@ class NearbyLockLogic extends BaseGetXController {
|
|||||||
showToast("锁数据异常,请重试");
|
showToast("锁数据异常,请重试");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var featureEnVal = reply.data.sublist(index + 1, index + featureEnValLength + 1);
|
var featureEnVal =
|
||||||
|
reply.data.sublist(index + 1, index + featureEnValLength + 1);
|
||||||
String featureEnValStr = asciiString(featureEnVal);
|
String featureEnValStr = asciiString(featureEnVal);
|
||||||
state.featureSettingValue = featureEnValStr;
|
state.featureSettingValue = featureEnValStr;
|
||||||
// List allFeatureEnValTwoList = charListChangeIntList(featureEnVal);
|
// List allFeatureEnValTwoList = charListChangeIntList(featureEnVal);
|
||||||
@ -317,7 +322,8 @@ class NearbyLockLogic extends BaseGetXController {
|
|||||||
Future<void> _getStarLockStatus() async {
|
Future<void> _getStarLockStatus() async {
|
||||||
// print("connectDeviceMacAddress:${BlueManage().connectDeviceMacAddress} connectDeviceName:${BlueManage().connectDeviceName}");
|
// print("connectDeviceMacAddress:${BlueManage().connectDeviceMacAddress} connectDeviceName:${BlueManage().connectDeviceName}");
|
||||||
// 进来之后首先连接
|
// 进来之后首先连接
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState state) async {
|
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
||||||
|
(BluetoothConnectionState state) async {
|
||||||
if (state == BluetoothConnectionState.connected) {
|
if (state == BluetoothConnectionState.connected) {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
@ -356,7 +362,11 @@ class NearbyLockLogic extends BaseGetXController {
|
|||||||
state.devices.clear();
|
state.devices.clear();
|
||||||
for (int i = 0; i < list.length; i++) {
|
for (int i = 0; i < list.length; i++) {
|
||||||
ScanResult device = list[i];
|
ScanResult device = list[i];
|
||||||
if (((device.advertisementData.serviceUuids.isNotEmpty ? device.advertisementData.serviceUuids[0] : "").toString()[31] != "1")) {
|
if (((device.advertisementData.serviceUuids.isNotEmpty
|
||||||
|
? device.advertisementData.serviceUuids[0]
|
||||||
|
: "")
|
||||||
|
.toString()[31] !=
|
||||||
|
"1")) {
|
||||||
state.devices.add(list[i]);
|
state.devices.add(list[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user