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