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