1、添加进入选择锁类型界面调用接口
2、优化发送电子钥匙功能 3、优化操作记录问题
This commit is contained in:
parent
ff88988a95
commit
1628e35c6c
@ -41,14 +41,14 @@ PODS:
|
|||||||
- ReachabilitySwift
|
- ReachabilitySwift
|
||||||
- device_info_plus (0.0.1):
|
- device_info_plus (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- DKImagePickerController/Core (4.3.8):
|
- DKImagePickerController/Core (4.3.7):
|
||||||
- DKImagePickerController/ImageDataManager
|
- DKImagePickerController/ImageDataManager
|
||||||
- DKImagePickerController/Resource
|
- DKImagePickerController/Resource
|
||||||
- DKImagePickerController/ImageDataManager (4.3.8)
|
- DKImagePickerController/ImageDataManager (4.3.7)
|
||||||
- DKImagePickerController/PhotoGallery (4.3.8):
|
- DKImagePickerController/PhotoGallery (4.3.7):
|
||||||
- DKImagePickerController/Core
|
- DKImagePickerController/Core
|
||||||
- DKPhotoGallery
|
- DKPhotoGallery
|
||||||
- DKImagePickerController/Resource (4.3.8)
|
- DKImagePickerController/Resource (4.3.7)
|
||||||
- DKPhotoGallery (0.0.17):
|
- DKPhotoGallery (0.0.17):
|
||||||
- DKPhotoGallery/Core (= 0.0.17)
|
- DKPhotoGallery/Core (= 0.0.17)
|
||||||
- DKPhotoGallery/Model (= 0.0.17)
|
- DKPhotoGallery/Model (= 0.0.17)
|
||||||
@ -306,7 +306,7 @@ SPEC CHECKSUMS:
|
|||||||
camera_avfoundation: 8b8d780bcfb6a4a02b0fbe2b4bd17b5b71946e68
|
camera_avfoundation: 8b8d780bcfb6a4a02b0fbe2b4bd17b5b71946e68
|
||||||
connectivity_plus: bf0076dd84a130856aa636df1c71ccaff908fa1d
|
connectivity_plus: bf0076dd84a130856aa636df1c71ccaff908fa1d
|
||||||
device_info_plus: e5c5da33f982a436e103237c0c85f9031142abed
|
device_info_plus: e5c5da33f982a436e103237c0c85f9031142abed
|
||||||
DKImagePickerController: a7836546cfdfe014171694f643a7d575bc8ace7f
|
DKImagePickerController: 0a24ebfe7b48beeb74c27531540aaa2cc1dac6cf
|
||||||
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
|
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
|
||||||
EMASRest: 8df6f87836767a9415ad5cc4af739bc9d215b475
|
EMASRest: 8df6f87836767a9415ad5cc4af739bc9d215b475
|
||||||
file_picker: ce3938a0df3cc1ef404671531facef740d03f920
|
file_picker: ce3938a0df3cc1ef404671531facef740d03f920
|
||||||
@ -316,7 +316,7 @@ SPEC CHECKSUMS:
|
|||||||
flutter_native_contact_picker: bd430ba0fbf82768bb50c2c52a69a65759a8f907
|
flutter_native_contact_picker: bd430ba0fbf82768bb50c2c52a69a65759a8f907
|
||||||
flutter_pcm_sound: de0572ca4f99091cc2abfcc31601b8a4ddd33c0e
|
flutter_pcm_sound: de0572ca4f99091cc2abfcc31601b8a4ddd33c0e
|
||||||
flutter_voice_processor: 2b89b93d69b02227ae3fd58589ee0bcfa3ca2a82
|
flutter_voice_processor: 2b89b93d69b02227ae3fd58589ee0bcfa3ca2a82
|
||||||
fluttertoast: 31b00dabfa7fb7bacd9e7dbee580d7a2ff4bf265
|
fluttertoast: 9f2f8e81bb5ce18facb9748d7855bf5a756fe3db
|
||||||
fluwx: daa284756ce53442b3d0417ceeda66e981906811
|
fluwx: daa284756ce53442b3d0417ceeda66e981906811
|
||||||
google_maps_flutter_ios: d1318b4ff711612cab16862d7a87e31a7403d458
|
google_maps_flutter_ios: d1318b4ff711612cab16862d7a87e31a7403d458
|
||||||
GoogleMaps: 20d7b12be49a14287f797e88e0e31bc4156aaeb4
|
GoogleMaps: 20d7b12be49a14287f797e88e0e31bc4156aaeb4
|
||||||
|
|||||||
@ -304,9 +304,7 @@ class BlueManage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// 调用发送数据 List senderData,
|
/// 调用发送数据 List senderData,
|
||||||
Future<void> bludSendData(
|
Future<void> bludSendData(String deviceName, ConnectStateCallBack stateCallBack, {bool isAddEquipment = false}) async {
|
||||||
String deviceName, ConnectStateCallBack stateCallBack,
|
|
||||||
{bool isAddEquipment = false}) async {
|
|
||||||
FlutterBluePlus.isSupported.then((isAvailable) async {
|
FlutterBluePlus.isSupported.then((isAvailable) async {
|
||||||
if (isAvailable) {
|
if (isAvailable) {
|
||||||
if (_adapterState == BluetoothAdapterState.on) {
|
if (_adapterState == BluetoothAdapterState.on) {
|
||||||
@ -343,6 +341,7 @@ class BlueManage {
|
|||||||
element.device.platformName == connectDeviceName ||
|
element.device.platformName == connectDeviceName ||
|
||||||
element.advertisementData.advName == connectDeviceName);
|
element.advertisementData.advName == connectDeviceName);
|
||||||
if (isAddEquipment == false && isExistDevice == false) {
|
if (isAddEquipment == false && isExistDevice == false) {
|
||||||
|
// AppLog.log("需要开启扫描");
|
||||||
// startScan(10, (scanDevices){
|
// startScan(10, (scanDevices){
|
||||||
startScanSingle(deviceName, 10, (List<ScanResult> scanDevices) {
|
startScanSingle(deviceName, 10, (List<ScanResult> scanDevices) {
|
||||||
// AppLog.log("扫描到的设备:$scanDevices");
|
// AppLog.log("扫描到的设备:$scanDevices");
|
||||||
@ -351,6 +350,7 @@ class BlueManage {
|
|||||||
isAddEquipment: isAddEquipment);
|
isAddEquipment: isAddEquipment);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
// AppLog.log("不需要开启扫描");
|
||||||
_connectDevice(devicesList, deviceName, connectStateCallBack,
|
_connectDevice(devicesList, deviceName, connectStateCallBack,
|
||||||
isAddEquipment: isAddEquipment);
|
isAddEquipment: isAddEquipment);
|
||||||
}
|
}
|
||||||
@ -576,12 +576,26 @@ class BlueManage {
|
|||||||
List subData = splitList(valueList, _mtuSize!);
|
List subData = splitList(valueList, _mtuSize!);
|
||||||
// AppLog.log('writeCharacteristicWithResponse _mtuSize:$_mtuSize 得到的分割数据:$subData');
|
// AppLog.log('writeCharacteristicWithResponse _mtuSize:$_mtuSize 得到的分割数据:$subData');
|
||||||
for (int i = 0; i < subData.length; i++) {
|
for (int i = 0; i < subData.length; i++) {
|
||||||
await characteristic.write(subData[i],withoutResponse: true).then((value) async {
|
if (characteristic.properties.writeWithoutResponse) {
|
||||||
// await Future.delayed(const Duration(milliseconds: 1)).then((
|
// 使用WRITE_NO_RESPONSE属性写入值
|
||||||
// value) async {
|
await characteristic.write(subData[i],withoutResponse: true).then((value) async {
|
||||||
// AppLog.log('分包发送成功了');
|
// await Future.delayed(const Duration(milliseconds: 1)).then((
|
||||||
// });
|
// value) async {
|
||||||
});
|
// AppLog.log('分包发送成功了');
|
||||||
|
// });
|
||||||
|
});
|
||||||
|
} 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('分包发送成功了');
|
||||||
|
// });
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// 特性不支持写入
|
||||||
|
throw Exception('This characteristic does not support writing.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} on Exception catch (e, s) {
|
} on Exception catch (e, s) {
|
||||||
AppLog.log('APP写入失败: $e');
|
AppLog.log('APP写入失败: $e');
|
||||||
|
|||||||
@ -61,6 +61,7 @@ class OpenLockCommand extends SenderProtocol {
|
|||||||
|
|
||||||
// OpenTime 4
|
// OpenTime 4
|
||||||
int? d1 = openTime;
|
int? d1 = openTime;
|
||||||
|
// AppLog.log("开门时间是:$d1");
|
||||||
|
|
||||||
data.add((d1! & 0xff000000) >> 24);
|
data.add((d1! & 0xff000000) >> 24);
|
||||||
data.add((d1 & 0xff0000) >> 16);
|
data.add((d1 & 0xff0000) >> 16);
|
||||||
|
|||||||
@ -100,8 +100,8 @@ class F {
|
|||||||
static String get apiPrefix {
|
static String get apiPrefix {
|
||||||
switch (appFlavor) {
|
switch (appFlavor) {
|
||||||
case Flavor.local:
|
case Flavor.local:
|
||||||
// return 'https://ge.lock.star-lock.cn'; // 葛工
|
return 'https://ge.lock.star-lock.cn'; // 葛工
|
||||||
return 'http://192.168.1.15:8022'; // 谢工
|
// return 'http://192.168.1.15:8022'; // 谢工
|
||||||
case Flavor.dev:
|
case Flavor.dev:
|
||||||
return 'https://dev.lock.star-lock.cn';
|
return 'https://dev.lock.star-lock.cn';
|
||||||
case Flavor.pre:
|
case Flavor.pre:
|
||||||
|
|||||||
@ -63,7 +63,7 @@ class DoorLockLogLogic extends BaseGetXController {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// 根据时间查解析数据
|
// 根据时间查解析数据
|
||||||
Future<void> _replyReferEventRecordTime(Reply reply) async {
|
Future<void> _replyReferEventRecordTime(Reply reply) async {
|
||||||
int status = reply.data[2];
|
int status = reply.data[2];
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
@ -135,9 +135,13 @@ class DoorLockLogLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 查询事件记录(时间查询)
|
// 查询事件记录(时间查询)
|
||||||
Future<void> senderReferEventRecordTime(int time) async {
|
Future<void> senderReferEventRecordTime(int time) async {
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
|
||||||
(BluetoothConnectionState state) async {
|
showEasyLoading();
|
||||||
if (state == BluetoothConnectionState.connected) {
|
showBlueConnetctToastTimer(action: (){
|
||||||
|
dismissEasyLoading();
|
||||||
|
});
|
||||||
|
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionStateState) async {
|
||||||
|
if (connectionStateState == BluetoothConnectionState.connected) {
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
@ -159,6 +163,12 @@ class DoorLockLogLogic extends BaseGetXController {
|
|||||||
publicKey: getPublicKeyList,
|
publicKey: getPublicKeyList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
);
|
);
|
||||||
|
} else if (connectionStateState == BluetoothConnectionState.disconnected) {
|
||||||
|
dismissEasyLoading();
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
if(state.ifCurrentScreen.value == true){
|
||||||
|
showBlueConnetctToast();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/appRouters.dart';
|
import 'package:star_lock/appRouters.dart';
|
||||||
@ -10,6 +11,7 @@ import 'package:star_lock/tools/noData.dart';
|
|||||||
import 'package:timelines/timelines.dart';
|
import 'package:timelines/timelines.dart';
|
||||||
|
|
||||||
import '../../../app_settings/app_colors.dart';
|
import '../../../app_settings/app_colors.dart';
|
||||||
|
import '../../../tools/appRouteObserver.dart';
|
||||||
import '../../../tools/titleAppBar.dart';
|
import '../../../tools/titleAppBar.dart';
|
||||||
import '../../../translations/trans_lib.dart';
|
import '../../../translations/trans_lib.dart';
|
||||||
|
|
||||||
@ -20,7 +22,7 @@ class DoorLockLogPage extends StatefulWidget {
|
|||||||
State<DoorLockLogPage> createState() => _DoorLockLogPageState();
|
State<DoorLockLogPage> createState() => _DoorLockLogPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _DoorLockLogPageState extends State<DoorLockLogPage> {
|
class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
|
||||||
final logic = Get.put(DoorLockLogLogic());
|
final logic = Get.put(DoorLockLogLogic());
|
||||||
final state = Get.find<DoorLockLogLogic>().state;
|
final state = Get.find<DoorLockLogLogic>().state;
|
||||||
|
|
||||||
@ -212,4 +214,54 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> {
|
|||||||
: NoData(),
|
: NoData(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() {
|
||||||
|
// TODO: implement didChangeDependencies
|
||||||
|
super.didChangeDependencies();
|
||||||
|
|
||||||
|
/// 路由订阅
|
||||||
|
AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
// TODO: implement dispose
|
||||||
|
/// 取消路由订阅
|
||||||
|
AppRouteObserver().routeObserver.unsubscribe(this);
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 从上级界面进入 当前界面即将出现
|
||||||
|
@override
|
||||||
|
void didPush() {
|
||||||
|
super.didPush();
|
||||||
|
state.ifCurrentScreen.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 返回上一个界面 当前界面即将消失
|
||||||
|
@override
|
||||||
|
void didPop() {
|
||||||
|
super.didPop();
|
||||||
|
logic.cancelBlueConnetctToastTimer();
|
||||||
|
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
|
||||||
|
state.ifCurrentScreen.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 从下级返回 当前界面即将出现
|
||||||
|
@override
|
||||||
|
void didPopNext() {
|
||||||
|
super.didPopNext();
|
||||||
|
state.ifCurrentScreen.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 进入下级界面 当前界面即将消失
|
||||||
|
@override
|
||||||
|
void didPushNext() {
|
||||||
|
super.didPushNext();
|
||||||
|
logic.cancelBlueConnetctToastTimer();
|
||||||
|
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
|
||||||
|
state.ifCurrentScreen.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,15 +17,8 @@ class DoorLockLogState {
|
|||||||
DateTime(2024, 10, 10),
|
DateTime(2024, 10, 10),
|
||||||
];
|
];
|
||||||
|
|
||||||
final startDate =
|
final startDate = DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day).millisecondsSinceEpoch.obs;
|
||||||
DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day)
|
final endDate = (DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day + 1).subtract(const Duration(milliseconds: 1))).millisecondsSinceEpoch.obs;
|
||||||
.millisecondsSinceEpoch
|
|
||||||
.obs;
|
|
||||||
final endDate = (DateTime(
|
|
||||||
DateTime.now().year, DateTime.now().month, DateTime.now().day + 1)
|
|
||||||
.subtract(const Duration(milliseconds: 1)))
|
|
||||||
.millisecondsSinceEpoch
|
|
||||||
.obs;
|
|
||||||
|
|
||||||
var dropdownTitle = '全部事件'.obs;
|
var dropdownTitle = '全部事件'.obs;
|
||||||
var dropdownValue = XSConstantMacro.lockEventTypeAll.obs;
|
var dropdownValue = XSConstantMacro.lockEventTypeAll.obs;
|
||||||
@ -53,6 +46,8 @@ class DoorLockLogState {
|
|||||||
isCheked: false),
|
isCheked: false),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||||
|
|
||||||
DoorLockLogState() {
|
DoorLockLogState() {
|
||||||
keyInfos.value = Get.arguments["keyInfo"];
|
keyInfos.value = Get.arguments["keyInfo"];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,18 +34,19 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
|||||||
switch (typeValue) {
|
switch (typeValue) {
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
if (state.beginTime.value.isEmpty) {
|
// 限时
|
||||||
|
if (state.timeLimitBeginTime.value.isEmpty) {
|
||||||
showToast("请选择开始时间".tr);
|
showToast("请选择开始时间".tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (state.beginTime.value.isEmpty) {
|
if (state.timeLimitEndTime.value.isEmpty) {
|
||||||
showToast("请选择结束时间".tr);
|
showToast("请选择结束时间".tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
typeValue = XSConstantMacro.keyTypeTime;
|
typeValue = XSConstantMacro.keyTypeTime;
|
||||||
startDate = DateTool().dateToTimestamp(state.beginTime.value, 1).toString();
|
startDate = DateTool().dateToTimestamp(state.timeLimitBeginTime.value, 1).toString();
|
||||||
endDate = DateTool().dateToTimestamp(state.endTime.value, 1).toString();
|
endDate = DateTool().dateToTimestamp(state.timeLimitEndTime.value, 1).toString();
|
||||||
startTime = "0";
|
startTime = "0";
|
||||||
endTime = "0";
|
endTime = "0";
|
||||||
|
|
||||||
@ -68,12 +69,12 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
|||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
typeValue = XSConstantMacro.keyTypeLoop;
|
typeValue = XSConstantMacro.keyTypeLoop;
|
||||||
if (state.beginTime.value.isEmpty) {
|
if (state.cycleBeginTime.value.isEmpty) {
|
||||||
showToast("请选择有效期".tr);
|
showToast("请选择有效期".tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
startDate = DateTool().dateToTimestamp(state.beginTime.value, 1).toString();
|
startDate = DateTool().dateToTimestamp(state.cycleBeginTime.value, 1).toString();
|
||||||
endDate = DateTool().dateToTimestamp(state.endTime.value, 1).toString();
|
endDate = DateTool().dateToTimestamp(state.cycleEndTime.value, 1).toString();
|
||||||
startTime = DateTool().dateToTimestamp(state.effectiveDateTime.value, 0).toString();
|
startTime = DateTool().dateToTimestamp(state.effectiveDateTime.value, 0).toString();
|
||||||
endTime = DateTool().dateToTimestamp(state.failureDateTime.value, 0).toString();
|
endTime = DateTool().dateToTimestamp(state.failureDateTime.value, 0).toString();
|
||||||
break;
|
break;
|
||||||
@ -217,13 +218,14 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
|||||||
void resetData() {
|
void resetData() {
|
||||||
state.emailOrPhoneController.text = "";
|
state.emailOrPhoneController.text = "";
|
||||||
state.keyNameController.text = "";
|
state.keyNameController.text = "";
|
||||||
if(state.seletType.value == 0){
|
|
||||||
state.beginTime.value = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()); //默认为当前时间
|
state.timeLimitBeginTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;// 限时开始时间
|
||||||
state.endTime.value = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString());//默认为当前时间
|
state.timeLimitEndTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;// 限时结束时间
|
||||||
}else{
|
state.cycleBeginTime = "".obs;// 循环开始时间
|
||||||
state.beginTime.value = ""; //默认为当前时间
|
state.cycleEndTime = "".obs;// 循环结束时间
|
||||||
state.endTime.value = "";//默认为当前时间
|
state.effectiveDateTime = "".obs;// 生效时间
|
||||||
}
|
state.failureDateTime = "".obs;// 失效时间
|
||||||
|
state.weekdaysList = [].obs;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -199,23 +199,23 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> with Sing
|
|||||||
children: [
|
children: [
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||||
rightTitle: state.beginTime.value,
|
rightTitle: state.timeLimitBeginTime.value,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
|
state.timeLimitBeginTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||||
});
|
});
|
||||||
})),
|
})),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
||||||
rightTitle: state.endTime.value,
|
rightTitle: state.timeLimitEndTime.value,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
state.endTime.value = DateTool().getYMDHNDateString(p, 1);
|
state.timeLimitEndTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||||
});
|
});
|
||||||
})),
|
})),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
@ -250,22 +250,22 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> with Sing
|
|||||||
children: [
|
children: [
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||||
rightTitle: "${state.beginTime.value}\n${state.endTime.value}",
|
rightTitle: "${state.cycleBeginTime.value}\n${state.cycleEndTime.value}",
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
action: () async {
|
action: () async {
|
||||||
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
||||||
arguments: {
|
arguments: {
|
||||||
'validityValue': state.weekdaysList.value,
|
'validityValue': state.weekdaysList.value,
|
||||||
'starDate': state.beginTime.value,
|
'starDate': state.cycleBeginTime.value,
|
||||||
'endDate': state.endTime.value,
|
'endDate': state.cycleEndTime.value,
|
||||||
'starTime': state.effectiveDateTime.value,
|
'starTime': state.effectiveDateTime.value,
|
||||||
'endTime': state.failureDateTime.value
|
'endTime': state.failureDateTime.value
|
||||||
});
|
});
|
||||||
if(result != null && result.isNotEmpty){
|
if(result != null && result.isNotEmpty){
|
||||||
state.weekdaysList.value = result['validityValue'];
|
state.weekdaysList.value = result['validityValue'];
|
||||||
state.beginTime.value = result['starDate'];
|
state.cycleBeginTime.value = result['starDate'];
|
||||||
state.endTime.value = result['endDate'];
|
state.cycleEndTime.value = result['endDate'];
|
||||||
state.effectiveDateTime.value = result['starTime'];
|
state.effectiveDateTime.value = result['starTime'];
|
||||||
state.failureDateTime.value = result['endTime'];
|
state.failureDateTime.value = result['endTime'];
|
||||||
}
|
}
|
||||||
@ -281,15 +281,15 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> with Sing
|
|||||||
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
||||||
arguments: {
|
arguments: {
|
||||||
'validityValue': state.weekdaysList.value,
|
'validityValue': state.weekdaysList.value,
|
||||||
'starDate': state.beginTime.value,
|
'starDate': state.cycleBeginTime.value,
|
||||||
'endDate': state.endTime.value,
|
'endDate': state.cycleEndTime.value,
|
||||||
'starTime': state.effectiveDateTime.value,
|
'starTime': state.effectiveDateTime.value,
|
||||||
'endTime': state.failureDateTime.value
|
'endTime': state.failureDateTime.value
|
||||||
});
|
});
|
||||||
if(result != null && result.isNotEmpty){
|
if(result != null && result.isNotEmpty){
|
||||||
state.weekdaysList.value = result['validityValue'];
|
state.weekdaysList.value = result['validityValue'];
|
||||||
state.beginTime.value = result['starDate'];
|
state.cycleBeginTime.value = result['starDate'];
|
||||||
state.endTime.value = result['endDate'];
|
state.cycleEndTime.value = result['endDate'];
|
||||||
state.effectiveDateTime.value = result['starTime'];
|
state.effectiveDateTime.value = result['starTime'];
|
||||||
state.failureDateTime.value = result['endTime'];
|
state.failureDateTime.value = result['endTime'];
|
||||||
}
|
}
|
||||||
@ -305,18 +305,17 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> with Sing
|
|||||||
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
||||||
arguments: {
|
arguments: {
|
||||||
'validityValue': state.weekdaysList.value,
|
'validityValue': state.weekdaysList.value,
|
||||||
'starDate': state.beginTime.value,
|
'starDate': state.cycleBeginTime.value,
|
||||||
'endDate': state.endTime.value,
|
'endDate': state.cycleEndTime.value,
|
||||||
'starTime': state.effectiveDateTime.value,
|
'starTime': state.effectiveDateTime.value,
|
||||||
'endTime': state.failureDateTime.value
|
'endTime': state.failureDateTime.value
|
||||||
});
|
});
|
||||||
if(result != null && result.isNotEmpty){
|
if(result != null && result.isNotEmpty){
|
||||||
state.weekdaysList.value = result['validityValue'];
|
state.weekdaysList.value = result['validityValue'];
|
||||||
state.beginTime.value = result['starDate'];
|
state.cycleBeginTime.value = result['starDate'];
|
||||||
state.endTime.value = result['endDate'];
|
state.cycleEndTime.value = result['endDate'];
|
||||||
state.effectiveDateTime.value = result['starTime'];
|
state.effectiveDateTime.value = result['starTime'];
|
||||||
state.failureDateTime.value = result['endTime'];
|
state.failureDateTime.value = result['endTime'];
|
||||||
Get.back(result: result);
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
)),
|
)),
|
||||||
|
|||||||
@ -18,8 +18,10 @@ class SendElectronicKeyState {
|
|||||||
final isRemoteUnlock = false.obs; //是否允许远程开锁
|
final isRemoteUnlock = false.obs; //是否允许远程开锁
|
||||||
final isAuthentication = false.obs; //是否可以实名认证
|
final isAuthentication = false.obs; //是否可以实名认证
|
||||||
|
|
||||||
var beginTime = "".obs; //默认为当前时间 开始时间
|
var timeLimitBeginTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;// 限时开始时间
|
||||||
var endTime = "".obs;//默认为当前时间 结束时间
|
var timeLimitEndTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;// 限时结束时间
|
||||||
|
var cycleBeginTime = "".obs;// 循环开始时间
|
||||||
|
var cycleEndTime = "".obs;// 循环结束时间
|
||||||
var effectiveDateTime = "".obs;// 生效时间
|
var effectiveDateTime = "".obs;// 生效时间
|
||||||
var failureDateTime = "".obs;// 失效时间
|
var failureDateTime = "".obs;// 失效时间
|
||||||
var weekdaysList = [].obs;
|
var weekdaysList = [].obs;
|
||||||
|
|||||||
@ -108,14 +108,13 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
keyID: BlueManage().connectDeviceName,
|
keyID: BlueManage().connectDeviceName,
|
||||||
userID: await Storage.getUid(),
|
userID: await Storage.getUid(),
|
||||||
openMode: state.openDoorModel,
|
openMode: state.openDoorModel,
|
||||||
openTime: DateTime.now().millisecondsSinceEpoch ~/ 1000,
|
openTime: state.netTime,
|
||||||
onlineToken: state.lockNetToken,
|
onlineToken: state.lockNetToken,
|
||||||
token: tokenData,
|
token: tokenData,
|
||||||
needAuthor: 1,
|
needAuthor: 1,
|
||||||
signKey: signKeyDataList,
|
signKey: signKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
);
|
);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 0x07:
|
case 0x07:
|
||||||
//无权限
|
//无权限
|
||||||
@ -330,7 +329,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
keyID: BlueManage().connectDeviceName,
|
keyID: BlueManage().connectDeviceName,
|
||||||
userID: await Storage.getUid(),
|
userID: await Storage.getUid(),
|
||||||
openMode: state.openDoorModel,
|
openMode: state.openDoorModel,
|
||||||
openTime: DateTime.now().millisecondsSinceEpoch ~/ 1000,
|
openTime: state.netTime,
|
||||||
onlineToken: state.lockNetToken,
|
onlineToken: state.lockNetToken,
|
||||||
token: getTokenList,
|
token: getTokenList,
|
||||||
needAuthor: 1,
|
needAuthor: 1,
|
||||||
@ -381,6 +380,16 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 从服务器获取锁的时间 开锁时传入
|
||||||
|
void getServerDatetime() async{
|
||||||
|
var entity = await ApiRepository.to.getServerDatetimeData(
|
||||||
|
lockId: state.keyInfos.value.lockId.toString(),
|
||||||
|
);
|
||||||
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
|
state.netTime = entity.data!.date!.toString().length > 10 ? entity.data!.date!~/ 1000 : entity.data!.date!;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 获取手机联网token,根据锁设置里面获取的开锁时是否联网来判断是否调用这个接口
|
// 获取手机联网token,根据锁设置里面获取的开锁时是否联网来判断是否调用这个接口
|
||||||
void getLockNetToken() async {
|
void getLockNetToken() async {
|
||||||
LockNetTokenEntity entity = await ApiRepository.to.getLockNetToken(lockId: state.keyInfos.value.lockId.toString());
|
LockNetTokenEntity entity = await ApiRepository.to.getLockNetToken(lockId: state.keyInfos.value.lockId.toString());
|
||||||
@ -432,6 +441,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
lockId: state.keyInfos.value.lockId.toString(), records: list);
|
lockId: state.keyInfos.value.lockId.toString(), records: list);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
// mockNetworkDataRequest();
|
// mockNetworkDataRequest();
|
||||||
|
AppLog.log("state.keyInfos.value.keyType:${state.keyInfos.value.keyType}");
|
||||||
if(state.keyInfos.value.keyType == XSConstantMacro.keyTypeOnce){
|
if(state.keyInfos.value.keyType == XSConstantMacro.keyTypeOnce){
|
||||||
// 单次删除
|
// 单次删除
|
||||||
deletKeyData();
|
deletKeyData();
|
||||||
@ -520,6 +530,8 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
@override
|
@override
|
||||||
Future<void> onReady() async {
|
Future<void> onReady() async {
|
||||||
super.onReady();
|
super.onReady();
|
||||||
|
getServerDatetime();
|
||||||
|
|
||||||
await PermissionDialog.request(Permission.location);
|
await PermissionDialog.request(Permission.location);
|
||||||
await PermissionDialog.requestBluetooth();
|
await PermissionDialog.requestBluetooth();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import 'package:star_lock/widget/flavors_img.dart';
|
|||||||
|
|
||||||
import '../../../appRouters.dart';
|
import '../../../appRouters.dart';
|
||||||
import '../../../app_settings/app_colors.dart';
|
import '../../../app_settings/app_colors.dart';
|
||||||
|
import '../../../app_settings/app_settings.dart';
|
||||||
import '../../../blue/blue_manage.dart';
|
import '../../../blue/blue_manage.dart';
|
||||||
import '../../../blue/io_tool/io_tool.dart';
|
import '../../../blue/io_tool/io_tool.dart';
|
||||||
import '../../../common/XSConstantMacro/XSConstantMacro.dart';
|
import '../../../common/XSConstantMacro/XSConstantMacro.dart';
|
||||||
@ -136,7 +137,6 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
state.widgetContext = context;
|
|
||||||
loadData();
|
loadData();
|
||||||
return F.sw(defaultCall: () => skWidget(), xhjCall: () => xhjWidget());
|
return F.sw(defaultCall: () => skWidget(), xhjCall: () => xhjWidget());
|
||||||
}
|
}
|
||||||
@ -1213,13 +1213,16 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
state.openLockBtnState.value = 1;
|
state.openLockBtnState.value = 1;
|
||||||
// state.animationController!.forward();
|
// state.animationController!.forward();
|
||||||
|
|
||||||
|
AppLog.log("点击开锁");
|
||||||
if (state.isOpenLockNeedOnline.value == 0) {
|
if (state.isOpenLockNeedOnline.value == 0) {
|
||||||
// 不需要联网
|
// 不需要联网
|
||||||
state.openDoorModel = 0;
|
state.openDoorModel = 0;
|
||||||
|
AppLog.log("点击开锁 state.openDoorModel = 0 不需要联网");
|
||||||
logic.openDoorAction();
|
logic.openDoorAction();
|
||||||
} else {
|
} else {
|
||||||
// 需要联网
|
// 需要联网
|
||||||
state.openDoorModel = 2;
|
state.openDoorModel = 2;
|
||||||
|
AppLog.log("点击开锁 state.openDoorModel = 2 需要联网");
|
||||||
logic.getLockNetToken();
|
logic.getLockNetToken();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1233,12 +1236,15 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
state.openLockBtnState.value = 1;
|
state.openLockBtnState.value = 1;
|
||||||
state.animationController!.forward();
|
state.animationController!.forward();
|
||||||
|
|
||||||
|
AppLog.log("长按闭锁");
|
||||||
if (state.isOpenLockNeedOnline.value == 0) {
|
if (state.isOpenLockNeedOnline.value == 0) {
|
||||||
// 不需要联网
|
// 不需要联网
|
||||||
|
AppLog.log("长按闭锁 state.openDoorModel = 32 不需要联网");
|
||||||
state.openDoorModel = 32;
|
state.openDoorModel = 32;
|
||||||
logic.openDoorAction();
|
logic.openDoorAction();
|
||||||
} else {
|
} else {
|
||||||
// 需要联网
|
// 需要联网
|
||||||
|
AppLog.log("长按闭锁 state.openDoorModel = 34 需要联网");
|
||||||
state.openDoorModel = 34;
|
state.openDoorModel = 34;
|
||||||
logic.getLockNetToken();
|
logic.getLockNetToken();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,6 +14,7 @@ class LockDetailState {
|
|||||||
StreamSubscription? lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent;
|
StreamSubscription? lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent;
|
||||||
|
|
||||||
String lockNetToken = "";
|
String lockNetToken = "";
|
||||||
|
int netTime = 0;
|
||||||
int lockUserNo = 0;
|
int lockUserNo = 0;
|
||||||
var senderUserId = 0;
|
var senderUserId = 0;
|
||||||
var isOnlyOneData = false;
|
var isOnlyOneData = false;
|
||||||
@ -45,7 +46,6 @@ class LockDetailState {
|
|||||||
final PageController pageController = PageController();
|
final PageController pageController = PageController();
|
||||||
var currentPage = 0.obs;
|
var currentPage = 0.obs;
|
||||||
|
|
||||||
late BuildContext widgetContext;
|
|
||||||
|
|
||||||
// LockDetailState() {
|
// LockDetailState() {
|
||||||
// Map map = Get.arguments;
|
// Map map = Get.arguments;
|
||||||
|
|||||||
@ -245,7 +245,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
IoSenderManage.senderCustomPasswordsCommand(
|
IoSenderManage.senderCustomPasswordsCommand(
|
||||||
keyID: "1",
|
keyID: "1",
|
||||||
userID: await Storage.getUid(),
|
userID: await Storage.getUid(),
|
||||||
pwdNo: state.isAdministrator.value == true ? 254 : 1,
|
pwdNo: state.isAdministrator.value == true ? 254 : 0,
|
||||||
pwd:state.pwdController.text,
|
pwd:state.pwdController.text,
|
||||||
useCountLimit: 0xff,
|
useCountLimit: 0xff,
|
||||||
startTime: DateTool().dateToTimestamp(state.beginTime.value, 1)~/1000,
|
startTime: DateTool().dateToTimestamp(state.beginTime.value, 1)~/1000,
|
||||||
@ -326,7 +326,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
IoSenderManage.senderCustomPasswordsCommand(
|
IoSenderManage.senderCustomPasswordsCommand(
|
||||||
keyID: "1",
|
keyID: "1",
|
||||||
userID: await Storage.getUid(),
|
userID: await Storage.getUid(),
|
||||||
pwdNo: state.isAdministrator.value == true ? 254 : 1,
|
pwdNo: state.isAdministrator.value == true ? 254 : 0,
|
||||||
pwd: state.pwdController.text,
|
pwd: state.pwdController.text,
|
||||||
useCountLimit: 0xff,
|
useCountLimit: 0xff,
|
||||||
startTime:state.isPermanent.value == false ? startDate ~/ 1000 : 0,
|
startTime:state.isPermanent.value == false ? startDate ~/ 1000 : 0,
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import '../../../../tools/appRouteObserver.dart';
|
|||||||
import '../../../../tools/commonItem.dart';
|
import '../../../../tools/commonItem.dart';
|
||||||
|
|
||||||
import '../../../../tools/dateTool.dart';
|
import '../../../../tools/dateTool.dart';
|
||||||
|
import '../../../../tools/pickers/time_picker/model/pduration.dart';
|
||||||
import '../../../../tools/submitBtn.dart';
|
import '../../../../tools/submitBtn.dart';
|
||||||
import '../../../../tools/titleAppBar.dart';
|
import '../../../../tools/titleAppBar.dart';
|
||||||
import '../../../../translations/trans_lib.dart';
|
import '../../../../translations/trans_lib.dart';
|
||||||
@ -223,7 +224,12 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
|
|||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Pickers.showDatePicker(context, mode: state.widgetType.value == 3 ? DateMode.YMDHM:DateMode.YMDH, onConfirm: (p) {
|
Pickers.showDatePicker(
|
||||||
|
context,
|
||||||
|
maxDate: PDuration(year: DateTime.now().year + 3, month: DateTime.now().month, day: DateTime.now().day, hour: 24),
|
||||||
|
// minDate: PDuration.now(),
|
||||||
|
mode: state.widgetType.value == 3 ? DateMode.YMDHM:DateMode.YMDH,
|
||||||
|
onConfirm: (p) {
|
||||||
if (state.widgetType.value == 3) {
|
if (state.widgetType.value == 3) {
|
||||||
// 自定义
|
// 自定义
|
||||||
state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
|
state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||||
@ -238,7 +244,13 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
|
|||||||
rightTitle: state.endTime.value,
|
rightTitle: state.endTime.value,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Pickers.showDatePicker(context, mode: DateMode.YMDH, onConfirm: (p) {
|
Pickers.showDatePicker(
|
||||||
|
context,
|
||||||
|
// maxDate传入三年以后得今天的时间
|
||||||
|
maxDate: PDuration(year: DateTime.now().year + 3, month: DateTime.now().month, day: DateTime.now().day),
|
||||||
|
minDate: PDuration(year: DateTime.now().year, month: DateTime.now().month, day: DateTime.now().day),
|
||||||
|
mode: DateMode.YMDH,
|
||||||
|
onConfirm: (p) {
|
||||||
if (state.widgetType.value == 3) {
|
if (state.widgetType.value == 3) {
|
||||||
// 自定义
|
// 自定义
|
||||||
state.endTime.value = DateTool().getYMDHNDateString(p, 1);
|
state.endTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||||
|
|||||||
@ -139,7 +139,7 @@ class _VideoLogPageState extends State<VideoLogPage> {
|
|||||||
Get.toNamed(Routers.valueAddedServicesHighFunctionPage);
|
Get.toNamed(Routers.valueAddedServicesHighFunctionPage);
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 150.h,
|
// height: 150.h,
|
||||||
margin: EdgeInsets.all(15.w),
|
margin: EdgeInsets.all(15.w),
|
||||||
padding:
|
padding:
|
||||||
EdgeInsets.only(left: 20.w, top: 20.w, bottom: 20.w, right: 10.w),
|
EdgeInsets.only(left: 20.w, top: 20.w, bottom: 20.w, right: 10.w),
|
||||||
|
|||||||
@ -23,9 +23,10 @@ class NearbyLockLogic extends BaseGetXController {
|
|||||||
// 点击连接设备
|
// 点击连接设备
|
||||||
void connect(String deviceName) {
|
void connect(String deviceName) {
|
||||||
showEasyLoading();
|
showEasyLoading();
|
||||||
BlueManage().bludSendData(deviceName,
|
BlueManage().bludSendData(deviceName, (BluetoothConnectionState state) async {
|
||||||
(BluetoothConnectionState state) async {
|
AppLog.log("点击要添加的设备了");
|
||||||
if (state == BluetoothConnectionState.connected) {
|
if (state == BluetoothConnectionState.connected) {
|
||||||
|
AppLog.log("开始获取公钥");
|
||||||
IoSenderManage.getPublicKey(lockId: deviceName);
|
IoSenderManage.getPublicKey(lockId: deviceName);
|
||||||
} else if (state == BluetoothConnectionState.disconnected) {
|
} else if (state == BluetoothConnectionState.disconnected) {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
@ -58,12 +59,14 @@ class NearbyLockLogic extends BaseGetXController {
|
|||||||
switch (reply.status) {
|
switch (reply.status) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
//成功
|
//成功
|
||||||
|
AppLog.log("获取公钥成功");
|
||||||
// 储存公钥
|
// 储存公钥
|
||||||
var publicKey = reply.data.sublist(3);
|
var publicKey = reply.data.sublist(3);
|
||||||
var saveStrList = changeIntListToStringList(publicKey);
|
var saveStrList = changeIntListToStringList(publicKey);
|
||||||
Storage.setStringList(saveBluePublicKey, saveStrList);
|
Storage.setStringList(saveBluePublicKey, saveStrList);
|
||||||
|
|
||||||
// 获取私钥
|
// 获取私钥
|
||||||
|
AppLog.log("开始获取私钥");
|
||||||
IoSenderManage.getPrivateKey(
|
IoSenderManage.getPrivateKey(
|
||||||
lockId: BlueManage().connectDeviceName,
|
lockId: BlueManage().connectDeviceName,
|
||||||
keyID: "1",
|
keyID: "1",
|
||||||
@ -73,6 +76,7 @@ class NearbyLockLogic extends BaseGetXController {
|
|||||||
needAuthor: 1);
|
needAuthor: 1);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
AppLog.log("获取公钥失败");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -80,6 +84,7 @@ class NearbyLockLogic extends BaseGetXController {
|
|||||||
Future<void> _replyGetPrivateKeyKey(Reply reply) async {
|
Future<void> _replyGetPrivateKeyKey(Reply reply) async {
|
||||||
switch (reply.status) {
|
switch (reply.status) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
|
AppLog.log("获取私钥成功");
|
||||||
//成功
|
//成功
|
||||||
reply.data.removeAt(0);
|
reply.data.removeAt(0);
|
||||||
|
|
||||||
@ -113,66 +118,66 @@ class NearbyLockLogic extends BaseGetXController {
|
|||||||
switch (status) {
|
switch (status) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
//成功
|
//成功
|
||||||
|
AppLog.log("获取锁状态成功");
|
||||||
// 厂商名称
|
// 厂商名称
|
||||||
var vendor = reply.data.sublist(3, 23);
|
var vendor = reply.data.sublist(3, 23);
|
||||||
var vendorStr = utf8String(vendor);
|
var vendorStr = utf8String(vendor);
|
||||||
state.lockInfo["vendor"] = vendorStr;
|
state.lockInfo["vendor"] = vendorStr;
|
||||||
// state.lockInfo["vendor"] = "XL";
|
// state.lockInfo["vendor"] = "XL";
|
||||||
AppLog.log("vendor:$vendor vendorStr:$vendorStr reply.data:${reply.data}");
|
AppLog.log("厂商名称 vendor:$vendor vendorStr:$vendorStr reply.data:${reply.data}");
|
||||||
|
|
||||||
// 锁设备类型
|
// 锁设备类型
|
||||||
var product = reply.data[23];
|
var product = reply.data[23];
|
||||||
state.lockInfo["product"] = product;
|
state.lockInfo["product"] = product;
|
||||||
// AppLog.log("product:$product");
|
AppLog.log("锁设备类型 product:$product");
|
||||||
|
|
||||||
// 产品名称
|
// 产品名称
|
||||||
var model = reply.data.sublist(24, 44);
|
var model = reply.data.sublist(24, 44);
|
||||||
var modelStr = utf8String(model);
|
var modelStr = utf8String(model);
|
||||||
state.lockInfo["model"] = modelStr;
|
state.lockInfo["model"] = modelStr;
|
||||||
// state.lockInfo["model"] = "JL-BLE-01";
|
// state.lockInfo["model"] = "JL-BLE-01";
|
||||||
// AppLog.log("model:$model modelStr:$modelStr modelStr:${modelStr.length}");
|
AppLog.log("产品名称 mmodelStr:$modelStr");
|
||||||
|
|
||||||
// 软件版本
|
// 软件版本
|
||||||
var fwVersion = reply.data.sublist(44, 64);
|
var fwVersion = reply.data.sublist(44, 64);
|
||||||
var fwVersionStr = utf8String(fwVersion);
|
var fwVersionStr = utf8String(fwVersion);
|
||||||
state.lockInfo["fwVersion"] = fwVersionStr;
|
state.lockInfo["fwVersion"] = fwVersionStr;
|
||||||
// AppLog.log("fwVersion:$fwVersion fwVersionStr:$fwVersionStr fwVersionStr:${fwVersionStr.length}");
|
AppLog.log("软件版本 fwVersionStr:$fwVersionStr");
|
||||||
|
|
||||||
// 硬件版本
|
// 硬件版本
|
||||||
var hwVersion = reply.data.sublist(64, 84);
|
var hwVersion = reply.data.sublist(64, 84);
|
||||||
var hwVersionStr = utf8String(hwVersion);
|
var hwVersionStr = utf8String(hwVersion);
|
||||||
state.lockInfo["hwVersion"] = hwVersionStr;
|
state.lockInfo["hwVersion"] = hwVersionStr;
|
||||||
// AppLog.log("hwVersion:$hwVersion hwVersionStr:${hwVersionStr.length}");
|
AppLog.log("硬件版本 hwVersionStr:$hwVersionStr");
|
||||||
|
|
||||||
// 厂商序列号
|
// 厂商序列号
|
||||||
var serialNum0 = reply.data.sublist(84, 100);
|
var serialNum0 = reply.data.sublist(84, 100);
|
||||||
var serialNum0Str = utf8String(serialNum0);
|
var serialNum0Str = utf8String(serialNum0);
|
||||||
state.lockInfo["serialNum0"] = serialNum0Str;
|
state.lockInfo["serialNum0"] = serialNum0Str;
|
||||||
// state.lockInfo["serialNum0"] = "${DateTime.now().millisecondsSinceEpoch ~/ 10}";
|
// state.lockInfo["serialNum0"] = "${DateTime.now().millisecondsSinceEpoch ~/ 10}";
|
||||||
|
AppLog.log("厂商序列号 serialNum0Str:${serialNum0Str.length}");
|
||||||
|
|
||||||
// 成品商序列号
|
// 成品商序列号
|
||||||
var serialNum1 = reply.data.sublist(100, 116);
|
var serialNum1 = reply.data.sublist(100, 116);
|
||||||
var serialNum1Str = utf8String(serialNum1);
|
var serialNum1Str = utf8String(serialNum1);
|
||||||
state.lockInfo["serialNum1"] = serialNum1Str;
|
state.lockInfo["serialNum1"] = serialNum1Str;
|
||||||
// AppLog.log("serialNum1Str:$serialNum1Str serialNum1Str:${serialNum1Str.length}");
|
AppLog.log("成品商序列号 serialNum1Str:$serialNum1Str");
|
||||||
|
|
||||||
// 蓝牙名称
|
// 蓝牙名称
|
||||||
var btDeviceName = reply.data.sublist(116, 132);
|
var btDeviceName = reply.data.sublist(116, 132);
|
||||||
var btDeviceNameStr = utf8String(btDeviceName);
|
var btDeviceNameStr = utf8String(btDeviceName);
|
||||||
state.lockInfo["btDeviceName"] = btDeviceNameStr;
|
state.lockInfo["btDeviceName"] = btDeviceNameStr;
|
||||||
// AppLog.log("btDeviceName:$btDeviceName btDeviceNameStr:$btDeviceNameStr btDeviceNameStr:${btDeviceNameStr.length}");
|
AppLog.log("蓝牙名称 btDeviceNameStr:$btDeviceNameStr");
|
||||||
|
|
||||||
// 电池剩余电量
|
// 电池剩余电量
|
||||||
var battRemCap = reply.data[132];
|
var battRemCap = reply.data[132];
|
||||||
state.lockInfo["electricQuantity"] = battRemCap;
|
state.lockInfo["electricQuantity"] = battRemCap;
|
||||||
// AppLog.log("battRemCap:$battRemCap");
|
AppLog.log("电池剩余电量 battRemCap:$battRemCap");
|
||||||
|
|
||||||
// 重置次数
|
// 重置次数
|
||||||
var restoreCounter = reply.data.sublist(133, 135);
|
var restoreCounter = reply.data.sublist(133, 135);
|
||||||
state.lockInfo["restoreCount"] =
|
state.lockInfo["restoreCount"] = restoreCounter[0] * 256 + restoreCounter[1];
|
||||||
restoreCounter[0] * 256 + restoreCounter[1];
|
AppLog.log("重置次数 restoreCounter:${restoreCounter[0] * 256 + restoreCounter[1]}");
|
||||||
// AppLog.log("restoreCounter:$restoreCounter");
|
|
||||||
|
|
||||||
// 重置时间
|
// 重置时间
|
||||||
var restoreDate = reply.data.sublist(135, 139);
|
var restoreDate = reply.data.sublist(135, 139);
|
||||||
@ -182,13 +187,13 @@ class NearbyLockLogic extends BaseGetXController {
|
|||||||
(0xFF & restoreDate[3]));
|
(0xFF & restoreDate[3]));
|
||||||
// String restoreDateStr = DateTool().dateToYMDHNSString(restoreDateValue.toString());
|
// String restoreDateStr = DateTool().dateToYMDHNSString(restoreDateValue.toString());
|
||||||
state.lockInfo["restoreDate"] = restoreDateValue * 1000;
|
state.lockInfo["restoreDate"] = restoreDateValue * 1000;
|
||||||
// AppLog.log("restoreDate:$restoreDate restoreDateValue:$restoreDateValue");
|
AppLog.log("重置时间 restoreDateValue:$restoreDateValue");
|
||||||
|
|
||||||
// 主控芯片型号
|
// 主控芯片型号
|
||||||
var icPartNo = reply.data.sublist(139, 149);
|
var icPartNo = reply.data.sublist(139, 149);
|
||||||
var icPartNoStr = utf8String(icPartNo);
|
var icPartNoStr = utf8String(icPartNo);
|
||||||
state.lockInfo["icPartNo"] = icPartNoStr;
|
state.lockInfo["icPartNo"] = icPartNoStr;
|
||||||
// AppLog.log("icPartNo:$icPartNo icPartNoStr:$icPartNoStr");
|
AppLog.log("主控芯片型号 icPartNoStr:$icPartNoStr");
|
||||||
|
|
||||||
// 有效时间
|
// 有效时间
|
||||||
var indate = reply.data.sublist(149, 153);
|
var indate = reply.data.sublist(149, 153);
|
||||||
@ -198,16 +203,19 @@ class NearbyLockLogic extends BaseGetXController {
|
|||||||
(0xFF & indate[3]));
|
(0xFF & indate[3]));
|
||||||
// String indateStr = DateTool().dateToYMDHNSString("$indateValue");
|
// String indateStr = DateTool().dateToYMDHNSString("$indateValue");
|
||||||
state.lockInfo["indate"] = indateValue * 1000;
|
state.lockInfo["indate"] = indateValue * 1000;
|
||||||
// AppLog.log("indate:$indate indateValue:$indateValue");
|
AppLog.log("有效时间 indateValue:$indateValue");
|
||||||
|
|
||||||
// mac地址
|
// mac地址
|
||||||
var macAddress = reply.data.sublist(153, 173);
|
var macAddress = reply.data.sublist(153, 173);
|
||||||
var macAddressStr = utf8String(macAddress);
|
var macAddressStr = utf8String(macAddress);
|
||||||
state.lockInfo["mac"] = macAddressStr;
|
state.lockInfo["mac"] = macAddressStr;
|
||||||
|
AppLog.log("mac地址 macAddressStr:$macAddressStr");
|
||||||
|
|
||||||
var index = 173;
|
var index = 173;
|
||||||
// 锁特征值字符串长度
|
// 锁特征值字符串长度
|
||||||
var featureValueLength = reply.data[173];
|
var featureValueLength = reply.data[173];
|
||||||
|
AppLog.log("锁特征值字符串长度 featureValueLength:$featureValueLength");
|
||||||
|
|
||||||
// 锁特征值说明(本机能支持的功能)
|
// 锁特征值说明(本机能支持的功能)
|
||||||
// 获取到锁给的字符数组
|
// 获取到锁给的字符数组
|
||||||
var featureNetxLength = index + featureValueLength + 1;
|
var featureNetxLength = index + featureValueLength + 1;
|
||||||
@ -222,9 +230,12 @@ class NearbyLockLogic extends BaseGetXController {
|
|||||||
// List allFeatureValueTwoList = charListChangeIntList(featureValue);
|
// List allFeatureValueTwoList = charListChangeIntList(featureValue);
|
||||||
// AppLog.log("featureValueLength:$featureValueLength featureValue:$featureValue \n featureValueStr:$featureValueStr");
|
// AppLog.log("featureValueLength:$featureValueLength featureValue:$featureValue \n featureValueStr:$featureValueStr");
|
||||||
index = index + featureValueLength + 1;
|
index = index + featureValueLength + 1;
|
||||||
|
AppLog.log("锁特征值字符串 featureValueStr:$featureValueStr");
|
||||||
|
|
||||||
// 使能特征值字符串长度
|
// 使能特征值字符串长度
|
||||||
var featureEnValLength = reply.data[index];
|
var featureEnValLength = reply.data[index];
|
||||||
|
AppLog.log("使能特征值字符串长度 featureEnValLength:$featureEnValLength");
|
||||||
|
|
||||||
// 使能锁特征值说明(本机启用的功能)
|
// 使能锁特征值说明(本机启用的功能)
|
||||||
var featureEnNextLength = index + featureEnValLength + 1;
|
var featureEnNextLength = index + featureEnValLength + 1;
|
||||||
if (reply.data.length < featureEnNextLength) {
|
if (reply.data.length < featureEnNextLength) {
|
||||||
@ -238,13 +249,14 @@ class NearbyLockLogic extends BaseGetXController {
|
|||||||
// List allFeatureEnValTwoList = charListChangeIntList(featureEnVal);
|
// List allFeatureEnValTwoList = charListChangeIntList(featureEnVal);
|
||||||
// AppLog.log("featureEnValLength:$featureEnValLength featureEnVal:$featureEnVal \n featureEnValStr:$featureEnValStr");
|
// AppLog.log("featureEnValLength:$featureEnValLength featureEnVal:$featureEnVal \n featureEnValStr:$featureEnValStr");
|
||||||
index = index + featureEnValLength + 1;
|
index = index + featureEnValLength + 1;
|
||||||
|
AppLog.log("使能锁特征值说明 featureEnValStr:$featureEnValStr");
|
||||||
|
|
||||||
// 支持的带参数特征值的总条目数
|
// 支持的带参数特征值的总条目数
|
||||||
// var featureParaTotal = reply.data[index];
|
// var featureParaTotal = reply.data[index];
|
||||||
|
|
||||||
var featureParaTotalList = reply.data.sublist(index);
|
var featureParaTotalList = reply.data.sublist(index);
|
||||||
state.featureSettingParams = featureParaTotalList;
|
state.featureSettingParams = featureParaTotalList;
|
||||||
// AppLog.log("featureParaTotalList:$featureParaTotalList");
|
AppLog.log("featureParaTotalList:$featureParaTotalList");
|
||||||
|
|
||||||
Get.toNamed(Routers.lockAddressGaoDePage, arguments: {
|
Get.toNamed(Routers.lockAddressGaoDePage, arguments: {
|
||||||
"pwdTimestamp": state.timestampValue * 1000,
|
"pwdTimestamp": state.timestampValue * 1000,
|
||||||
@ -257,8 +269,6 @@ class NearbyLockLogic extends BaseGetXController {
|
|||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
//无权限
|
//无权限
|
||||||
AppLog.log("${reply.commandType}需要鉴权");
|
|
||||||
|
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
// IoSenderManage.senderGetLockStatu(
|
// IoSenderManage.senderGetLockStatu(
|
||||||
@ -276,7 +286,6 @@ class NearbyLockLogic extends BaseGetXController {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//失败
|
//失败
|
||||||
AppLog.log("${reply.commandType}失败");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -299,10 +308,11 @@ class NearbyLockLogic extends BaseGetXController {
|
|||||||
// 获取锁状态
|
// 获取锁状态
|
||||||
Future<void> _getStarLockStatus() async {
|
Future<void> _getStarLockStatus() async {
|
||||||
// 进来之后首先连接
|
// 进来之后首先连接
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
// BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState state) async {
|
||||||
(BluetoothConnectionState state) async {
|
// if (state == BluetoothConnectionState.connected) {
|
||||||
if (state == BluetoothConnectionState.connected) {
|
// dismissEasyLoading();
|
||||||
dismissEasyLoading();
|
|
||||||
|
AppLog.log("开始获取锁状态");
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
// IoSenderManage.senderGetLockStatu(
|
// IoSenderManage.senderGetLockStatu(
|
||||||
@ -316,10 +326,10 @@ class NearbyLockLogic extends BaseGetXController {
|
|||||||
isBeforeAddUser: true,
|
isBeforeAddUser: true,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
);
|
);
|
||||||
} else if (state == BluetoothConnectionState.disconnected) {
|
// } else if (state == BluetoothConnectionState.disconnected) {
|
||||||
dismissEasyLoading();
|
// dismissEasyLoading();
|
||||||
}
|
// }
|
||||||
}, isAddEquipment: true);
|
// }, isAddEquipment: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// late StreamSubscription<List<ScanResult>>_scanListDiscoveredDeviceSubscription;
|
// late StreamSubscription<List<ScanResult>>_scanListDiscoveredDeviceSubscription;
|
||||||
|
|||||||
@ -0,0 +1,29 @@
|
|||||||
|
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import 'package:star_lock/tools/commonDataManage.dart';
|
||||||
|
import '../../../network/api_repository.dart';
|
||||||
|
import 'selectLockType_state.dart';
|
||||||
|
|
||||||
|
class SelectLockTypeLogic extends BaseGetXController {
|
||||||
|
SelectLockTypeState state = SelectLockTypeState();
|
||||||
|
|
||||||
|
void getServerDatetime() async{
|
||||||
|
var entity = await ApiRepository.to.getServerDatetimeData(
|
||||||
|
lockId: CommonDataManage().currentKeyInfo.lockId.toString(),
|
||||||
|
);
|
||||||
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
super.onInit();
|
||||||
|
|
||||||
|
getServerDatetime();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onClose() {
|
||||||
|
super.onClose();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,18 +1,15 @@
|
|||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:permission_handler/permission_handler.dart';
|
|
||||||
import 'package:star_lock/flavors.dart';
|
import 'package:star_lock/flavors.dart';
|
||||||
import 'package:star_lock/tools/appFirstEnterHandle.dart';
|
|
||||||
import 'package:star_lock/tools/storage.dart';
|
|
||||||
|
|
||||||
import '../../../appRouters.dart';
|
import '../../../appRouters.dart';
|
||||||
import '../../../app_settings/app_colors.dart';
|
import '../../../app_settings/app_colors.dart';
|
||||||
import '../../../baseWidget.dart';
|
import '../../../baseWidget.dart';
|
||||||
import '../../../tools/titleAppBar.dart';
|
import '../../../tools/titleAppBar.dart';
|
||||||
import '../../../translations/trans_lib.dart';
|
import '../../../translations/trans_lib.dart';
|
||||||
|
import 'selectLockType_logic.dart';
|
||||||
|
|
||||||
class SelectLockTypePage extends StatefulWidget {
|
class SelectLockTypePage extends StatefulWidget {
|
||||||
const SelectLockTypePage({Key? key}) : super(key: key);
|
const SelectLockTypePage({Key? key}) : super(key: key);
|
||||||
@ -21,8 +18,10 @@ class SelectLockTypePage extends StatefulWidget {
|
|||||||
State<SelectLockTypePage> createState() => _SelectLockTypePageState();
|
State<SelectLockTypePage> createState() => _SelectLockTypePageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _SelectLockTypePageState extends State<SelectLockTypePage>
|
class _SelectLockTypePageState extends State<SelectLockTypePage> with BaseWidget {
|
||||||
with BaseWidget {
|
final logic = Get.put(SelectLockTypeLogic());
|
||||||
|
final state = Get.find<SelectLockTypeLogic>().state;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
|||||||
@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class SelectLockTypeState{
|
||||||
|
|
||||||
|
}
|
||||||
@ -784,7 +784,9 @@ class ApiProvider extends BaseProvider {
|
|||||||
getServerDatetimeUrl.toUrl,
|
getServerDatetimeUrl.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
'lockId': lockId,
|
'lockId': lockId,
|
||||||
}));
|
}),
|
||||||
|
isUnShowLoading: true
|
||||||
|
);
|
||||||
|
|
||||||
// 锁诊断
|
// 锁诊断
|
||||||
Future<Response> setLockDiagnoseData(
|
Future<Response> setLockDiagnoseData(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user