fix:配网时蓝牙超时进行提示,调整配网成功后的上报流程

This commit is contained in:
liyi 2025-04-08 14:34:25 +08:00
parent 066aff8fdf
commit 823b268380

View File

@ -62,10 +62,8 @@ class ConfiguringWifiLogic extends BaseGetXController {
peerId: peerId, peerId: peerId,
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
await _getUploadLockSet();
showToast('配网成功'.tr, something: () async { showToast('配网成功'.tr, something: () async {
eventBus
.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
// peerID // peerID
StartChartManage().lockNetworkInfo = DeviceNetworkInfo( StartChartManage().lockNetworkInfo = DeviceNetworkInfo(
wifiName: wifiName, wifiName: wifiName,
@ -74,6 +72,7 @@ class ConfiguringWifiLogic extends BaseGetXController {
peerId: peerId, peerId: peerId,
); );
}); });
_getUploadLockSet();
} }
} }
@ -135,7 +134,7 @@ class ConfiguringWifiLogic extends BaseGetXController {
// //
await Storage.saveLockNetWorkInfo(jsonMap); await Storage.saveLockNetWorkInfo(jsonMap);
// //
updateNetworkInfo( updateNetworkInfo(
peerId: peerId ?? '', peerId: peerId ?? '',
wifiName: wifiName ?? '', wifiName: wifiName ?? '',
secretKey: secretKey ?? '', secretKey: secretKey ?? '',
@ -231,6 +230,13 @@ class ConfiguringWifiLogic extends BaseGetXController {
password: state.wifiPWDController.text, password: state.wifiPWDController.text,
gatewayConfigurationStr: state.getGatewayConfigurationStr, gatewayConfigurationStr: state.getGatewayConfigurationStr,
); );
} else if (connectionState == BluetoothConnectionState.disconnected) {
dismissEasyLoading();
cancelBlueConnetctToastTimer();
state.sureBtnState.value = 0;
if (state.ifCurrentScreen.value == true) {
showBlueConnetctToast();
}
} }
}, },
isAddEquipment: true, isAddEquipment: true,
@ -391,10 +397,10 @@ class ConfiguringWifiLogic extends BaseGetXController {
// //
Future<void> _getUploadLockSet() async { Future<void> _getUploadLockSet() async {
showEasyLoading(); // showEasyLoading();
showBlueConnetctToastTimer(action: () { // showBlueConnetctToastTimer(action: () {
dismissEasyLoading(); // dismissEasyLoading();
}); // });
BlueManage().blueSendData(BlueManage().connectDeviceName, BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState connectionState) async { (BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) { if (connectionState == BluetoothConnectionState.connected) {
@ -476,6 +482,8 @@ class ConfiguringWifiLogic extends BaseGetXController {
Get.offAllNamed(Routers.starLockMain); Get.offAllNamed(Routers.starLockMain);
} }
dismissEasyLoading(); dismissEasyLoading();
eventBus
.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
if (state.loadingTimer != null) { if (state.loadingTimer != null) {
state.loadingTimer!.cancel(); state.loadingTimer!.cancel();
state.loadingTimer = null; state.loadingTimer = null;
@ -493,6 +501,5 @@ class ConfiguringWifiLogic extends BaseGetXController {
state.loadingTimer!.cancel(); state.loadingTimer!.cancel();
state.loadingTimer = null; state.loadingTimer = null;
} }
} }
} }