From f05f74be0f017f9ddef0c340e0715c6776ac7705 Mon Sep 17 00:00:00 2001 From: anfe <448468458@qq.com> Date: Tue, 21 May 2024 11:16:04 +0800 Subject: [PATCH 1/7] =?UTF-8?q?feat:=E6=B7=BB=E5=8A=A0=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .DS_Store | Bin 6148 -> 6148 bytes pubspec.yaml | 3 ++- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.DS_Store b/.DS_Store index 0d0d83d942d5a6afc3f49b36da76e38eed24448a..a15ea27935c7877c7f6966c4a2945ca5e15353ec 100755 GIT binary patch delta 24 fcmZoMXffDO$IfnSX{MuKY%w{V&0+IVc6$K;TKWeJ delta 25 gcmZoMXffDO$IfAHYNn%LVqi8ogUx>PQFeO)0ASz;JOBUy diff --git a/pubspec.yaml b/pubspec.yaml index e4da4259..efb41595 100755 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -54,8 +54,9 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # 1.0.44+2024052002:打包给公司测试 # 1.0.45+2024052003:打包给公司测试 # 1.0.46+2024052004:打包给公司测试 +# 1.0.47+2024052101:打包给欧阳回归测试 -version: 1.0.46+2024052004 +version: 1.0.47+2024052101 environment: sdk: '>=2.12.0 <3.0.0' From 4c68c60f1d4577a1ea91bf57a6cd98b4caa1621e Mon Sep 17 00:00:00 2001 From: anfe <448468458@qq.com> Date: Tue, 21 May 2024 15:33:06 +0800 Subject: [PATCH 2/7] =?UTF-8?q?feat:=E8=A7=A3=E5=86=B3=E7=A1=AC=E4=BB=B6?= =?UTF-8?q?=E5=A4=9A=E6=AC=A1=E5=8F=91=E6=95=B0=E6=8D=AE=E5=8C=85=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/blue/blue_manage.dart | 190 ++------ lib/blue/io_reply.dart | 86 ++-- lib/blue/io_sender.dart | 6 +- lib/blue/reciver_data.dart | 39 +- .../authorizedAdmin_logic.dart | 2 +- .../card/addICCard/addICCard_logic.dart | 4 +- .../card/cardDetail/cardDetail_logic.dart | 2 +- .../card/cardList/cardList_logic.dart | 2 +- .../otherTypeKeyChangeDate_logic.dart | 6 +- .../otherTypeKeyChangeValidityDate_logic.dart | 6 +- .../doorLockLog/doorLockLog_logic.dart | 2 +- .../face/addFace/addFace_logic.dart | 4 +- .../face/faceDetail/faceDetail_logic.dart | 2 +- .../face/faceList/faceList_logic.dart | 2 +- .../addFingerprint/addFingerprint_logic.dart | 4 +- .../fingerprintDetail_logic.dart | 2 +- .../fingerprintList_logic.dart | 6 +- .../iris/irisDetail/irisDetail_logic.dart | 2 +- .../iris/irisList/irisList_logic.dart | 6 +- .../lockDetail/lockDetail_logic.dart | 410 +++++++++--------- .../lockDetail/lockDetail_page.dart | 5 +- .../lockOperatingRecord_logic.dart | 2 +- .../automaticBlocking_logic.dart | 2 +- .../adminOpenLockPassword_logic.dart | 2 +- .../uploadElectricQuantity_logic.dart | 2 +- .../burglarAlarm/burglarAlarm_logic.dart | 2 +- .../configuringWifi_logic.dart | 2 +- .../wifiList/wifiList_logic.dart | 2 +- .../lockEscalation/lockEscalation_logic.dart | 2 +- .../lockSet/lockSet/lockSet_logic.dart | 4 +- .../lockSoundSet/lockSoundSet_logic.dart | 2 +- .../lockSet/lockTime/lockTime_logic.dart | 2 +- .../lockSet/motorPower/motorPower_logic.dart | 4 +- .../normallyOpenMode_logic.dart | 2 +- .../openDoorDirection_logic.dart | 2 +- .../remoteUnlocking_logic.dart | 2 +- .../resetButton/resetButton_logic.dart | 2 +- .../palm/palmDetail/palmDetail_logic.dart | 2 +- .../palm/palmList/palmList_logic.dart | 6 +- .../passwordKeyDetail_logic.dart | 2 +- .../passwordKeyDetailChangeDate_logic.dart | 2 +- .../passwordKeyList_logic.dart | 4 +- .../passwordKey_perpetual_logic.dart | 2 +- .../lockMian/lockList/lockList_logic.dart | 2 +- lib/mine/about/debug/controller.dart | 4 +- .../addLock/nearbyLock/nearbyLock_logic.dart | 6 +- lib/mine/addLock/saveLock/saveLock_logic.dart | 2 +- .../expireCard/expireCard_logic.dart | 2 +- .../expireFingerprint_logic.dart | 2 +- lib/network/response_interceptor_log.dart | 2 +- 50 files changed, 374 insertions(+), 488 deletions(-) diff --git a/lib/blue/blue_manage.dart b/lib/blue/blue_manage.dart index 746062a1..5ae2f0df 100755 --- a/lib/blue/blue_manage.dart +++ b/lib/blue/blue_manage.dart @@ -17,6 +17,12 @@ typedef ConnectStateCallBack = Function( typedef ScanDevicesCallBack = Function(List); class BlueManage { + + factory BlueManage() => shareManager()!; + + BlueManage._init() { + _initBlue(); + } final List scanDevices = []; // 用来写入的服务id @@ -34,12 +40,6 @@ class BlueManage { // 监听发送事件 StreamSubscription? _sendStreamSubscription; - // 监听蓝牙扫描的事件 - // StreamSubscription? _scanSubscription; - // 监听蓝牙连接的事件 - // StreamSubscription? _currentConnectionStream; - - // StreamSubscription>? _scanResultsSubscription; StreamSubscription? _connectionStateSubscription; StreamSubscription? _mtuSubscription; @@ -64,11 +64,14 @@ class BlueManage { BluetoothAdapterState? _adapterState = BluetoothAdapterState.unknown; StreamSubscription? _adapterStateStateSubscription; - static BlueManage? _manager; + // 听上报来的数据,参数来自前面扫描到的结果 + List allData = []; - BlueManage._init() { - _initBlue(); - } + // 保存上一次的数据,用来判断是否收到重复的数据 + List lastTimeData = []; + int? dataLen; + + static BlueManage? _manager; static BlueManage? shareManager() { _manager ??= BlueManage._init(); @@ -76,16 +79,12 @@ class BlueManage { return _manager; } - factory BlueManage() => shareManager()!; - BlueManage? get manager => shareManager(); void _initBlue() { FlutterBluePlus.setLogLevel(LogLevel.error, color: true); _initSendStreamSubscription(); _initAdapterStateStateSubscription(); - // _initListenscanResults(); - // _initListenConnectionState(); } void _initGetMtuSubscription() { @@ -102,45 +101,6 @@ class BlueManage { }); } - // void _initListenscanResults() { - // var subscription = FlutterBluePlus.scanResults.listen((results) { - // scanDevices.clear(); - // for (var scanResult in results) { - // // 判断名字为空的直接剔除 - // // if (scanResult.device.advName.isEmpty) { - // // return; - // // } - // 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)) { - // // 查询id相同的元素 - // final knownDeviceIndex = scanDevices.indexWhere((d) => d.advertisementData.advName == scanResult.advertisementData.advName); - // // 不存在的时候返回-1 - // if (knownDeviceIndex >= 0) { - // scanDevices[knownDeviceIndex] = scanResult; - // } else { - // scanDevices.add(scanResult); - // } - // } - // } - // EventBusManager().eventBusFir(scanDevices); - // // FlutterBluePlus.stopScan(); - // }, onError: (e) { - // AppLog.log("Scan Error:$e", ); - // }); - // - // FlutterBluePlus.cancelWhenScanComplete(subscription); - - // FlutterBluePlus.isScanning.listen((state) { - // if (state) { - // prAppLog.logint('Scanning'); - // } else { - // AppLog.log('Not scanning'); - // } - // }); - // } - void _initListenConnectionState() { _connectionStateSubscription?.cancel(); _connectionStateSubscription = null; @@ -185,7 +145,7 @@ class BlueManage { if (_adapterState == BluetoothAdapterState.on) { try { //android 扫描比较慢,取样只要 8 分之一 - final int divisor = Platform.isAndroid ? 8 : 1; + final int divisor = Platform.isAndroid ? 3 : 1; FlutterBluePlus.startScan( continuousDivisor: divisor, continuousUpdates: true, @@ -316,7 +276,7 @@ class BlueManage { } /// 调用发送数据 List senderData, - Future bludSendData( + Future blueSendData( String deviceName, ConnectStateCallBack stateCallBack, {bool isAddEquipment = false}) async { FlutterBluePlus.isSupported.then((bool isAvailable) async { @@ -368,14 +328,13 @@ class BlueManage { } //查找缓存里面是否有设备 - bool isExistScanDevices(String connectDeviceName){ + bool isExistScanDevices(String connectDeviceName) { final bool isExistDevice = scanDevices.any((ScanResult element) => - element.device.platformName == connectDeviceName || + element.device.platformName == connectDeviceName || element.advertisementData.advName == connectDeviceName); return isExistDevice; } - Future _connectDevice(List devicesList, String deviceName, ConnectStateCallBack connectStateCallBack, {bool isAddEquipment = false}) async { @@ -400,13 +359,9 @@ class BlueManage { _initGetMtuSubscription(); _initListenConnectionState(); } - // AppLog.log("1 connectDeviceId:$connectDeviceMacAddress connectDeviceName:$connectDeviceName"); - // stopScan(); if (scanResult == null || connectDeviceMacAddress.isEmpty) { - // connectStateCallBack(BluetoothConnectionState.disconnected!); return; } - // AppLog.log("调用了停止扫描的方法"); await stopScan(); @@ -438,28 +393,18 @@ class BlueManage { connectStateCallBack(BluetoothConnectionState.disconnected); } - // await bluetoothConnectDevice!.connect(); if (bluetoothConnectionState == BluetoothConnectionState.connected) { try { bluetoothConnectDevice! .discoverServices() .then((List services) { for (final BluetoothService service in services) { - // AppLog.log("11111service.remoteId:${service.remoteId}" - // " service.uuid:${service.uuid}" - // " service.characteristics:${service.characteristics}" - // " service.includedServices:${service.includedServices}"); if (service.uuid == _serviceIdConnect) { for (final BluetoothCharacteristic characteristic in service.characteristics) { - // Get.log("22222characteristic.remoteId:${characteristic.remoteId}" - // " characteristic.uuid:${characteristic.uuid}" - // " characteristic.secondaryServiceUuid:${characteristic.secondaryServiceUuid}" - // " characteristic.characteristicUuid:${characteristic.characteristicUuid}"); if (characteristic.characteristicUuid == _characteristicIdSubscription) { _subScribeToCharacteristic(characteristic); - // AppLog.log('Discovering services finished'); bluetoothConnectionState = BluetoothConnectionState.connected; connectStateCallBack(bluetoothConnectionState!); } @@ -477,49 +422,41 @@ class BlueManage { } } - // 听上报来的数据,参数来自前面扫描到的结果 - List allData = []; - // 保存上一次的数据,用来判断是否收到重复的数据 - List lastTimeData = []; - int? dataLen; Future _subScribeToCharacteristic( BluetoothCharacteristic characteristic) async { final StreamSubscription> subscription = characteristic.onValueReceived.listen((List data) { - // AppLog.log("订阅获取的数据:$data"); + AppLog.log('订阅获取的数据: $data '); if (data == lastTimeData || data.isEmpty) { return; } else { lastTimeData = data; } - // code to handle incoming 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)) { + final bool dataHeadCorrect = isDataHeadCorrect(data); + final bool allDataHeadCorrect = isDataHeadCorrect(allData); + if (dataHeadCorrect && allDataHeadCorrect) { + //缓存数据和新数据都有包头,直接放弃缓存数据 + allData = []; + } + if (dataHeadCorrect) { // 当包有头时 // 判断是否需要分包 dataLen = data[8] * 256 + data[9]; // 高16位用来指示后面数据块内容的长度 - // AppLog.log("dataLen1111:$dataLen getDataLength:${data.length} data:$data"); if (dataLen! + 14 > data.length) { // 当前包的长度小于实际的包时 分包添加 不解析 allData.addAll(data); } else { // 当前包的长度小于实际的包时 不分包 解析 allData.addAll(data); - // AppLog.log("dataLen2222:$dataLen getDataLength:${data.length}"); CommandReciverManager.appDataReceive(allData); // 发送完解析初始化数组 allData = []; } - } else { + } else if (allDataHeadCorrect) { // 当包没有头时 是分包的包 直接添加 allData.addAll(data); - // var len = allData[8] * 256 + allData[9]; - // AppLog.log("dataLen3333:$dataLen allData.length:${allData.length} allData:$allData"); if (((dataLen ?? 0) + 14) <= allData.length) { // 当长度小于等于当前包的数据时 直接解析数据 CommandReciverManager.appDataReceive(allData); @@ -532,24 +469,30 @@ class BlueManage { await characteristic.setNotifyValue(true); } + //判断数据头是否正确 + bool isDataHeadCorrect(List data) { + if (data.length < 4) { + return false; + } + //239, 1, 238, 2, 是数据包头 + if ((data[0] == 0xEF) && + (data[1] == 0x01) && + (data[2] == 0xEE) && + (data[3] == 0x02)) { + return true; + } else { + return false; + } + } + // 写入 Future writeCharacteristicWithResponse(List value) async { final List services = await bluetoothConnectDevice!.discoverServices(); for (final BluetoothService service in services) { - // 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 (final BluetoothCharacteristic characteristic in service.characteristics) { - // AppLog.log("44444 characteristic.remoteId:${characteristic.remoteId}" - // " characteristic.uuid:${characteristic.uuid}\n\n" - // " characteristic.secondaryServiceUuid:${characteristic - // .secondaryServiceUuid}\n\n" - // " characteristic.characteristicUuid:${characteristic - // .characteristicUuid}"); if (characteristic.characteristicUuid == _characteristicIdWrite) { try { final List valueList = value; @@ -558,22 +501,10 @@ class BlueManage { for (int i = 0; i < subData.length; i++) { if (characteristic.properties.writeWithoutResponse) { // 使用WRITE_NO_RESPONSE属性写入值 - await characteristic - .write(subData[i], withoutResponse: true) - .then((value) async { - // await Future.delayed(const Duration(milliseconds: 1)).then(( - // value) async { - // AppLog.log('分包发送成功了'); - // }); - }); + await characteristic.write(subData[i], withoutResponse: true); } else if (characteristic.properties.write) { // 使用WRITE属性写入值 - await characteristic.write(subData[i]).then((value) async { - // await Future.delayed(const Duration(milliseconds: 1)).then(( - // value) async { - // AppLog.log('分包发送成功了'); - // }); - }); + await characteristic.write(subData[i]); } else { // 特性不支持写入 throw Exception( @@ -588,28 +519,6 @@ class BlueManage { } } } - // List services = await bluetoothConnectDevice!.discoverServices(); - // BluetoothCharacteristic characteristic = services - // .firstWhere((service) => service.uuid == _serviceIdWrite) - // .characteristics - // .firstWhere((char) => char.uuid == _characteristicIdWrite); - // try { - // List valueList = value; - // List subData = splitList(valueList, _mtuSize!); - // 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 { - // AppLog.log('分包发送成功了'); - // }); - // }); - // } - // } on Exception catch (e, s) { - // AppLog.log('Error occurred when writing: $e'); - // AppLog.log(s); - // rethrow; - // } } // 停止扫描蓝牙设备 @@ -624,16 +533,12 @@ class BlueManage { // 断开连接 Future disconnect() async { try { - // if(bluetoothConnectDevice != null && bluetoothConnectDevice!.connectionState == BluetoothConnectionState.connected){ connectDeviceMacAddress = ''; if (bluetoothConnectionState == BluetoothConnectionState.connected) { - // await writeNull(); - // await Future.delayed(const Duration(milliseconds: 1000)); //加快蓝牙断连 - await bluetoothConnectDevice!.disconnect(timeout: 2); + await bluetoothConnectDevice!.disconnect(timeout: 3); AppLog.log('断开连接成功'); } - // } } on Exception catch (e, _) { AppLog.log('断开连接失败: $e'); } finally { @@ -641,7 +546,7 @@ class BlueManage { } } - openBlue() async { + Future openBlue() async { if (Platform.isAndroid) { await FlutterBluePlus.turnOn(); } @@ -650,10 +555,9 @@ class BlueManage { } } - disposed() { + void disposed() { _sendStreamSubscription?.cancel(); _mtuSubscription!.cancel(); - // _scanResultsSubscription!.cancel(); _adapterStateStateSubscription!.cancel(); _connectionStateSubscription!.cancel(); } diff --git a/lib/blue/io_reply.dart b/lib/blue/io_reply.dart index 56c93b70..adf8c457 100755 --- a/lib/blue/io_reply.dart +++ b/lib/blue/io_reply.dart @@ -6,6 +6,7 @@ import '../app_settings/app_settings.dart'; import 'io_type.dart'; abstract class Reply{ + Reply.parseData(this.commandType, List dataDetail); CommandType? commandType; @@ -13,122 +14,121 @@ abstract class Reply{ int status = 0; List data = []; static String logTag= '锁 -> App,指令订阅类型 :'; - Reply.parseData(this.commandType, List dataDetail); void errorWithStstus(int status){ switch(status){ case 0x00: // 成功 - AppLog.log("$logTag ${commandType?.typeName} 0x00 成功"); + AppLog.log('$logTag ${commandType?.typeName} 0x00 成功'); break; case 0x01: // 包格式错误 - AppLog.log("$logTag ${commandType!.typeName} 0x01 包格式错误"); - showErrorMessage("包格式错误"); + AppLog.log('$logTag ${commandType!.typeName} 0x01 包格式错误'); + showErrorMessage('包格式错误'); break; case 0x02: // 密码错误 - AppLog.log("$logTag ${commandType!.typeName} 0x02 密码错误"); - showErrorMessage("密码错误"); + AppLog.log('$logTag ${commandType!.typeName} 0x02 密码错误'); + showErrorMessage('密码错误'); break; case 0x03: // 网络中断 - AppLog.log("$logTag ${commandType!.typeName} 0x03 网络中断"); - showErrorMessage("网络中断"); + AppLog.log('$logTag ${commandType!.typeName} 0x03 网络中断'); + showErrorMessage('网络中断'); break; case 0x04: // 用户未登记 - AppLog.log("$logTag ${commandType!.typeName} 0x04 用户未登记"); - showErrorMessage("用户未登记"); + AppLog.log('$logTag ${commandType!.typeName} 0x04 用户未登记'); + showErrorMessage('用户未登记'); break; case 0x05: // 参数错误 - AppLog.log("$logTag ${commandType!.typeName} 0x05 参数错误"); - showErrorMessage("参数错误"); + AppLog.log('$logTag ${commandType!.typeName} 0x05 参数错误'); + showErrorMessage('参数错误'); break; case 0x06: // 需要鉴权 - AppLog.log("$logTag ${commandType!.typeName} 0x06 需要鉴权"); + AppLog.log('$logTag ${commandType!.typeName} 0x06 需要鉴权'); // showErrorMessage("需要鉴权"); break; case 0x07: // 无权限 - AppLog.log("$logTag ${commandType!.typeName} 0x07 无权限"); + AppLog.log('$logTag ${commandType!.typeName} 0x07 无权限'); // showErrorMessage("无权限"); break; case 0x08: // 应答超时 - AppLog.log("$logTag ${commandType!.typeName} 0x08 应答超时"); - showErrorMessage("应答超时"); + AppLog.log('$logTag ${commandType!.typeName} 0x08 应答超时'); + showErrorMessage('应答超时'); break; case 0x09: // 权限校验错误 - AppLog.log("$logTag ${commandType!.typeName} 0x09 权限校验错误"); - showErrorMessage("权限校验错误"); + AppLog.log('$logTag ${commandType!.typeName} 0x09 权限校验错误'); + showErrorMessage('权限校验错误'); break; case 0x0a: // 钥匙不存在 - showErrorMessage("钥匙不存在"); - AppLog.log("$logTag ${commandType!.typeName} 0x0a 钥匙不存在"); + showErrorMessage('钥匙不存在'); + AppLog.log('$logTag ${commandType!.typeName} 0x0a 钥匙不存在'); break; case 0x0b: // 钥匙过期 - showErrorMessage("钥匙过期"); - AppLog.log("$logTag ${commandType!.typeName} 0x0b 钥匙过期"); + showErrorMessage('钥匙过期'); + AppLog.log('$logTag ${commandType!.typeName} 0x0b 钥匙过期'); break; case 0x0c: // 钥匙数量已到上限 - showErrorMessage("钥匙数量已到上限"); - AppLog.log("$logTag ${commandType!.typeName} 0x0c 钥匙数量已到上限"); + showErrorMessage('钥匙数量已到上限'); + AppLog.log('$logTag ${commandType!.typeName} 0x0c 钥匙数量已到上限'); break; case 0x0d: // 钥匙无效 - showErrorMessage("钥匙无效"); - AppLog.log("$logTag ${commandType!.typeName} 0x0d 钥匙无效"); + showErrorMessage('钥匙无效'); + AppLog.log('$logTag ${commandType!.typeName} 0x0d 钥匙无效'); break; case 0x0e: // 钥匙已存在 - showErrorMessage("钥匙已存在"); - AppLog.log("$logTag ${commandType!.typeName} 0x0e 钥匙已存在"); + showErrorMessage('钥匙已存在'); + AppLog.log('$logTag ${commandType!.typeName} 0x0e 钥匙已存在'); break; case 0x0f: // 用户已存在 - AppLog.log("$logTag ${commandType!.typeName} 0x0f 用户已存在"); - showErrorMessage("用户已存在"); + AppLog.log('$logTag ${commandType!.typeName} 0x0f 用户已存在'); + showErrorMessage('用户已存在'); break; case 0x10: // 密码失效 - AppLog.log("$logTag ${commandType!.typeName} 0x11 密码失效"); - showErrorMessage("密码失效"); + AppLog.log('$logTag ${commandType!.typeName} 0x11 密码失效'); + showErrorMessage('密码失效'); break; case 0x11: // 无效指令 - AppLog.log("$logTag ${commandType!.typeName} 0x11 无效指令"); - showErrorMessage("无效指令"); + AppLog.log('$logTag ${commandType!.typeName} 0x11 无效指令'); + showErrorMessage('无效指令'); break; case 0x12: // 门锁时间异常 - AppLog.log("$logTag ${commandType!.typeName} 0x12 门锁时间异常"); - showErrorMessage("门锁时间异常"); + AppLog.log('$logTag ${commandType!.typeName} 0x12 门锁时间异常'); + showErrorMessage('门锁时间异常'); break; case 0x15: // APP(手机)未联网 - AppLog.log("$logTag ${commandType!.typeName} 0x15 APP(手机)未联网"); - showErrorMessage("APP(手机)未联网"); + AppLog.log('$logTag ${commandType!.typeName} 0x15 APP(手机)未联网'); + showErrorMessage('APP(手机)未联网'); break; case 0x16: // 正在开锁中... - AppLog.log("$logTag ${commandType!.typeName} $status 正在开锁中..."); - showErrorMessage("正在开锁中..."); + AppLog.log('$logTag ${commandType!.typeName} $status 正在开锁中...'); + showErrorMessage('正在开锁中...'); break; case 0xff: // 异常,未知错误 - AppLog.log("$logTag ${commandType!.typeName} 0xff 异常,未知错误"); - showErrorMessage("异常,未知错误"); + AppLog.log('$logTag ${commandType!.typeName} 0xff 异常,未知错误'); + showErrorMessage('异常,未知错误'); break; default: //失败 - AppLog.log("$logTag ${commandType!.typeName} $status 蓝牙返回其他错误问题"); + AppLog.log('$logTag ${commandType!.typeName} $status 蓝牙返回其他错误问题'); break; } } diff --git a/lib/blue/io_sender.dart b/lib/blue/io_sender.dart index 098f50a5..ae45e67e 100755 --- a/lib/blue/io_sender.dart +++ b/lib/blue/io_sender.dart @@ -34,9 +34,9 @@ abstract class SenderProtocol extends IOData { } void printLog(List data) { - AppLog.log( - "App -> 锁,指令类型:${commandType!.typeName} ${commandType!.typeValue == 0x3030 - ? '子命令:${data[3]}' : ''} \n参数是:\n${toString()} \n加密之前数据是:\n$data 长度是:${data.length}"); + // AppLog.log( + // "App -> 锁,指令类型:${commandType!.typeName} ${commandType!.typeValue == 0x3030 + // ? '子命令:${data[3]}' : ''} \n参数是:\n${toString()} \n加密之前数据是:\n$data 长度是:${data.length}"); } //TODO:拼装数据Ï diff --git a/lib/blue/reciver_data.dart b/lib/blue/reciver_data.dart index e2aaad2b..4217a096 100755 --- a/lib/blue/reciver_data.dart +++ b/lib/blue/reciver_data.dart @@ -47,12 +47,12 @@ import 'io_tool/manager_event_bus.dart'; import 'sm4Encipher/sm4.dart'; class CommandReciverManager { - static void appDataReceive(List data) async { + static Future appDataReceive(List data) async { ///解析数据 if (data.isEmpty) { return; } - int dataSize = data.length; + final int dataSize = data.length; // 当小于包头加起来13个字节 if (dataSize < 13) { return; @@ -62,20 +62,20 @@ class CommandReciverManager { (data[1] == 0x01) && (data[2] == 0xEE) && (data[3] == 0x02)) { - var tmpType = (data[7] & 0x0f); // 包标识 - // AppLog.log("temType:$tmpType"); + final int tmpType = data[7] & 0x0f; // 包标识 + // AppLog.log('temType:$tmpType'); - var dataLen = data[8] * 256 + data[9]; // 高16位用来指示后面数据块内容的长度 - var oriLen = data[10] * 256 + data[11]; // 低16位用来指示数据加密前的原长度 + final int dataLen = data[8] * 256 + data[9]; // 高16位用来指示后面数据块内容的长度 + final int oriLen = data[10] * 256 + data[11]; // 低16位用来指示数据加密前的原长度 // AppLog.log("dataLen:$dataLen oriLen:$oriLen"); - List oriDataList = []; + List oriDataList = []; switch (tmpType) { case 0: //不加密 // for (var i = 0; i < oriLen ; i++) { // oriDataList.add(data[12 + i]); // } oriDataList = data.sublist(12, 12 + dataLen); - AppLog.log("不加密 :$oriDataList"); + AppLog.log('不加密 :$oriDataList'); break; case 1: //AES128 @@ -83,7 +83,7 @@ class CommandReciverManager { case 2: // SM4(事先约定密钥) // 获取的加密数组 - var getDataList = data.sublist(12, 12 + dataLen); + final List getDataList = data.sublist(12, 12 + dataLen); // 解密 // String key = SM4.createHexKey(key: IoManager().getCurrentDeviceLockId); @@ -91,39 +91,39 @@ class CommandReciverManager { key: utf8.encode(BlueManage().connectDeviceName), mode: SM4CryptoMode.ECB); oriDataList = oriDataList.sublist(0, oriLen); - AppLog.log("APP收到的解密后的数据:$oriDataList"); + AppLog.log('APP收到的解密后的数据:$oriDataList'); break; case 3: //SM4(设备指定密钥) // 获取的加密数组 - var getDataList = data.sublist(12, 12 + dataLen); + final List getDataList = data.sublist(12, 12 + dataLen); - var res = await Storage.getStringList(saveBluePrivateKey); - List getPrivateKeyList = changeStringListToIntList(res!); + final List? res = await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = changeStringListToIntList(res!); // 解密 oriDataList = SM4.decrypt(getDataList, key: getPrivateKeyList, mode: SM4CryptoMode.ECB); oriDataList = oriDataList.sublist(0, oriLen); - AppLog.log("APP收到的解密后的数据:$oriDataList"); + AppLog.log('APP收到的解密后的数据:$oriDataList data:$data'); break; } parseData(oriDataList).then((Reply? value) async { EasyLoading.dismiss(); await EventBusManager().eventBusFir(value); }).catchError((error) { - AppLog.log("APP解析数据时发生错误: $error"); + AppLog.log('APP解析数据时发生错误: $error'); }); } } static Future parseData(List data) async { if (data.isNotEmpty) { - var cmd = data[0] * 256 + data[1]; - CommandType commandType = ExtensionCommandType.getCommandType(cmd); + final int cmd = data[0] * 256 + data[1]; + final CommandType commandType = ExtensionCommandType.getCommandType(cmd); await IoManager().increaseCommandIndex(); // data.removeRange(0, 2); - var reply; + Reply? reply; switch (commandType) { case CommandType.getLockPublicKey: { @@ -204,7 +204,7 @@ class CommandReciverManager { case CommandType.generalExtendedCommond: { // 子命令类型 - int subType = data[3]; + final int subType = data[3]; switch (subType) { case 2: { @@ -437,5 +437,6 @@ class CommandReciverManager { } return reply; } + return null; } } diff --git a/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart b/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart index a2e3a7d9..434c7e57 100755 --- a/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart +++ b/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart @@ -73,7 +73,7 @@ class AuthorizedAdminLogic extends BaseGetXController { // 转移权限 Future transferPermissionsAction() async { - BlueManage().bludSendData(BlueManage().connectDeviceName, + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState state) async { if (state == BluetoothConnectionState.connected) { var privateKey = await Storage.getStringList(saveBluePrivateKey); diff --git a/lib/main/lockDetail/card/addICCard/addICCard_logic.dart b/lib/main/lockDetail/card/addICCard/addICCard_logic.dart index d35af8ef..f25dbe42 100755 --- a/lib/main/lockDetail/card/addICCard/addICCard_logic.dart +++ b/lib/main/lockDetail/card/addICCard/addICCard_logic.dart @@ -147,7 +147,7 @@ class AddICCardLogic extends BaseGetXController{ showBlueConnetctToastTimer(action: (){ Get.close(1); }); - BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected){ cancelBlueConnetctToastTimer(); // var publicKey = await Storage.getStringList(saveBluePublicKey); @@ -193,7 +193,7 @@ class AddICCardLogic extends BaseGetXController{ // 取消添加指纹 Future senderCancelAddCardCommand() async { - BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected){ var privateKey = await Storage.getStringList(saveBluePrivateKey); List getPrivateKeyList = changeStringListToIntList(privateKey!); diff --git a/lib/main/lockDetail/card/cardDetail/cardDetail_logic.dart b/lib/main/lockDetail/card/cardDetail/cardDetail_logic.dart index 91e9a92b..c4c4d51f 100755 --- a/lib/main/lockDetail/card/cardDetail/cardDetail_logic.dart +++ b/lib/main/lockDetail/card/cardDetail/cardDetail_logic.dart @@ -100,7 +100,7 @@ class CardDetailLogic extends BaseGetXController{ dismissEasyLoading(); state.sureBtnState.value = 0; }); - BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected){ var signKey = await Storage.getStringList(saveBlueSignKey); List signKeyDataList = changeStringListToIntList(signKey!); diff --git a/lib/main/lockDetail/card/cardList/cardList_logic.dart b/lib/main/lockDetail/card/cardList/cardList_logic.dart index c02dce71..b1eabbff 100755 --- a/lib/main/lockDetail/card/cardList/cardList_logic.dart +++ b/lib/main/lockDetail/card/cardList/cardList_logic.dart @@ -229,7 +229,7 @@ class CardListLogic extends BaseGetXController { showBlueConnetctToastTimer(action: (){ dismissEasyLoading(); }); - BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected){ // var publicKey = await Storage.getStringList(saveBluePublicKey); // List publicKeyDataList = changeStringListToIntList(publicKey!); diff --git a/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_logic.dart b/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_logic.dart index 55a98228..28f18489 100755 --- a/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_logic.dart +++ b/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_logic.dart @@ -105,7 +105,7 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{ dismissEasyLoading(); state.sureBtnState.value = 0; }); - BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected) { var privateKey = await Storage.getStringList(saveBluePrivateKey); List getPrivateKeyList = changeStringListToIntList(privateKey!); @@ -257,7 +257,7 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{ dismissEasyLoading(); state.sureBtnState.value = 0; }); - BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected){ // var publicKey = await Storage.getStringList(saveBluePublicKey); // List publicKeyDataList = changeStringListToIntList(publicKey!); @@ -313,7 +313,7 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{ dismissEasyLoading(); state.sureBtnState.value = 0; }); - BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected){ var signKey = await Storage.getStringList(saveBlueSignKey); diff --git a/lib/main/lockDetail/card/otherTypeKeyChangeValidityDate/otherTypeKeyChangeValidityDate_logic.dart b/lib/main/lockDetail/card/otherTypeKeyChangeValidityDate/otherTypeKeyChangeValidityDate_logic.dart index 7fa54f98..3cde986b 100755 --- a/lib/main/lockDetail/card/otherTypeKeyChangeValidityDate/otherTypeKeyChangeValidityDate_logic.dart +++ b/lib/main/lockDetail/card/otherTypeKeyChangeValidityDate/otherTypeKeyChangeValidityDate_logic.dart @@ -107,7 +107,7 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{ dismissEasyLoading(); state.sureBtnState.value = 0; }); - BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected) { var privateKey = await Storage.getStringList(saveBluePrivateKey); List getPrivateKeyList = changeStringListToIntList(privateKey!); @@ -259,7 +259,7 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{ dismissEasyLoading(); state.sureBtnState.value = 0; }); - BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected){ // var publicKey = await Storage.getStringList(saveBluePublicKey); // List publicKeyDataList = changeStringListToIntList(publicKey!); @@ -315,7 +315,7 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{ dismissEasyLoading(); state.sureBtnState.value = 0; }); - BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected){ var signKey = await Storage.getStringList(saveBlueSignKey); diff --git a/lib/main/lockDetail/doorLockLog/doorLockLog_logic.dart b/lib/main/lockDetail/doorLockLog/doorLockLog_logic.dart index 4852578a..d0184b1c 100755 --- a/lib/main/lockDetail/doorLockLog/doorLockLog_logic.dart +++ b/lib/main/lockDetail/doorLockLog/doorLockLog_logic.dart @@ -106,7 +106,7 @@ class DoorLockLogLogic extends BaseGetXController { showBlueConnetctToastTimer(action: () { dismissEasyLoading(); }); - BlueManage().bludSendData(BlueManage().connectDeviceName, + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionStateState) async { if (connectionStateState == BluetoothConnectionState.connected) { var privateKey = await Storage.getStringList(saveBluePrivateKey); diff --git a/lib/main/lockDetail/face/addFace/addFace_logic.dart b/lib/main/lockDetail/face/addFace/addFace_logic.dart index b620dcce..0cbecfd2 100755 --- a/lib/main/lockDetail/face/addFace/addFace_logic.dart +++ b/lib/main/lockDetail/face/addFace/addFace_logic.dart @@ -186,7 +186,7 @@ class AddFaceLogic extends BaseGetXController { showBlueConnetctToastTimer(action: () { Get.close(1); }); - BlueManage().bludSendData(BlueManage().connectDeviceName, + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected) { cancelBlueConnetctToastTimer(); @@ -231,7 +231,7 @@ class AddFaceLogic extends BaseGetXController { // 取消添加指纹 Future senderCancelAddFaceCommand() async { - BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected){ var privateKey = await Storage.getStringList(saveBluePrivateKey); List getPrivateKeyList = changeStringListToIntList(privateKey!); diff --git a/lib/main/lockDetail/face/faceDetail/faceDetail_logic.dart b/lib/main/lockDetail/face/faceDetail/faceDetail_logic.dart index 55f62580..7e79a191 100755 --- a/lib/main/lockDetail/face/faceDetail/faceDetail_logic.dart +++ b/lib/main/lockDetail/face/faceDetail/faceDetail_logic.dart @@ -97,7 +97,7 @@ class FaceDetailLogic extends BaseGetXController { dismissEasyLoading(); state.sureBtnState.value = 0; }); - BlueManage().bludSendData(BlueManage().connectDeviceName, + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected) { var privateKey = await Storage.getStringList(saveBluePrivateKey); diff --git a/lib/main/lockDetail/face/faceList/faceList_logic.dart b/lib/main/lockDetail/face/faceList/faceList_logic.dart index 2f2e6708..1a166331 100755 --- a/lib/main/lockDetail/face/faceList/faceList_logic.dart +++ b/lib/main/lockDetail/face/faceList/faceList_logic.dart @@ -256,7 +256,7 @@ class FaceListLogic extends BaseGetXController { showBlueConnetctToastTimer(action: () { dismissEasyLoading(); }); - BlueManage().bludSendData(BlueManage().connectDeviceName, + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected) { diff --git a/lib/main/lockDetail/fingerprint/addFingerprint/addFingerprint_logic.dart b/lib/main/lockDetail/fingerprint/addFingerprint/addFingerprint_logic.dart index 5f7f5e0b..f01eb892 100755 --- a/lib/main/lockDetail/fingerprint/addFingerprint/addFingerprint_logic.dart +++ b/lib/main/lockDetail/fingerprint/addFingerprint/addFingerprint_logic.dart @@ -185,7 +185,7 @@ class AddFingerprintLogic extends BaseGetXController { showBlueConnetctToastTimer(action: (){ Get.close(1); }); - BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected){ var privateKey = await Storage.getStringList(saveBluePrivateKey); List getPrivateKeyList = changeStringListToIntList(privateKey!); @@ -227,7 +227,7 @@ class AddFingerprintLogic extends BaseGetXController { // 取消添加指纹 Future senderCancelAddFingerprintCommand() async { - BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected){ var privateKey = await Storage.getStringList(saveBluePrivateKey); List getPrivateKeyList = changeStringListToIntList(privateKey!); diff --git a/lib/main/lockDetail/fingerprint/fingerprintDetail/fingerprintDetail_logic.dart b/lib/main/lockDetail/fingerprint/fingerprintDetail/fingerprintDetail_logic.dart index b720e72a..67989e56 100755 --- a/lib/main/lockDetail/fingerprint/fingerprintDetail/fingerprintDetail_logic.dart +++ b/lib/main/lockDetail/fingerprint/fingerprintDetail/fingerprintDetail_logic.dart @@ -98,7 +98,7 @@ class FingerprintDetailLogic extends BaseGetXController{ dismissEasyLoading(); state.sureBtnState.value = 0; }); - BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected){ // var publicKey = await Storage.getStringList(saveBluePublicKey); // List publicKeyDataList = changeStringListToIntList(publicKey!); diff --git a/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_logic.dart b/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_logic.dart index fa4f92e5..4bffbc07 100755 --- a/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_logic.dart +++ b/lib/main/lockDetail/fingerprint/fingerprintList/fingerprintList_logic.dart @@ -189,7 +189,7 @@ class FingerprintListLogic extends BaseGetXController{ } // 获取指纹状态 Future senderQueryingFingerprintStatus() async { - BlueManage().bludSendData(BlueManage().connectDeviceName,(BluetoothConnectionState state) async { + BlueManage().blueSendData(BlueManage().connectDeviceName,(BluetoothConnectionState state) async { if (state == BluetoothConnectionState.connected) { var privateKey = await Storage.getStringList(saveBluePrivateKey); List getPrivateKeyList = changeStringListToIntList(privateKey!); @@ -217,7 +217,7 @@ class FingerprintListLogic extends BaseGetXController{ // 查询用户、指纹、密码、卡片数量(用于判断是否同步) Future senderCheckingUserInfoCount() async { - BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState state) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState state) async { if (state == BluetoothConnectionState.connected) { var privateKey = await Storage.getStringList(saveBluePrivateKey); List getPrivateKeyList = changeStringListToIntList(privateKey!); @@ -248,7 +248,7 @@ class FingerprintListLogic extends BaseGetXController{ showBlueConnetctToastTimer(action: (){ dismissEasyLoading(); }); - BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected){ // var publicKey = await Storage.getStringList(saveBluePublicKey); // List publicKeyDataList = changeStringListToIntList(publicKey!); diff --git a/lib/main/lockDetail/iris/irisDetail/irisDetail_logic.dart b/lib/main/lockDetail/iris/irisDetail/irisDetail_logic.dart index 4cff3b34..e5309102 100755 --- a/lib/main/lockDetail/iris/irisDetail/irisDetail_logic.dart +++ b/lib/main/lockDetail/iris/irisDetail/irisDetail_logic.dart @@ -90,7 +90,7 @@ class IrisDetailLogic extends BaseGetXController { dismissEasyLoading(); state.sureBtnState.value = 0; }); - BlueManage().bludSendData(BlueManage().connectDeviceName, + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected) { // var publicKey = await Storage.getStringList(saveBluePublicKey); diff --git a/lib/main/lockDetail/iris/irisList/irisList_logic.dart b/lib/main/lockDetail/iris/irisList/irisList_logic.dart index 228e0e45..f0b2f68c 100755 --- a/lib/main/lockDetail/iris/irisList/irisList_logic.dart +++ b/lib/main/lockDetail/iris/irisList/irisList_logic.dart @@ -189,7 +189,7 @@ class IrisListLogic extends BaseGetXController { // 获取人脸状态 Future senderQueryingFaceStatus() async { - BlueManage().bludSendData(BlueManage().connectDeviceName, + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState state) async { if (state == BluetoothConnectionState.connected) { var privateKey = await Storage.getStringList(saveBluePrivateKey); @@ -218,7 +218,7 @@ class IrisListLogic extends BaseGetXController { // 查询用户、指纹、密码、卡片数量(用于判断是否同步) Future senderCheckingUserInfoCount() async { - BlueManage().bludSendData(BlueManage().connectDeviceName, + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState state) async { if (state == BluetoothConnectionState.connected) { var privateKey = await Storage.getStringList(saveBluePrivateKey); @@ -250,7 +250,7 @@ class IrisListLogic extends BaseGetXController { showBlueConnetctToastTimer(action: () { dismissEasyLoading(); }); - BlueManage().bludSendData(BlueManage().connectDeviceName, + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected) { var signKey = await Storage.getStringList(saveBlueSignKey); diff --git a/lib/main/lockDetail/lockDetail/lockDetail_logic.dart b/lib/main/lockDetail/lockDetail/lockDetail_logic.dart index d8d2c5fc..aeae0a6a 100755 --- a/lib/main/lockDetail/lockDetail/lockDetail_logic.dart +++ b/lib/main/lockDetail/lockDetail/lockDetail_logic.dart @@ -33,21 +33,22 @@ import 'lockNetToken_entity.dart'; class LockDetailLogic extends BaseGetXController { final LockDetailState state = LockDetailState(); + // 监听设备返回的数据 void initReplySubscription() { state.replySubscription = EventBusManager().eventBus!.on().listen((Reply reply) async { - // 开门 - if (reply is OpenDoorReply && state.ifCurrentScreen.value == true) { - _replyOpenLock(reply); - } + // 开门 + if (reply is OpenDoorReply && state.ifCurrentScreen.value == true) { + _replyOpenLock(reply); + } - // 开完锁之后上传记录 - if (reply is SenderReferEventRecordTimeReply && - state.ifCurrentScreen.value == true) { - _replyReferEventRecordTime(reply); - } - }); + // 开完锁之后上传记录 + if (reply is SenderReferEventRecordTimeReply && + state.ifCurrentScreen.value == true) { + _replyReferEventRecordTime(reply); + } + }); } // 开门数据解析 @@ -56,8 +57,8 @@ class LockDetailLogic extends BaseGetXController { switch (status) { case 0x00: - //成功 - // _showFullScreenOverlay(Get.context!); + //成功 + // _showFullScreenOverlay(Get.context!); cancelBlueConnetctToastTimer(); state.iSClosedUnlockSuccessfulPopup.value = true; @@ -65,10 +66,10 @@ class LockDetailLogic extends BaseGetXController { // 如果没有点击关闭弹窗,3秒后自动关闭 state.closedUnlockSuccessfulTimer = Timer.periodic(3.seconds, (Timer timer) { - state.iSClosedUnlockSuccessfulPopup.value = false; - timer.cancel(); - eventBus.fire(RefreshLockDetailInfoDataEvent()); - }); + state.iSClosedUnlockSuccessfulPopup.value = false; + timer.cancel(); + eventBus.fire(RefreshLockDetailInfoDataEvent()); + }); // 电量 final int power = reply.data[7]; @@ -86,14 +87,14 @@ class LockDetailLogic extends BaseGetXController { resetOpenDoorState(); break; case 0x06: - //无权限 + //无权限 final List? privateKey = - await Storage.getStringList(saveBluePrivateKey); + await Storage.getStringList(saveBluePrivateKey); final List getPrivateKeyList = - changeStringListToIntList(privateKey!); + changeStringListToIntList(privateKey!); final List? signKey = - await Storage.getStringList(saveBlueSignKey); + await Storage.getStringList(saveBlueSignKey); final List signKeyDataList = changeStringListToIntList(signKey!); final List tokenData = reply.data.sublist(2, 6); @@ -113,71 +114,58 @@ class LockDetailLogic extends BaseGetXController { ); break; case 0x16: - // 正在开锁中... + // 正在开锁中... resetOpenDoorState(); showToast('正在开锁中...'.tr, something: () { cancelBlueConnetctToastTimer(); }); break; case 0x0d: - // 钥匙无效 + // 钥匙无效 showToast('钥匙无效'.tr); - // state.animationController!.stop(); - resetOpenDoorState(); - cancelBlueConnetctToastTimer(); - BlueManage().disconnect(); + openDoorError(); break; case 0x0b: - // 钥匙无效 + // 钥匙无效 showToast('钥匙过期'.tr); - resetOpenDoorState(); - - cancelBlueConnetctToastTimer(); - BlueManage().disconnect(); + openDoorError(); break; case 0x0a: - // 钥匙不存在 + // 钥匙不存在 showToast('钥匙不存在'); - resetOpenDoorState(); - - cancelBlueConnetctToastTimer(); - BlueManage().disconnect(); + openDoorError(); break; case 0x0c: - // 钥匙数量已到上限 + // 钥匙数量已到上限 showToast('钥匙数量已到上限'); - resetOpenDoorState(); - - cancelBlueConnetctToastTimer(); - BlueManage().disconnect(); + openDoorError(); break; case 0x0e: - // 钥匙已存在 + // 钥匙已存在 showToast('钥匙已存在'); - resetOpenDoorState(); - - cancelBlueConnetctToastTimer(); - BlueManage().disconnect(); + openDoorError(); break; case 0x0f: - // 用户已存在 + // 用户已存在 showToast('用户已存在'); - resetOpenDoorState(); - - cancelBlueConnetctToastTimer(); - BlueManage().disconnect(); + openDoorError(); break; default: - //失败 + //失败 AppLog.log('开锁失败'); - // state.animationController!.stop(); - resetOpenDoorState(); - cancelBlueConnetctToastTimer(); - BlueManage().disconnect(); + openDoorError(); break; } } + //开门指令失败 + void openDoorError() { + resetOpenDoorState(); + state.animationController!.stop(); + cancelBlueConnetctToastTimer(); + BlueManage().disconnect(); + } + //清除开锁动画以及状态 void closeLuckStatus() { state.openLockBtnState.value = 0; @@ -190,67 +178,67 @@ class LockDetailLogic extends BaseGetXController { Future _replyReferEventRecordTime(Reply reply) async { final int status = reply.data[2]; switch (status) { - case 0x00: - //成功 - final int dataLength = (reply.data[5] << 8) + reply.data[6]; - // AppLog.log("dataLength:$dataLength"); - if (dataLength > 0) { - reply.data.removeRange(0, 7); - // 把得到的数据按17个字节分割成数组 然后塞进一个新的数组里面 - if (reply.data.length < 17) { - return; - } - final List> getList = splitList(reply.data, 17); - // AppLog.log("getList:$getList"); - final List uploadList = []; - for (int i = 0; i < getList.length; i++) { - final List indexList = getList[i]; - // AppLog.log("indexList:$indexList"); - final Map indexMap = {}; - indexMap['type'] = indexList[0].toString(); - int operateDate = 0; - if (indexList[0] == 2) { - final List passwordData = reply.data.sublist(7, 17); - final String password = utf8String(passwordData); - indexMap['user'] = password.toString(); - } else { - final int userNo = (indexList[1] * 256) + indexList[2]; - indexMap['user'] = userNo.toString(); - } + case 0x00: + //成功 + final int dataLength = (reply.data[5] << 8) + reply.data[6]; + // AppLog.log("dataLength:$dataLength"); + if (dataLength > 0) { + reply.data.removeRange(0, 7); + // 把得到的数据按17个字节分割成数组 然后塞进一个新的数组里面 + if (reply.data.length < 17) { + return; + } + final List> getList = splitList(reply.data, 17); + // AppLog.log("getList:$getList"); + final List uploadList = []; + for (int i = 0; i < getList.length; i++) { + final List indexList = getList[i]; + // AppLog.log("indexList:$indexList"); + final Map indexMap = {}; + indexMap['type'] = indexList[0].toString(); + int operateDate = 0; + if (indexList[0] == 2) { + final List passwordData = reply.data.sublist(7, 17); + final String password = utf8String(passwordData); + indexMap['user'] = password.toString(); + } else { + final int userNo = (indexList[1] * 256) + indexList[2]; + indexMap['user'] = userNo.toString(); + } - indexMap['success'] = '1'; + indexMap['success'] = '1'; - final int time = ((0xff & indexList[(3)]) << 24 | - (0xff & indexList[4]) << 16 | - (0xff & indexList[5]) << 8 | - (0xFF & indexList[6])); - operateDate = time * 1000; - indexMap['date'] = '$operateDate'; - uploadList.add(indexMap); + final int time = ((0xff & indexList[(3)]) << 24 | + (0xff & indexList[4]) << 16 | + (0xff & indexList[5]) << 8 | + (0xFF & indexList[6])); + operateDate = time * 1000; + indexMap['date'] = '$operateDate'; + uploadList.add(indexMap); - if (i == getList.length - 1) { - //设置最后的时间戳 - state.operateDate = operateDate; - } - } - lockRecordUploadData(uploadList); + if (i == getList.length - 1) { + //设置最后的时间戳 + state.operateDate = operateDate; + } + } + lockRecordUploadData(uploadList); - if (dataLength == state.logCountPage) { - senderReferEventRecordTime(); - } else { - await BlueManage().disconnect(); - } - } - break; - case 0x06: - //无权限 - BlueManage().disconnect(); - cancelBlueConnetctToastTimer(); - break; - default: - BlueManage().disconnect(); - cancelBlueConnetctToastTimer(); - break; + if (dataLength == state.logCountPage) { + senderReferEventRecordTime(); + } else { + await BlueManage().disconnect(); + } + } + break; + case 0x06: + //无权限 + BlueManage().disconnect(); + cancelBlueConnetctToastTimer(); + break; + default: + BlueManage().disconnect(); + cancelBlueConnetctToastTimer(); + break; } } @@ -258,11 +246,11 @@ class LockDetailLogic extends BaseGetXController { Future openDoorAction() async { showBlueConnetctToastTimer(action: () { resetOpenDoorState(); - // BlueManage().stopScan(); + closeLuckStatus(); BlueManage().disconnect(); }); final List? privateKey = - await Storage.getStringList(saveBluePrivateKey); + await Storage.getStringList(saveBluePrivateKey); final List getPrivateKeyList = changeStringListToIntList(privateKey!); final List? signKey = await Storage.getStringList(saveBlueSignKey); @@ -272,89 +260,83 @@ class LockDetailLogic extends BaseGetXController { final List getTokenList = changeStringListToIntList(token!); BlueManage() - .bludSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!, + .blueSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!, (BluetoothConnectionState deviceConnectionState) async { - if (deviceConnectionState == BluetoothConnectionState.connected) { - IoSenderManage.senderOpenLock( - keyID: BlueManage().connectDeviceName, - userID: await Storage.getUid(), - openMode: state.openDoorModel, - openTime: getUTCNetTime(), - onlineToken: state.lockNetToken, - token: getTokenList, - needAuthor: 1, - signKey: signKeyDataList, - privateKey: getPrivateKeyList, - ); - } else if (deviceConnectionState == - BluetoothConnectionState.disconnected) { - cancelBlueConnetctToastTimer(); - if (state.ifCurrentScreen.value == true) { - showBlueConnetctToast(); - } + if (deviceConnectionState == BluetoothConnectionState.connected) { + IoSenderManage.senderOpenLock( + keyID: BlueManage().connectDeviceName, + userID: await Storage.getUid(), + openMode: state.openDoorModel, + openTime: getUTCNetTime(), + onlineToken: state.lockNetToken, + token: getTokenList, + needAuthor: 1, + signKey: signKeyDataList, + privateKey: getPrivateKeyList, + ); + } else if (deviceConnectionState == + BluetoothConnectionState.disconnected) { + cancelBlueConnetctToastTimer(); + if (state.ifCurrentScreen.value == true) { + showBlueConnetctToast(); + } - resetOpenDoorState(); - } - }); + resetOpenDoorState(); + } + }); } // 查询事件记录(时间查询) Future senderReferEventRecordTime() async { showBlueConnetctToastTimer( isShowBlueConnetctToast: false, - outTimer: 10, action: () { BlueManage().disconnect(); }); - BlueManage().bludSendData(BlueManage().connectDeviceName, - (BluetoothConnectionState connectionState) async { - if (connectionState == BluetoothConnectionState.connected) { - final List? privateKey = + BlueManage().blueSendData(BlueManage().connectDeviceName, + (BluetoothConnectionState connectionState) async { + if (connectionState == BluetoothConnectionState.connected) { + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); - final List getPrivateKeyList = + final List getPrivateKeyList = changeStringListToIntList(privateKey!); - final List? token = await Storage.getStringList( - saveBlueToken); - final List getTokenList = changeStringListToIntList(token!); + final List? token = await Storage.getStringList(saveBlueToken); + final List getTokenList = changeStringListToIntList(token!); - final List? publicKey = + final List? publicKey = await Storage.getStringList(saveBluePublicKey); - final List getPublicKeyList = + final List getPublicKeyList = changeStringListToIntList(publicKey!); - IoSenderManage.senderReferEventRecordTimeCommand( - keyID: BlueManage().connectDeviceName, - userID: await Storage.getUid(), - logsCount: state.logCountPage, - // time:DateTime.now().millisecondsSinceEpoch~/1000, - time: state.operateDate, - token: getTokenList, - needAuthor: 1, - publicKey: getPublicKeyList, - privateKey: getPrivateKeyList, - ); - } - }); + IoSenderManage.senderReferEventRecordTimeCommand( + keyID: BlueManage().connectDeviceName, + userID: await Storage.getUid(), + logsCount: state.logCountPage, + // time:DateTime.now().millisecondsSinceEpoch~/1000, + time: state.operateDate, + token: getTokenList, + needAuthor: 1, + publicKey: getPublicKeyList, + privateKey: getPrivateKeyList, + ); + } + }); } // 从服务器获取锁的时间 开锁时传入 void getServerDatetime() async { final GetServerDatetimeEntity entity = - await ApiRepository.to.getServerDatetimeData(); + await ApiRepository.to.getServerDatetimeData(); if (entity.errorCode!.codeIsSuccessful) { state.differentialTime = entity.data!.date! ~/ 1000 - - DateTime - .now() - .millisecondsSinceEpoch ~/ 1000; + DateTime.now().millisecondsSinceEpoch ~/ 1000; // AppLog.log("entity.data!.date! ~/ 1000:${entity.data!.date! ~/ 1000} DateTime.now().millisecondsSinceEpoch ~/ 1000:${DateTime.now().millisecondsSinceEpoch ~/ 1000} 服务器时间差:${state.differentialTime}"); } } int getUTCNetTime() { - return DateTime - .now() - .millisecondsSinceEpoch ~/ 1000 + + return DateTime.now().millisecondsSinceEpoch ~/ 1000 + state.differentialTime; } @@ -380,11 +362,11 @@ class LockDetailLogic extends BaseGetXController { Future uploadElectricQuantityRequest() async { final KeyOperationRecordEntity entity = await ApiRepository.to .uploadElectricQuantity( - electricQuantity: state.electricQuantity.value.toString(), - electricQuantityStandby: - state.electricQuantityStandby.value.toString(), - lockId: state.keyInfos.value.lockId.toString(), - isUnShowLoading: true); + electricQuantity: state.electricQuantity.value.toString(), + electricQuantityStandby: + state.electricQuantityStandby.value.toString(), + lockId: state.keyInfos.value.lockId.toString(), + isUnShowLoading: true); if (entity.errorCode!.codeIsSuccessful) { SchedulerBinding.instance.addPostFrameCallback((_) { eventBus.fire(RefreshLockListInfoDataEvent(isUnShowLoading: true)); @@ -395,8 +377,8 @@ class LockDetailLogic extends BaseGetXController { // 查询锁记录最后时间 void getLockRecordLastUploadDataTime() async { final LockOperatingRecordGetLastRecordTimeEntity entity = - await ApiRepository.to.getLockRecordLastUploadDataTime( - lockId: state.keyInfos.value.lockId.toString()); + await ApiRepository.to.getLockRecordLastUploadDataTime( + lockId: state.keyInfos.value.lockId.toString()); if (entity.errorCode!.codeIsSuccessful) { state.operateDate = entity.data!.operateDate! ~/ 1000; senderReferEventRecordTime(); @@ -407,7 +389,7 @@ class LockDetailLogic extends BaseGetXController { Future lockRecordUploadData(List list) async { final KeyOperationRecordEntity entity = await ApiRepository.to .lockRecordUploadData( - lockId: state.keyInfos.value.lockId.toString(), records: list); + lockId: state.keyInfos.value.lockId.toString(), records: list); if (entity.errorCode!.codeIsSuccessful) { // mockNetworkDataRequest(); AppLog.log( @@ -423,7 +405,7 @@ class LockDetailLogic extends BaseGetXController { void deletKeyData() async { final ElectronicKeyListEntity entity = await ApiRepository.to .deleteElectronicKey( - keyId: state.keyInfos.value.keyId.toString(), includeUnderlings: 0); + keyId: state.keyInfos.value.keyId.toString(), includeUnderlings: 0); if (entity.errorCode!.codeIsSuccessful) { BlueManage().connectDeviceMacAddress = ''; SchedulerBinding.instance.addPostFrameCallback((_) { @@ -440,51 +422,50 @@ class LockDetailLogic extends BaseGetXController { eventBus .on() .listen((LockSetChangeSetRefreshLockDetailWithType event) { - if (event.type == 0) { - // 0考勤 - state.isAttendance.value = int.parse(event.setResult); - state.keyInfos.value.lockSetting!.attendance = - int.parse(event.setResult); - } else if (event.type == 1) { - // 1 开锁时是否需联网 - state.isOpenLockNeedOnline.value = int.parse(event.setResult); - state.keyInfos.value.lockSetting!.appUnlockOnline = - int.parse(event.setResult); - state.lockNetToken = ''; // 改变开锁时是否联网状态的时候清空token - } else if (event.type == 2) { - // 2 常开模式 - state.isOpenPassageMode.value = int.parse(event.setResult); - state.keyInfos.value.passageMode = int.parse(event.setResult); - } else if (event.type == 3) { - // 3 修改了锁名字 - state.lockAlias.value = event.setResult; - state.keyInfos.value.lockAlias = event.setResult; - Storage.setString(saveLockAlias, state.lockAlias.value); - } else if (event.type == 4) { - // 4 更新了电量 - state.electricQuantity.value = int.parse(event.setResult); - state.keyInfos.value.electricQuantity = int.parse(event.setResult); - } else if (event.type == 5) { - // 5 远程开锁 - state.keyInfos.value.lockSetting!.remoteUnlock = - int.parse(event.setResult); - } - CommonDataManage().currentKeyInfo = state.keyInfos.value; - eventBus.fire(RefreshLockDetailInfoDataEvent()); - }); + if (event.type == 0) { + // 0考勤 + state.isAttendance.value = int.parse(event.setResult); + state.keyInfos.value.lockSetting!.attendance = + int.parse(event.setResult); + } else if (event.type == 1) { + // 1 开锁时是否需联网 + state.isOpenLockNeedOnline.value = int.parse(event.setResult); + state.keyInfos.value.lockSetting!.appUnlockOnline = + int.parse(event.setResult); + state.lockNetToken = ''; // 改变开锁时是否联网状态的时候清空token + } else if (event.type == 2) { + // 2 常开模式 + state.isOpenPassageMode.value = int.parse(event.setResult); + state.keyInfos.value.passageMode = int.parse(event.setResult); + } else if (event.type == 3) { + // 3 修改了锁名字 + state.lockAlias.value = event.setResult; + state.keyInfos.value.lockAlias = event.setResult; + Storage.setString(saveLockAlias, state.lockAlias.value); + } else if (event.type == 4) { + // 4 更新了电量 + state.electricQuantity.value = int.parse(event.setResult); + state.keyInfos.value.electricQuantity = int.parse(event.setResult); + } else if (event.type == 5) { + // 5 远程开锁 + state.keyInfos.value.lockSetting!.remoteUnlock = + int.parse(event.setResult); + } + CommonDataManage().currentKeyInfo = state.keyInfos.value; + eventBus.fire(RefreshLockDetailInfoDataEvent()); + }); } String getKeyStatusTextAndShow() { String text = ''; if (state.keyInfos.value.keyStatus == - XSConstantMacro.keyStatusWaitIneffective || + XSConstantMacro.keyStatusWaitIneffective || state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusFrozen || state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusExpired || state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusDeleted || state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusReset) { text = - "${"你的钥匙".tr}${XSConstantMacro.getKeyStatusStr( - state.keyInfos.value.keyStatus!)}"; + "${"你的钥匙".tr}${XSConstantMacro.getKeyStatusStr(state.keyInfos.value.keyStatus!)}"; } else { text = state.isOpenPassageMode.value == 1 ? '常开模式启动!长按闭锁'.tr @@ -517,8 +498,8 @@ class LockDetailLogic extends BaseGetXController { await PermissionDialog.request(Permission.location); await PermissionDialog.requestBluetooth(); - final String connectDeviceName = state.keyInfos.value.bluetooth! - .bluetoothDeviceName!; + final String connectDeviceName = + state.keyInfos.value.bluetooth!.bluetoothDeviceName!; if (!BlueManage().isExistScanDevices(connectDeviceName)) { BlueManage().startScanSingle( connectDeviceName, 15, (List p0) => null); @@ -528,6 +509,5 @@ class LockDetailLogic extends BaseGetXController { @override void onInit() { super.onInit(); - } } diff --git a/lib/main/lockDetail/lockDetail/lockDetail_page.dart b/lib/main/lockDetail/lockDetail/lockDetail_page.dart index f179465c..8ad51780 100755 --- a/lib/main/lockDetail/lockDetail/lockDetail_page.dart +++ b/lib/main/lockDetail/lockDetail/lockDetail_page.dart @@ -1249,9 +1249,10 @@ class _LockDetailPageState extends State ), Positioned( top: 180.h, - left: 55.w, + width: 358.w, child: Column( mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( state.keyInfos.value.lockAlias!, @@ -1318,7 +1319,7 @@ class _LockDetailPageState extends State } } - void startOpenLock() { + void startOpenLock() { if (state.openLockBtnState.value == 1) { return; } diff --git a/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_logic.dart b/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_logic.dart index ebb452f9..b3abc8b5 100755 --- a/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_logic.dart +++ b/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_logic.dart @@ -97,7 +97,7 @@ class LockOperatingRecordLogic extends BaseGetXController { showBlueConnetctToastTimer(action: (){ dismissEasyLoading(); }); - BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionStateState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionStateState) async { if (connectionStateState == BluetoothConnectionState.connected) { var privateKey = await Storage.getStringList(saveBluePrivateKey); List getPrivateKeyList = changeStringListToIntList(privateKey!); diff --git a/lib/main/lockDetail/lockSet/automaticBlocking/automaticBlocking_logic.dart b/lib/main/lockDetail/lockSet/automaticBlocking/automaticBlocking_logic.dart index 4195839e..fafc4bc8 100755 --- a/lib/main/lockDetail/lockSet/automaticBlocking/automaticBlocking_logic.dart +++ b/lib/main/lockDetail/lockSet/automaticBlocking/automaticBlocking_logic.dart @@ -116,7 +116,7 @@ class AutomaticBlockingLogic extends BaseGetXController{ dismissEasyLoading(); state.sureBtnState.value = 0; }); - BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { if (connectionState == BluetoothConnectionState.connected) { var privateKey = await Storage.getStringList(saveBluePrivateKey); List getPrivateKeyList = changeStringListToIntList(privateKey!); diff --git a/lib/main/lockDetail/lockSet/basicInformation/adminOpenLockPassword/adminOpenLockPassword_logic.dart b/lib/main/lockDetail/lockSet/basicInformation/adminOpenLockPassword/adminOpenLockPassword_logic.dart index 51e88f6a..2c1f9b47 100755 --- a/lib/main/lockDetail/lockSet/basicInformation/adminOpenLockPassword/adminOpenLockPassword_logic.dart +++ b/lib/main/lockDetail/lockSet/basicInformation/adminOpenLockPassword/adminOpenLockPassword_logic.dart @@ -188,7 +188,7 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{ dismissEasyLoading(); state.sureBtnState.value = 0; }); - BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected) { var signKey = await Storage.getStringList(saveBlueSignKey); List signKeyDataList = changeStringListToIntList(signKey!); diff --git a/lib/main/lockDetail/lockSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_logic.dart b/lib/main/lockDetail/lockSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_logic.dart index 819af46a..95244889 100755 --- a/lib/main/lockDetail/lockSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_logic.dart +++ b/lib/main/lockDetail/lockSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_logic.dart @@ -50,7 +50,7 @@ class UploadElectricQuantityLogic extends BaseGetXController { dismissEasyLoading(); state.sureBtnState.value = 0; }); - BlueManage().bludSendData(BlueManage().connectDeviceName, + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected) { dismissEasyLoading(); diff --git a/lib/main/lockDetail/lockSet/burglarAlarm/burglarAlarm_logic.dart b/lib/main/lockDetail/lockSet/burglarAlarm/burglarAlarm_logic.dart index 1d008567..ec231e32 100755 --- a/lib/main/lockDetail/lockSet/burglarAlarm/burglarAlarm_logic.dart +++ b/lib/main/lockDetail/lockSet/burglarAlarm/burglarAlarm_logic.dart @@ -99,7 +99,7 @@ class BurglarAlarmLogic extends BaseGetXController{ dismissEasyLoading(); state.sureBtnState.value = 0; }); - BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { if (connectionState == BluetoothConnectionState.connected) { var privateKey = await Storage.getStringList(saveBluePrivateKey); List getPrivateKeyList = changeStringListToIntList(privateKey!); diff --git a/lib/main/lockDetail/lockSet/configuringWifi/configuringWifi/configuringWifi_logic.dart b/lib/main/lockDetail/lockSet/configuringWifi/configuringWifi/configuringWifi_logic.dart index 68f4810c..340ccc1b 100755 --- a/lib/main/lockDetail/lockSet/configuringWifi/configuringWifi/configuringWifi_logic.dart +++ b/lib/main/lockDetail/lockSet/configuringWifi/configuringWifi/configuringWifi_logic.dart @@ -136,7 +136,7 @@ class ConfiguringWifiLogic extends BaseGetXController{ dismissEasyLoading(); state.sureBtnState.value = 0; }); - BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { if (connectionState == BluetoothConnectionState.connected){ var privateKey = await Storage.getStringList(saveBluePrivateKey); List getPrivateKeyList = changeStringListToIntList(privateKey!); diff --git a/lib/main/lockDetail/lockSet/configuringWifi/wifiList/wifiList_logic.dart b/lib/main/lockDetail/lockSet/configuringWifi/wifiList/wifiList_logic.dart index 5f814347..77456721 100755 --- a/lib/main/lockDetail/lockSet/configuringWifi/wifiList/wifiList_logic.dart +++ b/lib/main/lockDetail/lockSet/configuringWifi/wifiList/wifiList_logic.dart @@ -113,7 +113,7 @@ class WifiListLogic extends BaseGetXController { dismissEasyLoading(); state.sureBtnState.value = 0; }); - BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { if (connectionState == BluetoothConnectionState.connected){ var token = await Storage.getStringList(saveBlueToken); List getTokenList = changeStringListToIntList(token!); diff --git a/lib/main/lockDetail/lockSet/lockEscalation/lockEscalation_logic.dart b/lib/main/lockDetail/lockSet/lockEscalation/lockEscalation_logic.dart index 62f4c274..db0570b1 100755 --- a/lib/main/lockDetail/lockSet/lockEscalation/lockEscalation_logic.dart +++ b/lib/main/lockDetail/lockSet/lockEscalation/lockEscalation_logic.dart @@ -80,7 +80,7 @@ class LockEscalationLogic extends BaseGetXController { //蓝牙操作 ota 升级 void blueOTAUpgrade(Map data, List token) { - BlueManage().bludSendData(BlueManage().connectDeviceName, + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected) { var privateKey = await Storage.getStringList(saveBluePrivateKey); diff --git a/lib/main/lockDetail/lockSet/lockSet/lockSet_logic.dart b/lib/main/lockDetail/lockSet/lockSet/lockSet_logic.dart index f2dff1ce..e0b17943 100755 --- a/lib/main/lockDetail/lockSet/lockSet/lockSet_logic.dart +++ b/lib/main/lockDetail/lockSet/lockSet/lockSet_logic.dart @@ -245,7 +245,7 @@ class LockSetLogic extends BaseGetXController { dismissEasyLoading(); showDeletAlertTipDialog(); }); - BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { if (connectionState == BluetoothConnectionState.connected) { var privateKey = await Storage.getStringList(saveBluePrivateKey); List getPrivateKeyList = changeStringListToIntList(privateKey!); @@ -306,7 +306,7 @@ class LockSetLogic extends BaseGetXController { showBlueConnetctToastTimer(action: (){ dismissEasyLoading(); }); - BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { if (connectionState == BluetoothConnectionState.connected) { var privateKey = await Storage.getStringList(saveBluePrivateKey); List getPrivateKeyList = changeStringListToIntList(privateKey!); diff --git a/lib/main/lockDetail/lockSet/lockSoundSet/lockSoundSet_logic.dart b/lib/main/lockDetail/lockSet/lockSoundSet/lockSoundSet_logic.dart index d2ea4555..7333c47c 100755 --- a/lib/main/lockDetail/lockSet/lockSoundSet/lockSoundSet_logic.dart +++ b/lib/main/lockDetail/lockSet/lockSoundSet/lockSoundSet_logic.dart @@ -103,7 +103,7 @@ class LockSoundSetLogic extends BaseGetXController { dismissEasyLoading(); state.sureBtnState.value = 0; }); - BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { if (connectionState == BluetoothConnectionState.connected) { var privateKey = await Storage.getStringList(saveBluePrivateKey); List getPrivateKeyList = changeStringListToIntList(privateKey!); diff --git a/lib/main/lockDetail/lockSet/lockTime/lockTime_logic.dart b/lib/main/lockDetail/lockSet/lockTime/lockTime_logic.dart index 9bccc128..961bdf42 100755 --- a/lib/main/lockDetail/lockSet/lockTime/lockTime_logic.dart +++ b/lib/main/lockDetail/lockSet/lockTime/lockTime_logic.dart @@ -103,7 +103,7 @@ class LockTimeLogic extends BaseGetXController{ dismissEasyLoading(); state.sureBtnState.value = 0; }); - BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { if (connectionState == BluetoothConnectionState.connected) { var privateKey = await Storage.getStringList(saveBluePrivateKey); List getPrivateKeyList = changeStringListToIntList(privateKey!); diff --git a/lib/main/lockDetail/lockSet/motorPower/motorPower_logic.dart b/lib/main/lockDetail/lockSet/motorPower/motorPower_logic.dart index e75f83b8..943480f9 100755 --- a/lib/main/lockDetail/lockSet/motorPower/motorPower_logic.dart +++ b/lib/main/lockDetail/lockSet/motorPower/motorPower_logic.dart @@ -84,7 +84,7 @@ class MotorPowerLogic extends BaseGetXController { // 读取支持功能-带参数 Future _readSupportFunctionsNoParameters() async { - BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { if (connectionState == BluetoothConnectionState.connected) { var privateKey = await Storage.getStringList(saveBluePrivateKey); List getPrivateKeyList = changeStringListToIntList(privateKey!); @@ -110,7 +110,7 @@ class MotorPowerLogic extends BaseGetXController { // 设置支持功能(带参数) Future sendOpenDoorDirection() async { - BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { if (connectionState == BluetoothConnectionState.connected) { var privateKey = await Storage.getStringList(saveBluePrivateKey); List getPrivateKeyList = changeStringListToIntList(privateKey!); diff --git a/lib/main/lockDetail/lockSet/normallyOpenMode/normallyOpenMode_logic.dart b/lib/main/lockDetail/lockSet/normallyOpenMode/normallyOpenMode_logic.dart index fa9ed712..37aaba23 100755 --- a/lib/main/lockDetail/lockSet/normallyOpenMode/normallyOpenMode_logic.dart +++ b/lib/main/lockDetail/lockSet/normallyOpenMode/normallyOpenMode_logic.dart @@ -120,7 +120,7 @@ class NormallyOpenModeLogic extends BaseGetXController{ dismissEasyLoading(); state.sureBtnState.value = 0; }); - BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { if (connectionState == BluetoothConnectionState.connected) { var privateKey = await Storage.getStringList(saveBluePrivateKey); List getPrivateKeyList = changeStringListToIntList(privateKey!); diff --git a/lib/main/lockDetail/lockSet/openDoorDirection/openDoorDirection_logic.dart b/lib/main/lockDetail/lockSet/openDoorDirection/openDoorDirection_logic.dart index da169195..b9dce4b6 100755 --- a/lib/main/lockDetail/lockSet/openDoorDirection/openDoorDirection_logic.dart +++ b/lib/main/lockDetail/lockSet/openDoorDirection/openDoorDirection_logic.dart @@ -86,7 +86,7 @@ class OpenDoorDirectionLogic extends BaseGetXController { // 设置支持功能(带参数) Future sendOpenDoorDirection() async { showEasyLoading(); - BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { dismissEasyLoading(); if (connectionState == BluetoothConnectionState.connected) { var privateKey = await Storage.getStringList(saveBluePrivateKey); diff --git a/lib/main/lockDetail/lockSet/remoteUnlocking/remoteUnlocking_logic.dart b/lib/main/lockDetail/lockSet/remoteUnlocking/remoteUnlocking_logic.dart index 1362d523..fd65a94e 100755 --- a/lib/main/lockDetail/lockSet/remoteUnlocking/remoteUnlocking_logic.dart +++ b/lib/main/lockDetail/lockSet/remoteUnlocking/remoteUnlocking_logic.dart @@ -109,7 +109,7 @@ class RemoteUnlockingLogic extends BaseGetXController { dismissEasyLoading(); state.sureBtnState.value = 0; }); - BlueManage().bludSendData(BlueManage().connectDeviceName, + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { if (connectionState == BluetoothConnectionState.connected) { var privateKey = await Storage.getStringList(saveBluePrivateKey); diff --git a/lib/main/lockDetail/lockSet/resetButton/resetButton_logic.dart b/lib/main/lockDetail/lockSet/resetButton/resetButton_logic.dart index 0b6a57a4..233f464a 100755 --- a/lib/main/lockDetail/lockSet/resetButton/resetButton_logic.dart +++ b/lib/main/lockDetail/lockSet/resetButton/resetButton_logic.dart @@ -98,7 +98,7 @@ class ResetButtonLogic extends BaseGetXController{ dismissEasyLoading(); state.sureBtnState.value = 0; }); - BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { if (connectionState == BluetoothConnectionState.connected) { var privateKey = await Storage.getStringList(saveBluePrivateKey); List getPrivateKeyList = changeStringListToIntList(privateKey!); diff --git a/lib/main/lockDetail/palm/palmDetail/palmDetail_logic.dart b/lib/main/lockDetail/palm/palmDetail/palmDetail_logic.dart index 51faf569..c92a3a67 100755 --- a/lib/main/lockDetail/palm/palmDetail/palmDetail_logic.dart +++ b/lib/main/lockDetail/palm/palmDetail/palmDetail_logic.dart @@ -89,7 +89,7 @@ class PalmDetailLogic extends BaseGetXController { dismissEasyLoading(); state.sureBtnState.value = 0; }); - BlueManage().bludSendData(BlueManage().connectDeviceName, + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected) { // var publicKey = await Storage.getStringList(saveBluePublicKey); diff --git a/lib/main/lockDetail/palm/palmList/palmList_logic.dart b/lib/main/lockDetail/palm/palmList/palmList_logic.dart index 6ae1c428..8e51ff12 100755 --- a/lib/main/lockDetail/palm/palmList/palmList_logic.dart +++ b/lib/main/lockDetail/palm/palmList/palmList_logic.dart @@ -185,7 +185,7 @@ class PalmListLogic extends BaseGetXController { // 获取人脸状态 Future senderQueryingFaceStatus() async { - BlueManage().bludSendData(BlueManage().connectDeviceName, + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState state) async { if (state == BluetoothConnectionState.connected) { var privateKey = await Storage.getStringList(saveBluePrivateKey); @@ -214,7 +214,7 @@ class PalmListLogic extends BaseGetXController { // 查询用户、指纹、密码、卡片数量(用于判断是否同步) Future senderCheckingUserInfoCount() async { - BlueManage().bludSendData(BlueManage().connectDeviceName, + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState state) async { if (state == BluetoothConnectionState.connected) { var privateKey = await Storage.getStringList(saveBluePrivateKey); @@ -246,7 +246,7 @@ class PalmListLogic extends BaseGetXController { showBlueConnetctToastTimer(action: () { dismissEasyLoading(); }); - BlueManage().bludSendData(BlueManage().connectDeviceName, + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected) { var signKey = await Storage.getStringList(saveBlueSignKey); diff --git a/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart b/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart index 34a698cc..28c999e7 100755 --- a/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart +++ b/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart @@ -127,7 +127,7 @@ class PasswordKeyDetailLogic extends BaseGetXController { dismissEasyLoading(); state.sureBtnState.value = 0; }); - BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected) { var signKey = await Storage.getStringList(saveBlueSignKey); List signKeyDataList = changeStringListToIntList(signKey!); diff --git a/lib/main/lockDetail/passwordKey/passwordKeyDetailChangeDate/passwordKeyDetailChangeDate_logic.dart b/lib/main/lockDetail/passwordKey/passwordKeyDetailChangeDate/passwordKeyDetailChangeDate_logic.dart index 963515a1..f583fdb2 100755 --- a/lib/main/lockDetail/passwordKey/passwordKeyDetailChangeDate/passwordKeyDetailChangeDate_logic.dart +++ b/lib/main/lockDetail/passwordKey/passwordKeyDetailChangeDate/passwordKeyDetailChangeDate_logic.dart @@ -121,7 +121,7 @@ class PasswordKeyDetailChangeDateLogic extends BaseGetXController { dismissEasyLoading(); state.sureBtnState.value = 0; }); - BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected) { var signKey = await Storage.getStringList(saveBlueSignKey); List signKeyDataList = changeStringListToIntList(signKey!); diff --git a/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart b/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart index 71a95cbe..fe252ea0 100755 --- a/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart +++ b/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart @@ -128,7 +128,7 @@ class PasswordKeyListLogic extends BaseGetXController { showBlueConnetctToastTimer(action: (){ dismissEasyLoading(); }); - BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected) { var signKey = await Storage.getStringList(saveBlueSignKey); List signKeyDataList = changeStringListToIntList(signKey!); @@ -177,7 +177,7 @@ class PasswordKeyListLogic extends BaseGetXController { dismissEasyLoading(); state.sureBtnState.value = 0; }); - BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected) { var signKey = await Storage.getStringList(saveBlueSignKey); List signKeyDataList = changeStringListToIntList(signKey!); diff --git a/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart b/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart index 48a5c689..0d6122d3 100755 --- a/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart +++ b/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart @@ -342,7 +342,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { dismissEasyLoading(); state.sureBtnState.value = 0; }); - BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected) { var signKey = await Storage.getStringList(saveBlueSignKey); List signKeyDataList = changeStringListToIntList(signKey!); diff --git a/lib/main/lockMian/lockList/lockList_logic.dart b/lib/main/lockMian/lockList/lockList_logic.dart index db7de770..fff0e86b 100755 --- a/lib/main/lockMian/lockList/lockList_logic.dart +++ b/lib/main/lockMian/lockList/lockList_logic.dart @@ -181,7 +181,7 @@ class LockListLogic extends BaseGetXController{ dismissEasyLoading(); showDeletAlertTipDialog(); }); - BlueManage().bludSendData(state.lockListInfoItemEntity.lockName!, (BluetoothConnectionState connectionState) async { + BlueManage().blueSendData(state.lockListInfoItemEntity.lockName!, (BluetoothConnectionState connectionState) async { if (connectionState == BluetoothConnectionState.connected) { List publicKeyData = state.lockListInfoItemEntity.bluetooth!.publicKey!.cast(); var saveStrList = changeIntListToStringList(publicKeyData); diff --git a/lib/mine/about/debug/controller.dart b/lib/mine/about/debug/controller.dart index 04b324b0..b5c67ff1 100755 --- a/lib/mine/about/debug/controller.dart +++ b/lib/mine/about/debug/controller.dart @@ -108,7 +108,7 @@ class DebugConsoleController { return; } - BlueManage().bludSendData(BlueManage().connectDeviceName, + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected) { var privateKey = await Storage.getStringList(saveBluePrivateKey); @@ -179,7 +179,7 @@ class DebugConsoleController { tokenList = changeStringListToIntList(tokenKey!); } - BlueManage().bludSendData(BlueManage().connectDeviceName, + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected) { IoSenderManage.senderCleanUpUsersCommand( diff --git a/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart b/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart index 2f5533fa..f703e39a 100755 --- a/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart +++ b/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart @@ -54,7 +54,7 @@ class NearbyLockLogic extends BaseGetXController { dismissEasyLoading(); // state.sureBtnState.value = 0; }); - BlueManage().bludSendData(deviceName, + BlueManage().blueSendData(deviceName, (BluetoothConnectionState state) async { AppLog.log("点击要添加的设备了"); if (state == BluetoothConnectionState.connected) { @@ -415,7 +415,7 @@ class NearbyLockLogic extends BaseGetXController { void oTAUpgrade(String deviceName) { showTitleEasyLoading("连接设备中..."); this.deviceName = deviceName; - BlueManage().bludSendData(deviceName, + BlueManage().blueSendData(deviceName, (BluetoothConnectionState state) async { AppLog.log("连接设备"); if (state == BluetoothConnectionState.connected) { @@ -460,7 +460,7 @@ class NearbyLockLogic extends BaseGetXController { AppLog.log('blueOTAUpgrade:设备名字为 null'); return; } - BlueManage().bludSendData(deviceName!, + BlueManage().blueSendData(deviceName!, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected) { String uid = await Storage.getUid() ?? ''; diff --git a/lib/mine/addLock/saveLock/saveLock_logic.dart b/lib/mine/addLock/saveLock/saveLock_logic.dart index c7d5269a..58f6c5aa 100755 --- a/lib/mine/addLock/saveLock/saveLock_logic.dart +++ b/lib/mine/addLock/saveLock/saveLock_logic.dart @@ -212,7 +212,7 @@ class SaveLockLogic extends BaseGetXController { showBlueConnetctToast(); } }); - BlueManage().bludSendData(BlueManage().connectDeviceName, + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected) { // 私钥 diff --git a/lib/mine/mineSet/lockUserManage/expireLockList/expireCard/expireCard_logic.dart b/lib/mine/mineSet/lockUserManage/expireLockList/expireCard/expireCard_logic.dart index 7829c717..065a0285 100755 --- a/lib/mine/mineSet/lockUserManage/expireLockList/expireCard/expireCard_logic.dart +++ b/lib/mine/mineSet/lockUserManage/expireLockList/expireCard/expireCard_logic.dart @@ -94,7 +94,7 @@ class ExpireCardLogic extends BaseGetXController { dismissEasyLoading(); state.sureBtnState.value = 0; }); - BlueManage().bludSendData(state.deletExpireCardItemEntity.lockInfo!.btDeviceName!, (BluetoothConnectionState deviceConnectionState) async { + BlueManage().blueSendData(state.deletExpireCardItemEntity.lockInfo!.btDeviceName!, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected){ // var publicKey = await Storage.getStringList(saveBluePublicKey); // List publicKeyDataList = changeStringListToIntList(publicKey!); diff --git a/lib/mine/mineSet/lockUserManage/expireLockList/expireFingerprint/expireFingerprint_logic.dart b/lib/mine/mineSet/lockUserManage/expireLockList/expireFingerprint/expireFingerprint_logic.dart index bfacb509..e9ebb90d 100755 --- a/lib/mine/mineSet/lockUserManage/expireLockList/expireFingerprint/expireFingerprint_logic.dart +++ b/lib/mine/mineSet/lockUserManage/expireLockList/expireFingerprint/expireFingerprint_logic.dart @@ -95,7 +95,7 @@ class ExpireFingerprintLogic extends BaseGetXController { dismissEasyLoading(); state.sureBtnState.value = 0; }); - BlueManage().bludSendData(state.deletExpireFingerprintItemEntity.lockInfo!.btDeviceName!, (BluetoothConnectionState deviceConnectionState) async { + BlueManage().blueSendData(state.deletExpireFingerprintItemEntity.lockInfo!.btDeviceName!, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected){ // var publicKey = await Storage.getStringList(saveBluePublicKey); // List publicKeyDataList = changeStringListToIntList(publicKey!); diff --git a/lib/network/response_interceptor_log.dart b/lib/network/response_interceptor_log.dart index 85890536..f24553c4 100755 --- a/lib/network/response_interceptor_log.dart +++ b/lib/network/response_interceptor_log.dart @@ -5,7 +5,7 @@ import 'package:get/get_connect/http/src/request/request.dart'; import 'package:star_lock/app_settings/app_settings.dart'; FutureOr responseLogInterceptor(Request request, Response response) { - AppLog.log('HTTP request:${request.url}\n RESPONSE => stataCode:${response.statusCode} ${response.bodyString}'); // \n ${response.headers} + // AppLog.log('HTTP request:${request.url}\n RESPONSE => stataCode:${response.statusCode} ${response.bodyString}'); // \n ${response.headers} EasyLoading.dismiss(animation: true); return response; } From 408f2e46b7dba3bbd51b33543d2be9d35ecfb7d7 Mon Sep 17 00:00:00 2001 From: anfe <448468458@qq.com> Date: Tue, 21 May 2024 16:09:54 +0800 Subject: [PATCH 3/7] =?UTF-8?q?feat:=E8=A7=A3=E5=86=B3=E5=A4=9A=E6=AC=A1?= =?UTF-8?q?=E5=BC=80=E9=97=A8=E5=90=8E=EF=BC=8C=E5=8A=A8=E7=94=BB=E4=BC=9A?= =?UTF-8?q?=E4=B8=80=E7=9B=B4=E4=B8=8D=E5=81=9C=E7=9A=84=E6=97=8B=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/blue/io_sender.dart | 8 ++++---- lib/main/lockDetail/lockDetail/lockDetail_logic.dart | 10 +++++----- lib/main/lockDetail/lockDetail/lockDetail_page.dart | 2 -- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/lib/blue/io_sender.dart b/lib/blue/io_sender.dart index ae45e67e..5270d56d 100755 --- a/lib/blue/io_sender.dart +++ b/lib/blue/io_sender.dart @@ -34,12 +34,12 @@ abstract class SenderProtocol extends IOData { } void printLog(List data) { - // AppLog.log( - // "App -> 锁,指令类型:${commandType!.typeName} ${commandType!.typeValue == 0x3030 - // ? '子命令:${data[3]}' : ''} \n参数是:\n${toString()} \n加密之前数据是:\n$data 长度是:${data.length}"); + AppLog.log( + "App -> 锁,指令类型:${commandType!.typeName} ${commandType!.typeValue == 0x3030 + ? '子命令:${data[3]}' : ''} \n参数是:\n${toString()} \n加密之前数据是:\n$data 长度是:${data.length}"); } - //TODO:拼装数据Ï + //TODO:拼装数据 List packageData() { commandData = messageDetail(); List commandList = []; diff --git a/lib/main/lockDetail/lockDetail/lockDetail_logic.dart b/lib/main/lockDetail/lockDetail/lockDetail_logic.dart index aeae0a6a..2e35c767 100755 --- a/lib/main/lockDetail/lockDetail/lockDetail_logic.dart +++ b/lib/main/lockDetail/lockDetail/lockDetail_logic.dart @@ -33,7 +33,6 @@ import 'lockNetToken_entity.dart'; class LockDetailLogic extends BaseGetXController { final LockDetailState state = LockDetailState(); - // 监听设备返回的数据 void initReplySubscription() { state.replySubscription = @@ -59,9 +58,8 @@ class LockDetailLogic extends BaseGetXController { case 0x00: //成功 // _showFullScreenOverlay(Get.context!); - cancelBlueConnetctToastTimer(); - state.iSClosedUnlockSuccessfulPopup.value = true; + cancelBlueConnetctToastTimer(); state.closedUnlockSuccessfulTimer?.cancel(); // 如果没有点击关闭弹窗,3秒后自动关闭 state.closedUnlockSuccessfulTimer = @@ -82,9 +80,10 @@ class LockDetailLogic extends BaseGetXController { } // 更新电量 uploadElectricQuantityRequest(); - + //锁数据更新 getLockRecordLastUploadDataTime(); resetOpenDoorState(); + state.animationController!.stop(); break; case 0x06: //无权限 @@ -287,10 +286,11 @@ class LockDetailLogic extends BaseGetXController { } // 查询事件记录(时间查询) - Future senderReferEventRecordTime() async { + void senderReferEventRecordTime() { showBlueConnetctToastTimer( isShowBlueConnetctToast: false, action: () { + closeLuckStatus(); BlueManage().disconnect(); }); BlueManage().blueSendData(BlueManage().connectDeviceName, diff --git a/lib/main/lockDetail/lockDetail/lockDetail_page.dart b/lib/main/lockDetail/lockDetail/lockDetail_page.dart index 8ad51780..97d42890 100755 --- a/lib/main/lockDetail/lockDetail/lockDetail_page.dart +++ b/lib/main/lockDetail/lockDetail/lockDetail_page.dart @@ -1324,7 +1324,6 @@ class _LockDetailPageState extends State return; } state.iSOpenLock.value = true; - state.iSClosedUnlockSuccessfulPopup.value = false; state.openLockBtnState.value = 1; state.animationController!.forward(); @@ -1347,7 +1346,6 @@ class _LockDetailPageState extends State return; } state.iSOpenLock.value = false; - state.iSClosedUnlockSuccessfulPopup.value = false; state.openLockBtnState.value = 1; state.animationController!.forward(); From af2ef694df2014bd145194ed01895edcf31f7eb9 Mon Sep 17 00:00:00 2001 From: anfe <448468458@qq.com> Date: Tue, 21 May 2024 17:11:56 +0800 Subject: [PATCH 4/7] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=20=E5=85=B6=E4=BB=96?= =?UTF-8?q?-=E6=8E=88=E6=9D=83=E7=AE=A1=E7=90=86=E5=91=98-=E7=94=B5?= =?UTF-8?q?=E5=AD=90=E9=92=A5=E5=8C=99=E9=87=8C=E7=9A=84=E6=8E=88=E6=9D=83?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E8=AF=A6=E6=83=85=E5=A4=9A=E4=BA=86?= =?UTF-8?q?=E5=8F=96=E6=B6=88=E6=8E=88=E6=9D=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/common/XSConstantMacro/XSConstantMacro.dart | 9 +++++++++ .../electronicKeyDetail/electronicKeyDetail_logic.dart | 8 +++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/common/XSConstantMacro/XSConstantMacro.dart b/lib/common/XSConstantMacro/XSConstantMacro.dart index a3d32886..e54e7b70 100755 --- a/lib/common/XSConstantMacro/XSConstantMacro.dart +++ b/lib/common/XSConstantMacro/XSConstantMacro.dart @@ -70,4 +70,13 @@ class XSConstantMacro { static int catEyeWorkModeStayCapture = 2; //逗留抓拍模式 static int catEyeWorkModeRealTimeMonitoring = 3; //实时监控模式 static int catEyeWorkModeCustom = 4; //自定义模式 + + //管理员类型 + static int userTypeSuperAdmin = 110301; //超级管理员 + static int userTypeAuthorizedAdmin = 110302; //授权管理员 + + + //电子钥匙类型 + static int keyRightAdmin = 1; //管理钥匙 + static int keyRightOrdinary = 2; //普通钥匙 } diff --git a/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart b/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart index 708938d8..6b38b259 100755 --- a/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart +++ b/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart @@ -255,16 +255,18 @@ class ElectronicKeyDetailLogic extends BaseGetXController { Future openModalBottomSheet(BuildContext context) async { List textList = []; - if (state.itemData.value.keyRight == 1) { + final bool isAdminKey = state.itemData.value.keyRight == 1; + final bool isLockOwner = CommonDataManage().currentKeyInfo.isLockOwner == 1; + if (isAdminKey) { // 授权管理员 textList = [ if (state.itemData.value.keyStatus == XSConstantMacro.keyStatusFrozen) '取消冻结'.tr else '冻结'.tr, - // '取消授权'.tr + if (isLockOwner) '取消授权'.tr ]; - } else if (CommonDataManage().currentKeyInfo.isLockOwner == 1) { + } else if (isLockOwner) { // 锁拥有者 if (state.keyType.value == 1 || state.keyType.value == 2) { textList = [ From 626c9eea4589557b3d8fefc5425ee3471c843f2b Mon Sep 17 00:00:00 2001 From: anfe <448468458@qq.com> Date: Tue, 21 May 2024 17:56:50 +0800 Subject: [PATCH 5/7] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=20=E5=BC=80=E9=94=81?= =?UTF-8?q?=E9=A1=B5-=E8=80=83=E5=8B=A4-=E8=AE=BE=E7=BD=AE-=E5=91=98?= =?UTF-8?q?=E5=B7=A5=20=E5=BC=80=E9=94=81=E9=A1=B5-=E8=80=83=E5=8B=A4-?= =?UTF-8?q?=E5=91=98=E5=B7=A5-=E7=BC=96=E8=BE=91=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../checkingInSet/checkingInSet_logic.dart | 74 +++++++++---------- .../checkingInSet/checkingInSet_page.dart | 14 +--- .../checkingInAddStaff_logic.dart | 19 ++--- .../checkingInAddStaff_page.dart | 13 ++-- 4 files changed, 54 insertions(+), 66 deletions(-) diff --git a/lib/main/lockDetail/checkingIn/checkingInSet/checkingInSet_logic.dart b/lib/main/lockDetail/checkingIn/checkingInSet/checkingInSet_logic.dart index ceaf5b91..6d61b06d 100755 --- a/lib/main/lockDetail/checkingIn/checkingInSet/checkingInSet_logic.dart +++ b/lib/main/lockDetail/checkingIn/checkingInSet/checkingInSet_logic.dart @@ -1,7 +1,9 @@ - import 'dart:async'; import 'package:get/get.dart'; +import 'package:star_lock/login/login/entity/LoginEntity.dart'; +import 'package:star_lock/main/lockDetail/checkingIn/checkingInSet/checkingInSet_entity.dart'; +import 'package:star_lock/main/lockDetail/lockSet/lockSet/checkingInInfoData_entity.dart'; import '../../../../network/api_repository.dart'; import '../../../../tools/baseGetXController.dart'; @@ -9,96 +11,94 @@ import '../../../../tools/dateTool.dart'; import '../../../../tools/eventBusEventManage.dart'; import 'checkingInSet_state.dart'; -class CheckingInSetLogic extends BaseGetXController{ +class CheckingInSetLogic extends BaseGetXController { CheckingInSetState state = CheckingInSetState(); // 开启考勤获取是否有公司 - void openCheckingInData() async{ - var entity = await ApiRepository.to.openCheckingInData( - lockId:state.getKeyInfosData.value.lockId.toString(), + Future openCheckingInData() async { + final CheckingInInfoDataEntity entity = await ApiRepository.to.openCheckingInData( + lockId: state.getKeyInfosData.value.lockId.toString(), ); - if(entity.errorCode!.codeIsSuccessful){ + if (entity.errorCode!.codeIsSuccessful) { state.companyId.value = entity.data!.companyId.toString(); getCheckInSetInfoData(); } } // 获取获取考勤设置信息 - void getCheckInSetInfoData() async{ - var entity = await ApiRepository.to.getCheckInSetInfoData( + Future getCheckInSetInfoData() async { + final CheckingInSetEntity entity = await ApiRepository.to.getCheckInSetInfoData( companyId: state.companyId.value, ); - if(entity.errorCode!.codeIsSuccessful){ + if (entity.errorCode!.codeIsSuccessful) { state.checkingInSetInfo.value = entity.data!; - state.beginTime.value = DateTool().dateToHNString(state.checkingInSetInfo.value.workStartTime.toString()); - state.endTime.value = DateTool().dateToHNString(state.checkingInSetInfo.value.workEndTime.toString()); - state.beginTimeTimestamp.value = state.checkingInSetInfo.value.workStartTime.toString(); - state.endTimeTimestamp.value = state.checkingInSetInfo.value.workEndTime.toString(); + state.beginTime.value = DateTool().dateToHNString( + state.checkingInSetInfo.value.workStartTime.toString()); + state.endTime.value = DateTool() + .dateToHNString(state.checkingInSetInfo.value.workEndTime.toString()); + state.beginTimeTimestamp.value = + state.checkingInSetInfo.value.workStartTime.toString(); + state.endTimeTimestamp.value = + state.checkingInSetInfo.value.workEndTime.toString(); state.weekDays.value = state.checkingInSetInfo.value.workDay!; - state.weekDaysStr.value = state.weekDays.value.join(","); - state.isCustom.value = (state.checkingInSetInfo.value.attendanceType! == 0) ? true : false; + state.weekDaysStr.value = state.weekDays.join(','); + state.isCustom.value = state.checkingInSetInfo.value.attendanceType! == 0; - state.staffNumber.value = state.checkingInSetInfo.value.staffNum!.toString(); + state.staffNumber.value = + state.checkingInSetInfo.value.staffNum!.toString(); state.companyName.value = state.checkingInSetInfo.value.companyName!; state.changeNameController.text = state.companyName.value; } } // 编辑考勤设置信息 - void editCheckInSetInfoData() async{ - var entity = await ApiRepository.to.editCheckInSetInfoData( + Future editCheckInSetInfoData() async { + final LoginEntity entity = await ApiRepository.to.editCheckInSetInfoData( attendanceType: state.checkingInSetInfo.value.attendanceType.toString(), companyId: state.checkingInSetInfo.value.companyId.toString(), - type: "1", + type: '1', companyName: state.changeNameController.text, workEndTime: state.checkingInSetInfo.value.workEndTime.toString(), workStartTime: state.checkingInSetInfo.value.workStartTime.toString(), - workDay:state.checkingInSetInfo.value.workDay!, + workDay: state.checkingInSetInfo.value.workDay!, ); - if(entity.errorCode!.codeIsSuccessful){ + if (entity.errorCode!.codeIsSuccessful) { state.companyName.value = state.changeNameController.text; - showToast("修改成功"); + showToast('修改成功'); } } // 删除公司 - void deletCompanyData() async{ - var entity = await ApiRepository.to.deletCompanyData( - companyId:state.checkingInSetInfo.value.companyId!, + Future deletCompanyData() async { + final CheckingInInfoDataEntity entity = await ApiRepository.to.deletCompanyData( + companyId: state.checkingInSetInfo.value.companyId!, ); - if(entity.errorCode!.codeIsSuccessful){ - eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(0, "0")); + if (entity.errorCode!.codeIsSuccessful) { + eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(0, '0')); Get.close(2); } } late StreamSubscription _teamEvent; + void _initLoadDataAction() { - _teamEvent = eventBus.on().listen((event) { + _teamEvent = eventBus.on().listen((RefreshCheckInSetDataEvent event) { getCheckInSetInfoData(); }); } @override void onReady() { - // TODO: implement onReady super.onReady(); - _initLoadDataAction(); openCheckingInData(); } - @override - void onInit() { - // TODO: implement onInit - super.onInit(); - } @override void onClose() { - // TODO: implement onClose _teamEvent.cancel(); } -} \ No newline at end of file +} diff --git a/lib/main/lockDetail/checkingIn/checkingInSet/checkingInSet_page.dart b/lib/main/lockDetail/checkingIn/checkingInSet/checkingInSet_page.dart index da4c5f2c..f4674bb8 100755 --- a/lib/main/lockDetail/checkingIn/checkingInSet/checkingInSet_page.dart +++ b/lib/main/lockDetail/checkingIn/checkingInSet/checkingInSet_page.dart @@ -73,13 +73,7 @@ class _CheckingInSetPageState extends State { 'checkingInSetInfo': state.checkingInSetInfo.value, }); if(data != null) { - setState(() { - // state.beginTime.value = data["beginTime"]; - // state.endTime.value = data["endTime"]; - // state.beginTimeTimestamp.value = data["beginTimeTimestamp"]; - // state.endTimeTimestamp.value = data["endTimeTimestamp"]; - logic.getCheckInSetInfoData(); - }); + setState(logic.getCheckInSetInfoData); } })), Obx(() => CommonItem( @@ -98,7 +92,7 @@ class _CheckingInSetPageState extends State { if(data != null) { state.isCustom.value = data['attendanceType']; state.weekDays.value = data['weekDays']; - state.weekDaysStr.value = state.weekDays.value.join(','); + state.weekDaysStr.value = state.weekDays.join(','); } })), CommonItem( @@ -125,9 +119,7 @@ class _CheckingInSetPageState extends State { margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 20.w), padding: EdgeInsets.only(top: 20.w, bottom: 20.w), onClick: () { - ShowTipView().showIosTipWithContentDialog('是否删除?'.tr, () { - logic.deletCompanyData(); - }); + ShowTipView().showIosTipWithContentDialog('是否删除?'.tr, logic.deletCompanyData); // showDeletCompanyAlertDialog(context); }), ), diff --git a/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_logic.dart b/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_logic.dart index 6f21bf4e..0b8cde56 100755 --- a/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_logic.dart +++ b/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_logic.dart @@ -1,9 +1,7 @@ import 'dart:async'; -import 'dart:ffi'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; -import 'package:star_lock/app_settings/app_settings.dart'; import 'package:star_lock/login/login/entity/LoginEntity.dart'; import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart'; import 'package:star_lock/tools/baseGetXController.dart'; @@ -72,7 +70,7 @@ class CheckingInAddStaffLogic extends BaseGetXController { ); if (entity.errorCode!.codeIsSuccessful) { state.keyEntity.value = entity.data!; - kyClickCallback(state.keyEntity.value); + kyClickCallback(state.keyEntity); } } @@ -82,6 +80,11 @@ class CheckingInAddStaffLogic extends BaseGetXController { if (state.appUnHaveAccount.value && state.staffAccount.contains('@')) { usernameType = '2'; } + // 当是app且没有钥匙时,直接把账号赋值给attendanceWayNumber + if (state.appUnHaveAccount.value && + state.selectPrintingMethodType.value == '1') { + state.attendanceWayNumber.value = state.staffAccountController.text; + } final LoginEntity entity = await ApiRepository.to.editStaffData( attendanceType: state.selectPrintingMethodType.value, @@ -151,25 +154,15 @@ class CheckingInAddStaffLogic extends BaseGetXController { @override void onReady() { - // TODO: implement onReady super.onReady(); _initLoadDataAction(); - changeInput(state.staffNameController); - - } - @override - void onInit() { - super.onInit(); - } @override void onClose() { - // TODO: implement onClose super.onClose(); - _getNumberEvent!.cancel(); } } diff --git a/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_page.dart b/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_page.dart index e8aee62b..c6e9539f 100755 --- a/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_page.dart +++ b/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_page.dart @@ -214,15 +214,18 @@ class _CheckingInAddStaffPageState extends State { child: Container( height: 40.h, padding: EdgeInsets.only( - left: 25.w, right: 25.w, top: 2.h), + left: 25.w, + right: 25.w, + ), decoration: BoxDecoration( color: AppColors.mainColor, borderRadius: BorderRadius.circular(20.h), ), - child: Text(addStaffSelectKeyType(), - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.white, fontSize: 22.sp)), + child: Center( + child: Text(addStaffSelectKeyType(), + style: TextStyle( + color: Colors.white, fontSize: 22.sp)), + ), ), ), ], From 8d949e6a06fd5b31c7ce2338f409e8bb92a800a4 Mon Sep 17 00:00:00 2001 From: anfe <448468458@qq.com> Date: Tue, 21 May 2024 18:11:26 +0800 Subject: [PATCH 6/7] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=20=E8=B4=A6=E5=8F=B7?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E5=90=8E=E6=89=AB=E6=8F=8F=E7=9A=84=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E7=BC=93=E5=AD=98=E6=B2=A1=E6=9C=89=E8=A2=AB=E6=B8=85?= =?UTF-8?q?=E9=99=A4=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/login/login/starLock_login_logic.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/login/login/starLock_login_logic.dart b/lib/login/login/starLock_login_logic.dart index 508c1f15..2e3cc55e 100755 --- a/lib/login/login/starLock_login_logic.dart +++ b/lib/login/login/starLock_login_logic.dart @@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bugly_plugin/flutter_bugly_plugin.dart'; import 'package:get/get.dart'; import 'package:star_lock/appRouters.dart'; +import 'package:star_lock/blue/blue_manage.dart'; import 'package:star_lock/login/login/entity/LoginEntity.dart'; import 'package:star_lock/mine/mine/starLockMine_state.dart'; import 'package:star_lock/tools/baseGetXController.dart'; @@ -47,11 +48,10 @@ class StarLockLoginLogic extends BaseGetXController { Storage.saveLoginData(entity.data); Storage.setBool(saveIsVip, entity.data!.isVip == 0 ? false : true); eventBus.fire(MineInfoChangeRefreshUI()); - // Get.back(); - // Get.toNamed(Routers.starLockMain); XSJPushProvider().initJPushService(); XSJPushProvider().initLocalNotification(false); Get.offNamedUntil(Routers.starLockMain, (Route route) => false); + BlueManage().scanDevices.clear(); //清除设备缓存 } } From c31afd3ef65217d3875e14171236c53c7f5d8896 Mon Sep 17 00:00:00 2001 From: anfe <448468458@qq.com> Date: Tue, 21 May 2024 18:35:10 +0800 Subject: [PATCH 7/7] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=20=E5=91=98=E5=B7=A5?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=B2=A1=E6=9C=89=E6=98=BE=E7=A4=BA=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E5=A4=B4=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../checkingInStaffList_page.dart | 18 +++++++++++++++--- .../lockDetail/lockDetail/lockDetail_page.dart | 2 -- .../lockMian/entity/lockListInfo_entity.dart | 5 +++++ 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_page.dart b/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_page.dart index 2b0e1afe..9f58f45e 100755 --- a/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_page.dart +++ b/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_page.dart @@ -145,9 +145,21 @@ class _CheckingInStaffListPageState extends State { SizedBox( width: 20.w, ), - // CustomNetworkImage(url: staffListItem.headurl!, width: 40.w , height: 40.w), - Image.asset(getTypeIcon(staffListItem.attendanceType!), - width: 60.w, height: 60.w), + if (staffListItem.headurl == null || staffListItem.headurl == '') + Image.asset( + getTypeIcon(staffListItem.attendanceType!), + width: 60.w, + height: 60.w, + ) + else + ClipRRect( + borderRadius: BorderRadius.circular(100.w), + child: Image.network( + staffListItem.headurl!, + width: 60.w, + height: 60.w, + ), + ), SizedBox( width: 20.w, ), diff --git a/lib/main/lockDetail/lockDetail/lockDetail_page.dart b/lib/main/lockDetail/lockDetail/lockDetail_page.dart index 97d42890..4f7db2a3 100755 --- a/lib/main/lockDetail/lockDetail/lockDetail_page.dart +++ b/lib/main/lockDetail/lockDetail/lockDetail_page.dart @@ -1326,7 +1326,6 @@ class _LockDetailPageState extends State state.iSOpenLock.value = true; state.openLockBtnState.value = 1; state.animationController!.forward(); - AppLog.log('点击开锁'); if (state.isOpenLockNeedOnline.value == 0) { // 不需要联网 @@ -1348,7 +1347,6 @@ class _LockDetailPageState extends State state.iSOpenLock.value = false; state.openLockBtnState.value = 1; state.animationController!.forward(); - EasyLoading.showToast('正在尝试闭锁……'.tr, duration: 2000.milliseconds); AppLog.log('长按闭锁'); if (state.isOpenLockNeedOnline.value == 0) { diff --git a/lib/main/lockMian/entity/lockListInfo_entity.dart b/lib/main/lockMian/entity/lockListInfo_entity.dart index 950d7639..4e484fc3 100755 --- a/lib/main/lockMian/entity/lockListInfo_entity.dart +++ b/lib/main/lockMian/entity/lockListInfo_entity.dart @@ -252,6 +252,11 @@ class LockListInfoItemEntity { data['hasGateway'] = hasGateway; return data; } + + //是否是锁拥有者 也代表是超级管理员 + bool isLockOwnerBool(){ + return isLockOwner== 1; + } } class Bluetooth {