style:增加对讲状态,整理部分代码
This commit is contained in:
parent
74708b505e
commit
1bafcd535a
BIN
assets/talk.h264
BIN
assets/talk.h264
Binary file not shown.
@ -235,12 +235,6 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
: null)),
|
: null)),
|
||||||
SubmitBtn(
|
|
||||||
btnName: '跳转至通话',
|
|
||||||
onClick: () {
|
|
||||||
Get.toNamed(Routers.lockMonitoringPage);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
SizedBox(height: 50.w),
|
SizedBox(height: 50.w),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
|||||||
@ -28,6 +28,7 @@ class UdpTalkAcceptHandler extends ScpMessageBaseHandle
|
|||||||
if (checkGenericRespSuccess(genericResp)) {
|
if (checkGenericRespSuccess(genericResp)) {
|
||||||
// 启动通话保持定时器
|
// 启动通话保持定时器
|
||||||
_handleStartTalkPing();
|
_handleStartTalkPing();
|
||||||
|
// 延迟2秒后启动监听
|
||||||
Future.delayed(Duration(seconds: 2), () {
|
Future.delayed(Duration(seconds: 2), () {
|
||||||
// 启动发送预期数据请求
|
// 启动发送预期数据请求
|
||||||
_handleStartSendTalkExpectDataRequest();
|
_handleStartSendTalkExpectDataRequest();
|
||||||
@ -37,6 +38,7 @@ class UdpTalkAcceptHandler extends ScpMessageBaseHandle
|
|||||||
// 停止播放铃声
|
// 停止播放铃声
|
||||||
stopRingtone();
|
stopRingtone();
|
||||||
// 设置状态为接听中
|
// 设置状态为接听中
|
||||||
|
talkStatus.setAnsweredSuccessfully();
|
||||||
talkStatus.setDuringCall();
|
talkStatus.setDuringCall();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,12 +51,15 @@ class UdpTalkDataHandler extends ScpMessageBaseHandle
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 处理h264协议的数据
|
||||||
void _handleVideoH264(TalkData talkData) {
|
void _handleVideoH264(TalkData talkData) {
|
||||||
final List<int> content = talkData.content;
|
final List<int> content = talkData.content;
|
||||||
talkDataRepository.addTalkData(content);
|
talkDataRepository.addTalkData(content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 处理图片数据
|
||||||
void _handleVideoImage(TalkData talkData) {}
|
void _handleVideoImage(TalkData talkData) {}
|
||||||
|
|
||||||
|
/// 处理g711音频数据
|
||||||
void _handleVideoG711(TalkData talkData) {}
|
void _handleVideoG711(TalkData talkData) {}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,6 +22,7 @@ class UdpTalkHangUpHandler extends ScpMessageBaseHandle
|
|||||||
// 停止发送通话保持的命令
|
// 停止发送通话保持的命令
|
||||||
startChartManage.stopTalkPingMessageTimer();
|
startChartManage.stopTalkPingMessageTimer();
|
||||||
startChartManage.stopTalkExpectMessageTimer();
|
startChartManage.stopTalkExpectMessageTimer();
|
||||||
|
talkStatus.setHangingUpDuring();
|
||||||
talkStatus.setEnd();
|
talkStatus.setEnd();
|
||||||
stopRingtone();
|
stopRingtone();
|
||||||
}
|
}
|
||||||
@ -32,6 +33,7 @@ class UdpTalkHangUpHandler extends ScpMessageBaseHandle
|
|||||||
// 停止发送通话保持的命令
|
// 停止发送通话保持的命令
|
||||||
startChartManage.stopTalkPingMessageTimer();
|
startChartManage.stopTalkPingMessageTimer();
|
||||||
startChartManage.stopTalkExpectMessageTimer();
|
startChartManage.stopTalkExpectMessageTimer();
|
||||||
|
talkStatus.setHangingUpDuring();
|
||||||
talkStatus.setEnd();
|
talkStatus.setEnd();
|
||||||
stopRingtone();
|
stopRingtone();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,8 +4,10 @@ import 'package:star_lock/talk/startChart/events/talk_status_change_event.dart';
|
|||||||
|
|
||||||
enum TalkStatus {
|
enum TalkStatus {
|
||||||
waitingAnswer, // 等待接听
|
waitingAnswer, // 等待接听
|
||||||
|
answeredSuccessfully, // 接听成功
|
||||||
waitingData, // 等待数据
|
waitingData, // 等待数据
|
||||||
duringCall, // 通话中
|
duringCall, // 通话中
|
||||||
|
hangingUpDuring, // 通话中挂断
|
||||||
rejected, // 被拒绝
|
rejected, // 被拒绝
|
||||||
uninitialized, // 未初始化
|
uninitialized, // 未初始化
|
||||||
initializationCompleted, // 初始化完成
|
initializationCompleted, // 初始化完成
|
||||||
@ -104,6 +106,16 @@ class StartChartTalkStatus {
|
|||||||
// 可以在这里添加特定于 "error" 状态的逻辑
|
// 可以在这里添加特定于 "error" 状态的逻辑
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 设置状态为通话中挂断
|
||||||
|
void setHangingUpDuring() {
|
||||||
|
_setStatus(TalkStatus.hangingUpDuring);
|
||||||
|
// 可以在这里添加特定于 "hangingUpDuring" 状态的逻辑
|
||||||
|
} /// 设置状态为接听成功
|
||||||
|
void setAnsweredSuccessfully() {
|
||||||
|
_setStatus(TalkStatus.answeredSuccessfully);
|
||||||
|
// 可以在这里添加特定于 "hangingUpDuring" 状态的逻辑
|
||||||
|
}
|
||||||
|
|
||||||
/// 设置状态为结束
|
/// 设置状态为结束
|
||||||
void setEnd() {
|
void setEnd() {
|
||||||
_setStatus(TalkStatus.end);
|
_setStatus(TalkStatus.end);
|
||||||
|
|||||||
@ -299,7 +299,6 @@ flutter:
|
|||||||
- images/lockType/
|
- images/lockType/
|
||||||
- assets/
|
- assets/
|
||||||
- assets/html/h264.html
|
- assets/html/h264.html
|
||||||
- assets/talk.h264
|
|
||||||
- lan/
|
- lan/
|
||||||
# An image asset can refer to one or more resolution-specific "variants", see
|
# An image asset can refer to one or more resolution-specific "variants", see
|
||||||
# https://flutter.dev/assets-and-images/#resolution-aware
|
# https://flutter.dev/assets-and-images/#resolution-aware
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user