Merge branch 'develop_liyi' of code-internal.star-lock.cn:StarlockTeam/app-starlock into develop_liyi

This commit is contained in:
“DaisyWu” 2025-02-10 14:05:18 +08:00
commit 05f9cad8c9
7 changed files with 125 additions and 89 deletions

View File

@ -115,7 +115,7 @@ class CommandReciverManager {
break;
}
parseData(oriDataList).then((Reply? value) async {
EasyLoading.dismiss();
// EasyLoading.dismiss();
await EventBusManager().eventBusFir(value);
}).catchError((Object error) {
AppLog.log('APP解析数据时发生错误: ${error.toString()}');

View File

@ -443,7 +443,8 @@ class LockDetailLogic extends BaseGetXController {
message: '开门超时处理-开锁失败',
detail: '开门超时,断开连接,开锁失败--OpenLockCommand:$command',
upload: true);
});
},
);
BlueManage()
.blueSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!,
@ -481,9 +482,9 @@ class LockDetailLogic extends BaseGetXController {
'open_lock_result': '断开连接',
});
if (state.ifCurrentScreen.value == true) {
showBlueConnetctToast();
}
// if (state.ifCurrentScreen.value == true) {
// showBlueConnetctToast();
// }
resetOpenDoorState();
}
});
@ -658,7 +659,9 @@ class LockDetailLogic extends BaseGetXController {
//
Future<void> remoteOpenLock() async {
final LoginEntity entity = await ApiRepository.to.remoteOpenLock(
lockId: state.keyInfos.value.lockId.toString(), timeOut: 60);
lockId: state.keyInfos.value.lockId.toString(),
timeOut: 60,
);
if (entity.errorCode!.codeIsSuccessful) {
showToast('已开锁'.tr);
}

View File

@ -88,11 +88,13 @@ class ConfiguringWifiLogic extends BaseGetXController {
Future<void> _replySenderConfiguringWifiResult(Reply reply) async {
final int status = reply.data[2];
state.sureBtnState.value = 0;
state.isLoading.value = false;
switch (status) {
case 0x00:
//
cancelBlueConnetctToastTimer();
dismissEasyLoading();
final int secretKeyJsonLength = (reply.data[4] << 8) + reply.data[3];
final List<int> secretKeyList =
@ -110,7 +112,8 @@ class ConfiguringWifiLogic extends BaseGetXController {
/// ,peerId
StartChartManage().lockPeerId = peerId ?? '';
dismissEasyLoading();
state.isLoading.value = false;
//
await Storage.saveLockNetWorkInfo(jsonMap);
//
@ -126,6 +129,7 @@ class ConfiguringWifiLogic extends BaseGetXController {
dismissEasyLoading();
cancelBlueConnetctToastTimer();
showToast('配网失败'.tr);
state.isLoading.value = false;
break;
}
}
@ -138,6 +142,10 @@ class ConfiguringWifiLogic extends BaseGetXController {
// wifi
Future<void> senderConfiguringWifiAction() async {
if (state.isLoading.isTrue) {
AppLog.log('正在配网中请勿重复点击');
return;
}
if (state.wifiNameController.text.isEmpty) {
showToast('请输入wifi名称'.tr);
return;
@ -197,11 +205,14 @@ class ConfiguringWifiLogic extends BaseGetXController {
password: state.wifiPWDController.text,
gatewayConfigurationStr: state.getGatewayConfigurationStr,
);
EasyLoading.show();
}
},
isAddEquipment: true,
);
//
showEasyLoading();
state.isLoading.value = true;
//
}
//

View File

@ -1,4 +1,3 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
@ -21,7 +20,8 @@ class ConfiguringWifiPage extends StatefulWidget {
State<ConfiguringWifiPage> createState() => _ConfiguringWifiPageState();
}
class _ConfiguringWifiPageState extends State<ConfiguringWifiPage> with RouteAware {
class _ConfiguringWifiPageState extends State<ConfiguringWifiPage>
with RouteAware {
final ConfiguringWifiLogic logic = Get.put(ConfiguringWifiLogic());
final ConfiguringWifiState state = Get.find<ConfiguringWifiLogic>().state;
@ -35,13 +35,21 @@ class _ConfiguringWifiPageState extends State<ConfiguringWifiPage> with RouteAwa
backgroundColor: AppColors.mainColor),
body: Column(
children: <Widget>[
configuringWifiTFWidget('WiFi名称'.tr, '请输入WiFi名字'.tr, state.wifiNameController),
Container(width: 1.sw, height: 1.h,color: AppColors.mainBackgroundColor),
configuringWifiTFWidget('WiFi密码'.tr, '请输入WiFi密码'.tr, state.wifiPWDController),
SizedBox(height: 50.h,),
SubmitBtn(btnName: '确定'.tr, onClick: () {
configuringWifiTFWidget(
'WiFi名称'.tr, '请输入WiFi名字'.tr, state.wifiNameController),
Container(
width: 1.sw, height: 1.h, color: AppColors.mainBackgroundColor),
configuringWifiTFWidget(
'WiFi密码'.tr, '请输入WiFi密码'.tr, state.wifiPWDController),
SizedBox(
height: 50.h,
),
SubmitBtn(
btnName: '确定'.tr,
onClick: () {
logic.senderConfiguringWifiAction();
}),
},
),
],
));
}

View File

@ -26,4 +26,6 @@ class ConfiguringWifiState{
TextEditingController wifiNameController = TextEditingController();
TextEditingController wifiPWDController = TextEditingController();
String getGatewayConfigurationStr = '';
RxBool isLoading=false.obs;
}

View File

@ -1,4 +1,3 @@
import 'dart:async';
import 'package:date_format/date_format.dart';
@ -25,14 +24,16 @@ class LockTimeLogic extends BaseGetXController{
//
late StreamSubscription<Reply> _replySubscription;
void _initReplySubscription() {
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
_replySubscription =
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
if (reply is TimingReply) {
_replyTiming(reply);
}
//
if(reply is GetStarLockStatuInfoReply && state.ifCurrentScreen.value == true) {
if (reply is GetStarLockStatuInfoReply) {
_replyGetStarLockStatusInfo(reply);
}
});
@ -53,13 +54,16 @@ class LockTimeLogic extends BaseGetXController{
(0xff & indate[1]) << 16 |
(0xff & indate[2]) << 8 |
(0xFF & indate[3]);
AppLog.log('indate:$indate indateValue:$indateValue');
AppLog.log(
'====================indate:$indate indateValue:$indateValue');
state.dateTime.value = DateTool().dateToYMDHNString('$indateValue');
break;
case 0x06:
//
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
final List<String>? privateKey =
await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList =
changeStringListToIntList(privateKey!);
IoSenderManage.senderGetStarLockStatuInfo(
lockID: BlueManage().connectDeviceName,
@ -82,7 +86,8 @@ class LockTimeLogic extends BaseGetXController{
switch (status) {
case 0x00:
//
final String dataEime = DateTool().dateToYMDHNString('${state.serverTime}');
final String dataEime =
DateTool().dateToYMDHNString('${state.serverTime}');
state.dateTime.value = dataEime;
state.sureBtnState.value = 0;
@ -128,15 +133,19 @@ class LockTimeLogic extends BaseGetXController{
dismissEasyLoading();
state.sureBtnState.value = 0;
});
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) {
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
final List<String>? privateKey =
await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList =
changeStringListToIntList(privateKey!);
final List<String>? token = await Storage.getStringList(saveBlueToken);
final List<int> getTokenList = changeStringListToIntList(token!);
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
final List<String>? signKey =
await Storage.getStringList(saveBlueSignKey);
final List<int> getSignKeyList = changeStringListToIntList(signKey!);
IoSenderManage.senderTimingCommand(
@ -152,9 +161,9 @@ class LockTimeLogic extends BaseGetXController{
dismissEasyLoading();
cancelBlueConnetctToastTimer();
state.sureBtnState.value = 0;
if(state.ifCurrentScreen.value == true){
showBlueConnetctToast();
}
// if (state.ifCurrentScreen.value == true) {
// showBlueConnetctToast();
// }
}
});
}
@ -168,8 +177,10 @@ class LockTimeLogic extends BaseGetXController{
BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) {
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
final List<String>? privateKey =
await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList =
changeStringListToIntList(privateKey!);
IoSenderManage.senderGetStarLockStatuInfo(
lockID: BlueManage().connectDeviceName,
@ -179,29 +190,30 @@ class LockTimeLogic extends BaseGetXController{
isBeforeAddUser: false,
privateKey: getPrivateKeyList,
);
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
} else if (deviceConnectionState ==
BluetoothConnectionState.disconnected) {
dismissEasyLoading();
cancelBlueConnetctToastTimer();
if (state.ifCurrentScreen.value == true) {
showBlueConnetctToast();
}
// if (state.ifCurrentScreen.value == true) {
// showBlueConnetctToast();
// }
}
});
}
//
Future<void> getLockTimeFromGateway() async {
final GetServerDatetimeEntity entity = await ApiRepository.to.getLockTimeFromGateway(
final GetServerDatetimeEntity entity =
await ApiRepository.to.getLockTimeFromGateway(
lockId: state.lockSetInfoData.value.lockId.toString(),
);
if(entity.errorCode!.codeIsSuccessful){
}
if (entity.errorCode!.codeIsSuccessful) {}
}
//
Future<void> getServerDatetime(bool isSendTime) async {
final GetServerDatetimeEntity entity = await ApiRepository.to.getServerDatetimeData(isUnShowLoading:false);
final GetServerDatetimeEntity entity =
await ApiRepository.to.getServerDatetimeData(isUnShowLoading: false);
if (entity.errorCode!.codeIsSuccessful) {
state.serverTime = entity.data!.date! ~/ 1000;
// AppLog.log("entity.data!.date! ~/ 1000:${entity.data!.date! ~/ 1000} DateTime.now().millisecondsSinceEpoch ~/ 1000:${DateTime.now().millisecondsSinceEpoch ~/ 1000} 服务器时间差:${state.differentialTime}");
@ -229,7 +241,6 @@ class LockTimeLogic extends BaseGetXController{
// getLockTimeFromGateway();
getServerDatetime(false);
}
@override

View File

@ -93,6 +93,7 @@ class NearbyLockLogic extends BaseGetXController {
showToast('固件升级完成'.tr);
closeOTADAta();
}
dismissEasyLoading();
});
}