添加全自动锁连续开锁5S提醒

This commit is contained in:
魏少阳 2024-01-26 14:10:57 +08:00
parent 42ff84b817
commit 918deb65da
9 changed files with 105 additions and 37 deletions

View File

@ -268,7 +268,7 @@ SPEC CHECKSUMS:
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825 ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
reactive_ble_mobile: 9ce6723d37ccf701dbffd202d487f23f5de03b4c reactive_ble_mobile: 9ce6723d37ccf701dbffd202d487f23f5de03b4c
shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695 shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695
sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a sqflite: 50a33e1d72bd59ee092a519a35d107502757ebed
SwiftProtobuf: 407a385e97fd206c4fbe880cc84123989167e0d1 SwiftProtobuf: 407a385e97fd206c4fbe880cc84123989167e0d1
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196 Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
url_launcher_ios: bbd758c6e7f9fd7b5b1d4cde34d2b95fcce5e812 url_launcher_ios: bbd758c6e7f9fd7b5b1d4cde34d2b95fcce5e812

View File

@ -6,6 +6,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import '../../../appRouters.dart';
import '../../../app_settings/app_colors.dart'; import '../../../app_settings/app_colors.dart';
import '../../../blue/blue_manage.dart'; import '../../../blue/blue_manage.dart';
import '../../../blue/io_protocol/io_addUser.dart'; import '../../../blue/io_protocol/io_addUser.dart';
@ -132,6 +133,11 @@ class LockDetailLogic extends BaseGetXController {
// //
print("${reply.commandType}校验错误"); print("${reply.commandType}校验错误");
break;
case 0x16:
// ...
print("${reply.commandType}正在开锁中...");
showToast("正在开锁中...");
break; break;
default: default:
// //
@ -331,7 +337,7 @@ class LockDetailLogic extends BaseGetXController {
keyType: 0, keyType: 0,
startDate: DateTime.now().millisecondsSinceEpoch, startDate: DateTime.now().millisecondsSinceEpoch,
expireDate: 0x11223344, expireDate: 0x11223344,
role: 0, role: state.keyInfos.value.keyRight == 1 ? 1 : 0,
password: "123456", password: "123456",
needAuthor: 1, needAuthor: 1,
publicKey: publicKeyDataList, publicKey: publicKeyDataList,
@ -388,7 +394,7 @@ class LockDetailLogic extends BaseGetXController {
keyType: 0, keyType: 0,
startDate: DateTime.now().millisecondsSinceEpoch, startDate: DateTime.now().millisecondsSinceEpoch,
expireDate: 0x11223344, expireDate: 0x11223344,
role: 0, role: state.keyInfos.value.keyRight == 1 ? 1 : 0,
password: "123456", password: "123456",
needAuthor: 1, needAuthor: 1,
publicKey: publicKeyDataList, publicKey: publicKeyDataList,
@ -592,6 +598,39 @@ class LockDetailLogic extends BaseGetXController {
} }
} }
// 0 1 2 3 4 5 6 7 8 9 10
clickItemBtnAction(int type){
state.clickNextType = type;
if (state.lockUserNo == 0) {
// lockUserNo为0
addUserConnectBlue();
} else {
clickPushBtnAction();
}
}
clickPushBtnAction(){
// 0 1 2 3 4 5 6 7 8 9 10
switch(state.clickNextType){
case 0:
//
startOpenLock();
break;
case 1:
//
startUnLock();
break;
case 2:
//
Get.toNamed(Routers.passwordKeyListPage, arguments: {"keyInfo": state.keyInfos.value});
break;
case 3:
//
Get.toNamed(Routers.passwordKeyListPage, arguments: {"keyInfo": state.keyInfos.value});
break;
}
}
// 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());

View File

