修复用户第一次进行蓝牙协议交互,添加用户问题

This commit is contained in:
魏少阳 2024-04-23 15:15:56 +08:00
parent 9e31a73a81
commit fc7b487f8a
11 changed files with 369 additions and 173 deletions

View File

@ -48,7 +48,7 @@ abstract class Reply{
case 0x06:
//
Get.log("${commandType!.typeName}需要鉴权");
showErrorMessage("需要鉴权");
// showErrorMessage("需要鉴权");
break;
case 0x07:
//

View File

@ -0,0 +1,158 @@
import 'dart:async';
import 'package:get/get.dart';
import 'package:star_lock/blue/sender_manage.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/eventBusEventManage.dart';
import '../main/lockDetail/lockDetail/lockNetToken_entity.dart';
import '../network/api_repository.dart';
import '../tools/commonDataManage.dart';
import '../tools/storage.dart';
import 'blue_manage.dart';
import 'io_protocol/io_addUser.dart';
import 'io_reply.dart';
import 'io_tool/io_tool.dart';
import 'io_tool/manager_event_bus.dart';
class SenderBeforeDataManage {
static SenderBeforeDataManage? _manager;
SenderBeforeDataManage._init();
static SenderBeforeDataManage? shareManager() {
_manager ??= SenderBeforeDataManage._init();
_manager!._init();
return _manager;
}
factory SenderBeforeDataManage() => shareManager()!;
SenderBeforeDataManage? get manager => shareManager();
void _init() {
_initReplySubscription();
}
//
StreamSubscription<Reply>? _replySubscription;
void _initReplySubscription() {
_replySubscription ??= EventBusManager().eventBus!.on<Reply>().listen((reply) async {
//
if ((reply is AddUserReply)) {
_replyAddUserKey(reply);
}
});
}
//
Future<void> _replyAddUserKey(Reply reply) async {
// var lockId = reply.data.sublist(2, 42);
// print("lockId:$lockId");
int status = reply.data[46];
// print("status:$status reply.data:${reply.data}");
print("status:$status");
switch (status) {
case 0x00:
//
CommonDataManage().currentLockUserNo = reply.data[47];
CommonDataManage().currentKeyInfo.lockUserNo = CommonDataManage().currentLockUserNo;
_updateLockUserNo();
break;
case 0x06:
//
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
var publicKey = await Storage.getStringList(saveBluePublicKey);
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
var token = reply.data.sublist(42, 46);
List<String> strTokenList = changeIntListToStringList(token);
Storage.setStringList(saveBlueToken, strTokenList);
// print("token:$token");
// IoSenderManage.senderAddUser(
// lockID: BlueManage().connectDeviceName,
// authUserID: CommonDataManage().currentKeyInfo.senderUserId!.toString(),
// keyID: CommonDataManage().currentKeyInfo.keyId.toString(),
// userID: await Storage.getUid(),
// openMode: 1,
// keyType: 0,
// startDate: CommonDataManage().currentKeyInfo.startDate!~/10000,
// expireDate: CommonDataManage().currentKeyInfo.endDate!~/10000,
// role: CommonDataManage().currentKeyInfo.keyRight == 1 ? 1 : 0,
// password: "123456",
// needAuthor: 1,
// publicKey: publicKeyDataList,
// privateKey: getPrivateKeyList,
// token: token);
var addUserData = AddUserCommand(
lockID: BlueManage().connectDeviceName,
authUserID: CommonDataManage().currentKeyInfo.senderUserId!.toString(),
keyID: CommonDataManage().currentKeyInfo.keyId.toString(),
userID: await Storage.getUid(),
openMode: 1,
keyType: 0,
startDate: CommonDataManage().currentKeyInfo.startDate!~/10000,
expireDate: CommonDataManage().currentKeyInfo.endDate!~/10000,
role: CommonDataManage().currentKeyInfo.keyRight == 1 ? 1 : 0,
password: "123456",
needAuthor: 1,
publicKey: publicKeyDataList,
privateKey: getPrivateKeyList,
token: token);
eventBus.fire(LockAddUserSucceedEvent(addUserData.packageData(), 1));
break;
default:
//
break;
}
}
Future<List<int>> getAddUserKeyData() async {
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 = changeStringListToIntList(token!);
var addUserData = AddUserCommand(
lockID: BlueManage().connectDeviceName,
authUserID: CommonDataManage().currentKeyInfo.senderUserId!.toString(),
keyID: CommonDataManage().currentKeyInfo.keyId.toString(),
userID: await Storage.getUid(),
openMode: 1,
keyType: 0,
startDate: CommonDataManage().currentKeyInfo.startDate!~/10000,
expireDate: CommonDataManage().currentKeyInfo.endDate!~/10000,
role: CommonDataManage().currentKeyInfo.keyRight == 1 ? 1 : 0,
password: "123456",
needAuthor: 1,
publicKey: publicKeyDataList,
privateKey: getPrivateKeyList,
token: getTokenList);
return addUserData.packageData();
}
// NO
void _updateLockUserNo() async {
LockNetTokenEntity entity = await ApiRepository.to.updateLockUserNo(
keyId: CommonDataManage().currentKeyInfo.keyId.toString(),
lockUserNo: CommonDataManage().currentKeyInfo.lockUserNo.toString()
);
if (entity.errorCode!.codeIsSuccessful) {
eventBus.fire(LockAddUserSucceedEvent([0], 0));
}
}
dispose() {
_replySubscription!.cancel();
}
}

View File

@ -1,15 +1,19 @@
import 'dart:async';
import '../app_settings/app_settings.dart';
import '../tools/commonDataManage.dart';
import '../tools/eventBusEventManage.dart';
import 'io_sender.dart';
import 'io_type.dart';
import 'io_tool/io_model.dart';
import 'io_tool/manager_event_bus.dart';
import 'sender_beforeDataManage.dart';
typedef CommandSendCallBack = void Function(ErrorType errorType);
class CommandSenderManager {
static final CommandSenderManager _manager = CommandSenderManager
._init();
static final CommandSenderManager _manager = CommandSenderManager._init();
factory CommandSenderManager()=>_manager;
static CommandSenderManager getInstance()=>_manager;
CommandSenderManager._init(){
@ -17,7 +21,21 @@ class CommandSenderManager {
}
init(){
initLockAddUserSucceedEvent();
}
//
StreamSubscription? _passCurrentLockInformationEvent;
List<int> dataBeforeAddTheUser = [];
void initLockAddUserSucceedEvent() {
// eventBus
_passCurrentLockInformationEvent = eventBus.on<LockAddUserSucceedEvent>().listen((event) {
if(event.type == 0){
_sendNormalData(dataBeforeAddTheUser);
}else{
_sendNormalData(event.dataList);
}
});
}
// CommandType lastCommandType = CommandType.readLockStatusInfo;
@ -37,8 +55,17 @@ class CommandSenderManager {
}
List<int> value = command.packageData();
// print("sendData:${value}");
_sendNormalData(value);
print("CommonDataManage().currentLockUserNo:${CommonDataManage().currentLockUserNo}");
if(CommonDataManage().currentLockUserNo == 0){
//
var entity = await SenderBeforeDataManage().getAddUserKeyData();
_sendNormalData(entity);
dataBeforeAddTheUser = value;
return;
}else{
print("继续发送数据了继续发送数据了继续发送数据了");
_sendNormalData(value);
}
}
void _sendNormalData(List<int> data) async {
@ -102,4 +129,7 @@ class CommandSenderManager {
// bufferList = [];
// }
dispose() {
_passCurrentLockInformationEvent?.cancel();
}
}

View File

@ -57,9 +57,9 @@ class LockDetailLogic extends BaseGetXController {
}
//
if ((reply is AddUserReply) && (state.ifCurrentScreen.value == true)) {
_replyAddUserKey(reply);
}
// if ((reply is AddUserReply) && (state.ifCurrentScreen.value == true)) {
// _replyAddUserKey(reply);
// }
});
}
@ -297,126 +297,126 @@ class LockDetailLogic extends BaseGetXController {
}
}
//
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:
//
Get.log("添加用户数据解析成功");
cancelBlueConnetctToastTimer();
state.lockUserNo = reply.data[47];
_updateLockUserNo();
break;
case 0x06:
//
Get.log("需要鉴权");
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: state.keyInfos.value.startDate!~/10000,
expireDate: state.keyInfos.value.endDate!~/10000,
role: state.keyInfos.value.keyRight == 1 ? 1 : 0,
password: "123456",
needAuthor: 1,
publicKey: publicKeyDataList,
privateKey: getPrivateKeyList,
token: token);
break;
default:
//
Get.log("领锁失败");
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:
// //
// Get.log("添加用户数据解析成功");
// cancelBlueConnetctToastTimer();
// state.lockUserNo = reply.data[47];
// _updateLockUserNo();
//
// break;
// case 0x06:
// //
// Get.log("需要鉴权");
// 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: state.keyInfos.value.startDate!~/10000,
// expireDate: state.keyInfos.value.endDate!~/10000,
// role: state.keyInfos.value.keyRight == 1 ? 1 : 0,
// password: "123456",
// needAuthor: 1,
// publicKey: publicKeyDataList,
// privateKey: getPrivateKeyList,
// token: token);
// break;
// default:
// //
// Get.log("领锁失败");
//
// break;
// }
// }
// ()
Future<void> addUserConnectBlue() async {
showBlueConnetctToastTimer(action: () {
state.openLockBtnState.value = 0;
eventBus.fire(RefreshLockDetailInfoDataEvent());
});
// var listData = AddUserCommand(
// lockID: BlueManage().connectDeviceName,
// authUserID: state.senderUserId.toString(),
// keyID: state.keyInfos.value.keyId.toString(),
// userID: await Storage.getUid(),
// openMode: 1,
// keyType: 0,
// startDate: state.keyInfos.value.startDate!~/10000,
// expireDate: state.keyInfos.value.endDate!~/10000,
// role: state.keyInfos.value.keyRight == 1 ? 1 : 0,
// password: "123456",
// needAuthor: 1,
// publicKey: publicKeyDataList,
// privateKey: getPrivateKeyList,
// token: getTokenList).packageData();
BlueManage().bludSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!, (BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.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);
}
Get.log("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: state.keyInfos.value.startDate!~/10000,
expireDate: state.keyInfos.value.endDate!~/10000,
role: state.keyInfos.value.keyRight == 1 ? 1 : 0,
password: "123456",
needAuthor: 1,
publicKey: publicKeyDataList,
privateKey: getPrivateKeyList,
token: getTokenList);
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
cancelBlueConnetctToastTimer();
if (state.ifCurrentScreen.value == true) {
showBlueConnetctToast();
}
state.openLockBtnState.value = 0;
eventBus.fire(RefreshLockDetailInfoDataEvent());
}
});
}
// Future<void> addUserConnectBlue() async {
// showBlueConnetctToastTimer(action: () {
// state.openLockBtnState.value = 0;
// eventBus.fire(RefreshLockDetailInfoDataEvent());
// });
//
// // var listData = AddUserCommand(
// // lockID: BlueManage().connectDeviceName,
// // authUserID: state.senderUserId.toString(),
// // keyID: state.keyInfos.value.keyId.toString(),
// // userID: await Storage.getUid(),
// // openMode: 1,
// // keyType: 0,
// // startDate: state.keyInfos.value.startDate!~/10000,
// // expireDate: state.keyInfos.value.endDate!~/10000,
// // role: state.keyInfos.value.keyRight == 1 ? 1 : 0,
// // password: "123456",
// // needAuthor: 1,
// // publicKey: publicKeyDataList,
// // privateKey: getPrivateKeyList,
// // token: getTokenList).packageData();
// BlueManage().bludSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!, (BluetoothConnectionState deviceConnectionState) async {
// if (deviceConnectionState == BluetoothConnectionState.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);
// }
//
// Get.log("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: state.keyInfos.value.startDate!~/10000,
// expireDate: state.keyInfos.value.endDate!~/10000,
// role: state.keyInfos.value.keyRight == 1 ? 1 : 0,
// password: "123456",
// needAuthor: 1,
// publicKey: publicKeyDataList,
// privateKey: getPrivateKeyList,
// token: getTokenList);
// } else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
// cancelBlueConnetctToastTimer();
// if (state.ifCurrentScreen.value == true) {
// showBlueConnetctToast();
// }
//
// state.openLockBtnState.value = 0;
// eventBus.fire(RefreshLockDetailInfoDataEvent());
// }
// });
// }
//
Future<void> openDoorAction() async {
@ -508,23 +508,23 @@ class LockDetailLogic extends BaseGetXController {
}
// NO
void _updateLockUserNo() async {
LockNetTokenEntity entity = await ApiRepository.to.updateLockUserNo(
keyId: state.keyInfos.value.keyId.toString(),
lockUserNo: state.lockUserNo.toString()
);
if (entity.errorCode!.codeIsSuccessful) {
eventBus.fire(RefreshLockDetailInfoDataEvent());
SchedulerBinding.instance.addPostFrameCallback((_) {
eventBus.fire(RefreshLockListInfoDataEvent());
});
if (state.isOpenLockNeedOnline.value == 0) {
openDoorAction();
} else {
getLockNetToken();
}
}
}
// void _updateLockUserNo() async {
// LockNetTokenEntity entity = await ApiRepository.to.updateLockUserNo(
// keyId: state.keyInfos.value.keyId.toString(),
// lockUserNo: state.lockUserNo.toString()
// );
// if (entity.errorCode!.codeIsSuccessful) {
// eventBus.fire(RefreshLockDetailInfoDataEvent());
// SchedulerBinding.instance.addPostFrameCallback((_) {
// eventBus.fire(RefreshLockListInfoDataEvent());
// });
// if (state.isOpenLockNeedOnline.value == 0) {
// openDoorAction();
// } else {
// getLockNetToken();
// }
// }
// }
//
void getLockRecordLastUploadDataTime() async {

View File

@ -17,6 +17,7 @@ import '../../../blue/blue_manage.dart';
import '../../../blue/io_tool/io_tool.dart';
import '../../../common/XSConstantMacro/XSConstantMacro.dart';
import '../../../tools/appRouteObserver.dart';
import '../../../tools/commonDataManage.dart';
import '../../../tools/dateTool.dart';
import '../../../tools/eventBusEventManage.dart';
import '../../../tools/storage.dart';
@ -48,7 +49,6 @@ class _LockDetailPageState extends State<LockDetailPage>
void initState() {
// TODO: implement initState
super.initState();
Get.log("LockDetailPage initState1111");
// logic.startScanAction();
@ -66,7 +66,6 @@ class _LockDetailPageState extends State<LockDetailPage>
@override
void didChangeDependencies() {
super.didChangeDependencies();
Get.log("LockDetailPage didChangeDependencies2222");
///
AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!);
@ -84,12 +83,15 @@ class _LockDetailPageState extends State<LockDetailPage>
void loadData() {
state.keyInfos.value = widget.lockListInfoItemEntity;
CommonDataManage().currentLockUserNo = state.keyInfos.value.lockUserNo!;
CommonDataManage().currentKeyInfo = state.keyInfos.value;
state.lockUserNo = state.keyInfos.value.lockUserNo!;
if (state.lockUserNo == 0) {
state.bottomBtnisEable.value = false;
} else {
state.bottomBtnisEable.value = true;
}
// if (state.lockUserNo == 0) {
// state.bottomBtnisEable.value = false;
// } else {
// state.bottomBtnisEable.value = true;
// }
// print("state.keyInfos.value.keyStatus:${state.keyInfos.value.keyStatus}");
if (state.keyInfos.value.keyStatus ==
XSConstantMacro.keyStatusWaitIneffective ||
@ -989,10 +991,10 @@ class _LockDetailPageState extends State<LockDetailPage>
state.openLockBtnState.value = 1;
// state.animationController!.forward();
if (state.lockUserNo == 0) {
// lockUserNo为0
logic.addUserConnectBlue();
} else {
// if (state.lockUserNo == 0) {
// // lockUserNo为0
// logic.addUserConnectBlue();
// } else {
// print("state.isOpenLockNeedOnline.value:${state.isOpenLockNeedOnline.value}");
if (state.isOpenLockNeedOnline.value == 0) {
//
@ -1002,7 +1004,7 @@ class _LockDetailPageState extends State<LockDetailPage>
//
logic.getLockNetToken();
}
}
// }
// });
}
@ -1015,13 +1017,13 @@ class _LockDetailPageState extends State<LockDetailPage>
state.openLockBtnState.value = 1;
state.animationController!.forward();
if (state.lockUserNo == 0) {
// lockUserNo为0
logic.addUserConnectBlue();
} else {
// if (state.lockUserNo == 0) {
// // lockUserNo为0
// logic.addUserConnectBlue();
// } else {
state.openDoorModel = 32;
logic.openDoorAction();
}
// }
}
@override
@ -1029,7 +1031,6 @@ class _LockDetailPageState extends State<LockDetailPage>
// TODO: implement dispose
///
Get.log("LockDetailPage===dispose");
AppRouteObserver().routeObserver.unsubscribe(this);
state.closedUnlockSuccessfulTimer?.cancel();
_lockRefreshLockDetailInfoDataEvent?.cancel();
@ -1048,7 +1049,6 @@ class _LockDetailPageState extends State<LockDetailPage>
@override
void didPush() {
super.didPush();
Get.log("LockDetailPage===didPush");
state.ifCurrentScreen.value = true;
}
@ -1056,7 +1056,6 @@ class _LockDetailPageState extends State<LockDetailPage>
@override
void didPop() {
super.didPop();
Get.log("LockDetailPage===didPop");
state.ifCurrentScreen.value = false;
logic.cancelBlueConnetctToastTimer();
BlueManage().stopScan();
@ -1069,14 +1068,12 @@ class _LockDetailPageState extends State<LockDetailPage>
void didPopNext() {
super.didPopNext();
state.ifCurrentScreen.value = true;
Get.log("LockDetailPage===didPopNext");
}
///
@override
void didPushNext() {
super.didPushNext();
Get.log("LockDetailPage===didPushNext");
state.ifCurrentScreen.value = false;
logic.cancelBlueConnetctToastTimer();
BlueManage().stopScan();

View File

@ -16,6 +16,7 @@ import '../../../../blue/io_tool/manager_event_bus.dart';
import '../../../../blue/sender_manage.dart';
import '../../../../network/api_repository.dart';
import '../../../../tools/baseGetXController.dart';
import '../../../../tools/commonDataManage.dart';
import '../../../../tools/eventBusEventManage.dart';
import '../../../../tools/storage.dart';
import 'checkingInInfoData_entity.dart';
@ -406,6 +407,8 @@ class LockSetLogic extends BaseGetXController {
);
if (entity.errorCode!.codeIsSuccessful) {
state.lockSetInfoData.value = entity.data!;
CommonDataManage().currentLockSetInfoData = entity.data!;
state.lockSettingInfo.value = state.lockSetInfoData.value.lockSettingInfo!;
state.lockFeature.value = state.lockSetInfoData.value.lockFeature!;
state.lockStatus.value = state.lockSetInfoData.value.lockStatus!;

View File

@ -1,15 +1,10 @@
import 'dart:convert';
import 'dart:typed_data';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
// import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import '../../../appRouters.dart';
import '../../../app_settings/app_colors.dart';
import '../../../blue/blue_manage.dart';
import '../../../tools/appRouteObserver.dart';

View File

@ -30,7 +30,7 @@ class SaveLockLogic extends BaseGetXController {
late StreamSubscription<Reply> _replySubscription;
void _initReplySubscription() {
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) {
if (reply is AddUserReply) {
if (reply is AddUserReply && state.ifCurrentScreen.value == true) {
_replyAddUserKey(reply);
}

View File

@ -2,6 +2,9 @@
// CommonDataManage的单例使
import 'package:get/get.dart';
import '../main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
import '../main/lockMian/entity/lockListInfo_entity.dart';
class CommonDataManage {
static CommonDataManage? _manager;
CommonDataManage._init();
@ -20,12 +23,15 @@ class CommonDataManage {
set setMainLockCount(int v) => _mainLockCount.value = v;
get getMainLockCount => _mainLockCount;
//
LockListInfoItemEntity currentKeyInfo = LockListInfoItemEntity();
//
int currentLockUserNo = 0;
// set setCurrentLockUserNo(int v) => _currentLockUserNo = v;
// get getCurrentLockUserNo => _currentLockUserNo;
LockSetInfoData currentLockSetInfoData = LockSetInfoData();
}

View File

@ -10,6 +10,13 @@ class RefreshLockListInfoDataEvent {
RefreshLockListInfoDataEvent();
}
///
class LockAddUserSucceedEvent {
int type; // 0 1token失效
List<int> dataList;
LockAddUserSucceedEvent(this.dataList, this.type);
}
///
class RefreshLockDetailInfoDataEvent {
RefreshLockDetailInfoDataEvent();

View File

@ -207,7 +207,7 @@ class Storage {
if (data != null && data.isNotEmpty) {
lockListInfoGroupEntity = LockListInfoGroupEntity.fromJson(jsonDecode(data));
}
print("lockListInfoEntity:$lockListInfoGroupEntity");
return lockListInfoGroupEntity;
}
}