diff --git a/lib/talk/starChart/handle/impl/udp_talk_expect_handler.dart b/lib/talk/starChart/handle/impl/udp_talk_expect_handler.dart index 792e7f2c..d500fd44 100644 --- a/lib/talk/starChart/handle/impl/udp_talk_expect_handler.dart +++ b/lib/talk/starChart/handle/impl/udp_talk_expect_handler.dart @@ -4,7 +4,9 @@ import 'dart:typed_data'; import 'package:flutter/services.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:get/get.dart'; +import 'package:star_lock/appRouters.dart'; import 'package:star_lock/app_settings/app_settings.dart'; +import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart'; import 'package:star_lock/talk/starChart/constant/message_type_constant.dart'; import 'package:star_lock/talk/starChart/constant/talk_status.dart'; import 'package:star_lock/talk/starChart/entity/scp_message.dart'; @@ -16,6 +18,8 @@ import 'package:star_lock/talk/starChart/proto/talk_data.pb.dart'; import 'package:star_lock/talk/starChart/proto/talk_expect.pb.dart'; import 'package:star_lock/talk/starChart/views/talkView/talk_view_logic.dart'; import 'package:star_lock/talk/starChart/views/talkView/talk_view_state.dart'; +import 'package:star_lock/tools/commonDataManage.dart'; +import 'package:star_lock/tools/storage.dart'; import '../../star_chart_manage.dart'; @@ -32,10 +36,14 @@ class UdpTalkExpectHandler extends ScpMessageBaseHandle } @override - void handleResp(ScpMessage scpMessage) { + void handleResp(ScpMessage scpMessage) async { // 收到预期音视频数据回复 final TalkExpectResp talkExpectResp = scpMessage.Payload; + if (talkExpectResp != null) { + // 播放铃声 + //test:使用自定义铃声 + playRingtone(); // print('收到预期音视频数据回复,scpMessage:$scpMessage'); // 停止发送预期数据的定时器 startChartManage.stopTalkExpectMessageTimer(); @@ -45,7 +53,7 @@ class UdpTalkExpectHandler extends ScpMessageBaseHandle startChartManage.rotateAngle = talkExpectResp.rotate; startChartManage.videoWidth = talkExpectResp.width; startChartManage.videoHeight = talkExpectResp.height; - AppLog.log('视频画面需要旋转:${talkExpectResp.rotate},画面宽高:${talkExpectResp.width}-${talkExpectResp.height}'); + // 收到预期数据的应答后,代表建立了连接,启动通话保持的监听 // 启动通话保持监听定时器(用来判断如果x秒内没有收到通话保持则执行的操作); talkePingOverTimeTimerManager.start(); @@ -59,6 +67,50 @@ class UdpTalkExpectHandler extends ScpMessageBaseHandle // 主动呼叫时需要启动ping startChartManage.startTalkPingMessageTimer(); } + AppLog.log( + '视频画面需要旋转:${talkExpectResp.rotate},画面宽高:${talkExpectResp.width}-${talkExpectResp.height}'); + // 获取锁支持项 + final LockListInfoItemEntity currentKeyInfo = + CommonDataManage().currentKeyInfo; + // 0、wifi保活 1、wifi不保活图传 2、wifi不保活可视对讲 + var isWifiLockType = currentKeyInfo.lockFeature?.wifiLockType == 1; + + final LockListInfoGroupEntity? lockListInfoGroupEntity = + await Storage.getLockMainListData(); + if (lockListInfoGroupEntity != null) { + lockListInfoGroupEntity!.groupList?.forEach((element) { + final lockList = element.lockList; + if (lockList != null && lockList.length != 0) { + for (var lockInfo in lockList) { + final peerId = lockInfo.network?.peerId; + if (peerId != null && peerId != '') { + if (peerId == scpMessage.FromPeerId) { + isWifiLockType = lockInfo.lockFeature?.wifiLockType == 1; + } + } + } + } + }); + } + if (isWifiLockType || + (talkExpectResp.rotate == 0 && + talkExpectResp.width == 640 && + talkExpectResp.height == 480)) { + Get.toNamed(Routers.imageTransmissionView); + return; + } + if (startChartManage + .getDefaultTalkExpect() + .videoType + .contains(VideoTypeE.H264)) { + Get.toNamed( + Routers.h264WebView, + ); + } else { + Get.toNamed( + Routers.starChartTalkView, + ); + } } } diff --git a/lib/talk/starChart/handle/impl/udp_talk_request_handler.dart b/lib/talk/starChart/handle/impl/udp_talk_request_handler.dart index 195c2ab6..4f3a002f 100644 --- a/lib/talk/starChart/handle/impl/udp_talk_request_handler.dart +++ b/lib/talk/starChart/handle/impl/udp_talk_request_handler.dart @@ -90,52 +90,10 @@ class UdpTalkRequestHandler extends ScpMessageBaseHandle }) async { // 发送预期数据、通知锁板需要获取视频数据 _handleRequestSendExpect(lockPeerID: lockPeerID); - // 播放铃声 - //test:使用自定义铃声 - playRingtone(); // 显示状态栏弹窗 // _showTalkRequestNotification(talkObjectName: talkObjectName); // 设置为等待接听状态 talkStatus.setPassiveCallWaitingAnswer(); - - // 获取锁支持项 - final LockListInfoItemEntity currentKeyInfo = - CommonDataManage().currentKeyInfo; - var isWifiLockType = currentKeyInfo.lockFeature?.wifiLockType == 1; - - final LockListInfoGroupEntity? lockListInfoGroupEntity = - await Storage.getLockMainListData(); - if (lockListInfoGroupEntity != null) { - lockListInfoGroupEntity!.groupList?.forEach((element) { - final lockList = element.lockList; - if (lockList != null && lockList.length != 0) { - for (var lockInfo in lockList) { - final peerId = lockInfo.network?.peerId; - if (peerId != null && peerId != '') { - if (peerId == lockPeerID) { - isWifiLockType = lockInfo.lockFeature?.wifiLockType == 1; - } - } - } - } - }); - } - if (isWifiLockType) { - Get.toNamed(Routers.imageTransmissionView); - return; - } - if (startChartManage - .getDefaultTalkExpect() - .videoType - .contains(VideoTypeE.H264)) { - Get.toNamed( - Routers.h264WebView, - ); - } else { - Get.toNamed( - Routers.starChartTalkView, - ); - } } // 收到来电请求时进行本地通知