@ -314,13 +314,13 @@ class _LockDetailPageState extends State<LockDetailPage>
var showWidgetArr = [ var showWidgetArr = [
// //
bottomItem('images/main/icon_main_operatingRecord.png', TranslationLoader.lanKeys!.operatingRecord!.tr, () { bottomItem('images/main/icon_main_operatingRecord.png', TranslationLoader.lanKeys!.operatingRecord!.tr, () {
Get.toNamed(Routers.lockOperatingRecordPage, arguments: {"keyInfo": widget.lockListInfoItemEntity}); Get.toNamed(Routers.lockOperatingRecordPage, arguments: {"keyInfo": state.keyInfos.value});
}), }),
// //
bottomItem('images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr, () { bottomItem('images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr, () {
Get.toNamed(Routers.lockSetPage, arguments: { Get.toNamed(Routers.lockSetPage, arguments: {
"lockId": widget.lockListInfoItemEntity.lockId, "lockId": state.keyInfos.value.lockId,
"isOnlyOneData": widget.isOnlyOneData, "isOnlyOneData": widget.isOnlyOneData,
}); });
}), }),
@ -344,14 +344,14 @@ class _LockDetailPageState extends State<LockDetailPage>
showWidgetArr.add(bottomItem('images/main/icon_main_electronicKey.png', showWidgetArr.add(bottomItem('images/main/icon_main_electronicKey.png',
TranslationLoader.lanKeys!.electronicKey!.tr, () { TranslationLoader.lanKeys!.electronicKey!.tr, () {
Get.toNamed(Routers.electronicKeyListPage, Get.toNamed(Routers.electronicKeyListPage,
arguments: {"keyInfo": widget.lockListInfoItemEntity}); arguments: {"keyInfo": state.keyInfos.value});
})); }));
// //
showWidgetArr.add(bottomItem('images/main/icon_main_password.png', showWidgetArr.add(bottomItem('images/main/icon_main_password.png',
TranslationLoader.lanKeys!.password!.tr, () { TranslationLoader.lanKeys!.password!.tr, () {
Get.toNamed(Routers.passwordKeyListPage, Get.toNamed(Routers.passwordKeyListPage,
arguments: {"keyInfo": widget.lockListInfoItemEntity}); arguments: {"keyInfo": state.keyInfos.value});
})); }));
// ic卡 // ic卡
@ -361,7 +361,7 @@ class _LockDetailPageState extends State<LockDetailPage>
// logic.showEasyLoading(); // logic.showEasyLoading();
// }); // });
Get.toNamed(Routers.cardListPage, arguments: { Get.toNamed(Routers.cardListPage, arguments: {
"lockId": widget.lockListInfoItemEntity.lockId, "lockId": state.keyInfos.value.lockId,
}); });
})); }));
} }
@ -371,7 +371,7 @@ class _LockDetailPageState extends State<LockDetailPage>
showWidgetArr.add(bottomItem('images/main/icon_main_fingerprint.png', showWidgetArr.add(bottomItem('images/main/icon_main_fingerprint.png',
TranslationLoader.lanKeys!.fingerprint!.tr, () { TranslationLoader.lanKeys!.fingerprint!.tr, () {
Get.toNamed(Routers.fingerprintListPage, arguments: { Get.toNamed(Routers.fingerprintListPage, arguments: {
"lockId": widget.lockListInfoItemEntity.lockId, "lockId": state.keyInfos.value.lockId,
}); });
})); }));
} }
@ -390,7 +390,7 @@ class _LockDetailPageState extends State<LockDetailPage>
bottomItem('images/main/icon_face.png', bottomItem('images/main/icon_face.png',
TranslationLoader.lanKeys!.humanFace!.tr, () { TranslationLoader.lanKeys!.humanFace!.tr, () {
Get.toNamed(Routers.faceList, arguments: { Get.toNamed(Routers.faceList, arguments: {
"lockId": widget.lockListInfoItemEntity.lockId, "lockId": state.keyInfos.value.lockId,
}); // Toast.show(msg: "功能暂未开放"); }); // Toast.show(msg: "功能暂未开放");
}), }),
); );
@ -402,7 +402,7 @@ class _LockDetailPageState extends State<LockDetailPage>
bottomItem('images/main/icon_catEyes.png', bottomItem('images/main/icon_catEyes.png',
TranslationLoader.lanKeys!.monitoring!.tr, () { TranslationLoader.lanKeys!.monitoring!.tr, () {
Get.toNamed(Routers.realTimePicturePage, arguments: { Get.toNamed(Routers.realTimePicturePage, arguments: {
"lockName": widget.lockListInfoItemEntity.lockName, "lockName": state.keyInfos.value.lockName,
"isMonitoring": true "isMonitoring": true
}); });
}), }),
@ -414,15 +414,15 @@ class _LockDetailPageState extends State<LockDetailPage>
bottomItem('images/main/icon_main_authorizedAdmin.png', bottomItem('images/main/icon_main_authorizedAdmin.png',
TranslationLoader.lanKeys!.authorizedAdmin!.tr, () { TranslationLoader.lanKeys!.authorizedAdmin!.tr, () {
Get.toNamed(Routers.authorizedAdminListPage, Get.toNamed(Routers.authorizedAdminListPage,
arguments: {"keyInfo": widget.lockListInfoItemEntity}); arguments: {"keyInfo": state.keyInfos.value});
}), }),
// //
bottomItem('images/main/icon_main_operatingRecord.png', bottomItem('images/main/icon_main_operatingRecord.png',
TranslationLoader.lanKeys!.operatingRecord!.tr, () { TranslationLoader.lanKeys!.operatingRecord!.tr, () {
// Get.toNamed(Routers.lockOperatingRecordPage, // Get.toNamed(Routers.lockOperatingRecordPage,
// arguments: {"keyInfo": widget.lockListInfoItemEntity}); // arguments: {"keyInfo": state.keyInfos.value});
Get.toNamed(Routers.doorLockLogPage, Get.toNamed(Routers.doorLockLogPage,
arguments: {"keyInfo": widget.lockListInfoItemEntity}); arguments: {"keyInfo": state.keyInfos.value});
}), }),
// //
bottomItem('images/main/icon_lockDetail_videoLog.png', bottomItem('images/main/icon_lockDetail_videoLog.png',
@ -441,7 +441,7 @@ class _LockDetailPageState extends State<LockDetailPage>
() { () {
// BlueManage().stopScan(); // BlueManage().stopScan();
Get.toNamed(Routers.lockSetPage, arguments: { Get.toNamed(Routers.lockSetPage, arguments: {
"lockId": widget.lockListInfoItemEntity.lockId, "lockId": state.keyInfos.value.lockId,
"isOnlyOneData": widget.isOnlyOneData, "isOnlyOneData": widget.isOnlyOneData,
}); });
}), }),

