Merge remote-tracking branch 'origin/develop_sky_minbb' into develop_sky_minbb
# Conflicts: # lib/main/lockDetail/lockDetail/lockDetail_logic.dart # lib/main/lockDetail/lockSet/configuringWifi/configuringWifi/configuringWifi_page.dart
This commit is contained in:
commit
07fb7a6542
@ -54,7 +54,7 @@ class DeviceNetworkInfo {
|
|||||||
String? networkMac;
|
String? networkMac;
|
||||||
String? secretKey;
|
String? secretKey;
|
||||||
String? peerId;
|
String? peerId;
|
||||||
String? rssi;
|
int? rssi;
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final map = <String, dynamic>{};
|
final map = <String, dynamic>{};
|
||||||
|
|||||||
@ -411,32 +411,19 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
indexMap['type'] = indexList[0].toString();
|
indexMap['type'] = indexList[0].toString();
|
||||||
|
|
||||||
final int userNo = (indexList[1] * 256) + indexList[2];
|
final int userNo = (indexList[1] * 256) + indexList[2];
|
||||||
indexMap['user'] = userNo.toString();
|
final List<int> passwordData = indexList.sublist(7, 17);
|
||||||
// AppLog.log('userNouserNouserNouserNo:$userNo');
|
final String password;
|
||||||
if (userNo == 0xFFFF) {
|
if(userNo == 65535){
|
||||||
// 离线密码情况:16进制格式,去除结束符F(0x1F)及其之后的内容
|
//离线密码
|
||||||
final List<int> passwordData = indexList.sublist(7, 17); // 取10个字节
|
password = passwordData
|
||||||
// 找到结束符F(0x1F)的位置
|
.map((byte) => byte.toRadixString(16).padLeft(2, '0'))
|
||||||
int endIndex = passwordData.indexOf(0x1F);
|
.join('')
|
||||||
if (endIndex == -1) {
|
.replaceAll(RegExp(r'f*$'), '');
|
||||||
// 如果没有结束符,取全部数据
|
|
||||||
endIndex = passwordData.length;
|
|
||||||
}
|
|
||||||
// 只取结束符前的部分(不包括结束符)
|
|
||||||
final List<int> actualPasswordData = passwordData.sublist(0, endIndex);
|
|
||||||
// 转换为十六进制字符串
|
|
||||||
String passwordHex = actualPasswordData.map((byte) => byte.toRadixString(16).padLeft(2, '0')).join();
|
|
||||||
// 过滤掉字母部分
|
|
||||||
passwordHex = passwordHex.replaceAll(RegExp(r'[^0-9]'), '');
|
|
||||||
|
|
||||||
indexMap['password'] = passwordHex;
|
|
||||||
// indexMap['password'] = passwordHex; // 存储十六进制字符串表示
|
|
||||||
AppLog.log('离线密码开锁:$passwordHex');
|
|
||||||
} else {
|
} else {
|
||||||
final List<int> passwordData = indexList.sublist(7, 17);
|
indexMap['user'] = userNo.toString();
|
||||||
final String password = utf8String(passwordData);
|
password = utf8String(passwordData);
|
||||||
indexMap['password'] = password.toString();
|
|
||||||
}
|
}
|
||||||
|
indexMap['password'] = password.toString();
|
||||||
|
|
||||||
// AppLog.log('passwordpasswordpassword:$password');
|
// AppLog.log('passwordpasswordpassword:$password');
|
||||||
|
|
||||||
@ -542,23 +529,6 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
signKey: signKeyDataList,
|
signKey: signKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
);
|
);
|
||||||
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
|
||||||
cancelBlueConnetctToastTimer();
|
|
||||||
BuglyTool.uploadException(
|
|
||||||
message: '蓝牙连接失败-开锁失败', detail: '蓝牙连接失败,断开连接, 开锁失败--OpenLockCommand:$command', upload: true);
|
|
||||||
final String getMobile = (await Storage.getMobile())!;
|
|
||||||
ApmHelper.instance.trackEvent('open_lock', {
|
|
||||||
'lock_name': state.keyInfos.value.lockName!,
|
|
||||||
'account': getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
|
||||||
'date': DateTool().getNowDateWithType(1),
|
|
||||||
'open_lock_result': '断开连接',
|
|
||||||
});
|
|
||||||
|
|
||||||
// if (state.ifCurrentScreen.value == true) {
|
|
||||||
// showBlueConnetctToast();
|
|
||||||
// }
|
|
||||||
resetOpenDoorState();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -61,7 +61,7 @@ class ConfiguringWifiLogic extends BaseGetXController {
|
|||||||
required String secretKey,
|
required String secretKey,
|
||||||
required String deviceMac,
|
required String deviceMac,
|
||||||
required String networkMac,
|
required String networkMac,
|
||||||
int? rssi,
|
required int rssi,
|
||||||
}) async {
|
}) async {
|
||||||
try {
|
try {
|
||||||
final LoginEntity entity = await ApiRepository.to.settingDeviceNetwork(
|
final LoginEntity entity = await ApiRepository.to.settingDeviceNetwork(
|
||||||
@ -174,7 +174,7 @@ class ConfiguringWifiLogic extends BaseGetXController {
|
|||||||
secretKey: secretKey,
|
secretKey: secretKey,
|
||||||
deviceMac: deviceMac ?? '',
|
deviceMac: deviceMac ?? '',
|
||||||
networkMac: networkMac ?? '',
|
networkMac: networkMac ?? '',
|
||||||
rssi: rssi,
|
rssi: rssi ?? 0,
|
||||||
);
|
);
|
||||||
if (info.errorCode!.codeIsSuccessful) {
|
if (info.errorCode!.codeIsSuccessful) {
|
||||||
// 设置锁的peerID
|
// 设置锁的peerID
|
||||||
@ -183,7 +183,7 @@ class ConfiguringWifiLogic extends BaseGetXController {
|
|||||||
networkMac: networkMac,
|
networkMac: networkMac,
|
||||||
secretKey: secretKey,
|
secretKey: secretKey,
|
||||||
peerId: peerId,
|
peerId: peerId,
|
||||||
rssi: rssi.toString(),
|
rssi: rssi,
|
||||||
);
|
);
|
||||||
|
|
||||||
state.lockSetInfoData.value?.lockBasicInfo?.networkInfo?.peerId =
|
state.lockSetInfoData.value?.lockBasicInfo?.networkInfo?.peerId =
|
||||||
|
|||||||
@ -28,6 +28,11 @@ class ThirdPartyPlatformLogic extends BaseGetXController {
|
|||||||
void onReady() async {
|
void onReady() async {
|
||||||
super.onReady();
|
super.onReady();
|
||||||
await getActivateInfo();
|
await getActivateInfo();
|
||||||
|
// 恢复之前保存的选中状态
|
||||||
|
final savedIndex = await state.getSavedSelectedPlatformIndex();
|
||||||
|
if (savedIndex != null && savedIndex < state.platFormSet.length) {
|
||||||
|
state.selectPlatFormIndex.value = savedIndex;
|
||||||
|
}
|
||||||
_initReplySubscription();
|
_initReplySubscription();
|
||||||
await getServerDatetime();
|
await getServerDatetime();
|
||||||
showEasyLoading();
|
showEasyLoading();
|
||||||
@ -209,6 +214,8 @@ class ThirdPartyPlatformLogic extends BaseGetXController {
|
|||||||
void savePlatFormSetting() {
|
void savePlatFormSetting() {
|
||||||
if (state.selectPlatFormIndex.value == 1 || state.selectPlatFormIndex.value == 0) {
|
if (state.selectPlatFormIndex.value == 1 || state.selectPlatFormIndex.value == 0) {
|
||||||
if (state.registerKey.isNotEmpty) {
|
if (state.registerKey.isNotEmpty) {
|
||||||
|
// 持久化保存选项
|
||||||
|
state.saveSelectedPlatformIndex(state.selectPlatFormIndex.value);
|
||||||
_requestAuthorizationCode();
|
_requestAuthorizationCode();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import 'dart:ui';
|
|||||||
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:get/get_rx/get_rx.dart';
|
import 'package:get/get_rx/get_rx.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import 'package:star_lock/main/lockDetail/lockDetail/ActivateInfoResponse.dart';
|
import 'package:star_lock/main/lockDetail/lockDetail/ActivateInfoResponse.dart';
|
||||||
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
|
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
|
||||||
import 'package:star_lock/translations/app_dept.dart';
|
import 'package:star_lock/translations/app_dept.dart';
|
||||||
@ -32,4 +33,16 @@ class ThirdPartyPlatformState {
|
|||||||
Map lockInfo = {};
|
Map lockInfo = {};
|
||||||
|
|
||||||
int serverTime = 0; // 服务器时间即UTC+0时间
|
int serverTime = 0; // 服务器时间即UTC+0时间
|
||||||
|
|
||||||
|
// 存储选中的平台索引
|
||||||
|
static const String _SELECTED_PLATFORM_INDEX_KEY = 'selected_platform_index';
|
||||||
|
Future<void> saveSelectedPlatformIndex(int index) async {
|
||||||
|
final prefs = await SharedPreferences.getInstance();
|
||||||
|
await prefs.setInt(_SELECTED_PLATFORM_INDEX_KEY, index);
|
||||||
|
}
|
||||||
|
// 从本地存储读取选中的平台索引
|
||||||
|
Future<int?> getSavedSelectedPlatformIndex() async {
|
||||||
|
final prefs = await SharedPreferences.getInstance();
|
||||||
|
return prefs.getInt(_SELECTED_PLATFORM_INDEX_KEY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -66,14 +66,12 @@ class AppLifecycleObserver extends WidgetsBindingObserver {
|
|||||||
final status = StartChartManage().talkStatus.status;
|
final status = StartChartManage().talkStatus.status;
|
||||||
if ((status == TalkStatus.passiveCallWaitingAnswer ||
|
if ((status == TalkStatus.passiveCallWaitingAnswer ||
|
||||||
status == TalkStatus.proactivelyCallWaitingAnswer ||
|
status == TalkStatus.proactivelyCallWaitingAnswer ||
|
||||||
status == TalkStatus.answeredSuccessfully) &&
|
status == TalkStatus.answeredSuccessfully ||
|
||||||
|
status == TalkStatus.uninitialized) &&
|
||||||
Get.currentRoute != '/StarLockRegisterPage') { // 避免在注册页返回
|
Get.currentRoute != '/StarLockRegisterPage') { // 避免在注册页返回
|
||||||
Get.back();
|
Get.back();
|
||||||
}
|
}
|
||||||
// 避免在无通话状态时销毁对讲资源
|
StartChartManage().destruction();
|
||||||
if (status != TalkStatus.uninitialized) {
|
|
||||||
StartChartManage().destruction();
|
|
||||||
}
|
|
||||||
_readMessageRefreshUIEvent?.cancel();
|
_readMessageRefreshUIEvent?.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1311,13 +1311,8 @@ class TalkViewNativeDecodeLogic extends BaseGetXController {
|
|||||||
state.currentQuality.value = quality;
|
state.currentQuality.value = quality;
|
||||||
TalkExpectReq talkExpectReq = StartChartManage().getDefaultTalkExpect();
|
TalkExpectReq talkExpectReq = StartChartManage().getDefaultTalkExpect();
|
||||||
final audioType = talkExpectReq.audioType;
|
final audioType = talkExpectReq.audioType;
|
||||||
|
|
||||||
// 立即显示loading状态
|
|
||||||
state.isLoading.value = true;
|
|
||||||
|
|
||||||
int width = 864;
|
int width = 864;
|
||||||
int height = 480;
|
int height = 480;
|
||||||
|
|
||||||
switch (quality) {
|
switch (quality) {
|
||||||
case '高清':
|
case '高清':
|
||||||
talkExpectReq = TalkExpectReq(
|
talkExpectReq = TalkExpectReq(
|
||||||
@ -1337,23 +1332,15 @@ class TalkViewNativeDecodeLogic extends BaseGetXController {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 立即预设解码器尺寸
|
/// 修改发送预期数据
|
||||||
|
StartChartManage().changeTalkExpectDataTypeAndReStartTalkExpectMessageTimer(talkExpect: talkExpectReq);
|
||||||
|
|
||||||
|
// 不立即loading,继续解码旧流帧,等待frameSeq回绕检测
|
||||||
|
// 仅重置frameSeq回绕检测标志
|
||||||
|
_pendingStreamReset = false;
|
||||||
_pendingResetWidth = width;
|
_pendingResetWidth = width;
|
||||||
_pendingResetHeight = height;
|
_pendingResetHeight = height;
|
||||||
|
|
||||||
try {
|
|
||||||
// 并行执行两个操作以提高效率,设置更短的总超时时间
|
|
||||||
await Future.wait([
|
|
||||||
// 立即重置解码器
|
|
||||||
_resetDecoderForNewStream(width, height),
|
|
||||||
// 修改发送预期数据
|
|
||||||
Future.microtask(() =>
|
|
||||||
StartChartManage().changeTalkExpectDataTypeAndReStartTalkExpectMessageTimer(talkExpect: talkExpectReq))
|
|
||||||
]).timeout(const Duration(milliseconds: 1500)); // 设置总超时时间
|
|
||||||
} catch (e) {
|
|
||||||
AppLog.log('切换清晰度超时或失败: $e');
|
|
||||||
state.isLoading.value = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _initHdOptions() {
|
void _initHdOptions() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user