修复未添加锁时调用蓝牙协议走添加用户问题
This commit is contained in:
parent
c67d641950
commit
a43f9c1577
@ -45,7 +45,7 @@ class CommandSenderManager {
|
|||||||
bool canSendControlCommand = false;
|
bool canSendControlCommand = false;
|
||||||
|
|
||||||
//TODO:发送常规数据
|
//TODO:发送常规数据
|
||||||
Future<void> managerSendData ({required SenderProtocol command, CommandSendCallBack? callBack}) async {
|
Future<void> managerSendData ({required SenderProtocol command, bool isBeforeAddUser = false, CommandSendCallBack? callBack}) async {
|
||||||
if (callBack != null) {
|
if (callBack != null) {
|
||||||
// if (!BluetoothManager().connected) {
|
// if (!BluetoothManager().connected) {
|
||||||
print('❌ 蓝牙断开了');
|
print('❌ 蓝牙断开了');
|
||||||
@ -57,8 +57,11 @@ class CommandSenderManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<int> value = command.packageData();
|
List<int> value = command.packageData();
|
||||||
// print("CommonDataManage().currentLockUserNo:${CommonDataManage().currentLockUserNo}");
|
// print("command.commandTyp:${command.commandType}");
|
||||||
|
if(isBeforeAddUser == true){
|
||||||
|
_sendNormalData(value);
|
||||||
|
}else{
|
||||||
if(CommonDataManage().currentLockUserNo == 0){
|
if(CommonDataManage().currentLockUserNo == 0){
|
||||||
// 先添加用户
|
// 先添加用户
|
||||||
var entity = await SenderBeforeDataManage().getAddUserKeyData();
|
var entity = await SenderBeforeDataManage().getAddUserKeyData();
|
||||||
@ -69,6 +72,7 @@ class CommandSenderManager {
|
|||||||
// print("继续发送数据了继续发送数据了继续发送数据了");
|
// print("继续发送数据了继续发送数据了继续发送数据了");
|
||||||
_sendNormalData(value);
|
_sendNormalData(value);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _sendNormalData(List<int> data) async {
|
void _sendNormalData(List<int> data) async {
|
||||||
|
|||||||
@ -44,6 +44,7 @@ class IoSenderManage {
|
|||||||
command: GetPublicKeyCommand(
|
command: GetPublicKeyCommand(
|
||||||
lockID: lockId,
|
lockID: lockId,
|
||||||
),
|
),
|
||||||
|
isBeforeAddUser: true,
|
||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,6 +66,7 @@ class IoSenderManage {
|
|||||||
publicKeyData: publicKeyData,
|
publicKeyData: publicKeyData,
|
||||||
needAuthor: needAuthor,
|
needAuthor: needAuthor,
|
||||||
),
|
),
|
||||||
|
isBeforeAddUser: true,
|
||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,6 +103,7 @@ class IoSenderManage {
|
|||||||
publicKey: publicKey,
|
publicKey: publicKey,
|
||||||
privateKey: privateKey,
|
privateKey: privateKey,
|
||||||
token: token),
|
token: token),
|
||||||
|
isBeforeAddUser: true,
|
||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -280,6 +283,7 @@ class IoSenderManage {
|
|||||||
required int? startTime,
|
required int? startTime,
|
||||||
required int? endTime,
|
required int? endTime,
|
||||||
required int? needAuthor,
|
required int? needAuthor,
|
||||||
|
required bool? isBeforeAddUser,
|
||||||
required List<int>? signKey,
|
required List<int>? signKey,
|
||||||
required List<int>? privateKey,
|
required List<int>? privateKey,
|
||||||
CommandSendCallBack? callBack}) {
|
CommandSendCallBack? callBack}) {
|
||||||
@ -297,6 +301,7 @@ class IoSenderManage {
|
|||||||
signKey: signKey,
|
signKey: signKey,
|
||||||
privateKey: privateKey,
|
privateKey: privateKey,
|
||||||
),
|
),
|
||||||
|
isBeforeAddUser: isBeforeAddUser ?? false,
|
||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,6 +316,7 @@ class IoSenderManage {
|
|||||||
required int? startTime,
|
required int? startTime,
|
||||||
required int? endTime,
|
required int? endTime,
|
||||||
required int? needAuthor,
|
required int? needAuthor,
|
||||||
|
required bool? isBeforeAddUser,
|
||||||
required List<int>? signKey,
|
required List<int>? signKey,
|
||||||
required List<int>? privateKey,
|
required List<int>? privateKey,
|
||||||
CommandSendCallBack? callBack}) {
|
CommandSendCallBack? callBack}) {
|
||||||
@ -328,6 +334,7 @@ class IoSenderManage {
|
|||||||
signKey: signKey,
|
signKey: signKey,
|
||||||
privateKey: privateKey,
|
privateKey: privateKey,
|
||||||
),
|
),
|
||||||
|
isBeforeAddUser: isBeforeAddUser ?? false,
|
||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -50,6 +50,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
// TODO: implement initState
|
// TODO: implement initState
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
|
print("openDoor:${DateTool().accordingTheCycleIntoTheCorrespondingNumber([5])}");
|
||||||
|
print("onLine:${DateTool().accordingTheCycleIntoTheCorrespondingNumber([1])}");
|
||||||
// logic.startScanAction();
|
// logic.startScanAction();
|
||||||
|
|
||||||
listeningAnimations();
|
listeningAnimations();
|
||||||
|
|||||||
@ -72,6 +72,7 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
|
|||||||
startTime: 0x11223344,
|
startTime: 0x11223344,
|
||||||
endTime: 0x11223344,
|
endTime: 0x11223344,
|
||||||
needAuthor: 1,
|
needAuthor: 1,
|
||||||
|
isBeforeAddUser: false,
|
||||||
signKey: signKeyDataList,
|
signKey: signKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
token: token);
|
token: token);
|
||||||
@ -230,6 +231,7 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
|
|||||||
startTime: 0x11223344,
|
startTime: 0x11223344,
|
||||||
endTime: 0x11223344,
|
endTime: 0x11223344,
|
||||||
needAuthor: 1,
|
needAuthor: 1,
|
||||||
|
isBeforeAddUser: false,
|
||||||
signKey: signKeyDataList,
|
signKey: signKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
token: getTokenList);
|
token: getTokenList);
|
||||||
|
|||||||
@ -14,13 +14,9 @@ import 'package:star_lock/blue/io_protocol/io_processOtaUpgrade.dart';
|
|||||||
import 'package:star_lock/blue/io_reply.dart';
|
import 'package:star_lock/blue/io_reply.dart';
|
||||||
import 'package:star_lock/blue/io_tool/io_tool.dart';
|
import 'package:star_lock/blue/io_tool/io_tool.dart';
|
||||||
import 'package:star_lock/blue/io_tool/manager_event_bus.dart';
|
import 'package:star_lock/blue/io_tool/manager_event_bus.dart';
|
||||||
import 'package:star_lock/blue/sender_manage.dart';
|
|
||||||
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSet_logic.dart';
|
|
||||||
import 'package:star_lock/permission/permission_dialog.dart';
|
import 'package:star_lock/permission/permission_dialog.dart';
|
||||||
import 'package:star_lock/tools/advancedCalendar/src/datetime_util.dart';
|
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
import 'package:star_lock/tools/commonDataManage.dart';
|
import 'package:star_lock/tools/commonDataManage.dart';
|
||||||
import 'package:star_lock/tools/pickers/time_picker/time_utils.dart';
|
|
||||||
import 'package:star_lock/tools/storage.dart';
|
import 'package:star_lock/tools/storage.dart';
|
||||||
|
|
||||||
import 'lockEscalation_state.dart';
|
import 'lockEscalation_state.dart';
|
||||||
|
|||||||
@ -55,6 +55,7 @@ class PasswordKeyDetailLogic extends BaseGetXController {
|
|||||||
startTime:0x11223344,
|
startTime:0x11223344,
|
||||||
endTime:0x11223344,
|
endTime:0x11223344,
|
||||||
needAuthor: 1,
|
needAuthor: 1,
|
||||||
|
isBeforeAddUser: false,
|
||||||
signKey: signKeyDataList,
|
signKey: signKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
token: token);
|
token: token);
|
||||||
@ -138,6 +139,7 @@ class PasswordKeyDetailLogic extends BaseGetXController {
|
|||||||
startTime:0x11223344,
|
startTime:0x11223344,
|
||||||
endTime:0x11223344,
|
endTime:0x11223344,
|
||||||
needAuthor: 1,
|
needAuthor: 1,
|
||||||
|
isBeforeAddUser: false,
|
||||||
signKey: signKeyDataList,
|
signKey: signKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
token: getTokenList);
|
token: getTokenList);
|
||||||
|
|||||||
@ -74,6 +74,7 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
startTime:0x11223344,
|
startTime:0x11223344,
|
||||||
endTime:0x11223344,
|
endTime:0x11223344,
|
||||||
needAuthor: 1,
|
needAuthor: 1,
|
||||||
|
isBeforeAddUser: false,
|
||||||
signKey: signKeyDataList,
|
signKey: signKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
token: token);
|
token: token);
|
||||||
@ -162,6 +163,7 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
startTime:0x11223344,
|
startTime:0x11223344,
|
||||||
endTime:0x11223344,
|
endTime:0x11223344,
|
||||||
needAuthor: 1,
|
needAuthor: 1,
|
||||||
|
isBeforeAddUser: false,
|
||||||
signKey: signKeyDataList,
|
signKey: signKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
token: getTokenList);
|
token: getTokenList);
|
||||||
|
|||||||
@ -253,6 +253,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
startTime: DateTool().dateToTimestamp(state.beginTime.value, 1)~/1000,
|
startTime: DateTool().dateToTimestamp(state.beginTime.value, 1)~/1000,
|
||||||
endTime: DateTool().dateToTimestamp(state.endTime.value, 1)~/1000,
|
endTime: DateTool().dateToTimestamp(state.endTime.value, 1)~/1000,
|
||||||
needAuthor: 1,
|
needAuthor: 1,
|
||||||
|
isBeforeAddUser: false,
|
||||||
signKey: signKeyDataList,
|
signKey: signKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
token: token);
|
token: token);
|
||||||
@ -335,6 +336,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
startTime:state.isPermanent.value == false ? startDate ~/ 1000 : 0,
|
startTime:state.isPermanent.value == false ? startDate ~/ 1000 : 0,
|
||||||
endTime: state.isPermanent.value == false ? endDate ~/ 1000 : 0,
|
endTime: state.isPermanent.value == false ? endDate ~/ 1000 : 0,
|
||||||
needAuthor: 1,
|
needAuthor: 1,
|
||||||
|
isBeforeAddUser: false,
|
||||||
signKey: signKeyDataList,
|
signKey: signKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
token: getTokenList);
|
token: getTokenList);
|
||||||
@ -394,6 +396,12 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
return "您好,您的密码是:${state.getPwdStr.value}\n$useDateStr\n密码名字:${state.pwdNameStr}";
|
return "您好,您的密码是:${state.getPwdStr.value}\n$useDateStr\n密码名字:${state.pwdNameStr}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String addSpaces(String input) {
|
||||||
|
return input.replaceAllMapped(RegExp(r'.{4}'), (match) {
|
||||||
|
return '${match.group(0)} ';
|
||||||
|
}).trim();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() {
|
void onReady() {
|
||||||
// TODO: implement onReady
|
// TODO: implement onReady
|
||||||
|
|||||||
@ -412,7 +412,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
|
|||||||
height: 10.h,
|
height: 10.h,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
state.getPwdStr.value,
|
logic.addSpaces(state.getPwdStr.value),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 40.sp,
|
fontSize: 40.sp,
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
|
|||||||
@ -140,6 +140,7 @@ class SaveLockLogic extends BaseGetXController {
|
|||||||
startTime: 0x11223344,
|
startTime: 0x11223344,
|
||||||
endTime: 0x11223344,
|
endTime: 0x11223344,
|
||||||
needAuthor: 1,
|
needAuthor: 1,
|
||||||
|
isBeforeAddUser: true,
|
||||||
signKey: signKeyDataList,
|
signKey: signKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
token: token);
|
token: token);
|
||||||
@ -184,6 +185,7 @@ class SaveLockLogic extends BaseGetXController {
|
|||||||
startTime: 0x11223344,
|
startTime: 0x11223344,
|
||||||
endTime: 0x11223344,
|
endTime: 0x11223344,
|
||||||
needAuthor: 1,
|
needAuthor: 1,
|
||||||
|
isBeforeAddUser: true,
|
||||||
signKey: signKeyDataList,
|
signKey: signKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
token: token);
|
token: token);
|
||||||
@ -271,6 +273,7 @@ class SaveLockLogic extends BaseGetXController {
|
|||||||
startTime: 0x11223344,
|
startTime: 0x11223344,
|
||||||
endTime: 0x11223344,
|
endTime: 0x11223344,
|
||||||
needAuthor: 1,
|
needAuthor: 1,
|
||||||
|
isBeforeAddUser: true,
|
||||||
signKey: signKeyDataList,
|
signKey: signKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
token: getTokenList);
|
token: getTokenList);
|
||||||
@ -304,6 +307,7 @@ class SaveLockLogic extends BaseGetXController {
|
|||||||
startTime: 0x11223344,
|
startTime: 0x11223344,
|
||||||
endTime: 0x11223344,
|
endTime: 0x11223344,
|
||||||
needAuthor: 1,
|
needAuthor: 1,
|
||||||
|
isBeforeAddUser: true,
|
||||||
signKey: signKeyDataList,
|
signKey: signKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
token: getTokenList);
|
token: getTokenList);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user