View File

@ -35,6 +35,9 @@ class LockDetailState {
var iSOpenLock = true.obs; // var iSOpenLock = true.obs; //
Timer? closedUnlockSuccessfulTimer; Timer? closedUnlockSuccessfulTimer;
// 0 1 2 3 4 5 6 7 8 9 10
var clickNextType = 0;
// //
late AnimationController animationController; late AnimationController animationController;
// var lockState = 0.obs;// 0 1() 2 3 4 5 // var lockState = 0.obs;// 0 1() 2 3 4 5

View File

@ -141,6 +141,9 @@ class LockFeature {
int? appUnlockOnline; int? appUnlockOnline;
int? bluetoothBroadcast; int? bluetoothBroadcast;
int? attendance; int? attendance;
int? motorTorsion;
int? stayWarn;
int? abnormalWarn;
LockFeature( LockFeature(
{this.password, {this.password,
@ -191,7 +194,10 @@ class LockFeature {
this.hotelLockCardSystem, this.hotelLockCardSystem,
this.appUnlockOnline, this.appUnlockOnline,
this.bluetoothBroadcast, this.bluetoothBroadcast,
this.attendance}); this.attendance,
this.motorTorsion,
this.stayWarn,
this.abnormalWarn,});
LockFeature.fromJson(Map<String, dynamic> json) { LockFeature.fromJson(Map<String, dynamic> json) {
password = json['password']; password = json['password'];
@ -243,6 +249,9 @@ class LockFeature {
appUnlockOnline = json['appUnlockOnline']; appUnlockOnline = json['appUnlockOnline'];
bluetoothBroadcast = json['bluetoothBroadcast']; bluetoothBroadcast = json['bluetoothBroadcast'];
attendance = json['attendance']; attendance = json['attendance'];
motorTorsion = json['motorTorsion'];
stayWarn = json['stayWarn'];
abnormalWarn = json['abnormalWarn'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -296,6 +305,9 @@ class LockFeature {
data['appUnlockOnline'] = appUnlockOnline; data['appUnlockOnline'] = appUnlockOnline;
data['bluetoothBroadcast'] = bluetoothBroadcast; data['bluetoothBroadcast'] = bluetoothBroadcast;
data['attendance'] = attendance; data['attendance'] = attendance;
data['motorTorsion'] = motorTorsion;
data['stayWarn'] = stayWarn;
data['abnormalWarn'] = abnormalWarn;
return data; return data;
} }
} }

View File

@ -21,6 +21,7 @@ import '../../../../tools/showTFView.dart';
import '../../../../tools/storage.dart'; import '../../../../tools/storage.dart';
import '../../../../translations/trans_lib.dart'; import '../../../../translations/trans_lib.dart';
import 'checkingInInfoData_entity.dart'; import 'checkingInInfoData_entity.dart';
import 'lockSetInfo_entity.dart';
import 'lockSet_state.dart'; import 'lockSet_state.dart';
typedef BlockSetStateCallback = void Function(); typedef BlockSetStateCallback = void Function();
@ -421,8 +422,8 @@ class LockSetLogic extends BaseGetXController {
} }
// //
void getLockSettingInfoData() async { Future<LockSetInfoEntity> getLockSettingInfoData() async {
var entity = await ApiRepository.to.getLockSettingInfoData( LockSetInfoEntity entity = await ApiRepository.to.getLockSettingInfoData(
lockId: state.lockId.toString(), lockId: state.lockId.toString(),
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
@ -441,6 +442,7 @@ class LockSetLogic extends BaseGetXController {
// await _readSupportFunctionsNoParameters(56); // await _readSupportFunctionsNoParameters(56);
// _readSupportFunctionsNoParameters(62); // _readSupportFunctionsNoParameters(62);
} }
return entity;
} }
// //
@ -736,8 +738,6 @@ class LockSetLogic extends BaseGetXController {
// TODO: implement onReady // TODO: implement onReady
super.onReady(); super.onReady();
getLockSettingInfoData();
_initReplySubscription(); _initReplySubscription();
_scanListDiscoveredDeviceSubscriptionAction(); _scanListDiscoveredDeviceSubscriptionAction();
} }

View File

@ -7,12 +7,14 @@ import 'package:star_lock/blue/blue_manage.dart';
import '../../../../appRouters.dart'; import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart'; import '../../../../app_settings/app_colors.dart';
import '../../../../tools/EasyRefreshTool.dart';
import '../../../../tools/appRouteObserver.dart'; import '../../../../tools/appRouteObserver.dart';
import '../../../../tools/commonItem.dart'; import '../../../../tools/commonItem.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';
import 'lockSetInfo_entity.dart';
import 'lockSet_logic.dart'; import 'lockSet_logic.dart';
// final RouteObserver<PageRoute> routeObserver = RouteObserver<PageRoute>(); // final RouteObserver<PageRoute> routeObserver = RouteObserver<PageRoute>();
@ -27,6 +29,12 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
final logic = Get.put(LockSetLogic()); final logic = Get.put(LockSetLogic());
final state = Get.find<LockSetLogic>().state; final state = Get.find<LockSetLogic>().state;
Future<void> getHttpData() async {
logic.getLockSettingInfoData().then((LockSetInfoEntity value){
setState(() {});
});
}
@override @override
void initState() { void initState() {
// TODO: implement initState // TODO: implement initState
@ -35,6 +43,8 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
logic.initLoadDataAction(() { logic.initLoadDataAction(() {
setState(() {}); setState(() {});
}); });
getHttpData();
} }
@override @override
@ -45,14 +55,19 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
barTitle: TranslationLoader.lanKeys!.set!.tr, barTitle: TranslationLoader.lanKeys!.set!.tr,
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor), backgroundColor: AppColors.mainColor),
body: Column( body: EasyRefreshTool(
children: [ onRefresh: (){
Expanded( getHttpData();
child: Obx(() => ListView( },
children: getListWidget(), child: Column(
)), children: [
), Expanded(
], child: Obx(() => ListView(
children: getListWidget(),
)),
),
],
),
)); ));
} }
@ -201,7 +216,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
}))), }))),
// //
Visibility( Visibility(
visible: true, visible: state.lockFeature.value.doorStatus == 1 ? true : false,
child: CommonItem( child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.doorOpener!.tr, leftTitel: TranslationLoader.lanKeys!.doorOpener!.tr,
rightTitle: "", rightTitle: "",
@ -285,8 +300,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
SizedBox(height: 10.h), SizedBox(height: 10.h),
// //
Obx(() => Visibility( Obx(() => Visibility(
// visible: state.lockFeature.value.passageMode == 1 ? true : false, visible: state.lockFeature.value.passageMode == 1 ? true : false,
visible:true,
child: CommonItem( child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.normallyOpenMode!.tr, leftTitel: TranslationLoader.lanKeys!.normallyOpenMode!.tr,
rightTitle: (state.lockSettingInfo.value.passageMode ?? 0) == 1 rightTitle: (state.lockSettingInfo.value.passageMode ?? 0) == 1
@ -334,7 +348,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
// Obx(() => // Obx(() =>
// //
Visibility( Visibility(
visible: true, visible: state.lockFeature.value.d3Face == 1 ? true : false,
child: CommonItem( child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.faceUnlocks!.tr, leftTitel: TranslationLoader.lanKeys!.faceUnlocks!.tr,
rightTitle: "", rightTitle: "",
@ -394,7 +408,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
// Obx(() => // Obx(() =>
// //
Visibility( Visibility(
visible: true, visible: state.lockFeature.value.openDirection == 1 ? true : false,
child: CommonItem( child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.openingDirectionSet!.tr, leftTitel: TranslationLoader.lanKeys!.openingDirectionSet!.tr,
rightTitle: "", rightTitle: "",
@ -408,7 +422,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
})), })),
// //
Visibility( Visibility(
visible: true, visible: state.lockFeature.value.motorTorsion == 1 ? true : false,
child: CommonItem( child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.motorPowerSetting!.tr, leftTitel: TranslationLoader.lanKeys!.motorPowerSetting!.tr,
rightTitle: "", rightTitle: "",

View File

@ -38,7 +38,7 @@ class _AboutPageState extends State<AboutPage> {
), ),
SizedBox(height: 20.h), SizedBox(height: 20.h),
Text( Text(
"星锁 1.0.0.08(preRelease-20240123)", "星锁 1.0.0.09(preRelease-20240126-1)",
style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor), style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor),
), ),
SizedBox(height: 20.h), SizedBox(height: 20.h),

View File

@ -1,6 +1,6 @@
abstract class Api { abstract class Api {
static String baseAddress = "https://pre.lock.star-lock.cn"; // // static String baseAddress = "https://pre.lock.star-lock.cn"; //
// static String baseAddress = "https://dev.lock.star-lock.cn"; // static String baseAddress = "https://dev.lock.star-lock.cn"; //
// static String baseAddress = "http://192.168.1.15:8022"; // // static String baseAddress = "http://192.168.1.15:8022"; //
// static String baseAddress = "https://ge.lock.star-lock.cn"; // // static String baseAddress = "https://ge.lock.star-lock.cn"; //