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? secretKey;
|
||||
String? peerId;
|
||||
String? rssi;
|
||||
int? rssi;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final map = <String, dynamic>{};
|
||||
|
||||
@ -411,32 +411,19 @@ class LockDetailLogic extends BaseGetXController {
|
||||
indexMap['type'] = indexList[0].toString();
|
||||
|
||||
final int userNo = (indexList[1] * 256) + indexList[2];
|
||||
indexMap['user'] = userNo.toString();
|
||||
// AppLog.log('userNouserNouserNouserNo:$userNo');
|
||||
if (userNo == 0xFFFF) {
|
||||
// 离线密码情况:16进制格式,去除结束符F(0x1F)及其之后的内容
|
||||
final List<int> passwordData = indexList.sublist(7, 17); // 取10个字节
|
||||
// 找到结束符F(0x1F)的位置
|
||||
int endIndex = passwordData.indexOf(0x1F);
|
||||
if (endIndex == -1) {
|
||||
// 如果没有结束符,取全部数据
|
||||
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');
|
||||
final List<int> passwordData = indexList.sublist(7, 17);
|
||||
final String password;
|
||||
if(userNo == 65535){
|
||||
//离线密码
|
||||
password = passwordData
|
||||
.map((byte) => byte.toRadixString(16).padLeft(2, '0'))
|
||||
.join('')
|
||||
.replaceAll(RegExp(r'f*$'), '');
|
||||
} else {
|
||||
final List<int> passwordData = indexList.sublist(7, 17);
|
||||
final String password = utf8String(passwordData);
|
||||
indexMap['password'] = password.toString();
|
||||
indexMap['user'] = userNo.toString();
|
||||
password = utf8String(passwordData);
|
||||
}
|
||||
indexMap['password'] = password.toString();
|
||||
|
||||
// AppLog.log('passwordpasswordpassword:$password');
|
||||
|
||||
@ -542,23 +529,6 @@ class LockDetailLogic extends BaseGetXController {
|
||||
signKey: signKeyDataList,
|
||||
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 deviceMac,
|
||||
required String networkMac,
|
||||
int? rssi,
|
||||
required int rssi,
|
||||
}) async {
|
||||
try {
|
||||
final LoginEntity entity = await ApiRepository.to.settingDeviceNetwork(
|
||||
@ -174,7 +174,7 @@ class ConfiguringWifiLogic extends BaseGetXController {
|
||||
secretKey: secretKey,
|
||||
deviceMac: deviceMac ?? '',
|
||||
networkMac: networkMac ?? '',
|
||||
rssi: rssi,
|
||||
rssi: rssi ?? 0,
|
||||
);
|
||||
if (info.errorCode!.codeIsSuccessful) {
|
||||
// 设置锁的peerID
|
||||
@ -183,7 +183,7 @@ class ConfiguringWifiLogic extends BaseGetXController {
|
||||
networkMac: networkMac,
|
||||
secretKey: secretKey,
|
||||
peerId: peerId,
|
||||
rssi: rssi.toString(),
|
||||
rssi: rssi,
|
||||
);
|
||||
|
||||
state.lockSetInfoData.value?.lockBasicInfo?.networkInfo?.peerId =
|
||||
|
||||
@ -28,6 +28,11 @@ class ThirdPartyPlatformLogic extends BaseGetXController {
|
||||
void onReady() async {
|
||||
super.onReady();
|
||||
await getActivateInfo();
|
||||
// 恢复之前保存的选中状态
|
||||
final savedIndex = await state.getSavedSelectedPlatformIndex();
|
||||
if (savedIndex != null && savedIndex < state.platFormSet.length) {
|
||||
state.selectPlatFormIndex.value = savedIndex;
|
||||
}
|
||||
_initReplySubscription();
|
||||
await getServerDatetime();
|
||||
showEasyLoading();
|
||||
@ -209,6 +214,8 @@ class ThirdPartyPlatformLogic extends BaseGetXController {
|
||||
void savePlatFormSetting() {
|
||||
if (state.selectPlatFormIndex.value == 1 || state.selectPlatFormIndex.value == 0) {
|
||||
if (state.registerKey.isNotEmpty) {
|
||||
// 持久化保存选项
|
||||
state.saveSelectedPlatformIndex(state.selectPlatFormIndex.value);
|
||||
_requestAuthorizationCode();
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -2,6 +2,7 @@ import 'dart:ui';
|
||||
|
||||
import 'package:get/get.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/lockSet/lockSet/lockSetInfo_entity.dart';
|
||||
import 'package:star_lock/translations/app_dept.dart';
|
||||
@ -32,4 +33,16 @@ class ThirdPartyPlatformState {
|
||||
Map lockInfo = {};
|
||||
|
||||
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;
|
||||
if ((status == TalkStatus.passiveCallWaitingAnswer ||
|
||||
status == TalkStatus.proactivelyCallWaitingAnswer ||
|
||||
status == TalkStatus.answeredSuccessfully) &&
|
||||
status == TalkStatus.answeredSuccessfully ||
|
||||
status == TalkStatus.uninitialized) &&
|
||||
Get.currentRoute != '/StarLockRegisterPage') { // 避免在注册页返回
|
||||
Get.back();
|
||||
}
|
||||
// 避免在无通话状态时销毁对讲资源
|
||||
if (status != TalkStatus.uninitialized) {
|
||||
StartChartManage().destruction();
|
||||
}
|
||||
StartChartManage().destruction();
|
||||
_readMessageRefreshUIEvent?.cancel();
|
||||
}
|
||||
|
||||
|
||||
@ -1311,13 +1311,8 @@ class TalkViewNativeDecodeLogic extends BaseGetXController {
|
||||
state.currentQuality.value = quality;
|
||||
TalkExpectReq talkExpectReq = StartChartManage().getDefaultTalkExpect();
|
||||
final audioType = talkExpectReq.audioType;
|
||||
|
||||
// 立即显示loading状态
|
||||
state.isLoading.value = true;
|
||||
|
||||
int width = 864;
|
||||
int height = 480;
|
||||
|
||||
switch (quality) {
|
||||
case '高清':
|
||||
talkExpectReq = TalkExpectReq(
|
||||
@ -1337,23 +1332,15 @@ class TalkViewNativeDecodeLogic extends BaseGetXController {
|
||||
break;
|
||||
}
|
||||
|
||||
// 立即预设解码器尺寸
|
||||
/// 修改发送预期数据
|
||||
StartChartManage().changeTalkExpectDataTypeAndReStartTalkExpectMessageTimer(talkExpect: talkExpectReq);
|
||||
|
||||
// 不立即loading,继续解码旧流帧,等待frameSeq回绕检测
|
||||
// 仅重置frameSeq回绕检测标志
|
||||
_pendingStreamReset = false;
|
||||
_pendingResetWidth = width;
|
||||
_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() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user