统一项目中打印方法
This commit is contained in:
parent
ebc73b3077
commit
9c7d84a897
@ -39,6 +39,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
|
||||
}
|
||||
|
||||
GetMaterialApp _initMaterialApp() => GetMaterialApp(
|
||||
enableLog: false,
|
||||
title: F.navTitle,
|
||||
navigatorObservers: [AppRouteObserver().routeObserver],
|
||||
translations: TranslationMessage(),
|
||||
|
||||
@ -12,8 +12,8 @@ class AppLog {
|
||||
static log(String msg,{bool? error}){
|
||||
if(!kDebugMode)return;
|
||||
error = error ?? false;
|
||||
if(!_printLog)return;
|
||||
if(_onlyError && !error) return;
|
||||
// if(!_printLog)return;
|
||||
// if(_onlyError && !error) return;
|
||||
if(error){
|
||||
msg = '----->>> $msg';
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ import 'dart:io';
|
||||
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/app_settings/app_settings.dart';
|
||||
|
||||
import 'io_tool/io_model.dart';
|
||||
import 'io_tool/io_tool.dart';
|
||||
@ -80,7 +81,6 @@ class BlueManage {
|
||||
BlueManage? get manager => shareManager();
|
||||
|
||||
void _initBlue() {
|
||||
Get.log("蓝牙功能初始化监听");
|
||||
FlutterBluePlus.setLogLevel(LogLevel.error, color: true);
|
||||
_initSendStreamSubscription();
|
||||
_initAdapterStateStateSubscription();
|
||||
@ -91,7 +91,7 @@ class BlueManage {
|
||||
void _initGetMtuSubscription() {
|
||||
_mtuSubscription ??= bluetoothConnectDevice!.mtu.listen((value) {
|
||||
_mtuSize = value - 3;
|
||||
print('_mtuSizeValue:$value mtuSize:$_mtuSize');
|
||||
AppLog.log('_mtuSizeValue:$value mtuSize:$_mtuSize');
|
||||
});
|
||||
}
|
||||
|
||||
@ -110,7 +110,7 @@ class BlueManage {
|
||||
// // if (scanResult.device.advName.isEmpty) {
|
||||
// // return;
|
||||
// // }
|
||||
// print("scanResult.device.advName:${scanResult.device.advName}"
|
||||
// AppLog.log("scanResult.device.advName:${scanResult.device.advName}"
|
||||
// " scanResult.advertisementData.serviceUuids:${scanResult.advertisementData.serviceUuids}"
|
||||
// " rssi:${scanResult.rssi}");
|
||||
// if (((scanResult.advertisementData.serviceUuids.isNotEmpty ? scanResult.advertisementData.serviceUuids[0] : "").toString().contains("758824")) && (scanResult.rssi >= -100)) {
|
||||
@ -127,16 +127,16 @@ class BlueManage {
|
||||
// EventBusManager().eventBusFir(scanDevices);
|
||||
// // FlutterBluePlus.stopScan();
|
||||
// }, onError: (e) {
|
||||
// print("Scan Error:$e", );
|
||||
// AppLog.log("Scan Error:$e", );
|
||||
// });
|
||||
//
|
||||
// FlutterBluePlus.cancelWhenScanComplete(subscription);
|
||||
|
||||
// FlutterBluePlus.isScanning.listen((state) {
|
||||
// if (state) {
|
||||
// print('Scanning');
|
||||
// prAppLog.logint('Scanning');
|
||||
// } else {
|
||||
// print('Not scanning');
|
||||
// AppLog.log('Not scanning');
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
@ -145,10 +145,9 @@ class BlueManage {
|
||||
_connectionStateSubscription?.cancel();
|
||||
_connectionStateSubscription = null;
|
||||
|
||||
_connectionStateSubscription =
|
||||
bluetoothConnectDevice!.connectionState.listen((state) async {
|
||||
_connectionStateSubscription = bluetoothConnectDevice!.connectionState.listen((state) async {
|
||||
bluetoothConnectionState = state;
|
||||
print("蓝牙连接状态:$state");
|
||||
// AppLog.log("蓝牙连接状态:$state");
|
||||
});
|
||||
}
|
||||
|
||||
@ -165,11 +164,11 @@ class BlueManage {
|
||||
writeCharacteristicWithResponse(model.data);
|
||||
} else {
|
||||
try {} catch (e) {
|
||||
print("Error Turning On:");
|
||||
AppLog.log("蓝牙打开失败");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
print("写入数据 蓝牙不可用,不能进行蓝牙操作");
|
||||
AppLog.log("写入数据 蓝牙不可用,不能进行蓝牙操作");
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -186,7 +185,7 @@ class BlueManage {
|
||||
FlutterBluePlus.startScan(timeout: Duration(seconds: timeout));
|
||||
Completer<dynamic> completer = Completer<dynamic>();
|
||||
var subscription = FlutterBluePlus.scanResults.listen((results) {
|
||||
// print("startScanSingle扫描到的设备:$results");
|
||||
// AppLog.log("startScanSingle扫描到的设备:$results");
|
||||
bool isExit = results.any((element) =>
|
||||
(element.device.platformName == deviceName) ||
|
||||
(element.advertisementData.advName == deviceName));
|
||||
@ -215,16 +214,14 @@ class BlueManage {
|
||||
completer.complete();
|
||||
}
|
||||
}, onError: (e) {
|
||||
print(
|
||||
"Scan Error:$e",
|
||||
);
|
||||
AppLog.log("扫描失败:$e",);
|
||||
});
|
||||
FlutterBluePlus.cancelWhenScanComplete(subscription);
|
||||
await completer.future;
|
||||
scanDevicesCallBack(scanDevices);
|
||||
subscription.cancel();
|
||||
} catch (e) {
|
||||
print("扫描失败");
|
||||
AppLog.log("扫描失败");
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
@ -232,11 +229,11 @@ class BlueManage {
|
||||
await FlutterBluePlus.turnOn();
|
||||
}
|
||||
} catch (e) {
|
||||
print("Error Turning On:");
|
||||
AppLog.log("蓝牙打开失败");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
print("开始扫描 蓝牙不可用,不能进行蓝牙操作");
|
||||
AppLog.log("开始扫描 蓝牙不可用,不能进行蓝牙操作");
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -257,9 +254,9 @@ class BlueManage {
|
||||
// if (scanResult.device.advName.isEmpty) {
|
||||
// return;
|
||||
// }
|
||||
Get.log("scanResult.device.advName:${scanResult.device.advName}"
|
||||
" scanResult.advertisementData.serviceUuids:${scanResult.advertisementData.serviceUuids}"
|
||||
" rssi:${scanResult.rssi}");
|
||||
// AppLog.log("scanResult.device.advName:${scanResult.device.advName}"
|
||||
// " scanResult.advertisementData.serviceUuids:${scanResult.advertisementData.serviceUuids}"
|
||||
// " rssi:${scanResult.rssi}");
|
||||
if (((scanResult.advertisementData.serviceUuids.isNotEmpty
|
||||
? scanResult.advertisementData.serviceUuids[0]
|
||||
: "")
|
||||
@ -284,14 +281,12 @@ class BlueManage {
|
||||
// EventBusManager().eventBusFir(scanDevices);
|
||||
// FlutterBluePlus.stopScan();
|
||||
}, onError: (e) {
|
||||
print(
|
||||
"Scan Error:$e",
|
||||
);
|
||||
AppLog.log("扫描失败:$e",);
|
||||
});
|
||||
|
||||
FlutterBluePlus.cancelWhenScanComplete(subscription);
|
||||
} catch (e) {
|
||||
print("扫描失败");
|
||||
AppLog.log("扫描失败");
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
@ -299,11 +294,11 @@ class BlueManage {
|
||||
await FlutterBluePlus.turnOn();
|
||||
}
|
||||
} catch (e) {
|
||||
print("Error Turning On:");
|
||||
AppLog.log("蓝牙打开失败");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Get.log("开始扫描 蓝牙不可用,不能进行蓝牙操作");
|
||||
AppLog.log("开始扫描 蓝牙不可用,不能进行蓝牙操作");
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -328,11 +323,11 @@ class BlueManage {
|
||||
stateCallBack(BluetoothConnectionState.disconnected);
|
||||
openBlue();
|
||||
} catch (e) {
|
||||
print("Error Turning On:");
|
||||
AppLog.log("蓝牙打开失败");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
print("开始扫描 蓝牙不可用,不能进行蓝牙操作");
|
||||
AppLog.log("开始扫描 蓝牙不可用,不能进行蓝牙操作");
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -350,7 +345,7 @@ class BlueManage {
|
||||
if (isAddEquipment == false && isExistDevice == false) {
|
||||
// startScan(10, (scanDevices){
|
||||
startScanSingle(deviceName, 10, (List<ScanResult> scanDevices) {
|
||||
print("扫描到的设备:$scanDevices");
|
||||
// AppLog.log("扫描到的设备:$scanDevices");
|
||||
devicesList = scanDevices;
|
||||
_connectDevice(devicesList, deviceName, connectStateCallBack,
|
||||
isAddEquipment: isAddEquipment);
|
||||
@ -365,7 +360,7 @@ class BlueManage {
|
||||
ConnectStateCallBack connectStateCallBack,
|
||||
{bool isAddEquipment = false}) async {
|
||||
// 判断数组列表里面是否有这个设备
|
||||
print("devicesList:$devicesList");
|
||||
// AppLog.log("devicesList:$devicesList");
|
||||
final knownDeviceIndex = devicesList.indexWhere((d) =>
|
||||
(d.device.platformName == deviceName) ||
|
||||
(d.advertisementData.advName == deviceName));
|
||||
@ -377,21 +372,20 @@ class BlueManage {
|
||||
: devicesList[knownDeviceIndex].device.platformName;
|
||||
|
||||
bluetoothConnectDevice = devicesList[knownDeviceIndex].device;
|
||||
print('bluetoothConnectDevice: $bluetoothConnectDevice');
|
||||
// AppLog.log('bluetoothConnectDevice: $bluetoothConnectDevice');
|
||||
scanResult = devicesList[knownDeviceIndex];
|
||||
|
||||
_initGetMtuSubscription();
|
||||
_initListenConnectionState();
|
||||
}
|
||||
print(
|
||||
"1 connectDeviceId:$connectDeviceMacAddress connectDeviceName:$connectDeviceName");
|
||||
// AppLog.log("1 connectDeviceId:$connectDeviceMacAddress connectDeviceName:$connectDeviceName");
|
||||
// stopScan();
|
||||
if (connectDeviceMacAddress.isEmpty) {
|
||||
// connectStateCallBack(BluetoothConnectionState.disconnected!);
|
||||
return;
|
||||
}
|
||||
|
||||
print("调用了停止扫描的方法");
|
||||
// AppLog.log("调用了停止扫描的方法");
|
||||
await stopScan();
|
||||
|
||||
if ((scanResult!.advertisementData.serviceUuids[0].toString()[31] == "0") &&
|
||||
@ -409,16 +403,16 @@ class BlueManage {
|
||||
await bluetoothConnectDevice!.connect(timeout: 5.seconds);
|
||||
break; // If the connection is successful, break the loop
|
||||
} catch (e) {
|
||||
print('Failed to connect: $e');
|
||||
AppLog.log('连接失败 重连了: $e');
|
||||
attempt++; // Increase the attempt count
|
||||
if (attempt < maxAttempts) {
|
||||
print('Retrying connection...');
|
||||
AppLog.log('重新尝试连接...');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (attempt >= maxAttempts) {
|
||||
print('Failed to connect after $maxAttempts attempts.');
|
||||
AppLog.log('$maxAttempts次后尝试连接失败');
|
||||
connectStateCallBack(BluetoothConnectionState.disconnected);
|
||||
}
|
||||
|
||||
@ -427,10 +421,10 @@ class BlueManage {
|
||||
try {
|
||||
bluetoothConnectDevice!.discoverServices().then((services) {
|
||||
for (BluetoothService service in services) {
|
||||
print("11111service.remoteId:${service.remoteId}"
|
||||
" service.uuid:${service.uuid}"
|
||||
" service.characteristics:${service.characteristics}"
|
||||
" service.includedServices:${service.includedServices}");
|
||||
// AppLog.log("11111service.remoteId:${service.remoteId}"
|
||||
// " service.uuid:${service.uuid}"
|
||||
// " service.characteristics:${service.characteristics}"
|
||||
// " service.includedServices:${service.includedServices}");
|
||||
if (service.uuid == _serviceIdConnect) {
|
||||
for (BluetoothCharacteristic characteristic
|
||||
in service.characteristics) {
|
||||
@ -441,7 +435,7 @@ class BlueManage {
|
||||
if (characteristic.characteristicUuid ==
|
||||
_characteristicIdSubscription) {
|
||||
_subScribeToCharacteristic(characteristic);
|
||||
print('Discovering services finished');
|
||||
// AppLog.log('Discovering services finished');
|
||||
bluetoothConnectionState = BluetoothConnectionState.connected;
|
||||
connectStateCallBack(bluetoothConnectionState!);
|
||||
}
|
||||
@ -451,9 +445,8 @@ class BlueManage {
|
||||
});
|
||||
} on Exception catch (e) {
|
||||
bluetoothConnectionState = BluetoothConnectionState.disconnected;
|
||||
print("5555 回调状态:$bluetoothConnectionState");
|
||||
connectStateCallBack(bluetoothConnectionState!);
|
||||
print('Error occurred when discovering services: $e');
|
||||
AppLog.log('发现设备时失败 e:$e bluetoothConnectionState:$bluetoothConnectionState');
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
@ -468,15 +461,14 @@ class BlueManage {
|
||||
|
||||
_subScribeToCharacteristic(BluetoothCharacteristic characteristic) async {
|
||||
final subscription = characteristic.onValueReceived.listen((data) {
|
||||
// Get.log("启动对特性的通知。当特性的值发生变化时,设备会发送一个通知");
|
||||
print("订阅获取的数据:$data");
|
||||
// AppLog.log("订阅获取的数据:$data");
|
||||
if (data == lastTimeData || data.isEmpty) {
|
||||
return;
|
||||
} else {
|
||||
lastTimeData = data;
|
||||
}
|
||||
// code to handle incoming data
|
||||
// print("subscribeToCharacteristic: deviceId = ${characteristic.deviceId} characteristicId =${characteristic.characteristicId}---上报来的数据data = $data");
|
||||
// AppLog.log("subscribeToCharacteristic: deviceId = ${characteristic.deviceId} characteristicId =${characteristic.characteristicId}---上报来的数据data = $data");
|
||||
if ((data[0] == 0xEF) &&
|
||||
(data[1] == 0x01) &&
|
||||
(data[2] == 0xEE) &&
|
||||
@ -484,14 +476,14 @@ class BlueManage {
|
||||
// 当包有头时
|
||||
// 判断是否需要分包
|
||||
dataLen = data[8] * 256 + data[9]; // 高16位用来指示后面数据块内容的长度
|
||||
// print("dataLen1111:$dataLen getDataLength:${data.length} data:$data");
|
||||
// AppLog.log("dataLen1111:$dataLen getDataLength:${data.length} data:$data");
|
||||
if (dataLen! + 12 > data.length) {
|
||||
// 当前包的长度小于实际的包时 分包添加 不解析
|
||||
allData.addAll(data);
|
||||
} else {
|
||||
// 当前包的长度小于实际的包时 不分包 解析
|
||||
allData.addAll(data);
|
||||
// print("dataLen2222:$dataLen getDataLength:${data.length}");
|
||||
// AppLog.log("dataLen2222:$dataLen getDataLength:${data.length}");
|
||||
CommandReciverManager.appDataReceive(allData);
|
||||
// 发送完解析初始化数组
|
||||
allData = <int>[];
|
||||
@ -500,10 +492,8 @@ class BlueManage {
|
||||
// 当包没有头时 是分包的包 直接添加
|
||||
allData.addAll(data);
|
||||
// var len = allData[8] * 256 + allData[9];
|
||||
print(
|
||||
"dataLen3333:$dataLen allData.length:${allData.length} allData:$allData");
|
||||
// AppLog.log("dataLen3333:$dataLen allData.length:${allData.length} allData:$allData");
|
||||
if ((dataLen! + 14) <= allData.length) {
|
||||
print("44444数据被解析了");
|
||||
// 当长度小于等于当前包的数据时 直接解析数据
|
||||
CommandReciverManager.appDataReceive(allData);
|
||||
// 发送完解析初始化数组
|
||||
@ -519,9 +509,9 @@ class BlueManage {
|
||||
await characteristic.setNotifyValue(true);
|
||||
|
||||
// characteristic.setNotifyValue(true).then((_) {
|
||||
// print("启动对特性的通知。当特性的值发生变化时,设备会发送一个通知");
|
||||
// AppLog.log("启动对特性的通知。当特性的值发生变化时,设备会发送一个通知");
|
||||
// characteristic.lastValueStream.listen((data) {
|
||||
// print("订阅获取的数据:$data");
|
||||
// AppLog.log("订阅获取的数据:$data");
|
||||
// // do something with new value
|
||||
// if(data == lastTimeData || data.isEmpty){
|
||||
// return;
|
||||
@ -529,19 +519,19 @@ class BlueManage {
|
||||
// lastTimeData = data;
|
||||
// }
|
||||
// // code to handle incoming data
|
||||
// // print("subscribeToCharacteristic: deviceId = ${characteristic.deviceId} characteristicId =${characteristic.characteristicId}---上报来的数据data = $data");
|
||||
// // AppLog.log("subscribeToCharacteristic: deviceId = ${characteristic.deviceId} characteristicId =${characteristic.characteristicId}---上报来的数据data = $data");
|
||||
// if ((data[0] == 0xEF) && (data[1] == 0x01) && (data[2] == 0xEE) && (data[3] == 0x02)) {
|
||||
// // 当包有头时
|
||||
// // 判断是否需要分包
|
||||
// dataLen = data[8] * 256 + data[9]; // 高16位用来指示后面数据块内容的长度
|
||||
// // print("dataLen1111:$dataLen getDataLength:${data.length}");
|
||||
// // AppLog.log("dataLen1111:$dataLen getDataLength:${data.length}");
|
||||
// if (dataLen! + 12 > data.length) {
|
||||
// // 当前包的长度小于实际的包时 分包添加 不解析
|
||||
// allData.addAll(data);
|
||||
// } else {
|
||||
// // 当前包的长度小于实际的包时 不分包 解析
|
||||
// allData.addAll(data);
|
||||
// // print("dataLen2222:$dataLen getDataLength:${data.length}");
|
||||
// // AppLog.log("dataLen2222:$dataLen getDataLength:${data.length}");
|
||||
// CommandReciverManager.appDataReceive(allData);
|
||||
// // 发送完解析初始化数组
|
||||
// allData = <int>[];
|
||||
@ -550,9 +540,9 @@ class BlueManage {
|
||||
// // 当包没有头时 是分包的包 直接添加
|
||||
// allData.addAll(data);
|
||||
// // var len = allData[8] * 256 + allData[9];
|
||||
// // print("dataLen3333:$dataLen");
|
||||
// // AppLog.log("dataLen3333:$dataLen");
|
||||
// if ((dataLen! + 14) <= allData.length) {
|
||||
// // print("44444数据被解析了");
|
||||
// // AppLog.log("44444数据被解析了");
|
||||
// // 当长度小于等于当前包的数据时 直接解析数据
|
||||
// CommandReciverManager.appDataReceive(allData);
|
||||
// // 发送完解析初始化数组
|
||||
@ -565,17 +555,16 @@ class BlueManage {
|
||||
|
||||
// 写入
|
||||
Future<void> writeCharacteristicWithResponse(List<int> value) async {
|
||||
List<BluetoothService> services =
|
||||
await bluetoothConnectDevice!.discoverServices();
|
||||
|
||||
List<BluetoothService> services = await bluetoothConnectDevice!.discoverServices();
|
||||
for (BluetoothService service in services) {
|
||||
// print("33333 service.remoteId:${service.remoteId}"
|
||||
// AppLog.log("33333 service.remoteId:${service.remoteId}"
|
||||
// " service.uuid:${service.uuid}\n\n"
|
||||
// " service.characteristics:${service.characteristics}\n\n"
|
||||
// " service.includedServices:${service.includedServices}");
|
||||
if (service.uuid == _serviceIdConnect) {
|
||||
for (BluetoothCharacteristic characteristic
|
||||
in service.characteristics) {
|
||||
// print("44444 characteristic.remoteId:${characteristic.remoteId}"
|
||||
for (BluetoothCharacteristic characteristic in service.characteristics) {
|
||||
// AppLog.log("44444 characteristic.remoteId:${characteristic.remoteId}"
|
||||
// " characteristic.uuid:${characteristic.uuid}\n\n"
|
||||
// " characteristic.secondaryServiceUuid:${characteristic
|
||||
// .secondaryServiceUuid}\n\n"
|
||||
@ -585,18 +574,17 @@ class BlueManage {
|
||||
try {
|
||||
List<int> valueList = value;
|
||||
List subData = splitList(valueList, _mtuSize!);
|
||||
// print('writeCharacteristicWithResponse _mtuSize:$_mtuSize 得到的分割数据:$subData');
|
||||
// AppLog.log('writeCharacteristicWithResponse _mtuSize:$_mtuSize 得到的分割数据:$subData');
|
||||
for (int i = 0; i < subData.length; i++) {
|
||||
await characteristic.write(subData[i],withoutResponse: true).then((value) async {
|
||||
// await Future.delayed(const Duration(milliseconds: 1)).then((
|
||||
// value) async {
|
||||
// print('分包发送成功了');
|
||||
// AppLog.log('分包发送成功了');
|
||||
// });
|
||||
});
|
||||
}
|
||||
} on Exception catch (e, s) {
|
||||
print('Error occurred when writing: $e');
|
||||
// Get.log(s);
|
||||
AppLog.log('APP写入失败: $e');
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
@ -611,18 +599,18 @@ class BlueManage {
|
||||
// try {
|
||||
// List<int> valueList = value;
|
||||
// List subData = splitList(valueList, _mtuSize!);
|
||||
// print('writeCharacteristicWithResponse 得到的分割数据:$subData');
|
||||
// AppLog.log('writeCharacteristicWithResponse 得到的分割数据:$subData');
|
||||
//
|
||||
// for (int i = 0; i < subData.length; i++) {
|
||||
// await characteristic.write(subData[i]).then((value) async {
|
||||
// await Future.delayed(const Duration(milliseconds: 1)).then((value) async {
|
||||
// print('分包发送成功了');
|
||||
// AppLog.log('分包发送成功了');
|
||||
// });
|
||||
// });
|
||||
// }
|
||||
// } on Exception catch (e, s) {
|
||||
// print('Error occurred when writing: $e');
|
||||
// print(s);
|
||||
// AppLog.log('Error occurred when writing: $e');
|
||||
// AppLog.log(s);
|
||||
// rethrow;
|
||||
// }
|
||||
}
|
||||
@ -632,10 +620,10 @@ class BlueManage {
|
||||
// try {
|
||||
// final result =
|
||||
// await _flutterReactiveBle!.readCharacteristic(characteristic);
|
||||
// print("readListresult$result");
|
||||
// AppLog.log("readListresult$result");
|
||||
// return result;
|
||||
// } on Exception catch (e, s) {
|
||||
// print(
|
||||
// AppLog.log(
|
||||
// 'Error occurred when reading ${characteristic.characteristicId} : $e',
|
||||
// );
|
||||
// rethrow;
|
||||
@ -649,7 +637,7 @@ class BlueManage {
|
||||
// .writeCharacteristicWithoutResponse(characteristic, value: value);
|
||||
// } on Exception catch (e, s) {
|
||||
// // ignore: avoid_print
|
||||
// print(s);
|
||||
// AppLog.log(s);
|
||||
// rethrow;
|
||||
// }
|
||||
// }
|
||||
@ -659,7 +647,7 @@ class BlueManage {
|
||||
try {
|
||||
await FlutterBluePlus.stopScan();
|
||||
} catch (e) {
|
||||
print("停止扫描失败");
|
||||
AppLog.log("停止扫描失败");
|
||||
}
|
||||
}
|
||||
|
||||
@ -670,11 +658,11 @@ class BlueManage {
|
||||
connectDeviceMacAddress = "";
|
||||
if (bluetoothConnectionState == BluetoothConnectionState.connected) {
|
||||
await bluetoothConnectDevice!.disconnect();
|
||||
print("断开连接成功");
|
||||
AppLog.log("断开连接成功");
|
||||
}
|
||||
// }
|
||||
} on Exception catch (e, _) {
|
||||
print("Error disconnecting from a device: $e");
|
||||
AppLog.log("断开连接失败: $e");
|
||||
} finally {
|
||||
bluetoothConnectionState = BluetoothConnectionState.disconnected;
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../app_settings/app_settings.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
import '../sm4Encipher/sm4.dart';
|
||||
import '../io_reply.dart';
|
||||
@ -68,13 +69,11 @@ class SenderAddFaceCommand extends SenderProtocol {
|
||||
|
||||
// keyID 40
|
||||
int keyIDLength = utf8.encode(keyID!).length;
|
||||
// print("${commandType!.typeValue}LockIDLength:$lockIDLength utf8.encode(lockID!)${utf8.encode(lockID!)}");
|
||||
subData.addAll(utf8.encode(keyID!));
|
||||
subData = getFixedLengthList(subData, 40 - keyIDLength);
|
||||
|
||||
//userID 20
|
||||
int userIDLength = utf8.encode(userID!).length;
|
||||
// print("${commandType!.typeValue}IDLength:$authUserIDLength utf8.encode(authUserID!)${utf8.encode(authUserID!)}");
|
||||
subData.addAll(utf8.encode(userID!));
|
||||
subData = getFixedLengthList(subData, 20 - userIDLength);
|
||||
|
||||
@ -159,7 +158,7 @@ class SenderAddFaceCommand extends SenderProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
AppLog.log("App发给锁的数据,指令类型是:${commandType!.typeName} 加密之前数据是:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
|
||||
@ -62,13 +62,11 @@ import '../io_type.dart';
|
||||
//
|
||||
// // keyID 40
|
||||
// int keyIDLength = utf8.encode(keyID!).length;
|
||||
// // print("${commandType!.typeValue}LockIDLength:$lockIDLength utf8.encode(lockID!)${utf8.encode(lockID!)}");
|
||||
// subData.addAll(utf8.encode(keyID!));
|
||||
// subData = getFixedLengthList(subData, 40 - keyIDLength);
|
||||
//
|
||||
// //userID 20
|
||||
// int userIDLength = utf8.encode(userID!).length;
|
||||
// // print("${commandType!.typeValue}IDLength:$authUserIDLength utf8.encode(authUserID!)${utf8.encode(authUserID!)}");
|
||||
// subData.addAll(utf8.encode(userID!));
|
||||
// subData = getFixedLengthList(subData, 20 - userIDLength);
|
||||
//
|
||||
|
||||
@ -46,8 +46,6 @@ import 'package:crypto/crypto.dart' as crypto;
|
||||
// List<int> subData = [];
|
||||
// List<int> ebcData = [];
|
||||
//
|
||||
// print("pwdNopwdNopwdNopwdNo:$fingerNo");
|
||||
//
|
||||
// // 指令类型
|
||||
// int type = commandType!.typeValue;
|
||||
// double typeDouble = type / 256;
|
||||
@ -61,13 +59,11 @@ import 'package:crypto/crypto.dart' as crypto;
|
||||
//
|
||||
// // keyID 40
|
||||
// int keyIDLength = utf8.encode(keyID!).length;
|
||||
// // print("${commandType!.typeValue}LockIDLength:$lockIDLength utf8.encode(lockID!)${utf8.encode(lockID!)}");
|
||||
// subData.addAll(utf8.encode(keyID!));
|
||||
// subData = getFixedLengthList(subData, 40 - keyIDLength);
|
||||
//
|
||||
// //userID 20
|
||||
// int userIDLength = utf8.encode(userID!).length;
|
||||
// // print("${commandType!.typeValue}IDLength:$authUserIDLength utf8.encode(authUserID!)${utf8.encode(authUserID!)}");
|
||||
// subData.addAll(utf8.encode(userID!));
|
||||
// subData = getFixedLengthList(subData, 20 - userIDLength);
|
||||
//
|
||||
@ -124,7 +120,6 @@ import 'package:crypto/crypto.dart' as crypto;
|
||||
// data.add(0);
|
||||
// }
|
||||
// }
|
||||
// print("${commandType!.typeName} SM4Data:$data");
|
||||
// // 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
// ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
// return ebcData;
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../app_settings/app_settings.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
import '../sm4Encipher/sm4.dart';
|
||||
import '../io_reply.dart';
|
||||
@ -70,13 +69,11 @@ class SenderAddFingerprintWithTimeCycleCoercionCommand extends SenderProtocol {
|
||||
|
||||
// keyID 40
|
||||
int keyIDLength = utf8.encode(keyID!).length;
|
||||
// print("${commandType!.typeValue}LockIDLength:$lockIDLength utf8.encode(lockID!)${utf8.encode(lockID!)}");
|
||||
subData.addAll(utf8.encode(keyID!));
|
||||
subData = getFixedLengthList(subData, 40 - keyIDLength);
|
||||
|
||||
//userID 20
|
||||
int userIDLength = utf8.encode(userID!).length;
|
||||
// print("${commandType!.typeValue}IDLength:$authUserIDLength utf8.encode(authUserID!)${utf8.encode(authUserID!)}");
|
||||
subData.addAll(utf8.encode(userID!));
|
||||
subData = getFixedLengthList(subData, 20 - userIDLength);
|
||||
|
||||
@ -161,7 +158,7 @@ class SenderAddFingerprintWithTimeCycleCoercionCommand extends SenderProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
AppLog.log("App发给锁的数据,指令类型是:${commandType!.typeName} 加密之前数据是:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
|
||||
@ -46,8 +46,6 @@ import '../sm4Encipher/sm4.dart';
|
||||
// List<int> subData = [];
|
||||
// List<int> ebcData = [];
|
||||
//
|
||||
// print("pwdNopwdNopwdNopwdNo:$cardNo");
|
||||
//
|
||||
// // 指令类型
|
||||
// int type = commandType!.typeValue;
|
||||
// double typeDouble = type / 256;
|
||||
@ -61,13 +59,11 @@ import '../sm4Encipher/sm4.dart';
|
||||
//
|
||||
// // keyID 40
|
||||
// int keyIDLength = utf8.encode(keyID!).length;
|
||||
// // print("${commandType!.typeValue}LockIDLength:$lockIDLength utf8.encode(lockID!)${utf8.encode(lockID!)}");
|
||||
// subData.addAll(utf8.encode(keyID!));
|
||||
// subData = getFixedLengthList(subData, 40 - keyIDLength);
|
||||
//
|
||||
// //userID 20
|
||||
// int userIDLength = utf8.encode(userID!).length;
|
||||
// // print("${commandType!.typeValue}IDLength:$authUserIDLength utf8.encode(authUserID!)${utf8.encode(authUserID!)}");
|
||||
// subData.addAll(utf8.encode(userID!));
|
||||
// subData = getFixedLengthList(subData, 20 - userIDLength);
|
||||
//
|
||||
@ -124,7 +120,6 @@ import '../sm4Encipher/sm4.dart';
|
||||
// data.add(0);
|
||||
// }
|
||||
// }
|
||||
// print("${commandType!.typeName} SM4Data:$data");
|
||||
// // 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
// ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
// return ebcData;
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../app_settings/app_settings.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
import '../sm4Encipher/sm4.dart';
|
||||
import '../io_reply.dart';
|
||||
@ -70,13 +69,11 @@ class SenderAddICCardWithTimeCycleCoercionCommand extends SenderProtocol {
|
||||
|
||||
// keyID 40
|
||||
int keyIDLength = utf8.encode(keyID!).length;
|
||||
// print("${commandType!.typeValue}LockIDLength:$lockIDLength utf8.encode(lockID!)${utf8.encode(lockID!)}");
|
||||
subData.addAll(utf8.encode(keyID!));
|
||||
subData = getFixedLengthList(subData, 40 - keyIDLength);
|
||||
|
||||
//userID 20
|
||||
int userIDLength = utf8.encode(userID!).length;
|
||||
// print("${commandType!.typeValue}IDLength:$authUserIDLength utf8.encode(authUserID!)${utf8.encode(authUserID!)}");
|
||||
subData.addAll(utf8.encode(userID!));
|
||||
subData = getFixedLengthList(subData, 20 - userIDLength);
|
||||
|
||||
@ -161,7 +158,7 @@ class SenderAddICCardWithTimeCycleCoercionCommand extends SenderProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
AppLog.log("App发给锁的数据,指令类型是:${commandType!.typeName} 加密之前数据是:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
|
||||
@ -62,13 +62,11 @@ import 'package:crypto/crypto.dart' as crypto;
|
||||
//
|
||||
// // keyID 40
|
||||
// int keyIDLength = utf8.encode(keyID!).length;
|
||||
// // print("${commandType!.typeValue}LockIDLength:$lockIDLength utf8.encode(lockID!)${utf8.encode(lockID!)}");
|
||||
// subData.addAll(utf8.encode(keyID!));
|
||||
// subData = getFixedLengthList(subData, 40 - keyIDLength);
|
||||
//
|
||||
// //userID 20
|
||||
// int userIDLength = utf8.encode(userID!).length;
|
||||
// // print("${commandType!.typeValue}IDLength:$authUserIDLength utf8.encode(authUserID!)${utf8.encode(authUserID!)}");
|
||||
// subData.addAll(utf8.encode(userID!));
|
||||
// subData = getFixedLengthList(subData, 20 - userIDLength);
|
||||
//
|
||||
@ -128,7 +126,6 @@ import 'package:crypto/crypto.dart' as crypto;
|
||||
// data.add(0);
|
||||
// }
|
||||
// }
|
||||
// print("${commandType!.typeName} SM4Data:$data");
|
||||
// // 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
// ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
// return ebcData;
|
||||
|
||||
@ -64,13 +64,11 @@ import 'package:crypto/crypto.dart' as crypto;
|
||||
//
|
||||
// // keyID 40
|
||||
// int keyIDLength = utf8.encode(keyID!).length;
|
||||
// // print("${commandType!.typeValue}LockIDLength:$lockIDLength utf8.encode(lockID!)${utf8.encode(lockID!)}");
|
||||
// subData.addAll(utf8.encode(keyID!));
|
||||
// subData = getFixedLengthList(subData, 40 - keyIDLength);
|
||||
//
|
||||
// //userID 20
|
||||
// int userIDLength = utf8.encode(userID!).length;
|
||||
// // print("${commandType!.typeValue}IDLength:$authUserIDLength utf8.encode(authUserID!)${utf8.encode(authUserID!)}");
|
||||
// subData.addAll(utf8.encode(userID!));
|
||||
// subData = getFixedLengthList(subData, 20 - userIDLength);
|
||||
//
|
||||
@ -131,7 +129,6 @@ import 'package:crypto/crypto.dart' as crypto;
|
||||
// data.add(0);
|
||||
// }
|
||||
// }
|
||||
// print("${commandType!.typeName} SM4Data:$data");
|
||||
// // 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
// ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
// return ebcData;
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../app_settings/app_settings.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
import '../sm4Encipher/sm4.dart';
|
||||
import '../io_reply.dart';
|
||||
@ -60,13 +59,11 @@ class SenderAddStressPasswordCommand extends SenderProtocol {
|
||||
|
||||
// keyID 40
|
||||
int keyIDLength = utf8.encode(keyID!).length;
|
||||
// print("${commandType!.typeValue}LockIDLength:$lockIDLength utf8.encode(lockID!)${utf8.encode(lockID!)}");
|
||||
subData.addAll(utf8.encode(keyID!));
|
||||
subData = getFixedLengthList(subData, 40 - keyIDLength);
|
||||
|
||||
//userID 20
|
||||
int userIDLength = utf8.encode(userID!).length;
|
||||
// print("${commandType!.typeValue}IDLength:$authUserIDLength utf8.encode(authUserID!)${utf8.encode(authUserID!)}");
|
||||
subData.addAll(utf8.encode(userID!));
|
||||
subData = getFixedLengthList(subData, 20 - userIDLength);
|
||||
|
||||
@ -125,7 +122,7 @@ class SenderAddStressPasswordCommand extends SenderProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
AppLog.log("App发给锁的数据,指令类型是:${commandType!.typeName} 加密之前数据是:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
|
||||
@ -3,6 +3,7 @@ import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../app_settings/app_settings.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
import '../sm4Encipher/sm4.dart';
|
||||
import '../io_reply.dart';
|
||||
@ -59,26 +60,21 @@ class AddUserCommand extends SenderProtocol {
|
||||
|
||||
// 锁id 40
|
||||
int lockIDLength = utf8.encode(lockID!).length;
|
||||
// print("${commandType!.typeValue}LockIDLength:$lockIDLength utf8.encode(lockID!)${utf8.encode(lockID!)}");
|
||||
data.addAll(utf8.encode(lockID!));
|
||||
data = getFixedLengthList(data, 40 - lockIDLength);
|
||||
|
||||
//authUserID 20
|
||||
int authUserIDLength = utf8.encode(authUserID!).length;
|
||||
// print("${commandType!.typeValue}IDLength:$authUserIDLength utf8.encode(authUserID!)${utf8.encode(authUserID!)}");
|
||||
data.addAll(utf8.encode(authUserID!));
|
||||
data = getFixedLengthList(data, 20 - authUserIDLength);
|
||||
|
||||
//KeyID 40
|
||||
int keyIDLength = utf8.encode(keyID!).length;
|
||||
// print("${commandType!.typeValue}keyIDLength:$keyIDLength utf8.encode(keyID!)${utf8.encode(keyID!)}");
|
||||
data.addAll(utf8.encode(keyID!));
|
||||
data = getFixedLengthList(data, 40 - keyIDLength);
|
||||
|
||||
//userID 要接受钥匙的用户的useid 20
|
||||
print("添加授权管理员userId:${userID}");
|
||||
int userIDLength = utf8.encode(userID!).length;
|
||||
// print("${commandType!.typeValue}userIDLength:$userIDLength utf8.encode(userID!)${utf8.encode(userID!)}");
|
||||
data.addAll(utf8.encode(userID!));
|
||||
data = getFixedLengthList(data, 20 - userIDLength);
|
||||
|
||||
@ -119,7 +115,6 @@ class AddUserCommand extends SenderProtocol {
|
||||
|
||||
// token 长度4 首次请求 Token 填 0,如果锁需要鉴权 操作者身份,则会分配动态口令并在应答消息中返回,二次请求时带上。 当token失效或者第一次发送的时候token为0
|
||||
data.addAll(token!);
|
||||
print("pubToken:$token");
|
||||
|
||||
if(needAuthor == 0){
|
||||
//AuthCodeLen 1
|
||||
@ -152,7 +147,7 @@ class AddUserCommand extends SenderProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
AppLog.log("App发给锁的数据,指令类型是:${commandType!.typeName} 加密之前数据是:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
|
||||
@ -51,7 +51,6 @@ import 'package:crypto/crypto.dart' as crypto;
|
||||
//
|
||||
// //userID 要接受钥匙的用户的useid 20
|
||||
// int userIDLength = utf8.encode(userID!).length;
|
||||
// print("openDoorUserId:${utf8.encode(userID!)} utf8.encode(userID!).length:${utf8.encode(userID!).length}");
|
||||
// subData.addAll(utf8.encode(userID!));
|
||||
// subData = getFixedLengthList(subData, 20 - userIDLength);
|
||||
//
|
||||
@ -61,14 +60,12 @@ import 'package:crypto/crypto.dart' as crypto;
|
||||
// data.add(subData.length);
|
||||
// data.addAll(subData);
|
||||
//
|
||||
// print("data:$data data.length:${data.length} (data.length % 16):${(data.length % 16)}");
|
||||
// if ((data.length % 16) != 0) {
|
||||
// int add = (16 - data.length % 16);
|
||||
// for (int i = 0; i < add; i++) {
|
||||
// data.add(0);
|
||||
// }
|
||||
// }
|
||||
// print("${commandType!.typeName} SM4Data:$data");
|
||||
// ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
// return ebcData;
|
||||
// }
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../app_settings/app_settings.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
import '../sm4Encipher/sm4.dart';
|
||||
import '../io_reply.dart';
|
||||
@ -58,13 +57,11 @@ class ChangeAdministratorPasswordCommand extends SenderProtocol {
|
||||
|
||||
// keyID 40
|
||||
int keyIDLength = utf8.encode(keyID!).length;
|
||||
// print("${commandType!.typeValue}LockIDLength:$lockIDLength utf8.encode(lockID!)${utf8.encode(lockID!)}");
|
||||
subData.addAll(utf8.encode(keyID!));
|
||||
subData = getFixedLengthList(subData, 40 - keyIDLength);
|
||||
|
||||
//userID 20
|
||||
int userIDLength = utf8.encode(userID!).length;
|
||||
// print("${commandType!.typeValue}IDLength:$authUserIDLength utf8.encode(authUserID!)${utf8.encode(authUserID!)}");
|
||||
subData.addAll(utf8.encode(userID!));
|
||||
subData = getFixedLengthList(subData, 20 - userIDLength);
|
||||
|
||||
@ -73,7 +70,6 @@ class ChangeAdministratorPasswordCommand extends SenderProtocol {
|
||||
|
||||
// pwd 20
|
||||
int pwdLength = utf8.encode(pwd!).length;
|
||||
// print("${commandType!.typeValue}keyIDLength:$keyIDLength utf8.encode(keyID!)${utf8.encode(keyID!)}");
|
||||
subData.addAll(utf8.encode(pwd!));
|
||||
subData = getFixedLengthList(subData, 20 - pwdLength);
|
||||
|
||||
@ -129,7 +125,7 @@ class ChangeAdministratorPasswordCommand extends SenderProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
AppLog.log("App发给锁的数据,指令类型是:${commandType!.typeName} 加密之前数据是:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
|
||||
@ -2,8 +2,7 @@
|
||||
//TODO:查询指纹状态
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../app_settings/app_settings.dart';
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
@ -105,7 +104,7 @@ class SenderCheckingCardStatusCommand extends SenderProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
AppLog.log("App发给锁的数据,指令类型是:${commandType!.typeName} 加密之前数据是:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
|
||||
@ -2,8 +2,7 @@
|
||||
//TODO:查询用户、指纹、密码、卡片数量(用于判断是否同步)
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../app_settings/app_settings.dart';
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
@ -106,7 +105,7 @@ class SenderCheckingUserInfoCountCommand extends SenderProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
AppLog.log("App发给锁的数据,指令类型是:${commandType!.typeName} 加密之前数据是:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
|
||||
@ -2,8 +2,7 @@
|
||||
//TODO:WIFI配网
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../app_settings/app_settings.dart';
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
@ -131,7 +130,7 @@ class SenderConfiguringWifiCommand extends SenderProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
AppLog.log("App发给锁的数据,指令类型是:${commandType!.typeName} 加密之前数据是:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
|
||||
@ -1,10 +1,8 @@
|
||||
|
||||
|
||||
//TODO:添加用户
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../app_settings/app_settings.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
import '../sm4Encipher/sm4.dart';
|
||||
import '../io_reply.dart';
|
||||
@ -48,25 +46,21 @@ class DeletUserCommand extends SenderProtocol {
|
||||
|
||||
// 锁id 40
|
||||
int lockIDLength = utf8.encode(lockID!).length;
|
||||
// print("${commandType!.typeValue}LockIDLength:$lockIDLength utf8.encode(lockID!)${utf8.encode(lockID!)}");
|
||||
data.addAll(utf8.encode(lockID!));
|
||||
data = getFixedLengthList(data, 40 - lockIDLength);
|
||||
|
||||
//authUserID 20
|
||||
int authUserIDLength = utf8.encode(authUserID!).length;
|
||||
// print("${commandType!.typeValue}authUserIDLength:$authUserIDLength utf8.encode(authUserID!)${utf8.encode(authUserID!)}");
|
||||
data.addAll(utf8.encode(authUserID!));
|
||||
data = getFixedLengthList(data, 20 - authUserIDLength);
|
||||
|
||||
//KeyID 40
|
||||
int keyIDLength = utf8.encode(keyID!).length;
|
||||
// print("${commandType!.typeValue}keyIDLength:$keyIDLength utf8.encode(keyID!)${utf8.encode(keyID!)}");
|
||||
data.addAll(utf8.encode(keyID!));
|
||||
data = getFixedLengthList(data, 40 - keyIDLength);
|
||||
|
||||
//delUserID 20
|
||||
int delUserIDLength = utf8.encode(delUserID!).length;
|
||||
// print("${commandType!.typeValue}authUserIDLength:$authUserIDLength utf8.encode(authUserID!)${utf8.encode(authUserID!)}");
|
||||
data.addAll(utf8.encode(delUserID!));
|
||||
data = getFixedLengthList(data, 20 - delUserIDLength);
|
||||
|
||||
@ -104,7 +98,7 @@ class DeletUserCommand extends SenderProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
AppLog.log("App发给锁的数据,指令类型是:${commandType!.typeName} 加密之前数据是:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
|
||||
@ -3,8 +3,7 @@
|
||||
//TODO:修改用户
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../app_settings/app_settings.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
import '../sm4Encipher/sm4.dart';
|
||||
import '../io_reply.dart';
|
||||
@ -60,25 +59,21 @@ class EditUserCommand extends SenderProtocol {
|
||||
|
||||
// 锁id 40
|
||||
int lockIDLength = utf8.encode(lockID!).length;
|
||||
// print("${commandType!.typeValue}LockIDLength:$lockIDLength utf8.encode(lockID!)${utf8.encode(lockID!)}");
|
||||
data.addAll(utf8.encode(lockID!));
|
||||
data = getFixedLengthList(data, 40 - lockIDLength);
|
||||
|
||||
//authUserID 20
|
||||
int authUserIDLength = utf8.encode(authUserID!).length;
|
||||
// print("${commandType!.typeValue}IDLength:$authUserIDLength utf8.encode(authUserID!)${utf8.encode(authUserID!)}");
|
||||
data.addAll(utf8.encode(authUserID!));
|
||||
data = getFixedLengthList(data, 20 - authUserIDLength);
|
||||
|
||||
//KeyID 40
|
||||
int keyIDLength = utf8.encode(keyID!).length;
|
||||
// print("${commandType!.typeValue}keyIDLength:$keyIDLength utf8.encode(keyID!)${utf8.encode(keyID!)}");
|
||||
data.addAll(utf8.encode(keyID!));
|
||||
data = getFixedLengthList(data, 40 - keyIDLength);
|
||||
|
||||
//userID 要接受钥匙的用户的useid 20
|
||||
int userIDLength = utf8.encode(userID!).length;
|
||||
// print("${commandType!.typeValue}userIDLength:$userIDLength utf8.encode(userID!)${utf8.encode(userID!)}");
|
||||
data.addAll(utf8.encode(userID!));
|
||||
data = getFixedLengthList(data, 20 - userIDLength);
|
||||
|
||||
@ -119,7 +114,6 @@ class EditUserCommand extends SenderProtocol {
|
||||
|
||||
// token 长度4 首次请求 Token 填 0,如果锁需要鉴权 操作者身份,则会分配动态口令并在应答消息中返回,二次请求时带上。 当token失效或者第一次发送的时候token为0
|
||||
data.addAll(token!);
|
||||
print("pubToken:$token");
|
||||
|
||||
if(needAuthor == 0){
|
||||
//AuthCodeLen 1
|
||||
@ -152,7 +146,7 @@ class EditUserCommand extends SenderProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
AppLog.log("App发给锁的数据,指令类型是:${commandType!.typeName} 加密之前数据是:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
|
||||
@ -4,6 +4,7 @@ import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../app_settings/app_settings.dart';
|
||||
import '../../tools/storage.dart';
|
||||
import '../blue_manage.dart';
|
||||
import '../io_tool/io_manager.dart';
|
||||
@ -49,19 +50,16 @@ class FactoryDataResetCommand extends SenderProtocol {
|
||||
|
||||
// 锁id 40
|
||||
int lockIDLength = utf8.encode(lockID!).length;
|
||||
// print("${commandType!.typeValue}LockIDLength:$lockIDLength utf8.encode(lockID!)${utf8.encode(lockID!)}");
|
||||
data.addAll(utf8.encode(lockID!));
|
||||
data = getFixedLengthList(data, 40 - lockIDLength);
|
||||
|
||||
//userID 20
|
||||
int userIDLength = utf8.encode(userID!).length;
|
||||
// print("${commandType!.typeValue}IDLength:$authUserIDLength utf8.encode(authUserID!)${utf8.encode(authUserID!)}");
|
||||
data.addAll(utf8.encode(userID!));
|
||||
data = getFixedLengthList(data, 20 - userIDLength);
|
||||
|
||||
// token 长度4 首次请求 Token 填 0,如果锁需要鉴权 操作者身份,则会分配动态口令并在应答消息中返回,二次请求时带上。 当token失效或者第一次发送的时候token为0
|
||||
data.addAll(token!);
|
||||
print("恢复出厂设置、pubToken:$token");
|
||||
|
||||
if(needAuthor == 0){
|
||||
//AuthCodeLen 1
|
||||
@ -91,7 +89,7 @@ class FactoryDataResetCommand extends SenderProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
AppLog.log("App发给锁的数据,指令类型是:${commandType!.typeName} 加密之前数据是:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
|
||||
@ -35,13 +35,11 @@
|
||||
//
|
||||
// // 锁id 40
|
||||
// int lockIDLength = utf8.encode(lockID!).length;
|
||||
// // print("addUserLockIDLength:$lockIDLength utf8.encode(lockID!)${utf8.encode(lockID!)}");
|
||||
// data.addAll(utf8.encode(lockID!));
|
||||
// data = getFixedLengthList(data, 40 - lockIDLength);
|
||||
//
|
||||
// //userID 要接受钥匙的用户的useid 20
|
||||
// int userIDLength = utf8.encode(userID!).length;
|
||||
// // print("userIDLength:$userIDLength utf8.encode(userID!)${utf8.encode(userID!)}");
|
||||
// data.addAll(utf8.encode(userID!));
|
||||
// data = getFixedLengthList(data, 20 - userIDLength);
|
||||
//
|
||||
@ -51,7 +49,6 @@
|
||||
// data.add(0);
|
||||
// }
|
||||
// }
|
||||
// print("${commandType!.typeName} SM4Data:$data");
|
||||
// // 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
// ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
// return ebcData;
|
||||
@ -69,65 +66,50 @@
|
||||
// case 0x00:
|
||||
// //成功
|
||||
// var softVersion = data.sublist(3, 7);
|
||||
// // print("softVersion:$softVersion");
|
||||
//
|
||||
// var power = data[7];
|
||||
// // print("power:$power");
|
||||
//
|
||||
// // APP 用户数量
|
||||
// var appUserCount = data.sublist(50, 53);
|
||||
// // print("appUserCount:$appUserCount");
|
||||
//
|
||||
// // 黑名单用户数量
|
||||
// var blacklistCount = data[53];
|
||||
// // print("blacklistCount:$blacklistCount");
|
||||
//
|
||||
// // 蓝牙钥匙数量
|
||||
// var bleKeyCount = data[54];
|
||||
// // print("bleKeyCount:$bleKeyCount");
|
||||
//
|
||||
// // 剩余可添加用户数量
|
||||
// var remainCount = data.sublist(54, 56);
|
||||
// // print("remainCount:$remainCount");
|
||||
//
|
||||
// // 未上传开锁记录数量
|
||||
// var notUploadCount = data.sublist(56, 58);
|
||||
// // print("notUploadCount:$notUploadCount");
|
||||
//
|
||||
// // 已设置开门密码数量
|
||||
// var pwdCount = data[58];
|
||||
// // print("pwdCount:$pwdCount");
|
||||
//
|
||||
// // 已设置开门指纹数量
|
||||
// var fingerprintCount = data[59];
|
||||
// // print("fingerprintCount:$fingerprintCount");
|
||||
//
|
||||
// // 锁当前时间
|
||||
// var lockTime = data.sublist(60, 64);
|
||||
// // print("lockTime:$lockTime");
|
||||
//
|
||||
// // 硬件版本信息,为固件升级提供判断依据
|
||||
// var hardVersion = data.sublist(64, 68);
|
||||
// // print("hardVersion:$hardVersion");
|
||||
// break;
|
||||
// case 0x06:
|
||||
// //无权限
|
||||
// print("${commandType.typeValue} 需要鉴权");
|
||||
//
|
||||
// break;
|
||||
// case 0x07:
|
||||
// //无权限
|
||||
// print("${commandType.typeValue} 用户无权限");
|
||||
//
|
||||
// break;
|
||||
// case 0x09:
|
||||
// // 权限校验错误
|
||||
// print("${commandType.typeValue} 权限校验错误");
|
||||
//
|
||||
// break;
|
||||
// default:
|
||||
// //失败
|
||||
// print("${commandType.typeValue} 领锁失败");
|
||||
//
|
||||
// break;
|
||||
// }
|
||||
|
||||
@ -5,6 +5,7 @@ import 'package:get/get.dart';
|
||||
import 'package:star_lock/blue/blue_manage.dart';
|
||||
import 'package:star_lock/blue/sm4Encipher/sm4.dart';
|
||||
|
||||
import '../../app_settings/app_settings.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
@ -35,7 +36,6 @@ class GetPrivateKeyCommand extends SenderProtocol {
|
||||
publicKeyDataList = publicKeyData!;
|
||||
List<int> data = [];
|
||||
List<int> ebcData = [];
|
||||
// print("lockID:${lockID!} lockID.utf8.encode${utf8.encode(lockID!)}");
|
||||
|
||||
// 指令类型
|
||||
int type = commandType!.typeValue;
|
||||
@ -44,9 +44,6 @@ class GetPrivateKeyCommand extends SenderProtocol {
|
||||
int type2 = type % 256;
|
||||
data.add(type1);
|
||||
data.add(type2);
|
||||
// print("type:$type");
|
||||
// print("type1:$type1");
|
||||
// print("type2:$type2");
|
||||
|
||||
// 锁id
|
||||
int lockIDLength = utf8.encode(lockID!).length;
|
||||
@ -108,7 +105,7 @@ class GetPrivateKeyCommand extends SenderProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
AppLog.log("App发给锁的数据,指令类型是:${commandType!.typeName} 加密之前数据是:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: utf8.encode(BlueManage().connectDeviceName), mode: SM4CryptoMode.ECB);
|
||||
|
||||
@ -121,6 +118,5 @@ class GetPrivateKeyReply extends Reply {
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail.sublist(2);
|
||||
status = data[0];
|
||||
// print("getData:$getData");
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,11 +28,7 @@ class GetPublicKeyCommand extends SenderProtocol {
|
||||
int type2 = type % 256;
|
||||
data.add(type1);
|
||||
data.add(type2);
|
||||
// print("type:$type");
|
||||
// print("type1:$type1");
|
||||
// print("type2:$type2");
|
||||
|
||||
Get.log("lockID:${lockID!} lockID.utf8.encode${utf8.encode(lockID!)}");
|
||||
int length = utf8.encode(lockID!).length;
|
||||
data.addAll(utf8.encode(lockID!));
|
||||
data = getFixedLengthList(data, 40 - length);
|
||||
|
||||
@ -3,6 +3,7 @@ import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../app_settings/app_settings.dart';
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
@ -50,7 +51,7 @@ class GetStarLockStatuInfoCommand extends SenderProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
AppLog.log("App发给锁的数据,指令类型是:${commandType!.typeName} 加密之前数据是:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
|
||||
@ -3,6 +3,7 @@ import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../app_settings/app_settings.dart';
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
@ -93,7 +94,7 @@ class SenderGetWifiCommand extends SenderProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
AppLog.log("App发给锁的数据,指令类型是:${commandType!.typeName} 加密之前数据是:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
|
||||
import 'dart:convert';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/app_settings/app_settings.dart';
|
||||
|
||||
import '../io_tool/io_tool.dart';
|
||||
import '../sm4Encipher/sm4.dart';
|
||||
@ -68,7 +69,6 @@ class OpenLockCommand extends SenderProtocol {
|
||||
|
||||
// token 长度4 首次请求 Token 填 0,如果锁需要鉴权 操作者身份,则会分配动态口令并在应答消息中返回,二次请求时带上。 当token失效或者第一次发送的时候token为0
|
||||
data.addAll(token!);
|
||||
print("pubToken:$token");
|
||||
|
||||
if(needAuthor == 0){
|
||||
//AuthCodeLen 1
|
||||
@ -107,7 +107,7 @@ class OpenLockCommand extends SenderProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
AppLog.log("App发给锁的数据,指令类型是:${commandType!.typeName} 加密之前数据是:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
|
||||
@ -3,6 +3,7 @@ import 'dart:typed_data';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../app_settings/app_settings.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
import '../sm4Encipher/sm4.dart';
|
||||
import '../io_reply.dart';
|
||||
@ -55,21 +56,21 @@ class OTAUpgradeCommand extends SenderProtocol {
|
||||
data.add(type1);
|
||||
data.add(type2);
|
||||
|
||||
print('---> 指令 : $type1 $type2' );
|
||||
AppLog.log('---> 指令 : $type1 $type2' );
|
||||
|
||||
// 锁id 40
|
||||
int lockIDLength = utf8.encode(lockID!).length;
|
||||
data.addAll(utf8.encode(lockID!));
|
||||
data = getFixedLengthList(data, 40 - lockIDLength);
|
||||
|
||||
print('---> 锁id :' + utf8.encode(lockID!).toString());
|
||||
AppLog.log('---> 锁id :${utf8.encode(lockID!)}');
|
||||
|
||||
//userID 20
|
||||
int userIDLength = utf8.encode(userID!).length;
|
||||
data.addAll(utf8.encode(userID!));
|
||||
data = getFixedLengthList(data, 20 - userIDLength);
|
||||
|
||||
print('---> userID :' + utf8.encode(userID!).toString());
|
||||
AppLog.log('---> userID :${utf8.encode(userID!)}');
|
||||
|
||||
//platform 2
|
||||
int platform0 = (platform! & 0xFF00) >> 8;
|
||||
@ -77,7 +78,7 @@ class OTAUpgradeCommand extends SenderProtocol {
|
||||
data.add(platform0);
|
||||
data.add(platform1);
|
||||
|
||||
print('---> platform : $platform0 $platform1');
|
||||
AppLog.log('---> platform : $platform0 $platform1');
|
||||
|
||||
//product 2
|
||||
// int product0 = (product! & 0xFF00) >> 8;
|
||||
@ -86,21 +87,21 @@ class OTAUpgradeCommand extends SenderProtocol {
|
||||
// data.add(product1);
|
||||
data.addAll([0,1]);//先默认是 01
|
||||
|
||||
print('---> platform : ${[0,1]}');
|
||||
AppLog.log('---> platform : ${[0,1]}');
|
||||
|
||||
//HwVersion 20
|
||||
int hwVersionLength = utf8.encode(hwVersion!).length;
|
||||
data.addAll(utf8.encode(hwVersion!));
|
||||
data = getFixedLengthList(data, 20 - hwVersionLength);
|
||||
|
||||
print('---> hwVersion : ${utf8.encode(hwVersion!)}');
|
||||
AppLog.log('---> hwVersion : ${utf8.encode(hwVersion!)}');
|
||||
|
||||
//FwVersion 20
|
||||
int fwVersionLength = utf8.encode(fwVersion!).length;
|
||||
data.addAll(utf8.encode(fwVersion!));
|
||||
data = getFixedLengthList(data, 20 - fwVersionLength);
|
||||
|
||||
print('---> FwVersion : ${utf8.encode(fwVersion!)}');
|
||||
AppLog.log('---> FwVersion : ${utf8.encode(fwVersion!)}');
|
||||
|
||||
//fwSize 4
|
||||
ByteData bytes = ByteData(4); // 创建一个长度为4的字节数据
|
||||
@ -108,7 +109,7 @@ class OTAUpgradeCommand extends SenderProtocol {
|
||||
List<int> byteList = bytes.buffer.asUint8List();
|
||||
data.addAll(byteList);
|
||||
|
||||
print('---> fwSize : ${byteList}');
|
||||
AppLog.log('---> fwSize : ${byteList}');
|
||||
|
||||
// 创建一个16字节的字节数组
|
||||
Uint8List result = Uint8List(16);
|
||||
@ -119,14 +120,14 @@ class OTAUpgradeCommand extends SenderProtocol {
|
||||
result[i ~/ 2] = byteValue;
|
||||
}
|
||||
data.addAll(result);
|
||||
print('---> fwMD5 : ${result}');
|
||||
AppLog.log('---> fwMD5 : $result');
|
||||
|
||||
// token 长度4 首次请求 Token 填 0,如果锁需要鉴权 操作者身份,则会分配动态口令并在应答消息中返回,二次请求时带上。 当token失效或者第一次发送的时候token为0
|
||||
data.addAll(token!);
|
||||
|
||||
print('---> token : ${token}');
|
||||
AppLog.log('---> token : $token');
|
||||
|
||||
print('--->1' + data.toString());
|
||||
AppLog.log('--->1$data');
|
||||
|
||||
if (needAuthor == 0) {
|
||||
//AuthCodeLen 1
|
||||
@ -145,7 +146,7 @@ class OTAUpgradeCommand extends SenderProtocol {
|
||||
|
||||
authCodeData.addAll(signKey!);
|
||||
|
||||
print('---> ${utf8.encode(keyID!)} ${utf8.encode(userID!)} $token $signKey');
|
||||
AppLog.log('---> ${utf8.encode(keyID!)} ${utf8.encode(userID!)} $token $signKey');
|
||||
|
||||
// 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||
var authCode = crypto.md5.convert(authCodeData);
|
||||
@ -161,7 +162,7 @@ class OTAUpgradeCommand extends SenderProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
AppLog.log("App发给锁的数据,指令类型是:${commandType!.typeName} 加密之前数据是:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
@ -176,7 +177,7 @@ class OTAUpgradeReply extends Reply {
|
||||
data = dataDetail;
|
||||
token = data.sublist(2, 6);
|
||||
status = data[6];
|
||||
print('--->2' + data.toString());
|
||||
AppLog.log('--->2' + data.toString());
|
||||
errorWithStstus(status);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../app_settings/app_settings.dart';
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
@ -103,7 +104,7 @@ class SenderQueryingFaceStatusCommand extends SenderProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
AppLog.log("App发给锁的数据,指令类型是:${commandType!.typeName} 加密之前数据是:$data");
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../app_settings/app_settings.dart';
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
@ -105,7 +106,7 @@ class SenderQueryingFingerprintStatusCommand extends SenderProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
AppLog.log("App发给锁的数据,指令类型是:${commandType!.typeName} 加密之前数据是:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
|
||||
@ -3,6 +3,7 @@ import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../app_settings/app_settings.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
import '../sm4Encipher/sm4.dart';
|
||||
import '../io_reply.dart';
|
||||
@ -54,13 +55,11 @@ class SenderReadAdminPasswordCommand extends SenderProtocol {
|
||||
|
||||
// keyID 40
|
||||
int keyIDLength = utf8.encode(keyID!).length;
|
||||
// print("${commandType!.typeValue}LockIDLength:$lockIDLength utf8.encode(lockID!)${utf8.encode(lockID!)}");
|
||||
subData.addAll(utf8.encode(keyID!));
|
||||
subData = getFixedLengthList(subData, 40 - keyIDLength);
|
||||
|
||||
//userID 20
|
||||
int userIDLength = utf8.encode(userID!).length;
|
||||
// print("${commandType!.typeValue}IDLength:$authUserIDLength utf8.encode(authUserID!)${utf8.encode(authUserID!)}");
|
||||
subData.addAll(utf8.encode(userID!));
|
||||
subData = getFixedLengthList(subData, 20 - userIDLength);
|
||||
|
||||
@ -107,7 +106,7 @@ class SenderReadAdminPasswordCommand extends SenderProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
AppLog.log("App发给锁的数据,指令类型是:${commandType!.typeName} 加密之前数据是:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
|
||||
@ -3,6 +3,7 @@ import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../app_settings/app_settings.dart';
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
@ -51,13 +52,11 @@ class ReadSupportFunctionsNoParametersCommand extends SenderProtocol {
|
||||
|
||||
// keyID 40
|
||||
int keyIDLength = utf8.encode(keyID!).length;
|
||||
// print("${commandType!.typeValue}LockIDLength:$lockIDLength utf8.encode(lockID!)${utf8.encode(lockID!)}");
|
||||
subData.addAll(utf8.encode(keyID!));
|
||||
subData = getFixedLengthList(subData, 40 - keyIDLength);
|
||||
|
||||
//userID 20
|
||||
int userIDLength = utf8.encode(userID!).length;
|
||||
// print("${commandType!.typeValue}IDLength:$authUserIDLength utf8.encode(authUserID!)${utf8.encode(authUserID!)}");
|
||||
subData.addAll(utf8.encode(userID!));
|
||||
subData = getFixedLengthList(subData, 20 - userIDLength);
|
||||
|
||||
@ -98,7 +97,7 @@ class ReadSupportFunctionsNoParametersCommand extends SenderProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
AppLog.log("App发给锁的数据,指令类型是:${commandType!.typeName} 加密之前数据是:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
|
||||
@ -3,6 +3,7 @@ import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../app_settings/app_settings.dart';
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
@ -51,13 +52,11 @@ class ReadSupportFunctionsWithParametersCommand extends SenderProtocol {
|
||||
|
||||
// keyID 40
|
||||
int keyIDLength = utf8.encode(keyID!).length;
|
||||
// print("${commandType!.typeValue}LockIDLength:$lockIDLength utf8.encode(lockID!)${utf8.encode(lockID!)}");
|
||||
subData.addAll(utf8.encode(keyID!));
|
||||
subData = getFixedLengthList(subData, 40 - keyIDLength);
|
||||
|
||||
//userID 20
|
||||
int userIDLength = utf8.encode(userID!).length;
|
||||
// print("${commandType!.typeValue}IDLength:$authUserIDLength utf8.encode(authUserID!)${utf8.encode(authUserID!)}");
|
||||
subData.addAll(utf8.encode(userID!));
|
||||
subData = getFixedLengthList(subData, 20 - userIDLength);
|
||||
|
||||
@ -98,7 +97,7 @@ class ReadSupportFunctionsWithParametersCommand extends SenderProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
AppLog.log("App发给锁的数据,指令类型是:${commandType!.typeName} 加密之前数据是:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
|
||||
@ -4,6 +4,7 @@ import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../app_settings/app_settings.dart';
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
@ -103,7 +104,7 @@ class SenderReferEventRecordNumberCommand extends SenderProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
AppLog.log("App发给锁的数据,指令类型是:${commandType!.typeName} 加密之前数据是:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
|
||||
@ -4,6 +4,7 @@ import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../app_settings/app_settings.dart';
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
@ -106,7 +107,7 @@ class SenderReferEventRecordTimeCommand extends SenderProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
AppLog.log("App发给锁的数据,指令类型是:${commandType!.typeName} 加密之前数据是:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
|
||||
@ -3,6 +3,7 @@ import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../app_settings/app_settings.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
import '../sm4Encipher/sm4.dart';
|
||||
import '../io_reply.dart';
|
||||
@ -61,13 +62,11 @@ class SenderCustomPasswordsCommand extends SenderProtocol {
|
||||
|
||||
// keyID 40
|
||||
int keyIDLength = utf8.encode(keyID!).length;
|
||||
// print("${commandType!.typeValue}LockIDLength:$lockIDLength utf8.encode(lockID!)${utf8.encode(lockID!)}");
|
||||
subData.addAll(utf8.encode(keyID!));
|
||||
subData = getFixedLengthList(subData, 40 - keyIDLength);
|
||||
|
||||
//userID 20
|
||||
int userIDLength = utf8.encode(userID!).length;
|
||||
// print("${commandType!.typeValue}IDLength:$authUserIDLength utf8.encode(authUserID!)${utf8.encode(authUserID!)}");
|
||||
subData.addAll(utf8.encode(userID!));
|
||||
subData = getFixedLengthList(subData, 20 - userIDLength);
|
||||
|
||||
@ -76,13 +75,11 @@ class SenderCustomPasswordsCommand extends SenderProtocol {
|
||||
|
||||
// pwd 20
|
||||
int pwdLength = utf8.encode(pwd!).length;
|
||||
// print("${commandType!.typeValue}keyIDLength:$keyIDLength utf8.encode(keyID!)${utf8.encode(keyID!)}");
|
||||
subData.addAll(utf8.encode(pwd!));
|
||||
subData = getFixedLengthList(subData, 20 - pwdLength);
|
||||
|
||||
// UseCountLimit
|
||||
subData.add(useCountLimit!);
|
||||
print("useCountLimituseCountLimituseCountLimit:$useCountLimit");
|
||||
|
||||
// token
|
||||
subData.addAll(token!);
|
||||
@ -133,7 +130,7 @@ class SenderCustomPasswordsCommand extends SenderProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
AppLog.log("App发给锁的数据,指令类型是:${commandType!.typeName} 加密之前数据是:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
|
||||
@ -3,6 +3,7 @@ import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../app_settings/app_settings.dart';
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
@ -53,13 +54,11 @@ class SetSupportFunctionsNoParametersCommand extends SenderProtocol {
|
||||
|
||||
// keyID 40
|
||||
int keyIDLength = utf8.encode(keyID!).length;
|
||||
// print("${commandType!.typeValue}LockIDLength:$lockIDLength utf8.encode(lockID!)${utf8.encode(lockID!)}");
|
||||
subData.addAll(utf8.encode(keyID!));
|
||||
subData = getFixedLengthList(subData, 40 - keyIDLength);
|
||||
|
||||
//userID 20
|
||||
int userIDLength = utf8.encode(userID!).length;
|
||||
// print("${commandType!.typeValue}IDLength:$authUserIDLength utf8.encode(authUserID!)${utf8.encode(authUserID!)}");
|
||||
subData.addAll(utf8.encode(userID!));
|
||||
subData = getFixedLengthList(subData, 20 - userIDLength);
|
||||
|
||||
@ -103,7 +102,7 @@ class SetSupportFunctionsNoParametersCommand extends SenderProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
AppLog.log("App发给锁的数据,指令类型是:${commandType!.typeName} 加密之前数据是:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
|
||||
@ -3,6 +3,7 @@ import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../app_settings/app_settings.dart';
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
@ -55,13 +56,11 @@ class SetSupportFunctionsWithParametersCommand extends SenderProtocol {
|
||||
|
||||
// keyID 40
|
||||
int keyIDLength = utf8.encode(keyID!).length;
|
||||
// print("${commandType!.typeValue}LockIDLength:$lockIDLength utf8.encode(lockID!)${utf8.encode(lockID!)}");
|
||||
subData.addAll(utf8.encode(keyID!));
|
||||
subData = getFixedLengthList(subData, 40 - keyIDLength);
|
||||
|
||||
//userID 20
|
||||
int userIDLength = utf8.encode(userID!).length;
|
||||
// print("${commandType!.typeValue}IDLength:$authUserIDLength utf8.encode(authUserID!)${utf8.encode(authUserID!)}");
|
||||
subData.addAll(utf8.encode(userID!));
|
||||
subData = getFixedLengthList(subData, 20 - userIDLength);
|
||||
|
||||
@ -108,7 +107,7 @@ class SetSupportFunctionsWithParametersCommand extends SenderProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
AppLog.log("App发给锁的数据,指令类型是:${commandType!.typeName} 加密之前数据是:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
import 'dart:convert';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../app_settings/app_settings.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
import '../sm4Encipher/sm4.dart';
|
||||
import '../io_reply.dart';
|
||||
@ -48,13 +49,11 @@ class TimingCommand extends SenderProtocol {
|
||||
|
||||
//userID 要接受钥匙的用户的useid 20
|
||||
int userIDLength = utf8.encode(userID!).length;
|
||||
Get.log("openDoorUserId:${utf8.encode(userID!)} utf8.encode(userID!).length:${utf8.encode(userID!).length}");
|
||||
data.addAll(utf8.encode(userID!));
|
||||
data = getFixedLengthList(data, 20 - userIDLength);
|
||||
|
||||
// nowTime 4
|
||||
int? d1 = nowTime;
|
||||
Get.log("timing d1:$d1");
|
||||
data.add((d1! & 0xff000000) >> 24);
|
||||
data.add((d1 & 0xff0000) >> 16);
|
||||
data.add((d1 & 0xff00) >> 8);
|
||||
@ -67,7 +66,7 @@ class TimingCommand extends SenderProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
AppLog.log("App发给锁的数据,指令类型是:${commandType!.typeName} 加密之前数据是:$data");
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../app_settings/app_settings.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
import '../sm4Encipher/sm4.dart';
|
||||
import '../io_reply.dart';
|
||||
@ -49,37 +50,31 @@ class TransferPermissionsCommand extends SenderProtocol {
|
||||
|
||||
// 锁id 40
|
||||
int lockIDLength = utf8.encode(lockID!).length;
|
||||
print("${commandType!.typeValue} lockID:$lockID LockIDLength:$lockIDLength utf8.encode(lockID!)${utf8.encode(lockID!)}");
|
||||
data.addAll(utf8.encode(lockID!));
|
||||
data = getFixedLengthList(data, 40 - lockIDLength);
|
||||
|
||||
//authUserID 20
|
||||
int authUserIDLength = utf8.encode(authUserID!).length;
|
||||
// print("${commandType!.typeValue}IDLength:$authUserIDLength utf8.encode(authUserID!)${utf8.encode(authUserID!)}");
|
||||
data.addAll(utf8.encode(authUserID!));
|
||||
data = getFixedLengthList(data, 20 - authUserIDLength);
|
||||
|
||||
//KeyID 40
|
||||
int keyIDLength = utf8.encode(keyID!).length;
|
||||
// print("${commandType!.typeValue}keyIDLength:$keyIDLength utf8.encode(keyID!)${utf8.encode(keyID!)}");
|
||||
data.addAll(utf8.encode(keyID!));
|
||||
data = getFixedLengthList(data, 40 - keyIDLength);
|
||||
|
||||
//oldUserID 20
|
||||
int oldUserIDLength = utf8.encode(oldUserID!).length;
|
||||
// print("${commandType!.typeValue}userIDLength:$userIDLength utf8.encode(userID!)${utf8.encode(userID!)}");
|
||||
data.addAll(utf8.encode(oldUserID!));
|
||||
data = getFixedLengthList(data, 20 - oldUserIDLength);
|
||||
|
||||
//newUserID 20
|
||||
int newUserIDLength = utf8.encode(newUserID!).length;
|
||||
// print("${commandType!.typeValue}userIDLength:$userIDLength utf8.encode(userID!)${utf8.encode(userID!)}");
|
||||
data.addAll(utf8.encode(newUserID!));
|
||||
data = getFixedLengthList(data, 20 - newUserIDLength);
|
||||
|
||||
// token 长度4 首次请求 Token 填 0,如果锁需要鉴权 操作者身份,则会分配动态口令并在应答消息中返回,二次请求时带上。 当token失效或者第一次发送的时候token为0
|
||||
data.addAll(token!);
|
||||
print("pubToken:$token");
|
||||
|
||||
if(needAuthor == 0){
|
||||
//AuthCodeLen 1
|
||||
@ -112,7 +107,7 @@ class TransferPermissionsCommand extends SenderProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
Get.log("${commandType!.typeName} SM4Data:$data");
|
||||
AppLog.log("App发给锁的数据,指令类型是:${commandType!.typeName} 加密之前数据是:$data");
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../app_settings/app_settings.dart';
|
||||
import 'io_type.dart';
|
||||
|
||||
abstract class Reply{
|
||||
@ -14,119 +15,118 @@ abstract class Reply{
|
||||
Reply.parseData(this.commandType, List<int> dataDetail);
|
||||
|
||||
void errorWithStstus(int status){
|
||||
// Get.log("errorWithStstus status:$status commandType:$commandType");
|
||||
switch(status){
|
||||
case 0x00:
|
||||
// 成功
|
||||
// Get.log("$commandType成功");
|
||||
break;
|
||||
case 0x01:
|
||||
// 包格式错误
|
||||
Get.log("${commandType!.typeName} 包格式错误");
|
||||
AppLog.log("${commandType!.typeName} 0x01 包格式错误");
|
||||
showErrorMessage("包格式错误");
|
||||
break;
|
||||
case 0x02:
|
||||
// 密码错误
|
||||
Get.log("${commandType!.typeName} 密码错误");
|
||||
AppLog.log("${commandType!.typeName} 0x02 密码错误");
|
||||
showErrorMessage("密码错误");
|
||||
break;
|
||||
case 0x03:
|
||||
// 网络中断
|
||||
Get.log("${commandType!.typeName} 网络中断");
|
||||
AppLog.log("${commandType!.typeName} 0x03 网络中断");
|
||||
showErrorMessage("网络中断");
|
||||
break;
|
||||
case 0x04:
|
||||
// 用户未登记
|
||||
Get.log("${commandType!.typeName} 用户未登记");
|
||||
AppLog.log("${commandType!.typeName} 0x04 用户未登记");
|
||||
showErrorMessage("用户未登记");
|
||||
break;
|
||||
case 0x05:
|
||||
// 参数错误
|
||||
Get.log("${commandType!.typeName}参数错误");
|
||||
AppLog.log("${commandType!.typeName} 0x05 参数错误");
|
||||
showErrorMessage("参数错误");
|
||||
break;
|
||||
case 0x06:
|
||||
// 需要鉴权
|
||||
Get.log("${commandType!.typeName}需要鉴权");
|
||||
AppLog.log("${commandType!.typeName} 0x06 需要鉴权");
|
||||
// showErrorMessage("需要鉴权");
|
||||
break;
|
||||
case 0x07:
|
||||
// 无权限
|
||||
Get.log("${commandType!.typeName}无权限");
|
||||
showErrorMessage("无权限");
|
||||
AppLog.log("${commandType!.typeName} 0x07 无权限");
|
||||
// showErrorMessage("无权限");
|
||||
break;
|
||||
case 0x08:
|
||||
// 应答超时
|
||||
Get.log("${commandType!.typeName}应答超时");
|
||||
AppLog.log("${commandType!.typeName} 0x08 应答超时");
|
||||
showErrorMessage("应答超时");
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
Get.log("${commandType!.typeName}权限校验错误");
|
||||
AppLog.log("${commandType!.typeName} 0x09 权限校验错误");
|
||||
showErrorMessage("权限校验错误");
|
||||
break;
|
||||
case 0x0a:
|
||||
// 钥匙不存在
|
||||
// showErrorMessage("钥匙不存在");
|
||||
Get.log("${commandType!.typeName}钥匙不存在");
|
||||
showErrorMessage("钥匙不存在");
|
||||
AppLog.log("${commandType!.typeName} 0x0a 钥匙不存在");
|
||||
break;
|
||||
case 0x0b:
|
||||
// 钥匙过期
|
||||
showErrorMessage("钥匙过期");
|
||||
Get.log("${commandType!.typeName}钥匙过期");
|
||||
AppLog.log("${commandType!.typeName} 0x0b 钥匙过期");
|
||||
break;
|
||||
case 0x0c:
|
||||
// 钥匙数量已到上限
|
||||
showErrorMessage("钥匙数量已到上限");
|
||||
Get.log("${commandType!.typeName}钥匙数量已到上限");
|
||||
AppLog.log("${commandType!.typeName} 0x0c 钥匙数量已到上限");
|
||||
break;
|
||||
case 0x0d:
|
||||
// 钥匙无效
|
||||
showErrorMessage("钥匙无效");
|
||||
Get.log("${commandType!.typeName}钥匙无效");
|
||||
AppLog.log("${commandType!.typeName} 0x0d 钥匙无效");
|
||||
break;
|
||||
case 0x0e:
|
||||
// 钥匙已存在
|
||||
showErrorMessage("钥匙已存在");
|
||||
Get.log("${commandType!.typeName}钥匙无效");
|
||||
AppLog.log("${commandType!.typeName} 0x0e 钥匙无效");
|
||||
break;
|
||||
case 0x0f:
|
||||
// 用户已存在
|
||||
Get.log("${commandType!.typeName}用户已存在");
|
||||
AppLog.log("${commandType!.typeName} 0x0f 用户已存在");
|
||||
showErrorMessage("用户已存在");
|
||||
break;
|
||||
case 0x10:
|
||||
// 密码失效
|
||||
Get.log("${commandType!.typeName}密码失效");
|
||||
AppLog.log("${commandType!.typeName} 0x11 密码失效");
|
||||
showErrorMessage("密码失效");
|
||||
break;
|
||||
case 0x11:
|
||||
// 无效指令
|
||||
Get.log("${commandType!.typeName}无效指令");
|
||||
AppLog.log("${commandType!.typeName} 0x11 无效指令");
|
||||
showErrorMessage("无效指令");
|
||||
break;
|
||||
case 0x12:
|
||||
// 门锁时间异常
|
||||
Get.log("${commandType!.typeName}门锁时间异常");
|
||||
AppLog.log("${commandType!.typeName} 0x12 门锁时间异常");
|
||||
showErrorMessage("门锁时间异常");
|
||||
break;
|
||||
case 0x15:
|
||||
// APP(手机)未联网
|
||||
Get.log("${commandType!.typeName}APP(手机)未联网");
|
||||
AppLog.log("${commandType!.typeName} 0x15 APP(手机)未联网");
|
||||
showErrorMessage("APP(手机)未联网");
|
||||
break;
|
||||
case 0x16:
|
||||
// 正在开锁中...
|
||||
Get.log("${commandType!.typeName}正在开锁中...");
|
||||
showErrorMessage("正在开锁中...");
|
||||
AppLog.log("${commandType!.typeName}正在开锁中...");
|
||||
// showErrorMessage("正在开锁中...");
|
||||
break;
|
||||
case 0xff:
|
||||
// 异常,未知错误
|
||||
Get.log("${commandType!.typeName} 0xff");
|
||||
AppLog.log("${commandType!.typeName} 0xff");
|
||||
showErrorMessage("异常,未知错误");
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
Get.log("蓝牙返回其他错误问题");
|
||||
AppLog.log("蓝牙返回其他错误问题");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,11 +38,9 @@ abstract class SenderProtocol extends IOData {
|
||||
|
||||
// 帧头
|
||||
commandList.addAll(header);
|
||||
// print("header:$header");
|
||||
|
||||
//包类型
|
||||
commandList.add(ask); //包类型
|
||||
// print("ask:$ask");
|
||||
|
||||
// 包序号
|
||||
int commandIndexChange = _commandIndex!;
|
||||
@ -51,17 +49,15 @@ abstract class SenderProtocol extends IOData {
|
||||
int commandIndexChang2 = commandIndexChange % 256;
|
||||
commandList.add(commandIndexChang1);
|
||||
commandList.add(commandIndexChang2);
|
||||
// print("_commandIndex:$_commandIndex commandIndexChang1$commandIndexChang1 commandIndexChang2:$commandIndexChang2");
|
||||
|
||||
// 包标识
|
||||
// 指令类型 高 4 位表示包版本,低 4 位用来指示后面数据的加密类型,长度为 1 字节,加密类型取值说明,0:明文,1:AES128,2:SM4(事先约定密钥),3:SM4(设备指定密钥)
|
||||
commandList.add(commandType!.identifierValue);
|
||||
// print("commandType!.identifierValue:${commandType!.identifierValue}");
|
||||
|
||||
// 数据长度
|
||||
int dataLen = dataSourceLength();
|
||||
// commandList.add(dataLength);
|
||||
// print("dataLen:$dataLen");
|
||||
|
||||
// var dataLen = 42;
|
||||
double dataLength = dataLen / 256;
|
||||
commandList.add(dataLength.toInt());
|
||||
@ -71,7 +67,6 @@ abstract class SenderProtocol extends IOData {
|
||||
|
||||
// 数据块
|
||||
commandList.addAll(commandData!); //数据块
|
||||
// print("commandData:$commandData");
|
||||
|
||||
// 校验位
|
||||
var mcrc = crc_16(commandList);
|
||||
|
||||
@ -59,9 +59,7 @@ List<int> getFixedLengthList(List<int> data, int length) {
|
||||
//int ---> 指定长度的hex (如指定长度为6的情况,0x000001 0x001234, 0xefab23)
|
||||
String intToFormatHex(int num, int length) {
|
||||
String hexString = num.toRadixString(16);
|
||||
// print("hexString=$hexString");
|
||||
String formatString = hexString.padLeft(length, "0");
|
||||
// print("formatHexString=$formatString");
|
||||
return formatString;
|
||||
}
|
||||
|
||||
@ -205,7 +203,6 @@ int _toUInt32(int value) {
|
||||
|
||||
bool checkListIndex(List<int> dataDetail, int index, int offsetLength) {
|
||||
if (dataDetail == null) {
|
||||
print('❌解析 dataDetail == null');
|
||||
return true;
|
||||
}
|
||||
var len = dataDetail.length;
|
||||
@ -296,7 +293,6 @@ bool compareTwoList({List<int>? list1, List<int>? list2}) {
|
||||
int v1 = list1[i];
|
||||
int v2 = list2[i];
|
||||
if (v1 != v2) {
|
||||
print('不包含 $i');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ import 'dart:convert';
|
||||
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:get/get.dart';
|
||||
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';
|
||||
@ -64,18 +65,16 @@ class CommandReciverManager {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get.log("appDataReceiveData:$data"); // &&(data[4] == 0x11)
|
||||
if ((data[0] == 0xEF) &&
|
||||
(data[1] == 0x01) &&
|
||||
(data[2] == 0xEE) &&
|
||||
(data[3] == 0x02)) {
|
||||
var tmpType = (data[7] & 0x0f); // 包标识
|
||||
// print("temType:$tmpType");
|
||||
// AppLog.log("temType:$tmpType");
|
||||
|
||||
var dataLen = data[8] * 256 + data[9]; // 高16位用来指示后面数据块内容的长度
|
||||
var oriLen = data[10] * 256 + data[11]; // 低16位用来指示数据加密前的原长度
|
||||
// print("dataLen:$dataLen oriLen:$oriLen");
|
||||
// List<int> dataList = [];
|
||||
// AppLog.log("dataLen:$dataLen oriLen:$oriLen");
|
||||
List<int> oriDataList = [];
|
||||
switch (tmpType) {
|
||||
case 0: //不加密
|
||||
@ -83,7 +82,7 @@ class CommandReciverManager {
|
||||
// oriDataList.add(data[12 + i]);
|
||||
// }
|
||||
oriDataList = data.sublist(12, 12 + dataLen);
|
||||
// print("不加密 oriDataList:$oriDataList");
|
||||
AppLog.log("不加密 :$oriDataList");
|
||||
break;
|
||||
case 1:
|
||||
//AES128
|
||||
@ -99,7 +98,7 @@ class CommandReciverManager {
|
||||
key: utf8.encode(BlueManage().connectDeviceName),
|
||||
mode: SM4CryptoMode.ECB);
|
||||
oriDataList = oriDataList.sublist(0, oriLen);
|
||||
// print("SM4 oriDataList:$oriDataList");
|
||||
AppLog.log("APP收到的解密后的数据:$oriDataList");
|
||||
break;
|
||||
case 3:
|
||||
//SM4(设备指定密钥)
|
||||
@ -108,24 +107,21 @@ class CommandReciverManager {
|
||||
|
||||
var res = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(res!);
|
||||
// print("getPrivateKeyList$getPrivateKeyList");
|
||||
|
||||
// 解密
|
||||
oriDataList = SM4.decrypt(getDataList,
|
||||
key: getPrivateKeyList, mode: SM4CryptoMode.ECB);
|
||||
oriDataList = oriDataList.sublist(0, oriLen);
|
||||
print("SM4 oriDataList:$oriDataList");
|
||||
AppLog.log("APP收到的解密后的数据:$oriDataList");
|
||||
break;
|
||||
}
|
||||
parseData(oriDataList).then((value) async {
|
||||
// Get.log("parseData222 data:$value");
|
||||
EasyLoading.dismiss();
|
||||
await EventBusManager().eventBusFir(value);
|
||||
}).catchError((error) {
|
||||
Get.log("Error occurred while parsing data: $error");
|
||||
AppLog.log("APP解析数据时发生错误: $error");
|
||||
});
|
||||
}
|
||||
// print('✅ 执行结束 _buffer:${_buffer.length}');
|
||||
}
|
||||
|
||||
static Future<Reply?> parseData(List<int> data) async {
|
||||
@ -134,7 +130,6 @@ class CommandReciverManager {
|
||||
CommandType commandType = ExtensionCommandType.getCommandType(cmd);
|
||||
await IoManager().increaseCommandIndex();
|
||||
// data.removeRange(0, 2);
|
||||
// Get.log("parseData cmd:$cmd commandType:$commandType data:$data");
|
||||
var reply;
|
||||
switch (commandType) {
|
||||
case CommandType.getLockPublicKey:
|
||||
@ -159,7 +154,6 @@ class CommandReciverManager {
|
||||
break;
|
||||
case CommandType.openLock:
|
||||
{
|
||||
// Get.log("openLockReply data:$data");
|
||||
reply = OpenDoorReply.parseData(commandType, data);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -48,13 +48,7 @@ class SenderBeforeDataManage {
|
||||
|
||||
// 添加用户
|
||||
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:
|
||||
//成功
|
||||
@ -73,7 +67,6 @@ class SenderBeforeDataManage {
|
||||
var token = reply.data.sublist(42, 46);
|
||||
List<String> strTokenList = changeIntListToStringList(token);
|
||||
Storage.setStringList(saveBlueToken, strTokenList);
|
||||
// print("token:$token");
|
||||
|
||||
// IoSenderManage.senderAddUser(
|
||||
// lockID: BlueManage().connectDeviceName,
|
||||
|
||||
@ -48,9 +48,9 @@ class CommandSenderManager {
|
||||
Future<void> managerSendData ({required SenderProtocol command, bool isBeforeAddUser = false, CommandSendCallBack? callBack}) async {
|
||||
if (callBack != null) {
|
||||
// if (!BluetoothManager().connected) {
|
||||
print('❌ 蓝牙断开了');
|
||||
AppLog.log('❌ 蓝牙断开了');
|
||||
if (callBack != null) {
|
||||
print('managerSendData ❌ callBack');
|
||||
AppLog.log('managerSendData ❌ callBack');
|
||||
// EasyLoading.dismiss();
|
||||
callBack(ErrorType.notConnected);
|
||||
}
|
||||
@ -58,7 +58,6 @@ class CommandSenderManager {
|
||||
}
|
||||
|
||||
List<int> value = command.packageData();
|
||||
// print("command.commandTyp:${command.commandType}");
|
||||
if(isBeforeAddUser == true){
|
||||
_sendNormalData(value);
|
||||
}else{
|
||||
@ -69,7 +68,6 @@ class CommandSenderManager {
|
||||
dataBeforeAddTheUser = value;
|
||||
return;
|
||||
}else{
|
||||
// print("继续发送数据了继续发送数据了继续发送数据了");
|
||||
_sendNormalData(value);
|
||||
}
|
||||
}
|
||||
@ -106,7 +104,7 @@ class CommandSenderManager {
|
||||
// AppLog.log(''''
|
||||
// ------->\n超时 第 $outTimeCount 次 重发 $commandType 指令 ''',error: true);
|
||||
// // if(commandType != CommandType.upgrade){
|
||||
// // print('重发重置帧序号');
|
||||
// // AppLog.log('重发重置帧序号');
|
||||
// // bufferList.replaceRange(1, 2, [IoManager().commandIndex]);
|
||||
// // }
|
||||
// _sendNormalData(bufferList);
|
||||
|
||||
@ -413,7 +413,7 @@ class SM4 {
|
||||
} else {
|
||||
// final lastByte = input.last;
|
||||
// final cutLen = input.length - lastByte;
|
||||
// print("object input.length:${input.length} lastByte:$lastByte input:$input cutLen:$cutLen");
|
||||
// AppLog.log("object input.length:${input.length} lastByte:$lastByte input:$input cutLen:$cutLen");
|
||||
// return input.sublist(0, cutLen);
|
||||
return input;
|
||||
}
|
||||
|
||||
@ -50,7 +50,6 @@ class _SafetyVerificationPageState extends State<SafetyVerificationPage> with Ti
|
||||
sliderMoveFinish = false;
|
||||
checkResultAfterDrag = false;
|
||||
});
|
||||
// print("countryCode:${state.getData["countryCode"]} getAccount:${state.getData["getAccount"]}");
|
||||
|
||||
var entity = await ApiRepository.to.getSliderVerifyImg(state.getData["countryCode"].toString(), state.getData["account"].toString());
|
||||
if(entity.errorCode! == 0){
|
||||
@ -338,23 +337,19 @@ class _SafetyVerificationPageState extends State<SafetyVerificationPage> with Ti
|
||||
onPanStart: (startDetails) {
|
||||
///开始
|
||||
_checkMilliseconds = DateTime.now().millisecondsSinceEpoch;
|
||||
// print(startDetails.localPosition);
|
||||
sliderStartX = startDetails.localPosition.dx;
|
||||
},
|
||||
onPanUpdate: (updateDetails) {
|
||||
///更新
|
||||
// print(updateDetails.localPosition);
|
||||
double offset = updateDetails.localPosition.dx - sliderStartX;
|
||||
if(offset < 0){
|
||||
offset = 0;
|
||||
}
|
||||
// print("offset ------ $offset");
|
||||
setState(() {
|
||||
state.sliderXMoved.value = offset;
|
||||
});
|
||||
},
|
||||
onPanEnd: (endDetails) { //结束
|
||||
// print("endDetails sliderXMoved:${state.sliderXMoved.value}");
|
||||
checkCaptcha(state.sliderXMoved.value);
|
||||
int nowTime = DateTime.now().millisecondsSinceEpoch;
|
||||
_checkMilliseconds = nowTime - _checkMilliseconds;
|
||||
|
||||
@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/app_settings/app_settings.dart';
|
||||
import 'package:star_lock/login/forgetPassword/starLock_forgetPassword_logic.dart';
|
||||
|
||||
import '../../appRouters.dart';
|
||||
@ -47,7 +48,7 @@ class _StarLockForgetPasswordPageState
|
||||
state.countryCode.value = result['code'];
|
||||
state.countryName.value = result['countryName'];
|
||||
}
|
||||
print("路由返回值: ${result}, countryCode:${state.countryName.value} ,state.countryName.value:${state.countryName.value}");
|
||||
// AppLog.log("路由返回值: $result, countryCode:${state.countryName.value} ,state.countryName.value:${state.countryName.value}");
|
||||
},
|
||||
child: SizedBox(
|
||||
height: 70.h,
|
||||
|
||||
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/app_settings/app_settings.dart';
|
||||
|
||||
import '../../appRouters.dart';
|
||||
import '../../app_settings/app_colors.dart';
|
||||
@ -145,7 +146,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
||||
state.countryCode.value = result['code'];
|
||||
state.countryName.value = result['countryName'];
|
||||
}
|
||||
Get.log("路由返回值: $result, countryCode:${logic.state.countryCode}");
|
||||
AppLog.log("路由返回值: $result, countryCode:${logic.state.countryCode}");
|
||||
},
|
||||
child: Obx(() => SizedBox(
|
||||
height: 70.h,
|
||||
|
||||
@ -71,9 +71,7 @@ class _SelectCountryRegionPageState extends State<SelectCountryRegionPage> {
|
||||
// show sus tag.
|
||||
SuspensionUtil.setShowSuspensionStatus(list);
|
||||
|
||||
setState(() {
|
||||
Get.log('list.length:${list.length}');
|
||||
});
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
@override
|
||||
@ -105,11 +103,9 @@ class _SelectCountryRegionPageState extends State<SelectCountryRegionPage> {
|
||||
CountryRegionModel countryModel = countriesList[i];
|
||||
if(countryModel.name!.contains(searchController.text) || countryModel.code!.contains(searchController.text)){
|
||||
searchList.add(countryModel);
|
||||
Get.log('countryModel.name:${countryModel.name} countryModel.code:${countryModel.code}');
|
||||
}
|
||||
}
|
||||
countriesList= searchList;
|
||||
Get.log('searchList.length:${searchList.length}');
|
||||
_handleList(searchList);
|
||||
}
|
||||
setState(() {});
|
||||
@ -142,7 +138,7 @@ class _SelectCountryRegionPageState extends State<SelectCountryRegionPage> {
|
||||
resultMap['code'] = model.code;
|
||||
resultMap['countryId'] = model.countryId.toString();
|
||||
resultMap['countryName'] = model.name;
|
||||
print("model.name:${model.name} model.code:${model.code} model.countryId:${model.countryId} model.flag:${model.flag} model.group:${model.group} model.tagIndex:${model.tagIndex}");
|
||||
// AppLog.log("model.name:${model.name} model.code:${model.code} model.countryId:${model.countryId} model.flag:${model.flag} model.group:${model.group} model.tagIndex:${model.tagIndex}");
|
||||
Navigator.pop(context, resultMap);
|
||||
});
|
||||
},
|
||||
|
||||
@ -50,5 +50,4 @@ Future _setCommonServices() async {
|
||||
} else {
|
||||
await Get.putAsync(() => DeviceInfoService().init());
|
||||
}
|
||||
// Get.log(PlatformInfoService.to.info.version);
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ import 'dart:async';
|
||||
|
||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/app_settings/app_settings.dart';
|
||||
import 'package:star_lock/blue/io_type.dart';
|
||||
import 'package:star_lock/tools/dateTool.dart';
|
||||
|
||||
@ -32,20 +33,16 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
||||
if (reply is TransferPermissionsReply) {
|
||||
var token = reply.data.sublist(2, 6);
|
||||
var saveStrList = changeIntListToStringList(token);
|
||||
Get.log("_replyFactoryDataResetKeyToken:$token");
|
||||
Storage.setStringList(saveBlueToken, saveStrList);
|
||||
|
||||
int status = reply.data[6];
|
||||
Get.log("status:$status");
|
||||
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
Get.log("${reply.commandType!.typeValue} 数据解析成功");
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
Get.log("${reply.commandType!.typeValue} 需要鉴权");
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList =
|
||||
changeStringListToIntList(privateKey!);
|
||||
@ -69,78 +66,9 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// if (reply is AddUserReply) {
|
||||
// _replyAddUserKey(reply);
|
||||
// }
|
||||
});
|
||||
}
|
||||
|
||||
// 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");
|
||||
//
|
||||
// // userNo = reply.data[46];
|
||||
// // print("status:$status");
|
||||
// switch (status) {
|
||||
// case 0x00:
|
||||
// //成功
|
||||
// print("添加用户数据解析成功");
|
||||
// state.isSendSuccess.value = true;
|
||||
// showToast("添加成功");
|
||||
// // bindBlueAdmin();
|
||||
// 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: await Storage.getUid(),
|
||||
// keyID: "1",
|
||||
// userID: state.addUserId.value,
|
||||
// openMode: 1,
|
||||
// keyType: (state.type.value == "1") ? 0 : 1,
|
||||
// startDate: state.effectiveDateTime.value.millisecondsSinceEpoch,
|
||||
// expireDate: state.failureDateTime.value.millisecondsSinceEpoch,
|
||||
// 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> transferPermissionsAction() async {
|
||||
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
||||
@ -154,7 +82,6 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
||||
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> getTokenList = changeStringListToIntList(token!);
|
||||
print("openDoorTokenPubToken:$getTokenList");
|
||||
|
||||
IoSenderManage.senderTransferPermissions(
|
||||
lockID: BlueManage().connectDeviceName,
|
||||
@ -170,43 +97,6 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
||||
});
|
||||
}
|
||||
|
||||
// 添加用户
|
||||
// Future<void> addUserConnectBlue(String receiveId) async {
|
||||
// // 进来之后首先连接
|
||||
// BlueManage().bludSendData(BlueManage().connectDeviceName, (DeviceConnectionState connecteState) async {
|
||||
// if (connecteState == 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);
|
||||
// }
|
||||
//
|
||||
// IoSenderManage.senderAddUser(
|
||||
// lockID: BlueManage().connectDeviceName,
|
||||
// authUserID: await Storage.getUid(),
|
||||
// keyID: "1",
|
||||
// userID: receiveId,
|
||||
// openMode: 1,
|
||||
// keyType: (state.type.value == "1") ? 0 : 1,
|
||||
// startDate: state.effectiveDateTime.value.millisecondsSinceEpoch,
|
||||
// expireDate: state.failureDateTime.value.millisecondsSinceEpoch,
|
||||
// role: 0,
|
||||
// password: "123456",
|
||||
// needAuthor: 1,
|
||||
// publicKey: publicKeyDataList,
|
||||
// privateKey: getPrivateKeyList,
|
||||
// token: getTokenList);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
//发送授权管理员列表请求
|
||||
Future<void> sendElectronicKeyRequest() async {
|
||||
if (state.emailOrPhoneController.text.isEmpty) {
|
||||
@ -222,7 +112,7 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
||||
var endDate = "0";
|
||||
var startTime = "0";
|
||||
var endTime = "0";
|
||||
Get.log("state.type.value:${state.seletType.value}");
|
||||
AppLog.log("state.type.value:${state.seletType.value}");
|
||||
String getKeyType = "1";
|
||||
if (state.seletType.value == 0) {
|
||||
getKeyType = "2";
|
||||
@ -268,7 +158,6 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
||||
endTime: int.parse(endTime),
|
||||
isOnlyManageSelf: state.onlyManageYouCreatesUser.value ? 1 : 0);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
Get.log('发送电子钥匙成功');
|
||||
state.isCreateUser.value = false;
|
||||
state.isSendSuccess.value = true;
|
||||
// Toast.show(msg: "添加成功");
|
||||
|
||||
@ -345,7 +345,6 @@ class _VolumeAuthorizationLockPageState
|
||||
usernameType:'1',
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print('发送电子钥匙成功');
|
||||
_isSendSuccess = true;
|
||||
setState(() {});
|
||||
} else {
|
||||
|
||||
@ -18,14 +18,12 @@ class AddCardTypeLogic extends BaseGetXController{
|
||||
var startTime = "";
|
||||
var endTime = "";
|
||||
if (state.selectType.value == "0") {
|
||||
print("永久卡永久卡永久卡");
|
||||
carType = 1;
|
||||
startDate = "0";
|
||||
endDate = "0";
|
||||
startTime = "0";
|
||||
endTime = "0";
|
||||
} else if (state.selectType.value == "1") {
|
||||
print("限时卡限时卡限时卡");
|
||||
carType = 2;
|
||||
startDate = DateTool().dateToTimestamp(state.timeLimitBeginTime.value, 1).toString();
|
||||
endDate = DateTool().dateToTimestamp(state.timeLimitEndTime.value, 1).toString();
|
||||
@ -51,7 +49,6 @@ class AddCardTypeLogic extends BaseGetXController{
|
||||
return;
|
||||
}
|
||||
} else if (state.selectType.value == "2") {
|
||||
print("循环卡循环卡循环卡");
|
||||
if (state.cycleBeginTime.value.isEmpty) {
|
||||
showToast("请选择有效期".tr);
|
||||
return;
|
||||
|
||||
@ -274,7 +274,6 @@ class _AddCardPageState extends State<AddCardPage> with SingleTickerProviderStat
|
||||
onClick: () async {
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if (isDemoMode == false) {
|
||||
// print("state.selectType:${state.selectType.value}");
|
||||
if (state.nameController.text.isEmpty) {
|
||||
logic.showToast("请输入姓名".tr);
|
||||
return;
|
||||
|
||||
@ -3,6 +3,7 @@ import 'dart:async';
|
||||
|
||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/app_settings/app_settings.dart';
|
||||
import 'package:star_lock/blue/io_type.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
|
||||
@ -64,16 +65,6 @@ class AddICCardLogic extends BaseGetXController{
|
||||
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||
|
||||
// var weekStr = "00000000";
|
||||
// for (var day in state.weekDay.value) {
|
||||
// int index = day % 7; // 将周日的索引转换为 0
|
||||
// weekStr = '${weekStr.substring(0, index)}1${weekStr.substring(index + 1)}';
|
||||
// }
|
||||
// // 倒序 weekStr
|
||||
// weekStr = weekStr.split('').reversed.join('');
|
||||
// int weekRound = int.parse(weekStr, radix: 2);
|
||||
// print("weekStrweekStrweekStr:$weekStr weekRound:$weekRound");
|
||||
|
||||
var token = reply.data.sublist(5, 9);
|
||||
var saveStrList = changeIntListToStringList(token);
|
||||
Storage.setStringList(saveBlueToken, saveStrList);
|
||||
@ -98,14 +89,12 @@ class AddICCardLogic extends BaseGetXController{
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
Get.log("${reply.commandType!.typeValue} 失败");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _replyAddICCardConfirmation(Reply reply) async {
|
||||
int status = reply.data[2];
|
||||
Get.log("_replyAddCardtatus:$status");
|
||||
|
||||
switch(status){
|
||||
case 0x00:
|
||||
@ -132,7 +121,6 @@ class AddICCardLogic extends BaseGetXController{
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
Get.log("${reply.commandType!.typeValue} 失败");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -143,7 +131,7 @@ class AddICCardLogic extends BaseGetXController{
|
||||
// switch(status){
|
||||
// case 0x00:
|
||||
// //成功
|
||||
// Get.log("${reply.commandType!.typeValue} 数据解析成功");
|
||||
// AppLog.log("${reply.commandType!.typeValue} 数据解析成功");
|
||||
// addICCardData();
|
||||
// break;
|
||||
// case 0x06:
|
||||
@ -161,7 +149,7 @@ class AddICCardLogic extends BaseGetXController{
|
||||
// var saveStrList = changeIntListToStringList(token);
|
||||
// Storage.setStringList(saveBlueToken, saveStrList);
|
||||
//
|
||||
// Get.log("state.isAdministrator.value:${state.isAdministrator.value}");
|
||||
// AppLog.log("state.isAdministrator.value:${state.isAdministrator.value}");
|
||||
// IoSenderManage.senderAddStressICCardCommand(
|
||||
// keyID:"1",
|
||||
// userID:await Storage.getUid(),
|
||||
@ -179,17 +167,17 @@ class AddICCardLogic extends BaseGetXController{
|
||||
// break;
|
||||
// case 0x07:
|
||||
// //无权限
|
||||
// Get.log("${reply.commandType!.typeValue} 用户无权限");
|
||||
// AppLog.log("${reply.commandType!.typeValue} 用户无权限");
|
||||
//
|
||||
// break;
|
||||
// case 0x09:
|
||||
// // 权限校验错误
|
||||
// Get.log("${reply.commandType!.typeValue} 权限校验错误");
|
||||
// AppLog.log("${reply.commandType!.typeValue} 权限校验错误");
|
||||
//
|
||||
// break;
|
||||
// default:
|
||||
// //失败
|
||||
// Get.log("${reply.commandType!.typeValue} 失败");
|
||||
// AppLog.log("${reply.commandType!.typeValue} 失败");
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
@ -205,17 +193,6 @@ class AddICCardLogic extends BaseGetXController{
|
||||
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||
|
||||
// var weekStr = "00000000";
|
||||
// print("state.weekDay.value:${state.weekDay.value}");
|
||||
// for (var day in state.weekDay.value) {
|
||||
// int index = day % 7; // 将周日的索引转换为 0
|
||||
// weekStr = '${weekStr.substring(0, index)}1${weekStr.substring(index + 1)}';
|
||||
// }
|
||||
// // 倒序 weekStr
|
||||
// weekStr = weekStr.split('').reversed.join('');
|
||||
// int weekRound = int.parse(weekStr, radix: 2);
|
||||
// // print("weekStrweekStrweekStr:$weekStr weekRound:$weekRound");
|
||||
|
||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||
|
||||
@ -225,7 +202,6 @@ class AddICCardLogic extends BaseGetXController{
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> getTokenList = changeStringListToIntList(token!);
|
||||
|
||||
Get.log("state.isAdministrator.value:${state.isAdministrator.value}");
|
||||
IoSenderManage.senderAddCardWithTimeCycleCoercionCommand(
|
||||
keyID:"1",
|
||||
userID:await Storage.getUid(),
|
||||
|
||||
@ -91,7 +91,6 @@ class _AddICCardPageState extends State<AddICCardPage> with RouteAware {
|
||||
@override
|
||||
void didPush() {
|
||||
super.didPush();
|
||||
print("lockSet===didPush");
|
||||
state.ifCurrentScreen.value = true;
|
||||
}
|
||||
|
||||
@ -99,7 +98,6 @@ class _AddICCardPageState extends State<AddICCardPage> with RouteAware {
|
||||
@override
|
||||
void didPop() {
|
||||
super.didPop();
|
||||
print("lockSet===didPop");
|
||||
logic.cancelBlueConnetctToastTimer();
|
||||
state.ifCurrentScreen.value = false;
|
||||
}
|
||||
@ -108,7 +106,6 @@ class _AddICCardPageState extends State<AddICCardPage> with RouteAware {
|
||||
@override
|
||||
void didPopNext() {
|
||||
super.didPopNext();
|
||||
print("lockSet===didPopNext");
|
||||
state.ifCurrentScreen.value = true;
|
||||
}
|
||||
|
||||
@ -116,10 +113,8 @@ class _AddICCardPageState extends State<AddICCardPage> with RouteAware {
|
||||
@override
|
||||
void didPushNext() {
|
||||
super.didPushNext();
|
||||
print("lockSet===didPushNext");
|
||||
logic.cancelBlueConnetctToastTimer();
|
||||
|
||||
|
||||
state.ifCurrentScreen.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,7 +31,6 @@ class AddICCardState{
|
||||
cardType.value = map["cardType"];
|
||||
isCoerced.value = map["isCoerced"];
|
||||
isAdministrator.value = map["isAdministrator"];
|
||||
print("isAdministrator.value isAdministrator.value:${isAdministrator.value}");
|
||||
startDate.value = map["startDate"];
|
||||
weekDay.value = map["weekDay"];
|
||||
fromType.value = map["fromType"];
|
||||
|
||||
@ -39,7 +39,6 @@ class CardDetailLogic extends BaseGetXController{
|
||||
switch(status){
|
||||
case 0x00:
|
||||
//成功
|
||||
Get.log("${reply.commandType!.typeValue} 数据解析成功");
|
||||
cancelBlueConnetctToastTimer();
|
||||
dismissEasyLoading();
|
||||
if(state.isDeletCard.value == true){
|
||||
@ -50,7 +49,6 @@ class CardDetailLogic extends BaseGetXController{
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
Get.log("${reply.commandType!.typeValue} 需要鉴权");
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
@ -84,7 +82,6 @@ class CardDetailLogic extends BaseGetXController{
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
Get.log("${reply.commandType!.typeValue} 失败");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -231,7 +231,6 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
||||
@override
|
||||
void didPush() {
|
||||
super.didPush();
|
||||
print("lockSet===didPush");
|
||||
state.ifCurrentScreen.value = true;
|
||||
}
|
||||
|
||||
|
||||
@ -50,14 +50,12 @@ class CardListLogic extends BaseGetXController {
|
||||
switch(status){
|
||||
case 0x00:
|
||||
//成功
|
||||
Get.log("${reply.commandType!.typeValue} 数据解析成功");
|
||||
state.isDeletCardData = false;
|
||||
cancelBlueConnetctToastTimer();
|
||||
deletICCardData();
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
Get.log("${reply.commandType!.typeValue} 需要鉴权");
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
@ -91,7 +89,6 @@ class CardListLogic extends BaseGetXController {
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
Get.log("${reply.commandType!.typeValue} 失败");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -102,24 +99,13 @@ class CardListLogic extends BaseGetXController {
|
||||
switch(status){
|
||||
case 0x00:
|
||||
//成功
|
||||
Get.log("${reply.commandType}数据解析成功");
|
||||
// _getLockStatus();
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
Get.log("${reply.commandType}需要鉴权");
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
Get.log("${reply.commandType}用户无权限");
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
Get.log("${reply.commandType}权限校验错误");
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
Get.log("${reply.commandType}失败");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -130,11 +116,9 @@ class CardListLogic extends BaseGetXController {
|
||||
|
||||
// 用户数量
|
||||
int userNum = reply.data[5];
|
||||
// print("userNum:$userNum");
|
||||
|
||||
// 指纹数量
|
||||
int fingerNum = reply.data[6];
|
||||
// print("fingerNum:$fingerNum");
|
||||
|
||||
// 密码数量
|
||||
int pwdNum = reply.data[7];
|
||||
@ -168,21 +152,17 @@ class CardListLogic extends BaseGetXController {
|
||||
|
||||
// 序列号
|
||||
var serialNo = reply.data.sublist(17, 21);
|
||||
Get.log("serialNo:$serialNo");
|
||||
|
||||
switch(status){
|
||||
case 0x00:
|
||||
//成功
|
||||
Get.log("${reply.commandType}数据解析成功");
|
||||
// _getLockStatus();
|
||||
break;
|
||||
case 0x06:
|
||||
//需要鉴权
|
||||
Get.log("${reply.commandType}需要鉴权");
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
Get.log("${reply.commandType}失败");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -365,7 +345,6 @@ class CardListLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
String getKeyType(FingerprintItemData fingerprintItemData){
|
||||
// fingerprintStatus 1:正常 2:失效
|
||||
var keyTypeStr = "";//
|
||||
if(fingerprintItemData.cardStatus == 1){
|
||||
if(fingerprintItemData.startDate! > DateTime.now().millisecondsSinceEpoch){
|
||||
@ -394,7 +373,6 @@ class CardListLogic extends BaseGetXController {
|
||||
Future<void> onReady() async {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
Get.log("onReady()");
|
||||
|
||||
// 获取是否是演示模式 演示模式不获取接口
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
@ -409,7 +387,6 @@ class CardListLogic extends BaseGetXController {
|
||||
Future<void> onInit() async {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
Get.log("onInit()");
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@ -49,7 +49,6 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Get.log("DateTime.now().timeZoneName:${DateTime.now().timeZoneName} timeZoneOffset:${DateTime.now().timeZoneOffset}");
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
@ -323,7 +322,6 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
||||
@override
|
||||
void didPush() {
|
||||
super.didPush();
|
||||
print("lockSet===didPush");
|
||||
state.ifCurrentScreen.value = true;
|
||||
}
|
||||
|
||||
|
||||
@ -46,12 +46,10 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
||||
// 添加人脸开始
|
||||
Future<void> _replyAddFaceBegin(Reply reply) async {
|
||||
int status = reply.data[2];
|
||||
print("status:$status");
|
||||
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
Get.log("${reply.commandType!.typeValue} 删除人脸数据解析成功");
|
||||
state.sureBtnState.value = 0;
|
||||
cancelBlueConnetctToastTimer();
|
||||
dismissEasyLoading();
|
||||
@ -152,14 +150,12 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
||||
switch(status){
|
||||
case 0x00:
|
||||
//成功
|
||||
Get.log("${reply.commandType!.typeValue} 数据解析成功");
|
||||
cancelBlueConnetctToastTimer();
|
||||
dismissEasyLoading();
|
||||
editICCardData();
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
Get.log("${reply.commandType!.typeValue} 需要鉴权");
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
@ -190,7 +186,6 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
Get.log("${reply.commandType!.typeValue} 失败");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -201,7 +196,6 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
||||
switch(status){
|
||||
case 0x00:
|
||||
//成功
|
||||
Get.log("${reply.commandType!.typeValue} 数据解析成功");
|
||||
state.sureBtnState.value = 0;
|
||||
cancelBlueConnetctToastTimer();
|
||||
dismissEasyLoading();
|
||||
@ -209,7 +203,6 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
Get.log("${reply.commandType!.typeValue} 需要鉴权");
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
@ -240,7 +233,6 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
Get.log("${reply.commandType!.typeValue} 失败");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -136,7 +136,6 @@ class _OtherTypeKeyChangeDatePageState extends State<OtherTypeKeyChangeDatePage>
|
||||
@override
|
||||
void didPush() {
|
||||
super.didPush();
|
||||
print("lockSet===didPush");
|
||||
state.ifCurrentScreen.value = true;
|
||||
}
|
||||
|
||||
@ -144,7 +143,6 @@ class _OtherTypeKeyChangeDatePageState extends State<OtherTypeKeyChangeDatePage>
|
||||
@override
|
||||
void didPop() {
|
||||
super.didPop();
|
||||
print("lockSet===didPop");
|
||||
logic.cancelBlueConnetctToastTimer();
|
||||
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
|
||||
state.ifCurrentScreen.value = false;
|
||||
@ -155,7 +153,6 @@ class _OtherTypeKeyChangeDatePageState extends State<OtherTypeKeyChangeDatePage>
|
||||
@override
|
||||
void didPopNext() {
|
||||
super.didPopNext();
|
||||
print("lockSet===didPopNext");
|
||||
state.ifCurrentScreen.value = true;
|
||||
}
|
||||
|
||||
@ -163,7 +160,6 @@ class _OtherTypeKeyChangeDatePageState extends State<OtherTypeKeyChangeDatePage>
|
||||
@override
|
||||
void didPushNext() {
|
||||
super.didPushNext();
|
||||
print("lockSet===didPushNext");
|
||||
logic.cancelBlueConnetctToastTimer();
|
||||
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
|
||||
state.ifCurrentScreen.value = false;
|
||||
|
||||
@ -48,12 +48,10 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
|
||||
// 添加人脸开始
|
||||
Future<void> _replyAddFaceBegin(Reply reply) async {
|
||||
int status = reply.data[2];
|
||||
print("status:$status");
|
||||
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
Get.log("${reply.commandType!.typeValue} 删除人脸数据解析成功");
|
||||
state.sureBtnState.value = 0;
|
||||
cancelBlueConnetctToastTimer();
|
||||
dismissEasyLoading();
|
||||
@ -154,14 +152,12 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
|
||||
switch(status){
|
||||
case 0x00:
|
||||
//成功
|
||||
Get.log("${reply.commandType!.typeValue} 数据解析成功");
|
||||
cancelBlueConnetctToastTimer();
|
||||
dismissEasyLoading();
|
||||
editICCardData();
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
Get.log("${reply.commandType!.typeValue} 需要鉴权");
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
@ -192,7 +188,6 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
Get.log("${reply.commandType!.typeValue} 失败");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -203,7 +198,6 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
|
||||
switch(status){
|
||||
case 0x00:
|
||||
//成功
|
||||
Get.log("${reply.commandType!.typeValue} 数据解析成功");
|
||||
state.sureBtnState.value = 0;
|
||||
cancelBlueConnetctToastTimer();
|
||||
dismissEasyLoading();
|
||||
@ -211,7 +205,6 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
Get.log("${reply.commandType!.typeValue} 需要鉴权");
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
@ -242,7 +235,6 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
Get.log("${reply.commandType!.typeValue} 失败");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,7 +30,6 @@ class CheckingInDetailLogic extends BaseGetXController{
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
print("onReady()");
|
||||
|
||||
// getCheckInDetailData();
|
||||
}
|
||||
@ -39,7 +38,6 @@ class CheckingInDetailLogic extends BaseGetXController{
|
||||
void onInit() {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
print("onInit()");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -46,22 +46,17 @@ class _CheckingInDetailPageState extends State<CheckingInDetailPage> {
|
||||
|
||||
//加载月历事件,请求接口
|
||||
_loadAttendanceMonthRecord(String dateTime) async {
|
||||
// print("_datas.length:${_datas.length} state.monthListData:${state.monthListData.length}");
|
||||
// 显示的上个月的天数
|
||||
var placeholderDays = _getPlaceholderDays(year: _year, month: _month);
|
||||
// 当月多少天
|
||||
var currentMonthDays = _getCurrentMonthDays(year: _year, month: _month);
|
||||
|
||||
// var changeList = _datas.sublist(placeholderDays, placeholderDays + currentMonthDays);
|
||||
// print("_datas.length:${_datas.length} placeholderDays:$placeholderDays currentMonthDays:$currentMonthDays");
|
||||
setState(() {
|
||||
// 因为_datas这个月上个月都包含的都有 遍历把本月的赋值
|
||||
for (int i = 0; i < _datas.length; i++) {
|
||||
// 因为i从0开始 所以i>=上个月的天数 且小于上个月跟本月天数之和
|
||||
if((i >= placeholderDays) && (i < (placeholderDays + currentMonthDays))){
|
||||
// print("i:$i placeholderDays:$placeholderDays currentMonthDays:$currentMonthDays state.monthListData.length:${state.monthListData.length}");
|
||||
_datas[i].workType = state.monthListData[i-placeholderDays].colorType.toString();
|
||||
// print("_datas[i].workType:${_datas[i].workType} i:$i");
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -70,9 +65,7 @@ class _CheckingInDetailPageState extends State<CheckingInDetailPage> {
|
||||
//加载日事件,请求接口
|
||||
_loadAttendanceDayRecord(String dateTime) async {
|
||||
//可根据接口返回的内容在日历下面打卡信息或者其余内容
|
||||
print("点击的是$dateTime");
|
||||
state.checkDate.value = DateTime.parse(dateTime).millisecondsSinceEpoch;
|
||||
print("点击的是$dateTime state.checkDate.value:${state.checkDate.value}");
|
||||
logic.getCheckInDetailData((){
|
||||
//设置模拟数据,日历月事件,可根据接口返回的结果
|
||||
_loadAttendanceMonthRecord("$_year-$_month");
|
||||
@ -209,7 +202,6 @@ class _CheckingInDetailPageState extends State<CheckingInDetailPage> {
|
||||
//子组件宽高长度比例
|
||||
childAspectRatio: 1),
|
||||
itemBuilder: (context, index) {
|
||||
// print("_datas[index].workType:${_datas[index].workType}");
|
||||
Color backColor = Colors.white;
|
||||
// Color textColor = const Color(0xFFFFFFFF);
|
||||
if(_datas[index].workType == "1"){
|
||||
|
||||
@ -31,7 +31,6 @@ class CheckingInAddHolidaysLogic extends BaseGetXController{
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
print("onReady()");
|
||||
|
||||
}
|
||||
|
||||
@ -39,7 +38,6 @@ class CheckingInAddHolidaysLogic extends BaseGetXController{
|
||||
void onInit() {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
print("onInit()");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -23,7 +23,6 @@ class CheckingInSetHolidaysLogic extends BaseGetXController{
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
print("onReady()");
|
||||
|
||||
editStaffLoadData();
|
||||
}
|
||||
@ -32,7 +31,6 @@ class CheckingInSetHolidaysLogic extends BaseGetXController{
|
||||
void onInit() {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
print("onInit()");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -255,7 +255,6 @@ class _CheckingInSetHolidaysPageState extends State<CheckingInSetHolidaysPage> {
|
||||
onConfirm: (p) {
|
||||
state.selectYear.value = p.year!;
|
||||
logic.editStaffLoadData();
|
||||
print("longer >>> 返回数据:${p.year}");
|
||||
},
|
||||
);
|
||||
}
|
||||
@ -303,7 +302,6 @@ class _CheckingInSetHolidaysPageState extends State<CheckingInSetHolidaysPage> {
|
||||
colorType = const Color(0xFF333333);
|
||||
break;
|
||||
}
|
||||
// print("colorType:$colorType");
|
||||
return colorType;
|
||||
}
|
||||
}
|
||||
|
||||
@ -115,7 +115,6 @@ class CheckingInListLogic extends BaseGetXController{
|
||||
Future<void> onReady() async {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
print("onReady()");
|
||||
|
||||
// 获取是否是演示模式 演示模式不获取接口
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
@ -130,7 +129,6 @@ class CheckingInListLogic extends BaseGetXController{
|
||||
void onInit() {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
print("onInit()");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -85,7 +85,6 @@ class CheckingInSetLogic extends BaseGetXController{
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
print("onReady()");
|
||||
|
||||
_initLoadDataAction();
|
||||
openCheckingInData();
|
||||
@ -95,7 +94,6 @@ class CheckingInSetLogic extends BaseGetXController{
|
||||
void onInit() {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
print("onInit()");
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@ -95,7 +95,6 @@ class _CheckingInSetPageState extends State<CheckingInSetPage> {
|
||||
"checkingInSetInfo": state.checkingInSetInfo.value,
|
||||
});
|
||||
if(data != null) {
|
||||
Get.log("data: $data");
|
||||
state.isCustom.value = data["attendanceType"];
|
||||
state.weekDays.value = data["weekDays"];
|
||||
state.weekDaysStr.value = state.weekDays.value.join(",");
|
||||
|
||||
@ -125,7 +125,6 @@ class _CheckingInSetWorkTimePageState extends State<CheckingInSetWorkTimePage> {
|
||||
// //获取当前时间的秒
|
||||
// int millisecond = now.millisecond;
|
||||
|
||||
// print("组合 $year-$month-$day $hour:$minute:$millisecond");
|
||||
return dateSlug;
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,7 +34,6 @@ class CheckingInSetWorkdaySetLogic extends BaseGetXController{
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
print("onReady()");
|
||||
|
||||
Map map = Get.arguments;
|
||||
state.pushType.value = map["pushType"];
|
||||
@ -59,7 +58,6 @@ class CheckingInSetWorkdaySetLogic extends BaseGetXController{
|
||||
void onInit() {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
print("onInit()");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -26,7 +26,6 @@ class CheckingInSetWorkdaySetState{
|
||||
|
||||
weekDays.value = checkingInSetInfo.value.workDay!;
|
||||
isCustom.value = (checkingInSetInfo.value.attendanceType! == 0) ? true : false;
|
||||
Get.log("weekDays: $weekDays checkingInSetInfo.value.workDay!: ${checkingInSetInfo.value.workDay!} checkingInSetInfo.value.attendanceType!: ${checkingInSetInfo.value.attendanceType!}");
|
||||
if(isCustom.value == false){
|
||||
if(checkingInSetInfo.value.workDay!.length == 5){
|
||||
isSingledayWeekend.value = 1;
|
||||
|
||||
@ -19,7 +19,6 @@ class CheckingInAddStaffLogic extends BaseGetXController{
|
||||
_getNumberEvent = eventBus.on<ChickInAddStaffCardAndFingerprintBlockNumberEvent>().listen((event) {
|
||||
state.attendanceWayNumber.value = event.number;
|
||||
isCanClickAction();
|
||||
// print("event.number = ${event.number} state.getDataPassword.value = ${state.attendanceWayNumber.value}");
|
||||
});
|
||||
}
|
||||
|
||||
@ -106,7 +105,6 @@ class CheckingInAddStaffLogic extends BaseGetXController{
|
||||
isCoerced: 1);
|
||||
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
// print('获取密码成功');
|
||||
if (entity.data != null) {
|
||||
state.attendanceWayNumber.value = entity.data!.keyboardPwd!;
|
||||
isCanClickAction();
|
||||
@ -134,14 +132,12 @@ class CheckingInAddStaffLogic extends BaseGetXController{
|
||||
}else{
|
||||
state.isCanClick.value = state.staffNameIsNotEmpty && state.attendanceWayNumberIsNotEmpty;
|
||||
}
|
||||
// print("state.isCanClick.value = ${state.isCanClick.value}");
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
print("onReady()");
|
||||
_initLoadDataAction();
|
||||
|
||||
changeInput(state.staffNameController);
|
||||
@ -151,7 +147,6 @@ class CheckingInAddStaffLogic extends BaseGetXController{
|
||||
void onInit() {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
print("onInit()");
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@ -308,7 +308,6 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
||||
state.attendanceWayNumber.value = numberList[index].toString();
|
||||
}
|
||||
logic.isCanClickAction();
|
||||
// print("object:$index str:$str type:$showBottomSheetToolType state.selectPrintingMethodType.value:${state.selectPrintingMethodType.value}");
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@ -43,7 +43,6 @@ class CheckingInStaffManageLogic extends BaseGetXController{
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
print("onReady()");
|
||||
|
||||
getStaffList();
|
||||
|
||||
@ -54,7 +53,6 @@ class CheckingInStaffManageLogic extends BaseGetXController{
|
||||
void onInit() {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
print("onInit()");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -14,7 +14,6 @@ class CheckingInStaffManageState{
|
||||
Map map = Get.arguments;
|
||||
getKeyInfosData.value = map["getKeyInfosData"];
|
||||
companyId.value = map["companyId"];
|
||||
// print("companyId.value:${companyId.value}");
|
||||
}
|
||||
|
||||
}
|
||||
@ -4,6 +4,7 @@ import 'dart:convert';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:star_lock/app_settings/app_settings.dart';
|
||||
// import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
||||
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_entity.dart';
|
||||
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_state.dart';
|
||||
@ -45,28 +46,18 @@ class DoorLockLogLogic extends BaseGetXController {
|
||||
// switch(status){
|
||||
// case 0x00:
|
||||
// //成功
|
||||
// print("${reply.commandType}数据解析成功");
|
||||
// // _getLockStatus();
|
||||
// break;
|
||||
// case 0x06:
|
||||
// //无权限
|
||||
// print("${reply.commandType}需要鉴权");
|
||||
//
|
||||
// break;
|
||||
// case 0x07:
|
||||
// //无权限
|
||||
// print("${reply.commandType}用户无权限");
|
||||
//
|
||||
// break;
|
||||
// case 0x09:
|
||||
// // 权限校验错误
|
||||
// print("${reply.commandType}权限校验错误");
|
||||
//
|
||||
// break;
|
||||
// default:
|
||||
// //失败
|
||||
// print("${reply.commandType}失败");
|
||||
//
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
@ -77,16 +68,15 @@ class DoorLockLogLogic extends BaseGetXController {
|
||||
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");
|
||||
// AppLog.log("getList:$getList");
|
||||
var uploadList = [];
|
||||
for (int i = 0; i < getList.length; i++) {
|
||||
var indexList = getList[i];
|
||||
// print("indexList:$indexList");
|
||||
// AppLog.log("indexList:$indexList");
|
||||
var indexMap = {};
|
||||
indexMap["seq"] = indexList[0].toString();
|
||||
indexMap["user"] = indexList[3].toString();
|
||||
@ -99,34 +89,19 @@ class DoorLockLogLogic extends BaseGetXController {
|
||||
(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;
|
||||
}
|
||||
}
|
||||
@ -258,7 +233,6 @@ class DoorLockLogLogic extends BaseGetXController {
|
||||
Future<void> onReady() async {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
print("onReady()");
|
||||
|
||||
// 获取是否是演示模式 演示模式不获取接口
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
|
||||
@ -223,7 +223,6 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
@ -236,6 +235,5 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
super.onClose();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,7 +23,6 @@ class ElectronicKeyDetailChangeDateState {
|
||||
Map map = Get.arguments;
|
||||
if ((map["itemData"] != null)) {
|
||||
itemData.value = map["itemData"];
|
||||
Get.log("itemData.value.keyId:${itemData.value.keyId}");
|
||||
if(map["pushType"] != null){
|
||||
pushType.value = map["pushType"];
|
||||
}
|
||||
@ -44,7 +43,6 @@ class ElectronicKeyDetailChangeDateState {
|
||||
|
||||
if ((map["expireLockItem"] != null)) {
|
||||
expireLockItem.value = map["expireLockItem"];
|
||||
Get.log("itemData.value.keyId:${expireLockItem.value.keyId}");
|
||||
|
||||
keyId.value = expireLockItem.value.keyId!;
|
||||
lockId.value = expireLockItem.value.lockId!;
|
||||
|
||||
@ -47,7 +47,6 @@ class ElectronicKeyPeriodValidityState {
|
||||
|
||||
if ((map["expireLockItem"] != null)) {
|
||||
expireLockItem.value = map["expireLockItem"];
|
||||
Get.log("itemData.value.keyId:${expireLockItem.value.keyId}");
|
||||
|
||||
keyId.value = expireLockItem.value.keyId!;
|
||||
lockId.value = expireLockItem.value.lockId!;
|
||||
|
||||
@ -3,6 +3,7 @@ import 'dart:async';
|
||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/app_settings/app_settings.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_state.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
@ -41,28 +42,14 @@ class KeyOperationRecordLogic extends BaseGetXController {
|
||||
// switch(status){
|
||||
// case 0x00:
|
||||
// //成功
|
||||
// print("${reply.commandType}数据解析成功");
|
||||
// // _getLockStatus();
|
||||
// break;
|
||||
// case 0x06:
|
||||
// //无权限
|
||||
// print("${reply.commandType}需要鉴权");
|
||||
//
|
||||
// break;
|
||||
// case 0x07:
|
||||
// //无权限
|
||||
// print("${reply.commandType}用户无权限");
|
||||
//
|
||||
// break;
|
||||
// case 0x09:
|
||||
// // 权限校验错误
|
||||
// print("${reply.commandType}权限校验错误");
|
||||
//
|
||||
// break;
|
||||
// default:
|
||||
// //失败
|
||||
// print("${reply.commandType}失败");
|
||||
//
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
@ -73,16 +60,15 @@ class KeyOperationRecordLogic extends BaseGetXController {
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
Get.log("${reply.commandType}数据解析成功");
|
||||
if (reply.data[5] > 0) {
|
||||
reply.data.removeRange(0, 6);
|
||||
// 把得到的数据按8位分割成数组 然后塞进一个新的数组里面
|
||||
var getList = splitList(reply.data, 8);
|
||||
// print("getList:$getList");
|
||||
// AppLog.log("getList:$getList");
|
||||
var uploadList = [];
|
||||
for (int i = 0; i < getList.length; i++) {
|
||||
var indexList = getList[i];
|
||||
// print("indexList:$indexList");
|
||||
// AppLog.log("indexList:$indexList");
|
||||
var indexMap = {};
|
||||
indexMap["seq"] = indexList[0].toString();
|
||||
indexMap["user"] = indexList[3].toString();
|
||||
@ -95,18 +81,15 @@ class KeyOperationRecordLogic extends BaseGetXController {
|
||||
(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;
|
||||
default:
|
||||
@ -188,7 +171,6 @@ class KeyOperationRecordLogic extends BaseGetXController {
|
||||
cardId:state.cardId.value,
|
||||
fingerprintId:state.fingerprintId.value);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
// print("操作记录列表成功:${entity.data?.itemList}");
|
||||
state.dataList.value = entity.data!.itemList!;
|
||||
}
|
||||
}
|
||||
@ -226,7 +208,6 @@ class KeyOperationRecordLogic extends BaseGetXController {
|
||||
Future<void> onReady() async {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
print("onReady()");
|
||||
|
||||
// 获取是否是演示模式 演示模式不获取接口
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
@ -241,7 +222,6 @@ class KeyOperationRecordLogic extends BaseGetXController {
|
||||
Future<void> onInit() async {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
print("onInit()");
|
||||
|
||||
// 获取是否是演示模式 演示模式不获取接口
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
|
||||
@ -46,7 +46,6 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
state.type.value = widget.type;
|
||||
Get.log('state.type.value:${state.type.value}');
|
||||
|
||||
return SingleChildScrollView(
|
||||
child: state.isDemoMode ? indexChangeWidget() : Obx(() => indexChangeWidget()),
|
||||
@ -205,7 +204,6 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
|
||||
if (value != null) {
|
||||
value as Map<String, dynamic>;
|
||||
state.lockIdList = value['selectLockIdList'];
|
||||
print("_lockIdList:$state.lockIdList");
|
||||
setState(() {});
|
||||
}
|
||||
});
|
||||
@ -284,7 +282,6 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
|
||||
state.endTime.value = result['endDate'];
|
||||
state.effectiveDateTime.value = result['starTime'];
|
||||
state.failureDateTime.value = result['endTime'];
|
||||
// Get.log('得到的有效期数据:${state.weekdaysList.value} == ${state.beginTime.value} == ${state.endTime.value}== ${state.effectiveDateTime.value} == ${state.failureDateTime.value}');
|
||||
}
|
||||
})),
|
||||
Obx(() => Visibility(
|
||||
|
||||
@ -71,7 +71,6 @@ class _MassSendLockGroupListPageState extends State<MassSendLockGroupListPage> {
|
||||
SubmitBtn(
|
||||
btnName: '确定'.tr,
|
||||
onClick: () {
|
||||
// print('得到lockid为$selectLockIdList ');
|
||||
Map<String, dynamic> resultMap = {};
|
||||
resultMap['selectLockIdList'] = selectLockIdList;
|
||||
Navigator.pop(context, resultMap);
|
||||
|
||||
@ -89,7 +89,6 @@ class MassSendReceiverCell extends StatelessWidget {
|
||||
TextEditingController controller = TextEditingController(text: getStr);
|
||||
controller.addListener(() {
|
||||
userData.userid = controller.text;
|
||||
print(controller.text);
|
||||
});
|
||||
|
||||
return controller;
|
||||
@ -99,7 +98,6 @@ class MassSendReceiverCell extends StatelessWidget {
|
||||
TextEditingController controller = TextEditingController(text: getStr);
|
||||
controller.addListener(() {
|
||||
userData.nickname = controller.text;
|
||||
print(controller.text);
|
||||
});
|
||||
|
||||
return controller;
|
||||
|
||||
@ -268,7 +268,6 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> with Sing
|
||||
state.endTime.value = result['endDate'];
|
||||
state.effectiveDateTime.value = result['starTime'];
|
||||
state.failureDateTime.value = result['endTime'];
|
||||
Get.log('得到的有效期数据:${state.weekdaysList.value} == ${state.beginTime.value} == ${state.endTime.value}== ${state.effectiveDateTime.value} == ${state.failureDateTime.value}');
|
||||
}
|
||||
})),
|
||||
Obx(() => Visibility(
|
||||
@ -463,7 +462,6 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> with Sing
|
||||
// var entity = await ApiRepository.to
|
||||
// .updateSetting(state.keyInfo.value.lockId.toString(), '1', '13');
|
||||
// if (entity.errorCode!.codeIsSuccessful) {
|
||||
// print("标记为已入住成功啦啦啦啦啦");
|
||||
// Toast.show(msg: "标记成功");
|
||||
// } else {
|
||||
// Toast.show(msg: '操作失败');
|
||||
|
||||
@ -44,23 +44,19 @@ class AddFaceLogic extends BaseGetXController {
|
||||
|
||||
Future<void> _replyAddFaceBegin(Reply reply) async {
|
||||
int status = reply.data[2];
|
||||
print("_replyAddFaceBegin status:$status");
|
||||
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
// print("${reply.commandType!.typeValue} 人脸开始数据解析成功");
|
||||
state.ifConnectScuess.value = true;
|
||||
|
||||
// 最大图片数
|
||||
state.maxRegCount.value = reply.data[10];
|
||||
print("人脸开始state.maxRegCount.value:${state.maxRegCount.value}");
|
||||
// state.fingerprintNumber.value = reply.data.last.toString();
|
||||
// AppLog.log("人脸开始state.maxRegCount.value:${state.maxRegCount.value}");
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
var weekStr = "00000000";
|
||||
print("state.weekDay.value:${state.weekDay.value}");
|
||||
for (var day in state.weekDay.value) {
|
||||
int index = day % 7; // 将周日的索引转换为 0
|
||||
weekStr = '${weekStr.substring(0, index)}1${weekStr.substring(index + 1)}';
|
||||
@ -68,7 +64,6 @@ class AddFaceLogic extends BaseGetXController {
|
||||
// 倒序 weekStr
|
||||
weekStr = weekStr.split('').reversed.join('');
|
||||
int weekRound = int.parse(weekStr, radix: 2);
|
||||
// print("weekStrweekStrweekStr:$weekStr weekRound:$weekRound");
|
||||
|
||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||
@ -97,20 +92,9 @@ class AddFaceLogic extends BaseGetXController {
|
||||
privateKey:getPrivateKeyList,
|
||||
token: token,
|
||||
);
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
print("${reply.commandType!.typeValue} 用户无权限");
|
||||
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
print("${reply.commandType!.typeValue} 权限校验错误");
|
||||
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
print("${reply.commandType!.typeValue} 失败");
|
||||
|
||||
break;
|
||||
}
|
||||
@ -118,56 +102,36 @@ class AddFaceLogic extends BaseGetXController {
|
||||
|
||||
Future<void> _replyAddFaceProcess(Reply reply) async {
|
||||
int status = reply.data[2];
|
||||
print("******33 status:$status");
|
||||
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
print("${reply.commandType!.typeValue} 注册人脸过程数据解析成功");
|
||||
if (reply.data[5] == 255) {
|
||||
// 注册人脸失败
|
||||
print("${reply.commandType!.typeValue} 注册人脸过程失败");
|
||||
showToast("添加失败");
|
||||
Get.close(2);
|
||||
} else {
|
||||
// state.addFaceProcessNumber.value++;
|
||||
|
||||
// 当前注册数
|
||||
state.regIndex.value = reply.data[6];
|
||||
print("注册人脸过程state.regIndex.value:${state.regIndex.value}");
|
||||
// AppLog.log("注册人脸过程state.regIndex.value:${state.regIndex.value}");
|
||||
}
|
||||
break;
|
||||
case 0x06:
|
||||
//需要权限
|
||||
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
print("${reply.commandType!.typeValue} 用户无权限");
|
||||
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
print("${reply.commandType!.typeValue} 权限校验错误");
|
||||
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
print("${reply.commandType!.typeValue} 注册人脸过程default失败");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _replyAddFaceConfirmation(Reply reply) async {
|
||||
int status = reply.data[2];
|
||||
print("status:$status");
|
||||
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
print("${reply.commandType!.typeValue} 人脸确认数据解析成功");
|
||||
// print("添加人脸确认成功,调用添加指纹接口");
|
||||
if (state.faceNumber.value == (reply.data[6]).toString()) {
|
||||
return;
|
||||
} else {
|
||||
@ -178,21 +142,9 @@ class AddFaceLogic extends BaseGetXController {
|
||||
case 0x06:
|
||||
//需要权限
|
||||
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
print("${reply.commandType!.typeValue} 用户无权限");
|
||||
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
print("${reply.commandType!.typeValue} 权限校验错误");
|
||||
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
print("${reply.commandType!.typeValue} 人脸确认default失败");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -207,7 +159,6 @@ class AddFaceLogic extends BaseGetXController {
|
||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||
cancelBlueConnetctToastTimer();
|
||||
var weekStr = "00000000";
|
||||
print("state.weekDay.value:${state.weekDay.value}");
|
||||
for (var day in state.weekDay.value) {
|
||||
int index = day % 7; // 将周日的索引转换为 0
|
||||
weekStr = '${weekStr.substring(0, index)}1${weekStr.substring(index + 1)}';
|
||||
@ -215,7 +166,6 @@ class AddFaceLogic extends BaseGetXController {
|
||||
// 倒序 weekStr
|
||||
weekStr = weekStr.split('').reversed.join('');
|
||||
int weekRound = int.parse(weekStr, radix: 2);
|
||||
// print("weekStrweekStrweekStr:$weekStr weekRound:$weekRound");
|
||||
|
||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||
@ -225,9 +175,6 @@ class AddFaceLogic extends BaseGetXController {
|
||||
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> getTokenList = changeStringListToIntList(token!);
|
||||
print(
|
||||
"openDoorTokenPubToken:$getTokenList state.startDate.value:${state.startDate.value}");
|
||||
// print("限时人脸开始时间:${state.startDate.value ~/ 1000} 限时人脸结束时间:${state.endDate.value ~/ 1000}");
|
||||
|
||||
IoSenderManage.senderAddFaceCommand(
|
||||
keyID:"1",
|
||||
@ -273,7 +220,6 @@ class AddFaceLogic extends BaseGetXController {
|
||||
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
// Toast.show(msg: "添加成功");
|
||||
print('更新人脸用户账号成功了么1');
|
||||
updateFaceUserNoLoadData(entity.data!.faceId!);
|
||||
}
|
||||
}
|
||||
@ -286,7 +232,6 @@ class AddFaceLogic extends BaseGetXController {
|
||||
faceUserNo: state.faceNumber.value,
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print('更新人脸用户账号成功了么2');
|
||||
showToast("添加成功");
|
||||
if (state.fromType.value == 2) {
|
||||
// 回调人脸号
|
||||
|
||||
@ -39,7 +39,6 @@ class AddFaceState {
|
||||
weekDay.value = map["cyclicConfig"];
|
||||
fromType.value = map["fromType"];
|
||||
isAdministrator.value = map["isAdministrator"];
|
||||
print("isAdministrator.value isAdministrator.value:${isAdministrator.value}");
|
||||
startDate.value = map["startDate"];
|
||||
// weekDay.value = map["weekDay"];
|
||||
fromType.value = map["fromType"];
|
||||
|
||||
@ -16,14 +16,12 @@ class AddFaceTypeLogic extends BaseGetXController {
|
||||
var startTime = "";
|
||||
var endTime = "";
|
||||
if (state.selectType.value == "0") {
|
||||
print("永久卡永久卡永久卡");
|
||||
faceType = 1;
|
||||
startDate = "0";
|
||||
endDate = "0";
|
||||
startTime = "0";
|
||||
endTime = "0";
|
||||
} else if (state.selectType.value == "1") {
|
||||
print("限时卡限时卡限时卡");
|
||||
faceType = 2;
|
||||
startDate = DateTool().dateToTimestamp(state.timeLimitBeginTime.value, 1).toString();
|
||||
endDate = DateTool().dateToTimestamp(state.timeLimitEndTime.value, 1).toString();
|
||||
@ -49,7 +47,6 @@ class AddFaceTypeLogic extends BaseGetXController {
|
||||
return;
|
||||
}
|
||||
} else if (state.selectType.value == "2") {
|
||||
print("循环卡循环卡循环卡");
|
||||
if (state.cycleBeginTime.value.isEmpty) {
|
||||
showToast("请选择有效期".tr);
|
||||
return;
|
||||
|
||||
@ -257,7 +257,6 @@ class _AddFaceTypePageState extends State<AddFaceTypePage> with SingleTickerProv
|
||||
onClick: () async {
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if (isDemoMode == false) {
|
||||
// print("state.selectType:${state.selectType.value}");
|
||||
if (state.nameController.text.isEmpty) {
|
||||
logic.showToast("请输入姓名");
|
||||
return;
|
||||
|
||||
@ -33,12 +33,10 @@ class FaceDetailLogic extends BaseGetXController {
|
||||
// 添加人脸开始
|
||||
Future<void> _replyAddFaceBegin(Reply reply) async {
|
||||
int status = reply.data[2];
|
||||
print("status:$status");
|
||||
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
Get.log("${reply.commandType!.typeValue} 删除人脸数据解析成功");
|
||||
state.sureBtnState.value = 0;
|
||||
cancelBlueConnetctToastTimer();
|
||||
dismissEasyLoading();
|
||||
|
||||
@ -101,11 +101,6 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
|
||||
});
|
||||
if (data != null) {
|
||||
setState(() {
|
||||
// print("state.starDate.value:${data["starDate"]} "
|
||||
// "state.endDate.value:${data["endDate"]} "
|
||||
// "state.starTime.value:${data["starTime"]} "
|
||||
// "state.endTime.value:${data["endTime"]} "
|
||||
// "state.weekDay.value:${data["weekDay"]}");
|
||||
state.startDate.value = data["starDate"];
|
||||
state.endDate.value = data["endDate"];
|
||||
state.startTime.value = data["starTime"];
|
||||
@ -249,7 +244,6 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
|
||||
@override
|
||||
void didPush() {
|
||||
super.didPush();
|
||||
print("lockSet===didPush");
|
||||
state.ifCurrentScreen.value = true;
|
||||
}
|
||||
|
||||
|
||||
@ -47,12 +47,10 @@ class FaceListLogic extends BaseGetXController {
|
||||
// 添加人脸开始---这里用作删除人脸
|
||||
Future<void> _replyAddFaceBegin(Reply reply) async {
|
||||
int status = reply.data[2];
|
||||
print("status:$status");
|
||||
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
print("${reply.commandType!.typeValue} list人脸数据解析成功");
|
||||
state.isDeletFaceData = false;
|
||||
cancelBlueConnetctToastTimer();
|
||||
dismissEasyLoading();
|
||||
@ -64,7 +62,6 @@ class FaceListLogic extends BaseGetXController {
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
print("${reply.commandType!.typeValue} 需要鉴权");
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
@ -105,21 +102,9 @@ class FaceListLogic extends BaseGetXController {
|
||||
// privateKey: getPrivateKeyList,
|
||||
// token: getTokenList,
|
||||
// );
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
print("${reply.commandType!.typeValue} 用户无权限");
|
||||
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
print("${reply.commandType!.typeValue} 权限校验错误");
|
||||
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
print("${reply.commandType!.typeValue} list人脸失败");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -131,28 +116,14 @@ class FaceListLogic extends BaseGetXController {
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
print("${reply.commandType}数据解析成功");
|
||||
// _getLockStatus();
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
print("${reply.commandType}需要鉴权");
|
||||
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
print("${reply.commandType}用户无权限");
|
||||
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
print("${reply.commandType}权限校验错误");
|
||||
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
print("${reply.commandType}失败");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -163,28 +134,15 @@ class FaceListLogic extends BaseGetXController {
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
print("${reply.commandType}数据解析成功");
|
||||
|
||||
// _getLockStatus();
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
print("${reply.commandType}需要鉴权");
|
||||
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
print("${reply.commandType}用户无权限");
|
||||
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
print("${reply.commandType}权限校验错误");
|
||||
//无权限 需要鉴权
|
||||
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
print("${reply.commandType}失败");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -195,11 +153,9 @@ class FaceListLogic extends BaseGetXController {
|
||||
|
||||
// 用户数量
|
||||
int userNum = reply.data[5];
|
||||
// print("userNum:$userNum");
|
||||
|
||||
// 指纹数量
|
||||
int fingerNum = reply.data[6];
|
||||
// print("fingerNum:$fingerNum");
|
||||
|
||||
// 密码数量
|
||||
int pwdNum = reply.data[7];
|
||||
@ -233,33 +189,18 @@ class FaceListLogic extends BaseGetXController {
|
||||
|
||||
// 序列号
|
||||
var serialNo = reply.data.sublist(17, 21);
|
||||
print("serialNo:$serialNo");
|
||||
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
print("${reply.commandType}数据解析成功");
|
||||
// _getLockStatus();
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
print("${reply.commandType}需要鉴权");
|
||||
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
print("${reply.commandType}用户无权限");
|
||||
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
print("${reply.commandType}权限校验错误");
|
||||
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
print("${reply.commandType}失败");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -401,7 +342,6 @@ class FaceListLogic extends BaseGetXController {
|
||||
faceId = state.deletKeyID;
|
||||
type = "0";
|
||||
}
|
||||
print("delet faceId $faceId");
|
||||
var entity = await ApiRepository.to.deleteFaceData(
|
||||
faceId: int.parse(faceId),
|
||||
lockId: state.lockId.value,
|
||||
@ -421,7 +361,6 @@ class FaceListLogic extends BaseGetXController {
|
||||
faceId = state.deletKeyID;
|
||||
type = "0";
|
||||
}
|
||||
print("delet faceId $faceId");
|
||||
var entity = await ApiRepository.to.clearFaceData(
|
||||
lockId: state.lockId.value,
|
||||
);
|
||||
@ -470,11 +409,9 @@ class FaceListLogic extends BaseGetXController {
|
||||
Future<void> onReady() async {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
print("onReady()");
|
||||
|
||||
// 获取是否是演示模式 演示模式不获取接口
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
// print("aaaaaaa:$isDemoMode");
|
||||
if (isDemoMode == false) {
|
||||
_initReplySubscription();
|
||||
|
||||
@ -488,7 +425,6 @@ class FaceListLogic extends BaseGetXController {
|
||||
Future<void> onInit() async {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
print("onInit()");
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if (isDemoMode == false) {
|
||||
// senderQueryingFingerprintStatus();
|
||||
|
||||
@ -117,11 +117,6 @@ class _FaceListPageState extends State<FaceListPage> {
|
||||
getFaceItemData.faceName!,
|
||||
logic.getKeyType(getFaceItemData),
|
||||
logic.getKeyDateType(getFaceItemData),
|
||||
// (getFaceItemData.faceType! != 1) ? (getFaceItemData.endDate! < DateTime.now().millisecondsSinceEpoch ? "已失效" : "") : "",
|
||||
// getFaceItemData.validTimeStr!,
|
||||
// fingerprintItemData.fingerprintType! == 1
|
||||
// ? "永久"
|
||||
// : "${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())}",
|
||||
() async {
|
||||
var data = await Get.toNamed(Routers.faceDetailPage, arguments: {
|
||||
"faceItemData": getFaceItemData,
|
||||
|
||||
@ -4,12 +4,10 @@ import 'dart:async';
|
||||
// import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/blue/io_type.dart';
|
||||
import 'package:star_lock/app_settings/app_settings.dart';
|
||||
import 'package:star_lock/tools/dateTool.dart';
|
||||
|
||||
import '../../../../../blue/blue_manage.dart';
|
||||
// import '../../../../../blue/io_protocol/io_addFingerprint.dart';
|
||||
import '../../../../../blue/io_protocol/io_addStressFingerprint.dart';
|
||||
import '../../../../../blue/io_reply.dart';
|
||||
import '../../../../../blue/io_tool/io_tool.dart';
|
||||
import '../../../../../blue/io_tool/manager_event_bus.dart';
|
||||
@ -52,22 +50,19 @@ class AddFingerprintLogic extends BaseGetXController {
|
||||
|
||||
Future<void> _replyAddFingerprintBegin(Reply reply) async {
|
||||
int status = reply.data[2];
|
||||
// Get.log("status:$status");
|
||||
|
||||
switch(status){
|
||||
case 0x00:
|
||||
//成功
|
||||
Get.log("${reply.commandType!.typeValue} 数据解析成功");
|
||||
state.ifConnectScuess.value = true;
|
||||
|
||||
// 最大图片数
|
||||
state.maxRegCount.value = reply.data[10];
|
||||
Get.log("state.maxRegCount.value:${state.maxRegCount.value}");
|
||||
// AppLog.log("state.maxRegCount.value:${state.maxRegCount.value}");
|
||||
// state.fingerprintNumber.value = reply.data.last.toString();
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
Get.log("${reply.commandType!.typeValue} 需要鉴权");
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
@ -110,21 +105,18 @@ class AddFingerprintLogic extends BaseGetXController {
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
Get.log("${reply.commandType!.typeValue} 用户无权限");
|
||||
showToast("添加指纹失败", something: (){
|
||||
Get.back();
|
||||
});
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
Get.log("${reply.commandType!.typeValue} 权限校验错误");
|
||||
showToast("添加指纹失败", something: (){
|
||||
Get.back();
|
||||
});
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
Get.log("${reply.commandType!.typeValue} 失败");
|
||||
showToast("添加指纹失败", something: (){
|
||||
Get.back();
|
||||
});
|
||||
@ -134,12 +126,10 @@ class AddFingerprintLogic extends BaseGetXController {
|
||||
|
||||
Future<void> _replyAddFingerprintProcess(Reply reply) async {
|
||||
int status = reply.data[2];
|
||||
Get.log("33 status:$status");
|
||||
|
||||
switch(status){
|
||||
case 0x00:
|
||||
//成功
|
||||
Get.log("${reply.commandType!.typeValue} 数据解析成功");
|
||||
if(reply.data[5] == 255){
|
||||
// 注册指纹失败
|
||||
showToast("添加失败");
|
||||
@ -149,7 +139,7 @@ class AddFingerprintLogic extends BaseGetXController {
|
||||
|
||||
// 当前注册数
|
||||
state.regIndex.value = reply.data[6];
|
||||
Get.log("state.regIndex.value:${state.regIndex.value}");
|
||||
AppLog.log("当前注册数 state.regIndex.value:${state.regIndex.value}");
|
||||
}
|
||||
break;
|
||||
case 0x06:
|
||||
@ -157,19 +147,16 @@ class AddFingerprintLogic extends BaseGetXController {
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
Get.log("${reply.commandType!.typeValue} 失败");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _replyAddFingerprintConfirmation(Reply reply) async {
|
||||
int status = reply.data[2];
|
||||
Get.log("status:$status");
|
||||
|
||||
switch(status){
|
||||
case 0x00:
|
||||
//成功
|
||||
Get.log("${reply.commandType!.typeValue} 数据解析成功");
|
||||
if(state.fingerprintNumber.value == (reply.data[6]).toString()){
|
||||
return;
|
||||
}else{
|
||||
@ -188,20 +175,16 @@ class AddFingerprintLogic extends BaseGetXController {
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
Get.log("${reply.commandType!.typeValue} 失败");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Future<void> _replyAddStressFingerprint(Reply reply) async {
|
||||
// int status = reply.data[2];
|
||||
// Get.log("status:$status");
|
||||
//
|
||||
// switch(status){
|
||||
// case 0x00:
|
||||
// //成功
|
||||
// Get.log("${reply.commandType!.typeValue} 数据解析成功");
|
||||
// // print("添加指纹确认成功,调用添加指纹接口");
|
||||
// addFingerprintsData();
|
||||
// break;
|
||||
// case 0x06:
|
||||
@ -236,15 +219,12 @@ class AddFingerprintLogic extends BaseGetXController {
|
||||
// break;
|
||||
// case 0x07:
|
||||
// //无权限
|
||||
// Get.log("${reply.commandType!.typeValue} 用户无权限");
|
||||
// break;
|
||||
// case 0x09:
|
||||
// // 权限校验错误
|
||||
// Get.log("${reply.commandType!.typeValue} 权限校验错误");
|
||||
// break;
|
||||
// default:
|
||||
// //失败
|
||||
// Get.log("${reply.commandType!.typeValue} 失败");
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
@ -257,18 +237,6 @@ class AddFingerprintLogic extends BaseGetXController {
|
||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||
if (deviceConnectionState == BluetoothConnectionState.connected){
|
||||
cancelBlueConnetctToastTimer();
|
||||
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||
|
||||
// var weekStr = "00000000";
|
||||
// for (var day in state.weekDay.value) {
|
||||
// int index = day % 7; // 将周日的索引转换为 0
|
||||
// weekStr = '${weekStr.substring(0, index)}1${weekStr.substring(index + 1)}';
|
||||
// }
|
||||
// // 倒序 weekStr
|
||||
// weekStr = weekStr.split('').reversed.join('');
|
||||
// int weekRound = int.parse(weekStr, radix: 2);
|
||||
// Get.log("weekStrweekStrweekStr:$weekStr weekRound:$weekRound");
|
||||
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
@ -279,7 +247,6 @@ class AddFingerprintLogic extends BaseGetXController {
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> getTokenList = changeStringListToIntList(token!);
|
||||
|
||||
Get.log("state.isCoerced.value:${state.isCoerced.value}");
|
||||
IoSenderManage.senderAddFingerprintWithTimeCycleCoercionCommand(
|
||||
keyID:"1",
|
||||
userID:await Storage.getUid(),
|
||||
@ -321,7 +288,6 @@ class AddFingerprintLogic extends BaseGetXController {
|
||||
// var token = await Storage.getStringList(saveBlueToken);
|
||||
// List<int> getTokenList = changeStringListToIntList(token!);
|
||||
//
|
||||
// Get.log("state.isAdministrator.value:${state.isAdministrator.value}");
|
||||
// IoSenderManage.senderAddFingerprintCommand(
|
||||
// keyID:"1",
|
||||
// userID:await Storage.getUid(),
|
||||
@ -382,8 +348,6 @@ class AddFingerprintLogic extends BaseGetXController {
|
||||
|
||||
// 添加指纹
|
||||
void addFingerprintsData() async{
|
||||
Get.log("effectiveDateTime:${state.effectiveDateTime.value} failureDateTime:${state.failureDateTime.value}");
|
||||
|
||||
var entity = await ApiRepository.to.addFingerprintsData(
|
||||
lockId: state.lockId.value.toString(),
|
||||
endDate: state.endDate.value,
|
||||
|
||||
@ -162,7 +162,6 @@ class _AddFingerprintPageState extends State<AddFingerprintPage> with RouteAware
|
||||
@override
|
||||
void didPush() {
|
||||
super.didPush();
|
||||
print("lockSet===didPush");
|
||||
state.ifCurrentScreen.value = true;
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user