diff --git a/lib/blue/blue_manage.dart b/lib/blue/blue_manage.dart index 6f258b2c..f90753b4 100755 --- a/lib/blue/blue_manage.dart +++ b/lib/blue/blue_manage.dart @@ -123,14 +123,18 @@ class BlueManage { .eventBus! .on() .listen((EventSendModel model) { + AppLog.log('eventBus接收发送数据:${model}'); if (model.sendChannel == DataChannel.ble) { FlutterBluePlus.isSupported.then((bool isAvailable) async { if (isAvailable) { if (_adapterState == BluetoothAdapterState.on) { // 蓝牙已开启,可以进行蓝牙操作 + AppLog.log('蓝牙已开启,开始收发送数据:${model.data}'); writeCharacteristicWithResponse(model.data); } else { - try {} catch (e) { + try { + AppLog.log('蓝牙已关闭,停止发送数据:${model.data}'); + } catch (e) { AppLog.log('蓝牙打开失败'); } } @@ -315,8 +319,10 @@ class BlueManage { } /// 判断是否包含指定的uuid - bool _isMatch(List serviceUuids, {DeviceType deviceType = DeviceType.blue}) { - final List prefixes = getDeviceType(deviceType).map((e) => e.toLowerCase()).toList(); + bool _isMatch(List serviceUuids, + {DeviceType deviceType = DeviceType.blue}) { + final List prefixes = + getDeviceType(deviceType).map((e) => e.toLowerCase()).toList(); for (String uuid in serviceUuids) { final String cleanUuid = uuid.replaceAll('-', '').toLowerCase(); if (cleanUuid.length == 8) { diff --git a/lib/main/lockDetail/lockDetail/lockDetail_logic.dart b/lib/main/lockDetail/lockDetail/lockDetail_logic.dart index 5355f785..3cf6e155 100755 --- a/lib/main/lockDetail/lockDetail/lockDetail_logic.dart +++ b/lib/main/lockDetail/lockDetail/lockDetail_logic.dart @@ -59,7 +59,7 @@ class LockDetailLogic extends BaseGetXController { // 开完锁之后上传记录 if (reply is SenderReferEventRecordTimeReply && state.ifCurrentScreen.value == true) { - _replyReferEventRecordTime(reply); + await _replyReferEventRecordTime(reply); } }); } @@ -116,7 +116,9 @@ class LockDetailLogic extends BaseGetXController { state.animationController!.stop(); //锁数据更新 + AppLog.log('开锁成功,开始同步所记录:getLockRecordLastUploadDataTime'); getLockRecordLastUploadDataTime(); + AppLog.log('开锁成功,结束同步所记录:getLockRecordLastUploadDataTime'); // 只有接听状态时才可以重发开门指令 if (StartChartManage().talkStatus.status == TalkStatus.answeredSuccessfully) { @@ -338,6 +340,7 @@ class LockDetailLogic extends BaseGetXController { reply.data.removeRange(0, 7); // 把得到的数据按17个字节分割成数组 然后塞进一个新的数组里面 if (reply.data.length < 17) { + AppLog.log('数据长度不够17:${reply.data}'); return; } final List> getList = splitList(reply.data, 17); @@ -384,6 +387,7 @@ class LockDetailLogic extends BaseGetXController { AppLog.log('操作记录:$indexList,解析失败,跳过该跳记录,进行下一条记录解析。'); } } + AppLog.log('上传数据长度:${uploadList.length}'); lockRecordUploadData(uploadList); if (dataLength == state.logCountPage) { @@ -510,6 +514,8 @@ class LockDetailLogic extends BaseGetXController { }); BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { + AppLog.log( + '开始发送同步锁记录命令,蓝牙状态是否链接:${connectionState == BluetoothConnectionState.connected}'); if (connectionState == BluetoothConnectionState.connected) { final List? privateKey = await Storage.getStringList(saveBluePrivateKey); @@ -524,6 +530,8 @@ class LockDetailLogic extends BaseGetXController { final List getPublicKeyList = changeStringListToIntList(publicKey!); + AppLog.log( + '发送同步锁记录命令:${BlueManage().connectDeviceName}'); IoSenderManage.senderReferEventRecordTimeCommand( keyID: BlueManage().connectDeviceName, userID: await Storage.getUid(), @@ -602,11 +610,14 @@ class LockDetailLogic extends BaseGetXController { final LockOperatingRecordGetLastRecordTimeEntity entity = await ApiRepository.to.getLockRecordLastUploadDataTime( lockId: state.keyInfos.value.lockId.toString()); + AppLog.log('开始获取服务端所记录更新时间:${entity}'); if (entity.errorCode!.codeIsSuccessful) { state.operateDate = entity.data!.operateDate! ~/ 1000; state.currentDate = entity.data!.currentDate! ~/ 1000; + AppLog.log('发送同步所记录命令:---'); senderReferEventRecordTime(); } + AppLog.log('结束获取服务端所记录更新时间:${entity}'); } // 操作记录上传 diff --git a/lib/main_local.dart b/lib/main_local.dart index 9e30d007..f56b6d65 100755 --- a/lib/main_local.dart +++ b/lib/main_local.dart @@ -4,7 +4,7 @@ import 'flavors.dart'; import 'main.dart' as runner; Future main() async { - F.appFlavor = Flavor.xhj; + F.appFlavor = Flavor.xhj_pre; // AppLog.log('local调用了main函数'); await runner.main(); }