feat:提交代码
This commit is contained in:
parent
4837cd58dd
commit
f626370d13
@ -375,7 +375,6 @@ class BlueManage {
|
||||
// AppLog.log('bluetoothConnectDevice: $bluetoothConnectDevice');
|
||||
scanResult = devicesList[knownDeviceIndex];
|
||||
|
||||
|
||||
_initGetMtuSubscription();
|
||||
_initListenConnectionState();
|
||||
}
|
||||
@ -478,7 +477,7 @@ class BlueManage {
|
||||
// 当包有头时
|
||||
// 判断是否需要分包
|
||||
dataLen = data[8] * 256 + data[9]; // 高16位用来指示后面数据块内容的长度
|
||||
// AppLog.log("dataLen1111:$dataLen getDataLength:${data.length} data:$data");
|
||||
AppLog.log("dataLen1111:$dataLen getDataLength:${data.length} data:$data");
|
||||
if (dataLen! + 14 > data.length) {
|
||||
// 当前包的长度小于实际的包时 分包添加 不解析
|
||||
allData.addAll(data);
|
||||
@ -494,8 +493,9 @@ class BlueManage {
|
||||
// 当包没有头时 是分包的包 直接添加
|
||||
allData.addAll(data);
|
||||
// var len = allData[8] * 256 + allData[9];
|
||||
AppLog.log("dataLen3333:$dataLen allData.length:${allData.length} allData:$allData");
|
||||
if ((dataLen! + 14) <= allData.length) {
|
||||
AppLog.log(
|
||||
"dataLen3333:$dataLen allData.length:${allData.length} allData:$allData");
|
||||
if (((dataLen ?? 0) + 14) <= allData.length) {
|
||||
// 当长度小于等于当前包的数据时 直接解析数据
|
||||
CommandReciverManager.appDataReceive(allData);
|
||||
// 发送完解析初始化数组
|
||||
|
||||
@ -34,8 +34,8 @@ abstract class SenderProtocol extends IOData {
|
||||
}
|
||||
|
||||
void printLog(List<int> data) {
|
||||
AppLog.log(
|
||||
"App -> 锁,指令类型:${commandType!.typeName} \n参数是:\n${toString()} \n加密之前数据是:\n$data 长度是:${data.length}");
|
||||
// AppLog.log(
|
||||
// "App -> 锁,指令类型:${commandType!.typeName} \n参数是:\n${toString()} \n加密之前数据是:\n$data 长度是:${data.length}");
|
||||
}
|
||||
|
||||
//TODO:拼装数据Ï
|
||||
|
||||
@ -5,6 +5,7 @@ import 'package:star_lock/app_settings/app_settings.dart';
|
||||
import 'package:star_lock/blue/blue_manage.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_addFace.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_changeAdministratorPassword.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_cleanUpUsers.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_deletUser.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_editUser.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_factoryDataReset.dart';
|
||||
@ -107,8 +108,11 @@ class CommandReciverManager {
|
||||
AppLog.log("APP收到的解密后的数据:$oriDataList");
|
||||
break;
|
||||
}
|
||||
parseData(oriDataList).then((value) async {
|
||||
parseData(oriDataList).then((Reply? value) async {
|
||||
EasyLoading.dismiss();
|
||||
if (value != null) {
|
||||
AppLog.log("锁 -> App,指令订阅类型 :${value.commandType?.typeName} \n $value");
|
||||
}
|
||||
await EventBusManager().eventBusFir(value);
|
||||
}).catchError((error) {
|
||||
AppLog.log("APP解析数据时发生错误: $error");
|
||||
@ -195,6 +199,11 @@ class CommandReciverManager {
|
||||
reply = ProcessOtaUpgradeReply.parseData(commandType, data);
|
||||
}
|
||||
break;
|
||||
case CommandType.cleanUpUsers:
|
||||
{
|
||||
reply = CleanUpUsersReply.parseData(commandType, data);
|
||||
}
|
||||
break;
|
||||
case CommandType.generalExtendedCommond:
|
||||
{
|
||||
// 子命令类型
|
||||
|
||||
@ -2,6 +2,7 @@ import 'dart:async';
|
||||
|
||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_cleanUpUsers.dart';
|
||||
import 'package:star_lock/blue/sender_manage.dart';
|
||||
import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart';
|
||||
import 'package:star_lock/network/api_provider.dart';
|
||||
@ -46,9 +47,12 @@ class SenderBeforeDataManage {
|
||||
_replySubscription ??=
|
||||
EventBusManager().eventBus!.on<Reply>().listen((reply) async {
|
||||
// 添加用户
|
||||
if ((reply is AddUserReply)) {
|
||||
if (reply is AddUserReply) {
|
||||
_replyAddUserKey(reply);
|
||||
}
|
||||
if(reply is CleanUpUsersReply){
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -104,7 +108,7 @@ class SenderBeforeDataManage {
|
||||
keyID: currentKeyInfo.keyId.toString(),
|
||||
userID: await Storage.getUid(),
|
||||
openMode: 1,
|
||||
keyType: 0,
|
||||
keyType: currentKeyInfo.keyType,
|
||||
startDate: currentKeyInfo.startDate! ~/ 1000,
|
||||
expireDate: currentKeyInfo.endDate! ~/ 1000,
|
||||
useCountLimit: 0xFFFF,
|
||||
@ -144,22 +148,17 @@ class SenderBeforeDataManage {
|
||||
List<int> tokenList = changeStringListToIntList(tokenKey!);
|
||||
AppLog.log('---> ${entity.data?.userNos}');
|
||||
|
||||
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
||||
(BluetoothConnectionState connectionState) async {
|
||||
if (connectionState == BluetoothConnectionState.connected) {
|
||||
IoSenderManage.senderCleanUpUsersCommand(
|
||||
lockID: BlueManage().connectDeviceName,
|
||||
authUserID:
|
||||
CommonDataManage().currentKeyInfo.senderUserId!.toString(),
|
||||
keyID: CommonDataManage().currentKeyInfo.keyId.toString(),
|
||||
userID: await Storage.getUid(),
|
||||
userNoList: entity.data!.userNos!,
|
||||
needAuthor: 1,
|
||||
publicKey: publicKeyDataList,
|
||||
privateKey: getPrivateKeyList,
|
||||
token: tokenList);
|
||||
}
|
||||
});
|
||||
IoSenderManage.senderCleanUpUsersCommand(
|
||||
lockID: BlueManage().connectDeviceName,
|
||||
authUserID:
|
||||
CommonDataManage().currentKeyInfo.senderUserId!.toString(),
|
||||
keyID: CommonDataManage().currentKeyInfo.keyId.toString(),
|
||||
userID: await Storage.getUid(),
|
||||
userNoList: entity.data!.userNos!,
|
||||
needAuthor: 1,
|
||||
publicKey: publicKeyDataList,
|
||||
privateKey: getPrivateKeyList,
|
||||
token: tokenList);
|
||||
|
||||
break;
|
||||
default:
|
||||
@ -188,7 +187,7 @@ class SenderBeforeDataManage {
|
||||
keyID: currentKeyInfo.keyId.toString(),
|
||||
userID: await Storage.getUid(),
|
||||
openMode: 1,
|
||||
keyType: 0,
|
||||
keyType: currentKeyInfo.keyType,
|
||||
startDate: currentKeyInfo.startDate! ~/ 1000,
|
||||
expireDate: currentKeyInfo.endDate! ~/ 1000,
|
||||
useCountLimit: 0xFFFF,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user