style:将对讲时的开门调整为使用http

This commit is contained in:
liyi 2025-01-24 11:05:28 +08:00
parent cea20dff00
commit d2b3ce2a3b
8 changed files with 253 additions and 197 deletions

View File

@ -10,6 +10,7 @@ class LockListInfoEntity {
? LockListInfoGroupEntity.fromJson(json['data']) ? LockListInfoGroupEntity.fromJson(json['data'])
: null; : null;
} }
int? errorCode; int? errorCode;
String? description; String? description;
String? errorMsg; String? errorMsg;
@ -43,6 +44,7 @@ class LockListInfoGroupEntity {
pages = json['pages']; pages = json['pages'];
total = json['total']; total = json['total'];
} }
List<GroupList>? groupList; List<GroupList>? groupList;
int? pageNo; int? pageNo;
int? pageSize; int? pageSize;
@ -75,6 +77,7 @@ class GroupList {
}); });
} }
} }
String? groupName; String? groupName;
int? groupId; int? groupId;
List<LockListInfoItemEntity>? lockList; List<LockListInfoItemEntity>? lockList;
@ -143,6 +146,7 @@ class LockListInfoItemEntity {
this.mac, this.mac,
this.initUserNo, this.initUserNo,
this.updateDate, this.updateDate,
this.network,
}); });
LockListInfoItemEntity.fromJson(Map<String, dynamic> json) { LockListInfoItemEntity.fromJson(Map<String, dynamic> json) {
@ -189,7 +193,11 @@ class LockListInfoItemEntity {
mac = json['mac']; mac = json['mac'];
initUserNo = json['initUserNo']; initUserNo = json['initUserNo'];
updateDate = json['updateDate']; updateDate = json['updateDate'];
network = json['network'] != null
? NetworkInfo.fromJson(json['network'])
: null;
} }
int? keyId; int? keyId;
int? lockId; int? lockId;
String? lockName; String? lockName;
@ -227,6 +235,7 @@ class LockListInfoItemEntity {
String? mac; String? mac;
int? initUserNo; int? initUserNo;
int? updateDate; int? updateDate;
NetworkInfo? network;
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{}; final Map<String, dynamic> data = <String, dynamic>{};
@ -273,6 +282,9 @@ class LockListInfoItemEntity {
data['mac'] = mac; data['mac'] = mac;
data['initUserNo'] = initUserNo; data['initUserNo'] = initUserNo;
data['updateDate'] = updateDate; data['updateDate'] = updateDate;
if (network != null) {
data['network'] = network!.toJson();
}
return data; return data;
} }
@ -301,6 +313,7 @@ class Bluetooth {
privateKey = json['privateKey'].cast<int>(); privateKey = json['privateKey'].cast<int>();
signKey = json['signKey'].cast<int>(); signKey = json['signKey'].cast<int>();
} }
String? bluetoothDeviceId; String? bluetoothDeviceId;
String? bluetoothDeviceName; String? bluetoothDeviceName;
List<int>? publicKey; List<int>? publicKey;
@ -348,6 +361,7 @@ class LockFeature {
isSupportBackupBattery = json['isSupportBackupBattery']; isSupportBackupBattery = json['isSupportBackupBattery'];
isNoSupportedBlueBroadcast = json['isNoSupportedBlueBroadcast']; isNoSupportedBlueBroadcast = json['isNoSupportedBlueBroadcast'];
} }
int? password; int? password;
int? icCard; int? icCard;
int? fingerprint; int? fingerprint;
@ -391,6 +405,7 @@ class LockSetting {
appUnlockOnline = json['appUnlockOnline']; appUnlockOnline = json['appUnlockOnline'];
remoteUnlock = json['remoteUnlock']; remoteUnlock = json['remoteUnlock'];
} }
int? attendance; int? attendance;
int? appUnlockOnline; int? appUnlockOnline;
int? remoteUnlock; int? remoteUnlock;
@ -403,3 +418,21 @@ class LockSetting {
return data; return data;
} }
} }
class NetworkInfo {
NetworkInfo({
this.peerId,
});
NetworkInfo.fromJson(Map<String, dynamic> json) {
peerId = json['peerId'];
}
String? peerId;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['peerId'] = peerId;
return data;
}
}

