642 lines
21 KiB
Dart
642 lines
21 KiB
Dart
|
||
import 'dart:async';
|
||
import 'dart:io';
|
||
|
||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
||
import 'package:permission_handler/permission_handler.dart';
|
||
import 'package:star_lock/blue/io_protocol/io_editUser.dart';
|
||
import 'package:star_lock/blue/io_protocol/io_getLockStatu.dart';
|
||
import 'package:star_lock/blue/io_type.dart';
|
||
import 'package:star_lock/tools/toast.dart';
|
||
|
||
import '../../../blue/blue_manage.dart';
|
||
import '../../../blue/io_protocol/io_addUser.dart';
|
||
import '../../../blue/io_protocol/io_getStarLockStatusInfo.dart';
|
||
import '../../../blue/io_protocol/io_openLock.dart';
|
||
import '../../../blue/io_protocol/io_referEventRecordTime.dart';
|
||
import '../../../blue/io_reply.dart';
|
||
import '../../../blue/io_tool/io_tool.dart';
|
||
import '../../../blue/io_tool/manager_event_bus.dart';
|
||
import '../../../blue/sender_manage.dart';
|
||
import '../../../network/api_repository.dart';
|
||
import '../../../tools/baseGetXController.dart';
|
||
import '../../../tools/eventBusEventManage.dart';
|
||
import '../../../tools/storage.dart';
|
||
import '../electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
|
||
import '../lockOperatingRecord/lockOperatingRecordGetLastRecordTime_entity.dart';
|
||
import 'lockDetail_state.dart';
|
||
import 'lockNetToken_entity.dart';
|
||
|
||
class LockDetailLogic extends BaseGetXController{
|
||
final LockDetailState state = LockDetailState();
|
||
|
||
// 监听设备返回的数据
|
||
late StreamSubscription<Reply> _replySubscription;
|
||
void _initReplySubscription() {
|
||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) async {
|
||
// 开门
|
||
if(reply is OpenDoorReply) {
|
||
_replyOpenLock(reply);
|
||
}
|
||
|
||
// 编辑锁用户
|
||
// if(reply is EditUserReply){
|
||
// _replyEditUserKey(reply);
|
||
// }
|
||
|
||
// 获取星锁状态信息
|
||
if(reply is GetStarLockStatuInfoReply){
|
||
_replyGetStarLockStatusInfo(reply);
|
||
}
|
||
|
||
// 开完锁之后上传记录
|
||
if(reply is SenderReferEventRecordTimeReply) {
|
||
_replyReferEventRecordTime(reply);
|
||
}
|
||
|
||
// 添加用户
|
||
if(reply is AddUserReply) {
|
||
_replyAddUserKey(reply);
|
||
}
|
||
});
|
||
}
|
||
|
||
// 开门数据解析
|
||
Future<void> _replyOpenLock(Reply reply) async {
|
||
var tokenData = reply.data.sublist(2, 6);
|
||
var saveStrList = changeIntListToStringList(tokenData);
|
||
print("openDoorToken:$tokenData");
|
||
Storage.setStringList(saveBlueToken, saveStrList);
|
||
|
||
int status = reply.data[6];
|
||
print("status:$status");
|
||
|
||
switch(status){
|
||
case 0x00:
|
||
//成功
|
||
print("${reply.commandType}数据解析成功");
|
||
|
||
// 电量
|
||
int power = reply.data[7];
|
||
state.electricQuantity.value = power;
|
||
|
||
getLockRecordLastUploadDataTime();
|
||
state.lockState.value = 2;
|
||
state.animationController.reset();
|
||
state.animationController.forward();
|
||
// state.animationController.isCompleted;
|
||
break;
|
||
case 0x06:
|
||
//无权限
|
||
print("${reply.commandType}需要鉴权");
|
||
|
||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||
|
||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||
|
||
IoSenderManage.senderOpenLock(
|
||
keyID: BlueManage().connectDeviceName,
|
||
userID: await Storage.getUid(),
|
||
openMode: 1,
|
||
openTime: DateTime.now().millisecondsSinceEpoch~/1000,
|
||
onlineToken:state.lockNetToken,
|
||
token: tokenData,
|
||
needAuthor: 1,
|
||
signKey: signKeyDataList,
|
||
privateKey: getPrivateKeyList,
|
||
);
|
||
|
||
break;
|
||
case 0x07:
|
||
//无权限
|
||
print("${reply.commandType}用户无权限");
|
||
|
||
break;
|
||
case 0x09:
|
||
// 权限校验错误
|
||
print("${reply.commandType}校验错误");
|
||
|
||
break;
|
||
default:
|
||
//失败
|
||
print("${reply.commandType}失败");
|
||
|
||
break;
|
||
}
|
||
}
|
||
|
||
// 获取锁状态数据解析
|
||
Future<void> _replyGetStarLockStatusInfo(Reply reply) async {
|
||
int status = reply.data[2];
|
||
switch(status){
|
||
case 0x00:
|
||
//成功
|
||
print("${reply.commandType}数据解析成功");
|
||
// 厂商名称
|
||
var vendor = reply.data.sublist(3, 23);
|
||
// print("vendor:$vendor");
|
||
|
||
// 锁设备类型
|
||
var product = reply.data[23];
|
||
// print("product:$product");
|
||
|
||
// 产品名称
|
||
var model = reply.data.sublist(24, 44);
|
||
// print("model:$model");
|
||
|
||
// 软件版本
|
||
var fwVersion = reply.data.sublist(44, 64);
|
||
// print("fwVersion:$fwVersion");
|
||
|
||
// 硬件版本
|
||
var hwVersion = reply.data.sublist(64, 84);
|
||
// print("hwVersion:$hwVersion");
|
||
|
||
// 厂商序列号
|
||
var serialNum0 = reply.data.sublist(84, 100);
|
||
// print("serialNum0:$serialNum0");
|
||
|
||
// 成品商序列号
|
||
var serialNum1 = reply.data.sublist(100, 116);
|
||
// print("serialNum1:$serialNum1");
|
||
|
||
// 蓝牙名称
|
||
var btDeviceName = reply.data.sublist(116, 132);
|
||
// print("btDeviceName:$btDeviceName");
|
||
|
||
// 电池剩余电量
|
||
var battRemCap = reply.data[132];
|
||
// print("battRemCap:$battRemCap");
|
||
|
||
// 重置次数
|
||
var restoreCounter = reply.data.sublist(133, 135);
|
||
// print("restoreCounter:$restoreCounter");
|
||
|
||
// 重置时间
|
||
var restoreDate = reply.data.sublist(135, 139);
|
||
// print("restoreDate:$restoreDate");
|
||
|
||
// 主控芯片型号
|
||
var icPartNo = reply.data.sublist(139, 149);
|
||
// print("icPartNo:$icPartNo");
|
||
|
||
// 有效时间
|
||
var indate = reply.data.sublist(149, 153);
|
||
// print("indate:$indate");
|
||
|
||
break;
|
||
case 0x06:
|
||
//无权限
|
||
print("${reply.commandType}需要鉴权");
|
||
|
||
break;
|
||
case 0x07:
|
||
//无权限
|
||
print("${reply.commandType}用户无权限");
|
||
|
||
break;
|
||
case 0x09:
|
||
// 权限校验错误
|
||
print("${reply.commandType}权限校验错误");
|
||
|
||
break;
|
||
default:
|
||
//失败
|
||
print("${reply.commandType}失败");
|
||
|
||
break;
|
||
}
|
||
}
|
||
|
||
// 根据时间查解析数据
|
||
Future<void> _replyReferEventRecordTime(Reply reply) async {
|
||
int status = reply.data[2];
|
||
switch(status){
|
||
case 0x00:
|
||
//成功
|
||
print("${reply.commandType}数据解析成功");
|
||
if(reply.data[5] > 0){
|
||
reply.data.removeRange(0, 6);
|
||
// 把得到的数据按8位分割成数组 然后塞进一个新的数组里面
|
||
var getList = splitList(reply.data, 8);
|
||
// print("getList:$getList");
|
||
var uploadList = [];
|
||
for(int i = 0; i<getList.length; i++){
|
||
var indexList = getList[i];
|
||
// print("indexList:$indexList");
|
||
var indexMap = {};
|
||
indexMap["seq"] = indexList[0].toString();
|
||
indexMap["user"] = indexList[3].toString();
|
||
indexMap["pwd"] = indexList[2].toString();
|
||
indexMap["success"] = "1";
|
||
indexMap["type"] = indexList[1].toString();
|
||
|
||
int value = ((0xff & indexList[(4)]) << 24 |
|
||
(0xff & indexList[5]) << 16 |
|
||
(0xff & indexList[6]) << 8 |
|
||
(0xFF & indexList[7]));
|
||
// indexMap["date"] = DateTool().dateToYMDHNSString("$value");
|
||
// print("value:${DateTool().dateToYMDHNSString("$value")}");
|
||
|
||
indexMap["date"] = "${value*1000}";
|
||
uploadList.add(indexMap);
|
||
}
|
||
lockRecordUploadData(uploadList);
|
||
// print("reply.data:${reply.data} getList:$getList}");
|
||
}
|
||
break;
|
||
case 0x06:
|
||
//无权限
|
||
print("${reply.commandType}需要鉴权");
|
||
|
||
break;
|
||
case 0x07:
|
||
//无权限
|
||
print("${reply.commandType}用户无权限");
|
||
|
||
break;
|
||
case 0x09:
|
||
// 权限校验错误
|
||
print("${reply.commandType}权限校验错误");
|
||
|
||
break;
|
||
default:
|
||
//失败
|
||
print("${reply.commandType}失败");
|
||
|
||
break;
|
||
}
|
||
}
|
||
|
||
// 添加用户
|
||
Future<void> _replyAddUserKey(Reply reply) async {
|
||
var lockId = reply.data.sublist(2, 42);
|
||
// print("lockId:$lockId");
|
||
|
||
var token = reply.data.sublist(42, 46);
|
||
List<String> strTokenList = changeIntListToStringList(token);
|
||
Storage.setStringList(saveBlueToken, strTokenList);
|
||
// print("token:$token");
|
||
|
||
int status = reply.data[46];
|
||
// print("status:$status reply.data:${reply.data}");
|
||
|
||
print("status:$status");
|
||
switch(status){
|
||
case 0x00:
|
||
//成功
|
||
print("添加用户数据解析成功");
|
||
state.lockUserNo = reply.data[47] + 1;
|
||
// updateLockUserNo();
|
||
|
||
if(state.isOpenLockNeedOnline.value == 0){
|
||
openDoorAction();
|
||
}else{
|
||
getLockNetToken();
|
||
}
|
||
|
||
break;
|
||
case 0x06:
|
||
//无权限
|
||
print("需要鉴权");
|
||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||
|
||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||
|
||
IoSenderManage.senderAddUser(
|
||
lockID: BlueManage().connectDeviceName,
|
||
authUserID:state.senderUserId.toString(),
|
||
keyID:state.keyInfos.value.keyId.toString(),
|
||
userID:await Storage.getUid(),
|
||
openMode:1,
|
||
keyType:0,
|
||
startDate:DateTime.now().millisecondsSinceEpoch,
|
||
expireDate:0x11223344,
|
||
role:0,
|
||
password:"123456",
|
||
needAuthor:1,
|
||
publicKey:publicKeyDataList,
|
||
privateKey:getPrivateKeyList,
|
||
token: token
|
||
);
|
||
break;
|
||
case 0x07:
|
||
//无权限
|
||
print("用户无权限");
|
||
|
||
break;
|
||
case 0x09:
|
||
// 权限校验错误
|
||
print("添加用户权限校验错误");
|
||
|
||
break;
|
||
default:
|
||
//失败
|
||
print("领锁失败");
|
||
|
||
break;
|
||
}
|
||
}
|
||
|
||
// 点击开门事件
|
||
Future<void> openDoorAction() async {
|
||
// if(BlueManage().connectDeviceMacAddress.isEmpty){
|
||
// Toast.show(msg: "正在连接设备,请稍等。");
|
||
// return;
|
||
// }
|
||
BlueManage().judgeReconnect(state.keyInfos.value.bluetooth!.bluetoothDeviceName!, (DeviceConnectionState deviceConnectionState) async {
|
||
print("77777777:$deviceConnectionState");
|
||
if (deviceConnectionState == DeviceConnectionState.connected){
|
||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||
|
||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||
|
||
bool isHave = await Storage.ifHaveKey(saveBlueToken);
|
||
List<int> getTokenList;
|
||
if(isHave){
|
||
var token = await Storage.getStringList(saveBlueToken);
|
||
getTokenList = changeStringListToIntList(token!);
|
||
}else{
|
||
getTokenList = [0,0,0,0];
|
||
}
|
||
print("openDoorTokenPubToken:$getTokenList getPrivateKeyList:$getPrivateKeyList");
|
||
|
||
print("millisecondsSinceEpoch/1000:${DateTime.now().millisecondsSinceEpoch~/1000}");
|
||
IoSenderManage.senderOpenLock(
|
||
keyID: BlueManage().connectDeviceName,
|
||
userID: await Storage.getUid(),
|
||
openMode: 1,
|
||
openTime: DateTime.now().millisecondsSinceEpoch~/1000,
|
||
onlineToken:state.lockNetToken,
|
||
token: getTokenList,
|
||
needAuthor: 1,
|
||
signKey: signKeyDataList,
|
||
privateKey: getPrivateKeyList,
|
||
);
|
||
}else if (deviceConnectionState == DeviceConnectionState.disconnected){
|
||
// Toast.show(msg: "连接设备失败,请确保在设备附近,设备未被连接,设备已打开");
|
||
|
||
state.lockState.value = 4;
|
||
state.animationController.reset();
|
||
state.animationController.forward();
|
||
}
|
||
}, isShowLoading: false);
|
||
}
|
||
|
||
// 编辑用户事件
|
||
// Future<void> editLockUserAction() async {
|
||
// BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState state) async {
|
||
// if (state == DeviceConnectionState.connected){
|
||
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||
//
|
||
// var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||
// List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||
//
|
||
// var token = await Storage.getStringList(saveBlueToken);
|
||
// List<int> getTokenList = changeStringListToIntList(token!);
|
||
// print("openDoorTokenPubToken:$getTokenList");
|
||
//
|
||
// print("publicKey:$publicKey publicKeyDataList:$publicKeyDataList privateKey:$privateKey getPrivateKeyList:$getPrivateKeyList token:$token getTokenList:$getTokenList");
|
||
// IoSenderManage.senderEditUser(
|
||
// lockID:BlueManage().connectDeviceName,
|
||
// authUserID:await Storage.getUid(),
|
||
// keyID:"1",
|
||
// userID:await Storage.getUid(),
|
||
// openMode:1,
|
||
// keyType:1,
|
||
// startDate:0x11223344,
|
||
// expireDate:0x11223344,
|
||
// role:255,
|
||
// password:"123456",
|
||
// needAuthor:1,
|
||
// publicKey:publicKeyDataList,
|
||
// privateKey:getPrivateKeyList,
|
||
// token: getTokenList
|
||
// );
|
||
// }
|
||
// });
|
||
// }
|
||
|
||
|
||
// 备用逻辑,进入管理钥匙界面获取锁状态
|
||
Future<void> connectBlue(String bluetoothDeviceName) async {
|
||
// 进来之后首先连接
|
||
BlueManage().connect(bluetoothDeviceName, (DeviceConnectionState state) async {
|
||
if(EasyLoading.isShow){
|
||
EasyLoading.dismiss();
|
||
}
|
||
if (state == DeviceConnectionState.connected){
|
||
// var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||
// List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||
// // IoSenderManage.senderGetLockStatu(
|
||
// // lockID:BlueManage().connectDeviceName,
|
||
// // userID:await Storage.getUid(),
|
||
// // privateKey:getPrivateKeyList,
|
||
// // );
|
||
// IoSenderManage.senderGetStarLockStatuInfo(
|
||
// lockID:BlueManage().connectDeviceName,
|
||
// userID:await Storage.getUid(),
|
||
// privateKey:getPrivateKeyList,
|
||
// );
|
||
}
|
||
}, isShowLoading: false);
|
||
}
|
||
|
||
// 查询事件记录(时间查询)
|
||
Future<void> senderReferEventRecordTime(int time) async {
|
||
BlueManage().judgeReconnect(BlueManage().connectDeviceName, (DeviceConnectionState state) async {
|
||
if (state == DeviceConnectionState.connected) {
|
||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||
|
||
var token = await Storage.getStringList(saveBlueToken);
|
||
List<int> getTokenList = changeStringListToIntList(token!);
|
||
|
||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||
List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
|
||
|
||
IoSenderManage.senderReferEventRecordTimeCommand(
|
||
keyID:BlueManage().connectDeviceName,
|
||
userID:await Storage.getUid(),
|
||
logsCount:20,
|
||
// time:DateTime.now().millisecondsSinceEpoch~/1000,
|
||
time: time,
|
||
token:getTokenList,
|
||
needAuthor:1,
|
||
publicKey:getPublicKeyList,
|
||
privateKey:getPrivateKeyList,
|
||
);
|
||
}
|
||
}, isShowLoading: false);
|
||
}
|
||
|
||
// 添加用户(普通用户接收电子钥匙)
|
||
Future<void> addUserConnectBlue() async {
|
||
// 进来之后首先连接
|
||
BlueManage().judgeReconnect(BlueManage().connectDeviceName, (DeviceConnectionState deviceConnectionState) async {
|
||
if (deviceConnectionState == DeviceConnectionState.connected){
|
||
// 私钥
|
||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||
|
||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||
|
||
var token = await Storage.getStringList(saveBlueToken);
|
||
List<int> getTokenList = [0,0,0,0];
|
||
if(token != null){
|
||
getTokenList = changeStringListToIntList(token);
|
||
}
|
||
print("BlueManage().connectDeviceName:${BlueManage().connectDeviceName} authUserID:${state.senderUserId.toString()} keyID:${state.keyInfos.value.keyId.toString()} userID:${await Storage.getUid()}");
|
||
IoSenderManage.senderAddUser(
|
||
lockID: BlueManage().connectDeviceName,
|
||
authUserID:state.senderUserId.toString(),
|
||
keyID:state.keyInfos.value.keyId.toString(),
|
||
userID:await Storage.getUid(),
|
||
openMode:1,
|
||
keyType:0,
|
||
startDate:DateTime.now().millisecondsSinceEpoch,
|
||
expireDate:0x11223344,
|
||
role:0,
|
||
password:"123456",
|
||
needAuthor:1,
|
||
publicKey:publicKeyDataList,
|
||
privateKey:getPrivateKeyList,
|
||
token: getTokenList
|
||
);
|
||
}
|
||
}, isShowLoading: false);
|
||
}
|
||
|
||
//开始连接
|
||
startConnect() {
|
||
state.lockState.value = 1;
|
||
state.animationController.forward();
|
||
|
||
if(state.lockUserNo == 0){
|
||
// 电子钥匙lockUserNo为0 要先添加用户
|
||
addUserConnectBlue();
|
||
}else{
|
||
if(state.isOpenLockNeedOnline.value == 0){
|
||
// 不需要联网
|
||
openDoorAction();
|
||
}else{
|
||
// 需要联网
|
||
getLockNetToken();
|
||
}
|
||
}
|
||
}
|
||
|
||
//关闭连接
|
||
stopConnect() {
|
||
|
||
}
|
||
|
||
// 获取手机联网token,根据锁设置里面获取的开锁时是否联网来判断是否调用这个接口
|
||
void getLockNetToken() async {
|
||
LockNetTokenEntity entity = await ApiRepository.to.getLockNetToken(lockId: state.keyInfos.value.lockId.toString());
|
||
if (entity.errorCode!.codeIsSuccessful) {
|
||
state.lockNetToken = entity.data!.token!;
|
||
print("state.lockNetToken:${state.lockNetToken}");
|
||
openDoorAction();
|
||
}
|
||
}
|
||
|
||
// 普通用户接收电子钥匙之后 更新锁用户NO
|
||
void updateLockUserNo() async {
|
||
LockNetTokenEntity entity = await ApiRepository.to.updateLockUserNo(keyId: state.keyInfos.value.keyId.toString(), lockUserNo: state.lockUserNo.toString());
|
||
if (entity.errorCode!.codeIsSuccessful) {
|
||
if(state.isOpenLockNeedOnline.value == 0){
|
||
openDoorAction();
|
||
}else{
|
||
getLockNetToken();
|
||
}
|
||
}
|
||
}
|
||
|
||
// 查询锁记录最后时间
|
||
void getLockRecordLastUploadDataTime() async {
|
||
LockOperatingRecordGetLastRecordTimeEntity entity = await ApiRepository.to.getLockRecordLastUploadDataTime(lockId: state.keyInfos.value.lockId.toString());
|
||
if (entity.errorCode!.codeIsSuccessful) {
|
||
senderReferEventRecordTime(entity.data!.operateDate!~/1000);
|
||
}
|
||
}
|
||
|
||
// 操作记录上传
|
||
void lockRecordUploadData(List list) async {
|
||
KeyOperationRecordEntity entity =
|
||
await ApiRepository.to.lockRecordUploadData(
|
||
lockId: state.keyInfos.value.lockId.toString(),
|
||
records: list);
|
||
if (entity.errorCode!.codeIsSuccessful) {
|
||
// mockNetworkDataRequest();
|
||
}
|
||
}
|
||
|
||
/// 锁设置里面开启关闭考勤刷新锁详情
|
||
StreamSubscription? _lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent;
|
||
void initLockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceAction() {
|
||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||
_lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent = eventBus.on<LockSetChangeSetRefreshLockDetailWithType>().listen((event) {
|
||
if(event.type == 0){
|
||
// 0考勤
|
||
state.isAttendance.value = event.setResult;
|
||
state.keyInfos.value.lockSetting!.attendance = event.setResult;
|
||
}else if(event.type == 1){
|
||
// 1 开锁时是否需联网
|
||
state.isOpenLockNeedOnline.value = event.setResult;
|
||
state.keyInfos.value.lockSetting!.appUnlockOnline = event.setResult;
|
||
}
|
||
});
|
||
}
|
||
|
||
@override
|
||
void onReady() {
|
||
// TODO: implement onReady
|
||
super.onReady();
|
||
print("onReady()");
|
||
|
||
// List<int> model = [5, 3, 2, 16, 100, 176, 0, 244, 249, 83, 101, 223, 74, 100, 40, 228, 96];
|
||
// var modelStr = utf8String(model);
|
||
// print("modelStrmodelStrmodelStr:$modelStr");
|
||
|
||
_initReplySubscription();
|
||
initLockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceAction();
|
||
|
||
// EasyLoading.show(status: "正在连接设备,请稍等。", maskType: EasyLoadingMaskType.none, dismissOnTap: true);
|
||
// Future.delayed(const Duration(seconds: 12), () {
|
||
// if(EasyLoading.isShow){
|
||
// EasyLoading.dismiss();
|
||
// Toast.show(msg: "连接设备失败,请确保在设备附近,设备未被连接,设备已打开");
|
||
// }
|
||
// });
|
||
}
|
||
|
||
@override
|
||
void onInit() {
|
||
// TODO: implement onInit
|
||
super.onInit();
|
||
// print("lockDetail_onInit()");
|
||
|
||
// 进来获取锁状态
|
||
// connectBlue();
|
||
// factoryDataResetAction();
|
||
}
|
||
|
||
@override
|
||
void onClose() {
|
||
// TODO: implement onClose
|
||
print("锁详情界面销毁了");
|
||
|
||
_replySubscription.cancel();
|
||
_lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent!.cancel();
|
||
}
|
||
} |