fix:补充测试代码

This commit is contained in:
liyi 2024-12-24 16:21:44 +08:00
parent a029c4b4e0
commit 006af6e751
4 changed files with 11 additions and 14 deletions

View File

@ -25,6 +25,11 @@ class StarChartLogic extends BaseGetXController {
@override @override
void onReady() { void onReady() {
super.onReady(); super.onReady();
// PCM
FlutterPcmSound.setup(sampleRate: 8000, channelCount: 1);
//
FlutterPcmSound.setFeedThreshold(8000 ~/ 2); //
_getTalkStatusRefreshUIAction(); _getTalkStatusRefreshUIAction();
_startListenTalkData(); _startListenTalkData();
} }
@ -72,14 +77,6 @@ class StarChartLogic extends BaseGetXController {
Future<void> _playG711Data(List<int> pcmData) async { Future<void> _playG711Data(List<int> pcmData) async {
// PCM PcmArrayInt16 // PCM PcmArrayInt16
final PcmArrayInt16 fromList = PcmArrayInt16.fromList(pcmData); final PcmArrayInt16 fromList = PcmArrayInt16.fromList(pcmData);
// PCM
await FlutterPcmSound.setup(sampleRate: 8000, channelCount: 1);
//
FlutterPcmSound.setFeedThreshold(8000 ~/ 2); //
// final PcmArrayInt16 fromList = PcmArrayInt16.fromList(audioData);
await FlutterPcmSound.feed(fromList); await FlutterPcmSound.feed(fromList);
FlutterPcmSound.play(); FlutterPcmSound.play();
} }

View File

@ -31,12 +31,12 @@ class UdpTalkAcceptHandler extends ScpMessageBaseHandle
// //
final GenericResp genericResp = scpMessage.Payload; final GenericResp genericResp = scpMessage.Payload;
if (checkGenericRespSuccess(genericResp)) { if (checkGenericRespSuccess(genericResp)) {
//
_handleStartSendTalkExpectDataRequest();
Future.delayed(Duration(seconds: 1), () { Future.delayed(Duration(seconds: 1), () {
print('启动定时器判断'); print('启动定时器判断');
// //
_handleStartTalkPing(); _handleStartTalkPing();
//
_handleStartSendTalkExpectDataRequest();
// //
_handleCheckTalkDataTimer(); _handleCheckTalkDataTimer();
}); });

View File

@ -66,8 +66,8 @@ class UdpTalkRequestHandler extends ScpMessageBaseHandle
Routers.starChartPage, Routers.starChartPage,
arguments: <String, String>{'lockId': '111'}, arguments: <String, String>{'lockId': '111'},
); );
// //
HapticFeedback.lightImpact(); HapticFeedback.vibrate();
} }
// //

View File

@ -33,12 +33,12 @@ class ScpMessageBaseHandle {
// //
final talkePingOverTimeTimerManager = OverTimeTimerManager( final talkePingOverTimeTimerManager = OverTimeTimerManager(
timeoutInSeconds: 5, timeoutInSeconds: 15,
); );
// //
final talkDataOverTimeTimerManager = OverTimeTimerManager( final talkDataOverTimeTimerManager = OverTimeTimerManager(
timeoutInSeconds: 3, timeoutInSeconds: 13,
); );
// //