View File

@ -1,4 +1,3 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
@ -6,6 +5,7 @@ import 'package:flutter/scheduler.dart';
import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_settings.dart'; import 'package:star_lock/app_settings/app_settings.dart';
import 'package:star_lock/talk/starChart/star_chart_manage.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
import '../../../blue/blue_manage.dart'; import '../../../blue/blue_manage.dart';
@ -32,7 +32,6 @@ class LockListLogic extends BaseGetXController {
final ShowTipView showTipView = ShowTipView(); final ShowTipView showTipView = ShowTipView();
List<GroupList> get groupDataList { List<GroupList> get groupDataList {
final List<GroupList> list = final List<GroupList> list =
_groupDataList.map((GroupList e) => e.copy()).toList(); _groupDataList.map((GroupList e) => e.copy()).toList();
if (state.searchStr.value != '' && state.showSearch.value) { if (state.searchStr.value != '' && state.showSearch.value) {
@ -41,6 +40,20 @@ class LockListLogic extends BaseGetXController {
!(element.lockAlias?.contains(state.searchStr.value) ?? true)); !(element.lockAlias?.contains(state.searchStr.value) ?? true));
}); });
} }
if (list.length > 0) {
StartChartManage().lockListPeerId.clear();
list.forEach((element) {
final lockList = element.lockList;
if (lockList != null && lockList.length > 0) {
lockList.forEach((element) {
if (element.network?.peerId != null &&
element.network?.peerId != '') {
StartChartManage().lockListPeerId.add(element);
}
});
}
});
}
return list; return list;
} }
@ -142,7 +155,7 @@ class LockListLogic extends BaseGetXController {
} else { } else {
return XSConstantMacro.getKeyStatusStr(keyInfo.keyStatus!); return XSConstantMacro.getKeyStatusStr(keyInfo.keyStatus!);
} }
}else if (keyInfo.keyType == XSConstantMacro.keyTypeOnce){ } else if (keyInfo.keyType == XSConstantMacro.keyTypeOnce) {
return XSConstantMacro.getKeyStatusStr(keyInfo.keyStatus!); return XSConstantMacro.getKeyStatusStr(keyInfo.keyStatus!);
} }
return ''; return '';
@ -185,11 +198,13 @@ class LockListLogic extends BaseGetXController {
// //
AppLog.log('调用了删除锁'); AppLog.log('调用了删除锁');
showTipView.resetGetController(); showTipView.resetGetController();
showTipView.showTFViewAlertDialog(state.passwordTF, '请输入登录密码'.tr, '请输入登录密码'.tr, checkLoginPassword); showTipView.showTFViewAlertDialog(
state.passwordTF, '请输入登录密码'.tr, '请输入登录密码'.tr, checkLoginPassword);
}); });
} else if (state.lockListInfoItemEntity.keyRight == 1) { } else if (state.lockListInfoItemEntity.keyRight == 1) {
// //
showTipView.showDeleteAdministratorIsHaveAllDataDialog('同时删除其发送的所有钥匙,钥匙删除后不能恢复'.tr, (bool a) { showTipView.showDeleteAdministratorIsHaveAllDataDialog(
'同时删除其发送的所有钥匙,钥匙删除后不能恢复'.tr, (bool a) {
// //
state.deleteAdministratorIsHaveAllData.value = a; state.deleteAdministratorIsHaveAllData.value = a;
deletKeyData(); deletKeyData();

View File

@ -22,7 +22,7 @@ class UdpGoOnlineHandler extends ScpMessageBaseHandle
final responseType = loginResponse.responseType; final responseType = loginResponse.responseType;
if (responseType != null && if (responseType != null &&
responseType == PayloadTypeConstant.loginSuccessResponse) { responseType == PayloadTypeConstant.loginSuccessResponse) {
startChartManage.isOnlineStartChartServer = true; startChartManage.isOnlineStarChartServer = true;
// 线 // 线
startChartManage.stopReStartOnlineStartChartServer(); startChartManage.stopReStartOnlineStartChartServer();
log(text: '星图登录成功,PeerID:${scpMessage.ToPeerId}'); log(text: '星图登录成功,PeerID:${scpMessage.ToPeerId}');

View File

@ -25,7 +25,7 @@ class UdpHeartBeatHandler extends ScpMessageBaseHandle
// //
startChartManage.stopHeartbeat(); startChartManage.stopHeartbeat();
// 线 // 线
startChartManage.isOnlineStartChartServer = false; startChartManage.isOnlineStarChartServer = false;
startChartManage.reStartOnlineStartChartServer(); startChartManage.reStartOnlineStartChartServer();
} else { } else {
// //

View File

@ -30,6 +30,7 @@ class UdpTalkRequestHandler extends ScpMessageBaseHandle
final TalkReq talkReq = scpMessage.Payload; final TalkReq talkReq = scpMessage.Payload;
startChartManage.FromPeerId = scpMessage.ToPeerId!; startChartManage.FromPeerId = scpMessage.ToPeerId!;
startChartManage.ToPeerId = scpMessage.FromPeerId!; startChartManage.ToPeerId = scpMessage.FromPeerId!;
startChartManage.lockPeerId = scpMessage.FromPeerId!;
// //
_talkRequestEvent(talkObjectName: talkReq.callerName); _talkRequestEvent(talkObjectName: talkReq.callerName);
} }

View File

@ -12,6 +12,7 @@ import 'package:star_lock/app_settings/app_settings.dart';
import 'package:star_lock/flavors.dart'; import 'package:star_lock/flavors.dart';
import 'package:star_lock/login/login/entity/LoginData.dart'; import 'package:star_lock/login/login/entity/LoginData.dart';
import 'package:star_lock/login/login/entity/LoginEntity.dart'; import 'package:star_lock/login/login/entity/LoginEntity.dart';
import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart';
import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/network/start_chart_api.dart'; import 'package:star_lock/network/start_chart_api.dart';
import 'package:star_lock/talk/other/audio_player_manager.dart'; import 'package:star_lock/talk/other/audio_player_manager.dart';
@ -79,12 +80,13 @@ class StartChartManage {
String ToPeerId = ''; // ID String ToPeerId = ''; // ID
String FromPeerId = ''; // ID String FromPeerId = ''; // ID
String lockPeerId = ''; String lockPeerId = ''; // peerId
List<LockListInfoItemEntity> lockListPeerId = []; // peerId
// echo测试peer对端 // echo测试peer对端
final String echoPeerId = '3phX8Ng2cZHz5NtP8xAf6nYy2z1BYytoejgjoHrWMGhH'; final String echoPeerId = '3phX8Ng2cZHz5NtP8xAf6nYy2z1BYytoejgjoHrWMGhH';
bool isOnlineStartChartServer = false; // 线 bool isOnlineStarChartServer = false; // 线
Timer? reStartOnlineStartChartServerTimer; // 线 Timer? reStartOnlineStartChartServerTimer; // 线
Timer? talkPingTimer; // Timer? talkPingTimer; //
Timer? talkExpectTimer; // Timer? talkExpectTimer; //
@ -119,7 +121,7 @@ class StartChartManage {
// //
final loginData = await Storage.getLoginData(); final loginData = await Storage.getLoginData();
if ((isOnlineStartChartServer && _udpSocket != null) || loginData == null) { if ((isOnlineStarChartServer && _udpSocket != null) || loginData == null) {
// 线 // 线
return; return;
} }
@ -391,7 +393,7 @@ class StartChartManage {
// 线 // 线
Future<void> _sendOnlineMessage() async { Future<void> _sendOnlineMessage() async {
if (isOnlineStartChartServer) { if (isOnlineStarChartServer) {
_log(text: '星图已上线,请勿重复发送上线消息'); _log(text: '星图已上线,请勿重复发送上线消息');
return; return;
} }
@ -670,7 +672,7 @@ class StartChartManage {
// 线 // 线
Future<void> reStartOnlineStartChartServer() async { Future<void> reStartOnlineStartChartServer() async {
if (isOnlineStartChartServer) { if (isOnlineStarChartServer) {
_log(text: '星图已上线,请勿重复发送上线消息'); _log(text: '星图已上线,请勿重复发送上线消息');
return; return;
} }
@ -714,17 +716,16 @@ class StartChartManage {
// _udpSocket = null; // _udpSocket = null;
} }
// print('发送消息');
//ToDo: //ToDo:
UdpTalkDataHandler().updateSendDataRate(message.length); // UdpTalkDataHandler().updateSendDataRate(message.length);
//
// // //
Provider.of<DebugInfoModel>(Get.context!, listen: false).updateDebugInfo( // Provider.of<DebugInfoModel>(Get.context!, listen: false).updateDebugInfo(
UdpTalkDataHandler().getLastRecvDataRate() ~/ 1024, // KB // UdpTalkDataHandler().getLastRecvDataRate() ~/ 1024, // KB
UdpTalkDataHandler().getLastRecvPacketCount(), // UdpTalkDataHandler().getLastRecvPacketCount(),
UdpTalkDataHandler().getLastSendDataRate() ~/ 1024, // KB // UdpTalkDataHandler().getLastSendDataRate() ~/ 1024, // KB
UdpTalkDataHandler().getLastSendPacketCount(), // UdpTalkDataHandler().getLastSendPacketCount(),
); // );
} }
// //
@ -1101,9 +1102,10 @@ class StartChartManage {
} }
/// ///
Future<void> destruction() async { void destruction() async {
// sendTalkHangupMessage(); //
isOnlineStartChartServer = false; sendTalkHangupMessage();
isOnlineStarChartServer = false;
// //
stopHeartbeat(); stopHeartbeat();
// //
@ -1120,8 +1122,12 @@ class StartChartManage {
stopSendingRbcuConfirmMessages(); stopSendingRbcuConfirmMessages();
// //
_resetData(); _resetData();
//
await Storage.removerRelayInfo(); await Storage.removerRelayInfo();
//
await Storage.removerStarChartRegisterNodeInfo(); await Storage.removerStarChartRegisterNodeInfo();
// udp服务
closeUdpSocket();
} }
/// ///
@ -1130,6 +1136,7 @@ class StartChartManage {
videoType: [VideoTypeE.IMAGE], videoType: [VideoTypeE.IMAGE],
audioType: [AudioTypeE.G711], audioType: [AudioTypeE.G711],
); );
isOnlineStartChartServer = false; isOnlineStarChartServer = false;
talkStatus.setUninitialized();
} }
} }

View File

@ -21,9 +21,12 @@ import 'package:star_lock/app_settings/app_settings.dart';
import 'package:star_lock/blue/blue_manage.dart'; import 'package:star_lock/blue/blue_manage.dart';
import 'package:star_lock/blue/io_protocol/io_openLock.dart'; import 'package:star_lock/blue/io_protocol/io_openLock.dart';
import 'package:star_lock/blue/io_tool/io_tool.dart'; import 'package:star_lock/blue/io_tool/io_tool.dart';
import 'package:star_lock/login/login/entity/LoginEntity.dart';
import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_logic.dart'; import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_logic.dart';
import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_state.dart'; import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_state.dart';
import 'package:star_lock/main/lockDetail/lockDetail/lockNetToken_entity.dart'; import 'package:star_lock/main/lockDetail/lockDetail/lockNetToken_entity.dart';
import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart';
import 'package:star_lock/main/lockMian/lockList/lockList_logic.dart';
import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/talk/call/g711.dart'; import 'package:star_lock/talk/call/g711.dart';
import 'package:star_lock/talk/starChart/constant/talk_status.dart'; import 'package:star_lock/talk/starChart/constant/talk_status.dart';
@ -98,8 +101,6 @@ class TalkViewLogic extends BaseGetXController {
state.videoBuffer.removeAt(0); // state.videoBuffer.removeAt(0); //
} }
state.videoBuffer.add(talkData); // state.videoBuffer.add(talkData); //
///
// updateNetworkStatus(currentTimestamp);
break; break;
} }
}); });
@ -233,36 +234,6 @@ class TalkViewLogic extends BaseGetXController {
} }
} }
///
void updateNetworkStatus(int currentTimestamp) {
if (state.lastFrameTimestamp.value != 0) {
final frameInterval = currentTimestamp - state.lastFrameTimestamp.value;
if (frameInterval > 500 && frameInterval <= 1000) {
// 5001
state.networkStatus.value = NetworkStatus.lagging;
// showNetworkStatus("Network is lagging");
} else if (frameInterval > 1000) {
// 1
state.networkStatus.value = NetworkStatus.delayed;
// showNetworkStatus("Network is delayed");
} else {
state.networkStatus.value = NetworkStatus.normal;
state.alertCount.value = 0; //
}
}
state.lastFrameTimestamp.value = currentTimestamp;
}
///
void showNetworkStatus(String message) {
// EasyLoading
if (state.alertCount.value < state.maxAlertNumber.value &&
!EasyLoading.isShow) {
showToast(message);
state.alertCount++;
}
}
/// ///
void _stopPlayG711Data() async { void _stopPlayG711Data() async {
await FlutterPcmSound.pause(); await FlutterPcmSound.pause();
@ -271,44 +242,44 @@ class TalkViewLogic extends BaseGetXController {
} }
/// ///
udpOpenDoorAction() async { // udpOpenDoorAction() async {
final List<String>? privateKey = // final List<String>? privateKey =
await Storage.getStringList(saveBluePrivateKey); // await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); // final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
//
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey); // final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
final List<int> signKeyDataList = changeStringListToIntList(signKey!); // final List<int> signKeyDataList = changeStringListToIntList(signKey!);
//
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!);
//
await _getLockNetToken(); // await _getLockNetToken();
//
final OpenLockCommand openLockCommand = OpenLockCommand( // final OpenLockCommand openLockCommand = OpenLockCommand(
lockID: BlueManage().connectDeviceName, // lockID: BlueManage().connectDeviceName,
userID: await Storage.getUid(), // userID: await Storage.getUid(),
openMode: lockDetailState.openDoorModel, // openMode: lockDetailState.openDoorModel,
openTime: _getUTCNetTime(), // openTime: _getUTCNetTime(),
onlineToken: lockDetailState.lockNetToken, // onlineToken: lockDetailState.lockNetToken,
token: getTokenList, // token: getTokenList,
needAuthor: 1, // needAuthor: 1,
signKey: signKeyDataList, // signKey: signKeyDataList,
privateKey: getPrivateKeyList, // privateKey: getPrivateKeyList,
); // );
final messageDetail = openLockCommand.packageData(); // final messageDetail = openLockCommand.packageData();
// List<int> // // List<int>
String hexString = messageDetail // String hexString = messageDetail
.map((byte) => byte.toRadixString(16).padLeft(2, '0')) // .map((byte) => byte.toRadixString(16).padLeft(2, '0'))
.join(' '); // .join(' ');
//
AppLog.log('open lock hexString: $hexString'); // AppLog.log('open lock hexString: $hexString');
// // //
StartChartManage().sendRemoteUnLockMessage( // StartChartManage().sendRemoteUnLockMessage(
bluetoothDeviceName: BlueManage().connectDeviceName, // bluetoothDeviceName: BlueManage().connectDeviceName,
openLockCommand: messageDetail, // openLockCommand: messageDetail,
); // );
showToast('正在开锁中...'.tr); // showToast('正在开锁中...'.tr);
} // }
int _getUTCNetTime() { int _getUTCNetTime() {
if (lockDetailState.isHaveNetwork) { if (lockDetailState.isHaveNetwork) {
@ -524,6 +495,34 @@ class TalkViewLogic extends BaseGetXController {
} }
} }
//
Future<void> remoteOpenLock() async {
final lockPeerId = StartChartManage().lockPeerId;
final lockListPeerId = StartChartManage().lockListPeerId;
int lockId = 0;
if (lockListPeerId.length == 0) {
// peerId使lockId
lockId = lockDetailState.keyInfos.value.lockId ?? 0;
} else {
// peerId使peerId
// peerId
lockId = lockListPeerId
.firstWhere(
(element) => element.network?.peerId == lockPeerId,
orElse: () => LockListInfoItemEntity(), // null
)
?.lockId ??
0;
}
if (lockPeerId.isNotEmpty) {}
final LoginEntity entity = await ApiRepository.to
.remoteOpenLock(lockId: lockId.toString(), timeOut: 60);
if (entity.errorCode!.codeIsSuccessful) {
showToast('已开锁'.tr);
StartChartManage().lockListPeerId = [];
}
}
/// ///
void _initAudioRecorder() { void _initAudioRecorder() {
state.voiceProcessor = VoiceProcessor.instance; state.voiceProcessor = VoiceProcessor.instance;

View File

@ -56,31 +56,31 @@ class _TalkViewPageState extends State<TalkViewPage>
} }
}); });
_latencyStream = measureServerLatencyStream(F.apiPrefix); // // _latencyStream = measureServerLatencyStream(F.apiPrefix); //
}
Stream<int> measureServerLatencyStream(String url) async* {
while (true) {
final latency = await measureServerLatency(url);
yield latency;
await Future.delayed(Duration(seconds: 1)); //
}
}
Future<int> measureServerLatency(String url) async {
final Stopwatch stopwatch = Stopwatch()..start();
try {
final http.Response response = await http.get(Uri.parse(url));
if (response.statusCode == 200) {
stopwatch.stop();
return stopwatch.elapsedMilliseconds;
} else {
return -1; //
}
} catch (e) {
return -1; //
}
} }
//
// Stream<int> measureServerLatencyStream(String url) async* {
// while (true) {
// final latency = await measureServerLatency(url);
// yield latency;
// await Future.delayed(Duration(seconds: 1)); //
// }
// }
//
// Future<int> measureServerLatency(String url) async {
// final Stopwatch stopwatch = Stopwatch()..start();
// try {
// final http.Response response = await http.get(Uri.parse(url));
// if (response.statusCode == 200) {
// stopwatch.stop();
// return stopwatch.elapsedMilliseconds;
// } else {
// return -1; //
// }
// } catch (e) {
// return -1; //
// }
// }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -255,40 +255,40 @@ class _TalkViewPageState extends State<TalkViewPage>
) )
: Container()), : Container()),
//ToDo: //ToDo:
// Visibility( Visibility(
// visible: true, visible: true,
// child: Positioned( child: Positioned(
// top: 20, // top: 20, //
// left: 20, left: 20,
// right: 20, // right: 20, //
// child: Container( child: Container(
// height: 100, // 100 height: 100, // 100
// color: Colors.black.withOpacity(0.5), // color: Colors.black.withOpacity(0.5), //
// padding: const EdgeInsets.all(10), // padding: const EdgeInsets.all(10), //
// child: Consumer<DebugInfoModel>( child: Consumer<DebugInfoModel>(
// builder: (BuildContext context, DebugInfoModel debugInfo, builder: (BuildContext context, DebugInfoModel debugInfo,
// Widget? child) { Widget? child) {
// return Column( return Column(
// crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
// children: <Widget>[ children: <Widget>[
// Text( Text(
// 'recv ${debugInfo.recvDataRate}KB/s [${debugInfo.recvPacketCount}]', 'recv ${debugInfo.recvDataRate}KB/s [${debugInfo.recvPacketCount}]',
// style: const TextStyle( style: const TextStyle(
// color: Colors.white), // color: Colors.white), //
// ), ),
// Text( Text(
// 'send ${debugInfo.sendDataRate}KB/s [${debugInfo.sendPacketCount}]', 'send ${debugInfo.sendDataRate}KB/s [${debugInfo.sendPacketCount}]',
// style: const TextStyle( style: const TextStyle(
// color: Colors.white), // color: Colors.white), //
// ), ),
// ], ],
// ); );
// }, },
// ), ),
// ), ),
// ), ),
// ), ),
// // //
// Positioned( // Positioned(
// top: 120, // top: 120,
// left: 20, // left: 20,
@ -455,10 +455,11 @@ class _TalkViewPageState extends State<TalkViewPage>
'开锁'.tr, '开锁'.tr,
AppColors.mainColor, AppColors.mainColor,
onClick: () { onClick: () {
if (state.talkStatus.value == TalkStatus.answeredSuccessfully && // if (state.talkStatus.value == TalkStatus.answeredSuccessfully &&
state.listData.value.length > 0) { // state.listData.value.length > 0) {
logic.udpOpenDoorAction(); // logic.udpOpenDoorAction();
} logic.remoteOpenLock();
// }
// if (UDPManage().remoteUnlock == 1) { // if (UDPManage().remoteUnlock == 1) {
// logic.udpOpenDoorAction(); // logic.udpOpenDoorAction();
// showDeletPasswordAlertDialog(context); // showDeletPasswordAlertDialog(context);
@ -534,45 +535,45 @@ class _TalkViewPageState extends State<TalkViewPage>
); );
} }
void showDeletPasswordAlertDialog(BuildContext context) { // void showDeletPasswordAlertDialog(BuildContext context) {
showDialog( // showDialog(
barrierDismissible: false, // barrierDismissible: false,
context: context, // context: context,
builder: (BuildContext context) { // builder: (BuildContext context) {
return ShowTFView( // return ShowTFView(
title: '请输入6位数字开锁密码'.tr, // title: '请输入6位数字开锁密码'.tr,
tipTitle: '', // tipTitle: '',
controller: state.passwordTF, // controller: state.passwordTF,
inputFormatters: <TextInputFormatter>[ // inputFormatters: <TextInputFormatter>[
LengthLimitingTextInputFormatter(6), // // LengthLimitingTextInputFormatter(6), //
FilteringTextInputFormatter.allow(RegExp('[0-9]')), // FilteringTextInputFormatter.allow(RegExp('[0-9]')),
], // ],
sureClick: () async { // sureClick: () async {
// // //
// if (state.passwordTF.text.isEmpty) { // // if (state.passwordTF.text.isEmpty) {
// logic.showToast('请输入开锁密码'.tr); // // logic.showToast('请输入开锁密码'.tr);
// return; // // return;
// } // // }
//
// List<int> numbers = state.passwordTF.text.split('').map((char) => int.parse(char)).toList(); // // List<int> numbers = state.passwordTF.text.split('').map((char) => int.parse(char)).toList();
// // //
// lockID // // lockID
// final List<int> numbers = <int>[]; // // final List<int> numbers = <int>[];
// final List<int> lockIDData = utf8.encode(state.passwordTF.text); // // final List<int> lockIDData = utf8.encode(state.passwordTF.text);
// numbers.addAll(lockIDData); // // numbers.addAll(lockIDData);
// // topBytes = getFixedLengthList(lockIDData, 20 - lockIDData.length); // // // topBytes = getFixedLengthList(lockIDData, 20 - lockIDData.length);
// for (int i = 0; i < 6 - lockIDData.length; i++) { // // for (int i = 0; i < 6 - lockIDData.length; i++) {
// numbers.add(0); // // numbers.add(0);
// } // // }
logic.udpOpenDoorAction(); // // logic.udpOpenDoorAction();
}, // },
cancelClick: () { // cancelClick: () {
Get.back(); // Get.back();
}, // },
); // );
}, // },
); // );
} // }
// //
Widget buildRotationTransition() { Widget buildRotationTransition() {