视频对讲和监控优化
This commit is contained in:
parent
3224fd342a
commit
aae65dbfad
@ -926,8 +926,8 @@ class LockDetailLogic extends BaseGetXController {
|
||||
}
|
||||
// 重置丢包率监控
|
||||
// PacketLossStatistics().reset();
|
||||
// 发送监控id
|
||||
StartChartManage().startCallRequestMessageTimer(ToPeerId: network!.peerId ?? '');
|
||||
// 发送监控id - 监控模式不设置等待接听状态
|
||||
StartChartManage().startCallRequestMessageTimer(ToPeerId: network!.peerId ?? '', isMonitoring: true);
|
||||
} else {
|
||||
showToast('猫眼设置为省电模式时无法进行监控,请在猫眼设置中切换为其他模式'.tr);
|
||||
}
|
||||
|
||||
@ -37,6 +37,8 @@ class UdpTalkHangUpHandler extends ScpMessageBaseHandle
|
||||
startChartManage.stopSendingRbcuInfoMessages();
|
||||
startChartManage.stopSendingRbcuProBeMessages();
|
||||
startChartManage.stopTalkHangupMessageTimer();
|
||||
// 设置最终结束状态
|
||||
talkStatus.setEnd();
|
||||
Get.back();
|
||||
}
|
||||
}
|
||||
@ -55,6 +57,8 @@ class UdpTalkHangUpHandler extends ScpMessageBaseHandle
|
||||
startChartManage.stopSendingRbcuInfoMessages();
|
||||
startChartManage.stopSendingRbcuProBeMessages();
|
||||
startChartManage.stopTalkHangupMessageTimer();
|
||||
// 设置最终结束状态
|
||||
talkStatus.setEnd();
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@ -433,7 +433,10 @@ class StartChartManage {
|
||||
}
|
||||
|
||||
/// 启动持续发送对讲请求
|
||||
void startCallRequestMessageTimer({required String ToPeerId}) async {
|
||||
void startCallRequestMessageTimer({required String ToPeerId, bool isMonitoring = false}) async {
|
||||
// 更新全局ToPeerId为当前要连接的锁的peerId
|
||||
this.ToPeerId = ToPeerId;
|
||||
this.lockPeerId = ToPeerId;
|
||||
// 如果已经处于等待接听状态就不发送
|
||||
// if (talkStatus.status != TalkStatus.proactivelyCallWaitingAnswer) {
|
||||
// // 如果是h264则跳转至webview
|
||||
@ -477,9 +480,12 @@ class StartChartManage {
|
||||
await sendCallRequestMessage(ToPeerId: ToPeerId);
|
||||
},
|
||||
);
|
||||
talkStatus.setProactivelyCallWaitingAnswer();
|
||||
// 启动对讲请求应答超时判断
|
||||
talkeRequestOverTimeTimerManager.start();
|
||||
// 只有非监控模式才设置为等待接听状态
|
||||
if (!isMonitoring) {
|
||||
talkStatus.setProactivelyCallWaitingAnswer();
|
||||
// 启动对讲请求应答超时判断
|
||||
talkeRequestOverTimeTimerManager.start();
|
||||
}
|
||||
}
|
||||
|
||||
/// 停止持续发送对讲请求
|
||||
@ -730,19 +736,19 @@ class StartChartManage {
|
||||
// _log(text: '发送通话保持');
|
||||
}
|
||||
|
||||
void _sendTalkHangupMessage() async {
|
||||
Future<void> _sendTalkHangupMessage() async {
|
||||
final message = MessageCommand.talkHangupMessage(
|
||||
ToPeerId: ToPeerId,
|
||||
FromPeerId: FromPeerId,
|
||||
MessageId: MessageCommand.getNextMessageId(ToPeerId, increment: true),
|
||||
);
|
||||
// try {
|
||||
// await _sendMessage(message: message);
|
||||
// } catch (e) {
|
||||
// // 记录日志但不中断程序执行
|
||||
// AppLog.log('发送挂断消息失败: $e');
|
||||
// // 不抛出异常,避免应用崩溃
|
||||
// }
|
||||
try {
|
||||
await _sendMessage(message: message);
|
||||
} catch (e) {
|
||||
// 记录日志但不中断程序执行
|
||||
AppLog.log('发送挂断消息失败: $e');
|
||||
// 不抛出异常,避免应用崩溃
|
||||
}
|
||||
}
|
||||
|
||||
// 发送通话中挂断消息
|
||||
@ -751,7 +757,7 @@ class StartChartManage {
|
||||
talkHangupTimer ??= Timer.periodic(
|
||||
Duration(seconds: _defaultIntervalTime),
|
||||
(Timer timer) async {
|
||||
_sendTalkHangupMessage();
|
||||
await _sendTalkHangupMessage();
|
||||
},
|
||||
);
|
||||
|
||||
@ -1250,7 +1256,7 @@ class StartChartManage {
|
||||
final message = MessageCommand.bleMessage(
|
||||
FromPeerId: FromPeerId,
|
||||
ToPeerId: lockPeerId,
|
||||
MessageId: MessageCommand.getNextMessageId(ToPeerId, increment: true),
|
||||
MessageId: MessageCommand.getNextMessageId(lockPeerId, increment: true),
|
||||
bluetoothDeviceName: bluetoothDeviceName,
|
||||
bleStructData: bleStructData,
|
||||
);
|
||||
@ -1265,6 +1271,9 @@ class StartChartManage {
|
||||
status == TalkStatus.proactivelyCallWaitingAnswer ||
|
||||
status == TalkStatus.answeredSuccessfully ||
|
||||
status == TalkStatus.uninitialized) {
|
||||
// 先发送一次挂断消息
|
||||
await _sendTalkHangupMessage();
|
||||
// 再启动定时器确保消息能被接收
|
||||
startTalkRejectMessageTimer();
|
||||
startTalkHangupMessageTimer();
|
||||
await Future.delayed(Duration(seconds: 1));
|
||||
|
||||
@ -83,6 +83,9 @@ class ImageTransmissionLogic extends BaseGetXController {
|
||||
// 拒绝
|
||||
StartChartManage().startTalkRejectMessageTimer();
|
||||
}
|
||||
// 完全释放资源,确保不会自动重新连接
|
||||
await Future.delayed(Duration(milliseconds: 500));
|
||||
StartChartManage().destruction();
|
||||
Get.back();
|
||||
}
|
||||
|
||||
|
||||
@ -410,7 +410,7 @@ class _TalkViewNativeDecodePageState extends State<TalkViewNativeDecodePage> wit
|
||||
case TalkStatus.proactivelyCallWaitingAnswer:
|
||||
return 'images/main/icon_lockDetail_monitoringUnTalkback.png';
|
||||
default:
|
||||
return 'images/main/icon_lockDetail_monitoringAnswerCalls.png';
|
||||
return 'images/main/icon_lockDetail_monitoringUnTalkback.png';
|
||||
}
|
||||
}
|
||||
|
||||
@ -427,7 +427,7 @@ class _TalkViewNativeDecodePageState extends State<TalkViewNativeDecodePage> wit
|
||||
case TalkStatus.hangingUpDuring:
|
||||
return '长按说话'.tr;
|
||||
default:
|
||||
return '接听'.tr;
|
||||
return '长按说话'.tr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@ class TalkViewNativeDecodeState {
|
||||
TextEditingController passwordTF = TextEditingController();
|
||||
|
||||
RxList<int> listAudioData = <int>[].obs; //得到的音频流字节数据
|
||||
GlobalKey globalKey = GlobalKey();
|
||||
final GlobalKey globalKey = GlobalKey();
|
||||
|
||||
Timer? oneMinuteTimeTimer; // 定时器超过60秒关闭当前界面
|
||||
RxInt oneMinuteTime = 0.obs; // 定时器秒数
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user