Merge branch 'develop_liyi' of code-internal.star-lock.cn:StarlockTeam/app-starlock into develop_liyi
This commit is contained in:
commit
05f9cad8c9
@ -115,7 +115,7 @@ class CommandReciverManager {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
parseData(oriDataList).then((Reply? value) async {
|
parseData(oriDataList).then((Reply? value) async {
|
||||||
EasyLoading.dismiss();
|
// EasyLoading.dismiss();
|
||||||
await EventBusManager().eventBusFir(value);
|
await EventBusManager().eventBusFir(value);
|
||||||
}).catchError((Object error) {
|
}).catchError((Object error) {
|
||||||
AppLog.log('APP解析数据时发生错误: ${error.toString()}');
|
AppLog.log('APP解析数据时发生错误: ${error.toString()}');
|
||||||
|
|||||||
@ -426,25 +426,26 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
AppLog.log('command:${command}');
|
AppLog.log('command:${command}');
|
||||||
|
|
||||||
showBlueConnetctToastTimer(
|
showBlueConnetctToastTimer(
|
||||||
outTimer: 20,
|
outTimer: 20,
|
||||||
action: () async {
|
action: () async {
|
||||||
final String getMobile = (await Storage.getMobile())!;
|
final String getMobile = (await Storage.getMobile())!;
|
||||||
ApmHelper.instance.trackEvent('open_lock', {
|
ApmHelper.instance.trackEvent('open_lock', {
|
||||||
'lock_name': state.keyInfos.value.lockName!,
|
'lock_name': state.keyInfos.value.lockName!,
|
||||||
'account':
|
'account':
|
||||||
getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
||||||
'date': DateTool().getNowDateWithType(1),
|
'date': DateTool().getNowDateWithType(1),
|
||||||
'open_lock_result': '超时',
|
'open_lock_result': '超时',
|
||||||
});
|
|
||||||
|
|
||||||
resetOpenDoorState();
|
|
||||||
blueManageDisconnect();
|
|
||||||
BuglyTool.uploadException(
|
|
||||||
message: '开门超时处理-开锁失败',
|
|
||||||
detail: '开门超时,断开连接,开锁失败--OpenLockCommand:$command',
|
|
||||||
upload: true);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
resetOpenDoorState();
|
||||||
|
blueManageDisconnect();
|
||||||
|
BuglyTool.uploadException(
|
||||||
|
message: '开门超时处理-开锁失败',
|
||||||
|
detail: '开门超时,断开连接,开锁失败--OpenLockCommand:$command',
|
||||||
|
upload: true);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
BlueManage()
|
BlueManage()
|
||||||
.blueSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!,
|
.blueSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!,
|
||||||
(BluetoothConnectionState deviceConnectionState) async {
|
(BluetoothConnectionState deviceConnectionState) async {
|
||||||
@ -481,9 +482,9 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
'open_lock_result': '断开连接',
|
'open_lock_result': '断开连接',
|
||||||
});
|
});
|
||||||
|
|
||||||
if (state.ifCurrentScreen.value == true) {
|
// if (state.ifCurrentScreen.value == true) {
|
||||||
showBlueConnetctToast();
|
// showBlueConnetctToast();
|
||||||
}
|
// }
|
||||||
resetOpenDoorState();
|
resetOpenDoorState();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -658,7 +659,9 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
// 远程开锁
|
// 远程开锁
|
||||||
Future<void> remoteOpenLock() async {
|
Future<void> remoteOpenLock() async {
|
||||||
final LoginEntity entity = await ApiRepository.to.remoteOpenLock(
|
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) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast('已开锁'.tr);
|
showToast('已开锁'.tr);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -88,11 +88,13 @@ class ConfiguringWifiLogic extends BaseGetXController {
|
|||||||
Future<void> _replySenderConfiguringWifiResult(Reply reply) async {
|
Future<void> _replySenderConfiguringWifiResult(Reply reply) async {
|
||||||
final int status = reply.data[2];
|
final int status = reply.data[2];
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
|
state.isLoading.value = false;
|
||||||
|
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
//成功
|
//成功
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
dismissEasyLoading();
|
|
||||||
final int secretKeyJsonLength = (reply.data[4] << 8) + reply.data[3];
|
final int secretKeyJsonLength = (reply.data[4] << 8) + reply.data[3];
|
||||||
|
|
||||||
final List<int> secretKeyList =
|
final List<int> secretKeyList =
|
||||||
@ -110,7 +112,8 @@ class ConfiguringWifiLogic extends BaseGetXController {
|
|||||||
|
|
||||||
/// 配网成功后,赋值锁的peerId
|
/// 配网成功后,赋值锁的peerId
|
||||||
StartChartManage().lockPeerId = peerId ?? '';
|
StartChartManage().lockPeerId = peerId ?? '';
|
||||||
|
dismissEasyLoading();
|
||||||
|
state.isLoading.value = false;
|
||||||
// 保存到缓存
|
// 保存到缓存
|
||||||
await Storage.saveLockNetWorkInfo(jsonMap);
|
await Storage.saveLockNetWorkInfo(jsonMap);
|
||||||
// 上报服务器
|
// 上报服务器
|
||||||
@ -126,6 +129,7 @@ class ConfiguringWifiLogic extends BaseGetXController {
|
|||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
showToast('配网失败'.tr);
|
showToast('配网失败'.tr);
|
||||||
|
state.isLoading.value = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -138,6 +142,10 @@ class ConfiguringWifiLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 点击配置wifi
|
// 点击配置wifi
|
||||||
Future<void> senderConfiguringWifiAction() async {
|
Future<void> senderConfiguringWifiAction() async {
|
||||||
|
if (state.isLoading.isTrue) {
|
||||||
|
AppLog.log('正在配网中请勿重复点击');
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (state.wifiNameController.text.isEmpty) {
|
if (state.wifiNameController.text.isEmpty) {
|
||||||
showToast('请输入wifi名称'.tr);
|
showToast('请输入wifi名称'.tr);
|
||||||
return;
|
return;
|
||||||
@ -197,11 +205,14 @@ class ConfiguringWifiLogic extends BaseGetXController {
|
|||||||
password: state.wifiPWDController.text,
|
password: state.wifiPWDController.text,
|
||||||
gatewayConfigurationStr: state.getGatewayConfigurationStr,
|
gatewayConfigurationStr: state.getGatewayConfigurationStr,
|
||||||
);
|
);
|
||||||
EasyLoading.show();
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
isAddEquipment: true,
|
isAddEquipment: true,
|
||||||
);
|
);
|
||||||
|
// 显示加载指示器
|
||||||
|
showEasyLoading();
|
||||||
|
state.isLoading.value = true;
|
||||||
|
// 模拟异步请求
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取设备状态
|
// 获取设备状态
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
@ -21,7 +20,8 @@ class ConfiguringWifiPage extends StatefulWidget {
|
|||||||
State<ConfiguringWifiPage> createState() => _ConfiguringWifiPageState();
|
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 ConfiguringWifiLogic logic = Get.put(ConfiguringWifiLogic());
|
||||||
final ConfiguringWifiState state = Get.find<ConfiguringWifiLogic>().state;
|
final ConfiguringWifiState state = Get.find<ConfiguringWifiLogic>().state;
|
||||||
|
|
||||||
@ -30,24 +30,32 @@ class _ConfiguringWifiPageState extends State<ConfiguringWifiPage> with RouteAwa
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
barTitle: '配置WiFi'.tr,
|
barTitle: '配置WiFi'.tr,
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor),
|
backgroundColor: AppColors.mainColor),
|
||||||
body: Column(
|
body: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
configuringWifiTFWidget('WiFi名称'.tr, '请输入WiFi名字'.tr, state.wifiNameController),
|
configuringWifiTFWidget(
|
||||||
Container(width: 1.sw, height: 1.h,color: AppColors.mainBackgroundColor),
|
'WiFi名称'.tr, '请输入WiFi名字'.tr, state.wifiNameController),
|
||||||
configuringWifiTFWidget('WiFi密码'.tr, '请输入WiFi密码'.tr, state.wifiPWDController),
|
Container(
|
||||||
SizedBox(height: 50.h,),
|
width: 1.sw, height: 1.h, color: AppColors.mainBackgroundColor),
|
||||||
SubmitBtn(btnName: '确定'.tr, onClick: () {
|
configuringWifiTFWidget(
|
||||||
logic.senderConfiguringWifiAction();
|
'WiFi密码'.tr, '请输入WiFi密码'.tr, state.wifiPWDController),
|
||||||
}),
|
SizedBox(
|
||||||
|
height: 50.h,
|
||||||
|
),
|
||||||
|
SubmitBtn(
|
||||||
|
btnName: '确定'.tr,
|
||||||
|
onClick: () {
|
||||||
|
logic.senderConfiguringWifiAction();
|
||||||
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget configuringWifiTFWidget(
|
Widget configuringWifiTFWidget(
|
||||||
String titleStr, String rightTitle,TextEditingController controller) {
|
String titleStr, String rightTitle, TextEditingController controller) {
|
||||||
return Column(
|
return Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
@ -86,16 +94,16 @@ class _ConfiguringWifiPageState extends State<ConfiguringWifiPage> with RouteAwa
|
|||||||
hintStyle: TextStyle(fontSize: 22.sp),
|
hintStyle: TextStyle(fontSize: 22.sp),
|
||||||
focusedBorder: const OutlineInputBorder(
|
focusedBorder: const OutlineInputBorder(
|
||||||
borderSide:
|
borderSide:
|
||||||
BorderSide(width: 0, color: Colors.transparent)),
|
BorderSide(width: 0, color: Colors.transparent)),
|
||||||
disabledBorder: const OutlineInputBorder(
|
disabledBorder: const OutlineInputBorder(
|
||||||
borderSide:
|
borderSide:
|
||||||
BorderSide(width: 0, color: Colors.transparent)),
|
BorderSide(width: 0, color: Colors.transparent)),
|
||||||
enabledBorder: const OutlineInputBorder(
|
enabledBorder: const OutlineInputBorder(
|
||||||
borderSide:
|
borderSide:
|
||||||
BorderSide(width: 0, color: Colors.transparent)),
|
BorderSide(width: 0, color: Colors.transparent)),
|
||||||
border: const OutlineInputBorder(
|
border: const OutlineInputBorder(
|
||||||
borderSide:
|
borderSide:
|
||||||
BorderSide(width: 0, color: Colors.transparent)),
|
BorderSide(width: 0, color: Colors.transparent)),
|
||||||
contentPadding: const EdgeInsets.symmetric(vertical: 0),
|
contentPadding: const EdgeInsets.symmetric(vertical: 0),
|
||||||
),
|
),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
|
|||||||
@ -26,4 +26,6 @@ class ConfiguringWifiState{
|
|||||||
TextEditingController wifiNameController = TextEditingController();
|
TextEditingController wifiNameController = TextEditingController();
|
||||||
TextEditingController wifiPWDController = TextEditingController();
|
TextEditingController wifiPWDController = TextEditingController();
|
||||||
String getGatewayConfigurationStr = '';
|
String getGatewayConfigurationStr = '';
|
||||||
|
|
||||||
|
RxBool isLoading=false.obs;
|
||||||
}
|
}
|
||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:date_format/date_format.dart';
|
import 'package:date_format/date_format.dart';
|
||||||
@ -20,19 +19,21 @@ import '../../../../tools/dateTool.dart';
|
|||||||
import '../../../../tools/storage.dart';
|
import '../../../../tools/storage.dart';
|
||||||
import 'lockTime_state.dart';
|
import 'lockTime_state.dart';
|
||||||
|
|
||||||
class LockTimeLogic extends BaseGetXController{
|
class LockTimeLogic extends BaseGetXController {
|
||||||
final LockTimeState state = LockTimeState();
|
final LockTimeState state = LockTimeState();
|
||||||
|
|
||||||
// 获取解析后的数据
|
// 获取解析后的数据
|
||||||
late StreamSubscription<Reply> _replySubscription;
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
|
|
||||||
void _initReplySubscription() {
|
void _initReplySubscription() {
|
||||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
|
_replySubscription =
|
||||||
if(reply is TimingReply) {
|
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
|
||||||
|
if (reply is TimingReply) {
|
||||||
_replyTiming(reply);
|
_replyTiming(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取锁状态
|
// 获取锁状态
|
||||||
if(reply is GetStarLockStatuInfoReply && state.ifCurrentScreen.value == true) {
|
if (reply is GetStarLockStatuInfoReply) {
|
||||||
_replyGetStarLockStatusInfo(reply);
|
_replyGetStarLockStatusInfo(reply);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -50,16 +51,19 @@ class LockTimeLogic extends BaseGetXController{
|
|||||||
// 有效时间
|
// 有效时间
|
||||||
final List<int> indate = reply.data.sublist(150, 154);
|
final List<int> indate = reply.data.sublist(150, 154);
|
||||||
final int indateValue = (0xff & indate[0]) << 24 |
|
final int indateValue = (0xff & indate[0]) << 24 |
|
||||||
(0xff & indate[1]) << 16 |
|
(0xff & indate[1]) << 16 |
|
||||||
(0xff & indate[2]) << 8 |
|
(0xff & indate[2]) << 8 |
|
||||||
(0xFF & indate[3]);
|
(0xFF & indate[3]);
|
||||||
AppLog.log('indate:$indate indateValue:$indateValue');
|
AppLog.log(
|
||||||
|
'====================indate:$indate indateValue:$indateValue');
|
||||||
state.dateTime.value = DateTool().dateToYMDHNString('$indateValue');
|
state.dateTime.value = DateTool().dateToYMDHNString('$indateValue');
|
||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
//需要鉴权
|
//需要鉴权
|
||||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey =
|
||||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList =
|
||||||
|
changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
IoSenderManage.senderGetStarLockStatuInfo(
|
IoSenderManage.senderGetStarLockStatuInfo(
|
||||||
lockID: BlueManage().connectDeviceName,
|
lockID: BlueManage().connectDeviceName,
|
||||||
@ -79,10 +83,11 @@ class LockTimeLogic extends BaseGetXController{
|
|||||||
// 校时数据解析
|
// 校时数据解析
|
||||||
Future<void> _replyTiming(Reply reply) async {
|
Future<void> _replyTiming(Reply reply) async {
|
||||||
final int status = reply.data[2];
|
final int status = reply.data[2];
|
||||||
switch(status){
|
switch (status) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
//成功
|
//成功
|
||||||
final String dataEime = DateTool().dateToYMDHNString('${state.serverTime}');
|
final String dataEime =
|
||||||
|
DateTool().dateToYMDHNString('${state.serverTime}');
|
||||||
state.dateTime.value = dataEime;
|
state.dateTime.value = dataEime;
|
||||||
|
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
@ -118,43 +123,47 @@ class LockTimeLogic extends BaseGetXController{
|
|||||||
|
|
||||||
// 校验时间
|
// 校验时间
|
||||||
Future<void> sendTiming() async {
|
Future<void> sendTiming() async {
|
||||||
if(state.sureBtnState.value == 1){
|
if (state.sureBtnState.value == 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state.sureBtnState.value = 1;
|
state.sureBtnState.value = 1;
|
||||||
|
|
||||||
showEasyLoading();
|
showEasyLoading();
|
||||||
showBlueConnetctToastTimer(action: (){
|
showBlueConnetctToastTimer(action: () {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||||
|
(BluetoothConnectionState connectionState) async {
|
||||||
if (connectionState == BluetoothConnectionState.connected) {
|
if (connectionState == BluetoothConnectionState.connected) {
|
||||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey =
|
||||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList =
|
||||||
|
changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||||
final List<int> getTokenList = changeStringListToIntList(token!);
|
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!);
|
final List<int> getSignKeyList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
IoSenderManage.senderTimingCommand(
|
IoSenderManage.senderTimingCommand(
|
||||||
lockID:BlueManage().connectDeviceName,
|
lockID: BlueManage().connectDeviceName,
|
||||||
userID:await Storage.getUid(),
|
userID: await Storage.getUid(),
|
||||||
nowTime: state.serverTime,
|
nowTime: state.serverTime,
|
||||||
token:getTokenList,
|
token: getTokenList,
|
||||||
needAuthor:1,
|
needAuthor: 1,
|
||||||
signKey:getSignKeyList,
|
signKey: getSignKeyList,
|
||||||
privateKey:getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
);
|
);
|
||||||
} else if (connectionState == BluetoothConnectionState.disconnected) {
|
} else if (connectionState == BluetoothConnectionState.disconnected) {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
if(state.ifCurrentScreen.value == true){
|
// if (state.ifCurrentScreen.value == true) {
|
||||||
showBlueConnetctToast();
|
// showBlueConnetctToast();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -168,8 +177,10 @@ class LockTimeLogic extends BaseGetXController{
|
|||||||
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||||
(BluetoothConnectionState deviceConnectionState) async {
|
(BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey =
|
||||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList =
|
||||||
|
changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
IoSenderManage.senderGetStarLockStatuInfo(
|
IoSenderManage.senderGetStarLockStatuInfo(
|
||||||
lockID: BlueManage().connectDeviceName,
|
lockID: BlueManage().connectDeviceName,
|
||||||
@ -179,41 +190,42 @@ class LockTimeLogic extends BaseGetXController{
|
|||||||
isBeforeAddUser: false,
|
isBeforeAddUser: false,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
);
|
);
|
||||||
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
} else if (deviceConnectionState ==
|
||||||
|
BluetoothConnectionState.disconnected) {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
if (state.ifCurrentScreen.value == true) {
|
// if (state.ifCurrentScreen.value == true) {
|
||||||
showBlueConnetctToast();
|
// showBlueConnetctToast();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 从网关获取时间
|
// 从网关获取时间
|
||||||
Future<void> getLockTimeFromGateway() async{
|
Future<void> getLockTimeFromGateway() async {
|
||||||
final GetServerDatetimeEntity entity = await ApiRepository.to.getLockTimeFromGateway(
|
final GetServerDatetimeEntity entity =
|
||||||
|
await ApiRepository.to.getLockTimeFromGateway(
|
||||||
lockId: state.lockSetInfoData.value.lockId.toString(),
|
lockId: state.lockSetInfoData.value.lockId.toString(),
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if (entity.errorCode!.codeIsSuccessful) {}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 从服务器获取锁的时间 开锁时传入
|
// 从服务器获取锁的时间 开锁时传入
|
||||||
Future<void> getServerDatetime(bool isSendTime) async{
|
Future<void> getServerDatetime(bool isSendTime) async {
|
||||||
final GetServerDatetimeEntity entity = await ApiRepository.to.getServerDatetimeData(isUnShowLoading:false);
|
final GetServerDatetimeEntity entity =
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
await ApiRepository.to.getServerDatetimeData(isUnShowLoading: false);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
state.serverTime = entity.data!.date! ~/ 1000;
|
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}");
|
// AppLog.log("entity.data!.date! ~/ 1000:${entity.data!.date! ~/ 1000} DateTime.now().millisecondsSinceEpoch ~/ 1000:${DateTime.now().millisecondsSinceEpoch ~/ 1000} 服务器时间差:${state.differentialTime}");
|
||||||
if(isSendTime == false){
|
if (isSendTime == false) {
|
||||||
getStarLockStatus();
|
getStarLockStatus();
|
||||||
}else{
|
} else {
|
||||||
sendTiming();
|
sendTiming();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int getLocalTime(){
|
int getLocalTime() {
|
||||||
final DateTime now = DateTime.now();
|
final DateTime now = DateTime.now();
|
||||||
final Duration timeZoneOffset = now.timeZoneOffset;
|
final Duration timeZoneOffset = now.timeZoneOffset;
|
||||||
// AppLog.log('timeZoneOffset.inSeconds:$timeZoneOffset.inSeconds');
|
// AppLog.log('timeZoneOffset.inSeconds:$timeZoneOffset.inSeconds');
|
||||||
@ -229,7 +241,6 @@ class LockTimeLogic extends BaseGetXController{
|
|||||||
// getLockTimeFromGateway();
|
// getLockTimeFromGateway();
|
||||||
|
|
||||||
getServerDatetime(false);
|
getServerDatetime(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -242,4 +253,4 @@ class LockTimeLogic extends BaseGetXController{
|
|||||||
super.onClose();
|
super.onClose();
|
||||||
_replySubscription.cancel();
|
_replySubscription.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -93,6 +93,7 @@ class NearbyLockLogic extends BaseGetXController {
|
|||||||
showToast('固件升级完成'.tr);
|
showToast('固件升级完成'.tr);
|
||||||
closeOTADAta();
|
closeOTADAta();
|
||||||
}
|
}
|
||||||
|
dismissEasyLoading();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user