fix:增加通话数据未收到时定时器判断
This commit is contained in:
parent
f337f6d346
commit
422c230dfc
@ -29,6 +29,13 @@ class UdpTalkAcceptHandler extends ScpMessageBaseHandle
|
|||||||
talkePingOverTimeTimerManager.setOnTimeout(() {
|
talkePingOverTimeTimerManager.setOnTimeout(() {
|
||||||
EasyLoading.showToast('通话异常中断', duration: 2000.milliseconds);
|
EasyLoading.showToast('通话异常中断', duration: 2000.milliseconds);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 启动对讲数据监听定时器
|
||||||
|
talkDataOverTimeTimerManager.startTimer();
|
||||||
|
// 设置对讲数据超时后的事件
|
||||||
|
talkDataOverTimeTimerManager.setOnTimeout(() {
|
||||||
|
EasyLoading.showToast('通话连接失败', duration: 2000.milliseconds);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,9 +2,9 @@ import 'dart:async';
|
|||||||
|
|
||||||
typedef TimeoutCallback = void Function();
|
typedef TimeoutCallback = void Function();
|
||||||
|
|
||||||
class TalkPingOverTimeTimerManager {
|
class OverTimeTimerManager {
|
||||||
// 构造函数,接受超时时间
|
// 构造函数,接受超时时间
|
||||||
TalkPingOverTimeTimerManager({required this.timeoutInSeconds});
|
OverTimeTimerManager({required this.timeoutInSeconds});
|
||||||
|
|
||||||
// 定义一个可取消的 Timer
|
// 定义一个可取消的 Timer
|
||||||
Timer? _timer;
|
Timer? _timer;
|
||||||
@ -4,11 +4,10 @@ import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
|||||||
import 'package:star_lock/app_settings/app_settings.dart';
|
import 'package:star_lock/app_settings/app_settings.dart';
|
||||||
import 'package:star_lock/talk/other/audio_player_manager.dart';
|
import 'package:star_lock/talk/other/audio_player_manager.dart';
|
||||||
import 'package:star_lock/talk/startChart/constant/udp_constant.dart';
|
import 'package:star_lock/talk/startChart/constant/udp_constant.dart';
|
||||||
import 'package:star_lock/talk/startChart/handle/other/talk_ping_overtime_timer_manger.dart';
|
import 'package:star_lock/talk/startChart/handle/other/overtime_timer_manger.dart';
|
||||||
|
|
||||||
import 'package:star_lock/talk/startChart/proto/generic.pb.dart';
|
import 'package:star_lock/talk/startChart/proto/generic.pb.dart';
|
||||||
import 'package:star_lock/talk/startChart/start_chart_manage.dart';
|
import 'package:star_lock/talk/startChart/start_chart_manage.dart';
|
||||||
import 'package:star_lock/tools/storage.dart';
|
|
||||||
|
|
||||||
class ScpMessageBaseHandle {
|
class ScpMessageBaseHandle {
|
||||||
final startChartManage = StartChartManage();
|
final startChartManage = StartChartManage();
|
||||||
@ -16,10 +15,15 @@ class ScpMessageBaseHandle {
|
|||||||
final audioManager = AudioPlayerManager();
|
final audioManager = AudioPlayerManager();
|
||||||
|
|
||||||
// 通话保持超时监听定时器管理
|
// 通话保持超时监听定时器管理
|
||||||
final talkePingOverTimeTimerManager = TalkPingOverTimeTimerManager(
|
final talkePingOverTimeTimerManager = OverTimeTimerManager(
|
||||||
timeoutInSeconds: 5,
|
timeoutInSeconds: 5,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// 通话数据超时定时器
|
||||||
|
final talkDataOverTimeTimerManager = OverTimeTimerManager(
|
||||||
|
timeoutInSeconds: 3,
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool checkGenericRespSuccess(GenericResp genericResp) {
|
bool checkGenericRespSuccess(GenericResp genericResp) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user