|
1 /* |
|
2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Part of TestConsole application. |
|
15 ** Methods for the class CTestAppConsole |
|
16 ** |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 #include <e32std.h> |
|
23 #include <e32svr.h> |
|
24 #include <e32base.h> |
|
25 #include <AudioPreference.h> |
|
26 #include "TestConsole.h" |
|
27 #include "MccInternalCodecs.h" |
|
28 #include "MmccEvents.h" |
|
29 #include "MccDef.h" |
|
30 #include "MmccCodecAMR.h" |
|
31 |
|
32 |
|
33 _LIT( KTxtMainInstructions, "Please select one option:\n" |
|
34 L"1. Session & Q. Stream creation\n" |
|
35 L"2. Prepare & W. Start Stream\n" |
|
36 L"3. Pause Stream\n" |
|
37 L"4. Resume Stream\n" |
|
38 L"5. Stop & d. Delete Stream\n" |
|
39 L"6. Close Session\n" |
|
40 L"7. Set volume & gain\n" |
|
41 L"8. Get gain & maxgain & codec & volume\n" |
|
42 L"\n" |
|
43 L"c. Codec menu\n" |
|
44 L"m. DTMF menu\n" |
|
45 L"n. Network settings\n" |
|
46 L"r. Send non-RTCP data\n" |
|
47 L"t. Toggle inactivity timer on/off\n" |
|
48 L"9. Quit\n" ); |
|
49 |
|
50 _LIT( KTxtCodecInstructions, "Select option:\n" |
|
51 L"1. Supported Codecs\n" |
|
52 L"2. Change codec\n" |
|
53 L"3. Set Codec Settings\n" |
|
54 L"4. Toggle VAD/FW\n" |
|
55 L"5. Set Codec\n" |
|
56 L"6. Set FTMP attribute\n" |
|
57 L"9. Return main menu\n" ); |
|
58 |
|
59 |
|
60 _LIT( KTxtDTMFInstructions, "Select option:\n " |
|
61 L"1. Start DTMF Tone\n" |
|
62 L"2. Stop DTMF Tone\n" |
|
63 L"3. Send DTMF Tones\n" |
|
64 L"4. Continue sending\n" |
|
65 L"9. Return main menu\n" ); |
|
66 |
|
67 //******************************************************************************* |
|
68 // Method : CTestAppConsole::NewL() |
|
69 // Purpose : |
|
70 // Parameters : |
|
71 // Return Value: |
|
72 //******************************************************************************* |
|
73 CTestAppConsole* CTestAppConsole::NewL() |
|
74 { |
|
75 CTestAppConsole* self = new( ELeave ) CTestAppConsole(); |
|
76 CleanupStack::PushL( self ); |
|
77 |
|
78 self->ConstructL(); |
|
79 |
|
80 CleanupStack::Pop(); |
|
81 return self; |
|
82 } |
|
83 |
|
84 //******************************************************************************* |
|
85 // Method : CTestAppConsole::CTestAppConsole() |
|
86 // Purpose : Constructor |
|
87 // Parameters : |
|
88 // Return Value: |
|
89 //******************************************************************************* |
|
90 CTestAppConsole::CTestAppConsole() |
|
91 : |
|
92 CActive( EPriorityStandard ), |
|
93 iDTMFSessionID( KNullId ), |
|
94 iDTMFStreamID( 0 ), |
|
95 iInactivityTimerActive( EFalse ), |
|
96 iIapId( -1 ), |
|
97 iNetSettingsDone( EFalse ), |
|
98 iCurMenu( EMainMenu ), |
|
99 iDtmfMode( EFalse ), |
|
100 iSdesReported( EFalse ), |
|
101 iSrReported( EFalse ), |
|
102 iRrReported( EFalse ), |
|
103 iNumOfNonRtcpDataSent( 0 ) |
|
104 { |
|
105 CActiveScheduler::Add( this ); |
|
106 } |
|
107 |
|
108 //******************************************************************************* |
|
109 // Method : CTestAppConsole::ConstructL() |
|
110 // Purpose : |
|
111 // Parameters : |
|
112 // Return Value: |
|
113 //******************************************************************************* |
|
114 void CTestAppConsole::ConstructL() |
|
115 { |
|
116 _LIT( KTxtTitle, " Mcc Test " ); |
|
117 iConsole = Console::NewL( KTxtTitle, TSize( KConsFullScreen, KConsFullScreen ) ); |
|
118 DisplayConsoleMenu( KTxtMainInstructions ); |
|
119 |
|
120 //__KHEAP_MARK; |
|
121 iMccInterface = CMccInterface::NewL( *this ); |
|
122 |
|
123 iCodecArray.Reset(); |
|
124 iMccInterface->GetCapabilities( iCodecArray/*iCodecInformation*/ ); // RPointerArray<TFourCC>& aCodecs |
|
125 |
|
126 RunTestCodecFactory(); |
|
127 } |
|
128 |
|
129 //******************************************************************************* |
|
130 // Method : CTestAppConsole::~CTestAppConsole() |
|
131 // Purpose : Destructor |
|
132 // Parameters : |
|
133 // Return Value: |
|
134 //******************************************************************************* |
|
135 CTestAppConsole::~CTestAppConsole() |
|
136 { |
|
137 Cancel(); // any outstanding request |
|
138 |
|
139 if ( iConsole ) |
|
140 { |
|
141 delete iConsole; |
|
142 } |
|
143 |
|
144 delete iInstruct; |
|
145 |
|
146 iCodecInformation.ResetAndDestroy(); |
|
147 iCodecInformation.Close(); |
|
148 |
|
149 iCodecArray.ResetAndDestroy(); |
|
150 iCodecArray.Close(); |
|
151 |
|
152 iMccInterface->Close(); |
|
153 delete iMccInterface; |
|
154 |
|
155 |
|
156 //__KHEAP_MARKEND; |
|
157 } |
|
158 |
|
159 //******************************************************************************* |
|
160 // Method : CTestAppConsole::StartTesting() |
|
161 // Purpose : start this AO |
|
162 // Parameters : |
|
163 // Return Value: |
|
164 //******************************************************************************* |
|
165 void CTestAppConsole::StartTesting() |
|
166 { |
|
167 DoRead(); |
|
168 } |
|
169 |
|
170 //******************************************************************************* |
|
171 // Method : CTestAppConsole::DoRead() |
|
172 // Purpose : get the user's option and send request to scheduler |
|
173 // Parameters : |
|
174 // Return Value: |
|
175 //******************************************************************************* |
|
176 void CTestAppConsole::DoRead() |
|
177 { |
|
178 //PrintOptions(); |
|
179 |
|
180 iConsole->Read( iStatus ); |
|
181 SetActive(); |
|
182 } |
|
183 |
|
184 //******************************************************************************* |
|
185 // Method : CTestAppConsole::RunL() |
|
186 // Purpose : |
|
187 // Parameters : |
|
188 // Return Value: |
|
189 //******************************************************************************* |
|
190 void CTestAppConsole::RunL() |
|
191 { |
|
192 // According to current test case and direct the user's command |
|
193 // to proper command handler. |
|
194 switch ( iCurMenu ) |
|
195 { |
|
196 case EMainMenu: |
|
197 DisplayConsoleMenu( KTxtMainInstructions ); |
|
198 ProcessMainInput(); |
|
199 break; |
|
200 case EDTMFTestMenu: |
|
201 DisplayConsoleMenu( KTxtDTMFInstructions ); |
|
202 ProcessDTMFInput(); |
|
203 break; |
|
204 case ECodecTestMenu: |
|
205 DisplayConsoleMenu( KTxtCodecInstructions ); |
|
206 ProcessCodecInput(); |
|
207 break; |
|
208 default: |
|
209 break; |
|
210 } |
|
211 |
|
212 //ProcessKey( TChar( iConsole->KeyCode() ) ); |
|
213 //DoRead(); |
|
214 |
|
215 } |
|
216 |
|
217 //******************************************************************************* |
|
218 // Method : CTestAppConsole::DoCancel() |
|
219 // Purpose : |
|
220 // Parameters : |
|
221 // Return Value: |
|
222 //******************************************************************************* |
|
223 void CTestAppConsole::DoCancel() |
|
224 { |
|
225 iConsole->ReadCancel(); |
|
226 } |
|
227 |
|
228 |
|
229 //******************************************************************************* |
|
230 // Method : CTestAppConsole::DisplayConsoleMenu() |
|
231 // Purpose : Display main or sub console menus for different test cases |
|
232 // Parameters : TDesc &aInstructions |
|
233 // Return Value: void |
|
234 //******************************************************************************* |
|
235 void CTestAppConsole::DisplayConsoleMenu( const TDesC &aInstructions ) |
|
236 { |
|
237 if ( iInstruct ) |
|
238 { |
|
239 delete iInstruct; |
|
240 iInstruct = NULL; |
|
241 } |
|
242 iInstruct = aInstructions.AllocL(); |
|
243 iConsole->ClearScreen(); |
|
244 iConsole->Write( *iInstruct ); |
|
245 } |
|
246 |
|
247 |
|
248 //******************************************************************************* |
|
249 // Method : CTestAppConsole::ProcessMainInput() |
|
250 // Purpose : Obtain user's option and decide which test case to run next. |
|
251 // Parameters : |
|
252 // Return Value: |
|
253 //******************************************************************************* |
|
254 void CTestAppConsole::ProcessMainInput() |
|
255 { |
|
256 TBuf<20> line; |
|
257 GetStringFromConsole( line ); |
|
258 |
|
259 if ( line.Length() > 0 ) |
|
260 { |
|
261 TChar inputChar = line.Ptr()[0]; |
|
262 |
|
263 switch( inputChar ) |
|
264 { |
|
265 case '1': |
|
266 RunTestCreateSession(); |
|
267 break; |
|
268 case 'q': |
|
269 RunTestCreateStreams(); |
|
270 break; |
|
271 |
|
272 case 'z': |
|
273 RunTest1c(); |
|
274 break; |
|
275 |
|
276 case '2': |
|
277 RunTestPrepareStreams(); |
|
278 break; |
|
279 case 'p': |
|
280 RunTest2p(); |
|
281 break; |
|
282 |
|
283 case 'w': |
|
284 RunTestStartStream(); |
|
285 break; |
|
286 case '3': |
|
287 RunTestPauseStreams(); |
|
288 break; |
|
289 case '4': |
|
290 RunTestResumeStreams(); |
|
291 break; |
|
292 case '5': |
|
293 RunTestStopStream(); |
|
294 break; |
|
295 case 'd': |
|
296 RunTestDeleteStreams(); |
|
297 break; |
|
298 case '6': |
|
299 RunTestCloseSession(); |
|
300 break; |
|
301 case '7': |
|
302 RunTest7(); |
|
303 break; |
|
304 case '8': |
|
305 RunTestGetCodecAndAudioSettings(); |
|
306 break; |
|
307 |
|
308 case 'l': |
|
309 SetRemoteAddr(); |
|
310 break; |
|
311 case 'n': |
|
312 SetNetSettings(); |
|
313 break; |
|
314 |
|
315 case 'r': |
|
316 SendNonRtcpData(); |
|
317 break; |
|
318 |
|
319 case 't': |
|
320 ToggleInactivityTimer(); |
|
321 break; |
|
322 |
|
323 // Menus |
|
324 case 'c': |
|
325 iCurMenu = ECodecTestMenu; |
|
326 DisplayConsoleMenu( KTxtCodecInstructions ); |
|
327 break; |
|
328 case 'm': |
|
329 iCurMenu = EDTMFTestMenu; |
|
330 DisplayConsoleMenu( KTxtDTMFInstructions ); |
|
331 break; |
|
332 |
|
333 case '9': |
|
334 iMccInterface->Close(); |
|
335 CActiveScheduler::Stop(); |
|
336 break; |
|
337 default: |
|
338 _LIT( KTxtWrongOption, "Wrong Option! Try Again." ); |
|
339 DisplayMsg( KTxtWrongOption ); |
|
340 break; |
|
341 } |
|
342 } |
|
343 // Ready to get next input option. |
|
344 DoRead(); |
|
345 } |
|
346 |
|
347 |
|
348 //******************************************************************************* |
|
349 // Method : CTestAppConsole::DisplayMsg() |
|
350 // Purpose : Display testing message on screen |
|
351 // Parameters : TDesC & |
|
352 // Return Value: |
|
353 //******************************************************************************* |
|
354 void CTestAppConsole::DisplayMsg( const TDesC &aMsg ) |
|
355 { |
|
356 iConsole->ClearScreen(); |
|
357 iConsole->Write( *iInstruct ); |
|
358 iConsole->Printf( KTxtLineBreak ); |
|
359 iConsole->Printf( aMsg ); |
|
360 iConsole->Printf( KTxtLineBreak ); |
|
361 } |
|
362 |
|
363 //******************************************************************************* |
|
364 // Method : CTestAppConsole::GetAddrFromConsole() |
|
365 // Purpose : |
|
366 // Parameters : |
|
367 // Return Value: |
|
368 //******************************************************************************* |
|
369 TKeyCode CTestAppConsole::GetStringFromConsole( TDes &aAddr ) |
|
370 { |
|
371 // Get a line from console |
|
372 TKeyCode input = EKeyNull; |
|
373 const TInt start_pos = iConsole->WhereX(); |
|
374 aAddr.Zero(); |
|
375 |
|
376 // loop until descriptor full or EKeyEnter or EKeyEscape entered |
|
377 do { |
|
378 // get one character |
|
379 input = iConsole->Getch(); |
|
380 // process it |
|
381 if( input == EKeyBackspace || input == EKeyDelete ) |
|
382 { |
|
383 // backspace or delete |
|
384 if( iConsole->WhereX() > start_pos ) |
|
385 { |
|
386 iConsole->SetPos( iConsole->WhereX() - 1 ); |
|
387 iConsole->ClearToEndOfLine(); |
|
388 if( aAddr.Length() > 0 ) |
|
389 { |
|
390 aAddr.SetLength( aAddr.Length() - 1 ); |
|
391 } |
|
392 } |
|
393 } |
|
394 else |
|
395 { |
|
396 // other than backspace or delete |
|
397 TChar ch( input ); |
|
398 if( ch.IsPrint() ) |
|
399 { |
|
400 aAddr.Append( ch ); |
|
401 iConsole->Printf( _L( "%c" ), input ); |
|
402 } |
|
403 } |
|
404 } |
|
405 while( aAddr.Length() < aAddr.MaxLength() && input != EKeyEnter && input != EKeyEscape ); |
|
406 |
|
407 DisplayMsg( KTxtLineBreak ); |
|
408 return input; |
|
409 } |
|
410 |
|
411 // --------------------------------------------------------------------------- |
|
412 // CTestAppConsole::SetNetSettings |
|
413 // |
|
414 // --------------------------------------------------------------------------- |
|
415 // |
|
416 void CTestAppConsole::SetNetSettings() |
|
417 { |
|
418 TBuf<20> line; |
|
419 TUint port; |
|
420 TUint rport; |
|
421 TUint iapid; |
|
422 |
|
423 iConsole->Printf( _L( "\nEnter Iap Id: " ) ); |
|
424 GetIntegerFromConsole( iapid ); |
|
425 |
|
426 iNetSettings.iIapId = iapid; |
|
427 iNetSettings.iMediaQosValue = 46; |
|
428 |
|
429 iConsole->Printf( _L( "\nEnter the Remote IP address " ) ); |
|
430 |
|
431 GetStringFromConsole( line ); |
|
432 |
|
433 iRemoteAddr.Input( line ); |
|
434 |
|
435 iConsole->Printf( _L( "\nEnter the Remote port: " ) ); |
|
436 GetIntegerFromConsole( rport ); |
|
437 |
|
438 RDebug::Print( _L("RemotePort: %d"), rport ); |
|
439 |
|
440 iRemoteAddr.SetPort( rport ); |
|
441 |
|
442 iConsole->Printf( _L( "\nEnter the Local port: " ) ); |
|
443 |
|
444 GetIntegerFromConsole( port ); |
|
445 |
|
446 RDebug::Print( _L( "LocalPort: %d" ), port ); |
|
447 |
|
448 iConsole->Printf( _L( "Addr: %d\n"), iRemoteAddr.Address() ); |
|
449 RDebug::Print( _L( "RemoteAddr: %d"), iRemoteAddr.Address() ); |
|
450 |
|
451 iNetSettings.iRemoteAddress.SetAddress( iRemoteAddr.Address() ); |
|
452 iNetSettings.iRemoteAddress.SetPort( rport ); |
|
453 iNetSettings.iLocalPort = port; |
|
454 |
|
455 DisplayMsg( _L( "Create DTMF session <y/n>: " ) ); |
|
456 GetStringFromConsole( line ); |
|
457 TChar inputChar = line.Ptr()[0]; |
|
458 |
|
459 if ( inputChar == 'y' ) |
|
460 { |
|
461 iDtmfMode = ETrue; |
|
462 } |
|
463 |
|
464 // RTCP is not available in DTMF sessions |
|
465 if ( !iDtmfMode ) |
|
466 { |
|
467 iConsole->Printf( _L( "\nEnable RTCP? <y/n>: " ) ); |
|
468 GetStringFromConsole( line ); |
|
469 TChar inputChar = line.Ptr()[0]; |
|
470 |
|
471 if ( inputChar == 'y' ) |
|
472 { |
|
473 iNetSettings.iMediaSignalling = ESignalRtcp; |
|
474 iConsole->Printf( _L( "\nRTCP enabled\n" ) ); |
|
475 } |
|
476 } |
|
477 |
|
478 iNetSettingsDone = ETrue; |
|
479 } |
|
480 |
|
481 // --------------------------------------------------------------------------- |
|
482 // CTestAppConsole::RunTestCreateSession |
|
483 // |
|
484 // --------------------------------------------------------------------------- |
|
485 // |
|
486 void CTestAppConsole::RunTestCreateSession() |
|
487 { |
|
488 TBuf<20> line; |
|
489 |
|
490 if ( !iNetSettingsDone ) |
|
491 { |
|
492 SetNetSettings(); |
|
493 } |
|
494 |
|
495 if ( iDtmfMode ) |
|
496 { |
|
497 DisplayMsg( _L( "Enable inband DTMF <y/n>: " ) ); |
|
498 GetStringFromConsole( line ); |
|
499 TChar inputChar = line.Ptr()[0]; |
|
500 if ( inputChar == 'y' ) |
|
501 { |
|
502 iNetSettings.iMediaSignalling |
|
503 = TMCCMediaSignalingType( iNetSettings.iMediaSignalling | KSignalInbandDtmf ); |
|
504 DisplayMsg( _L( "Inband DTMF enabled" ) ); |
|
505 } |
|
506 |
|
507 DisplayMsg( _L( "Enable outband DTMF <y/n>: " ) ); |
|
508 GetStringFromConsole( line ); |
|
509 inputChar = line.Ptr()[0]; |
|
510 |
|
511 if ( inputChar == 'y' ) |
|
512 { |
|
513 iNetSettings.iMediaSignalling |
|
514 = TMCCMediaSignalingType( iNetSettings.iMediaSignalling | KSignalOutbandDtmf ); |
|
515 DisplayMsg( _L( "Outband DTMF enabled" ) ); |
|
516 } |
|
517 |
|
518 TInt err = iMccInterface->CreateSession( iDTMFSessionID ); |
|
519 if ( err == KErrNone ) |
|
520 { |
|
521 iConsole->Printf( _L( "DTMF Session created, id: %d\n" ), iSessionId ); |
|
522 } |
|
523 else |
|
524 { |
|
525 iConsole->Printf( _L( "Could not create DTMF session, error %d\n" ), err ); |
|
526 } |
|
527 |
|
528 err = iMccInterface->CreateLink( iDTMFSessionID, KMccLinkGeneral, iDtmfLinkID, iNetSettings ); |
|
529 if ( err == KErrNone ) |
|
530 { |
|
531 iConsole->Printf( _L( "DTMF link created, id: %d\n" ), iDtmfLinkID ); |
|
532 } |
|
533 else |
|
534 { |
|
535 iConsole->Printf( _L( "Could not create DTMF session, error %d\n" ), err ); |
|
536 } |
|
537 } |
|
538 else |
|
539 { |
|
540 // Create session |
|
541 TInt err = iMccInterface->CreateSession( iSessionId ); |
|
542 if ( err == KErrNone ) |
|
543 { |
|
544 iConsole->Printf( _L( "Session created, id: %d\n" ), iSessionId ); |
|
545 } |
|
546 else |
|
547 { |
|
548 iConsole->Printf( _L( "Could not create session, error %d\n" ), err ); |
|
549 } |
|
550 } |
|
551 |
|
552 TVersion version = iMccInterface->Version(); |
|
553 iConsole->Printf( _L( "Version %d.%d.%d\n" ), |
|
554 version.iMajor, version.iMinor, version.iBuild ); |
|
555 }; |
|
556 |
|
557 // --------------------------------------------------------------------------- |
|
558 // CTestAppConsole::RunTestCreateStreams |
|
559 // |
|
560 // --------------------------------------------------------------------------- |
|
561 // |
|
562 void CTestAppConsole::RunTestCreateStreams() |
|
563 { |
|
564 TInt err( KErrNone ); |
|
565 if ( KMccFourCCIdDTMF == iCodecArray[iCodecSelected]->FourCC() ) |
|
566 { |
|
567 // Create DTMF stream |
|
568 err = iMccInterface->CreateStream( iDTMFSessionID, iDtmfLinkID, iDTMFStreamID, |
|
569 EMccAudioUplinkStream, iCodecArray[iCodecSelected] ); |
|
570 if ( err != KErrNone ) |
|
571 { |
|
572 iConsole->Printf( _L( "\nCould not create DTMF stream" ) ); |
|
573 return; |
|
574 } |
|
575 iConsole->Printf( _L( "\nEnter the Remote port: " ) ); |
|
576 TInt rport; |
|
577 GetIntegerFromConsole( rport ); |
|
578 iRemoteAddr.SetPort( rport ); |
|
579 iMccInterface->SetRemoteAddress( iDTMFSessionID, iDtmfLinkID, iRemoteAddr ); |
|
580 iConsole->Printf( _L( "Stream created. ID: DTMF %d, pt: %d\n" ), iDTMFStreamID, iCodecArray[iCodecSelected]->PayloadType() ); |
|
581 } |
|
582 else |
|
583 { |
|
584 // Create uplink |
|
585 iConsole->Printf( _L( "Creating uplink...\n" ) ); |
|
586 err = iMccInterface->CreateLink( iSessionId, KMccLinkGeneral, iUplinkId, iNetSettings ); |
|
587 if ( err == KErrNone ) |
|
588 { |
|
589 iConsole->Printf( _L( "Uplink created, id: %d, port: %d\n" ), |
|
590 iUplinkId, iNetSettings.iLocalPort ); |
|
591 } |
|
592 else |
|
593 { |
|
594 iConsole->Printf( _L( "Could not create uplink, error %d\n" ), err ); |
|
595 return; |
|
596 } |
|
597 |
|
598 // Create upstream |
|
599 |
|
600 // Make the AMR codec compatible with the RTP sender program |
|
601 if ( iCodecSelected == 0 ) |
|
602 { |
|
603 iCodecArray[iCodecSelected]->SetBitrate( KAmrNbBitrate122 ); |
|
604 iCodecArray[iCodecSelected]->SetCodecMode( EOctetAligned ); |
|
605 iCodecArray[iCodecSelected]->SetPayloadType( 96 ); |
|
606 iCodecArray[iCodecSelected]->SetPTime( 20 ); |
|
607 iCodecArray[iCodecSelected]->SetMaxPTime( 200 ); |
|
608 } |
|
609 |
|
610 err = iMccInterface->CreateStream( iSessionId, iUplinkId, iUpStreamId, |
|
611 EMccAudioUplinkStream, iCodecArray[iCodecSelected] ); |
|
612 if ( err != KErrNone ) |
|
613 { |
|
614 iConsole->Printf( _L( "\nCould not create upstream, error %d" ), err ); |
|
615 return; |
|
616 } |
|
617 iConsole->Printf( _L( "Upstream created. Sess %d, link %d, stream %d, pt: %d\n" ), |
|
618 iSessionId, iUplinkId, iUpStreamId, |
|
619 iCodecArray[iCodecSelected]->PayloadType() ); |
|
620 |
|
621 // Create downlink |
|
622 iConsole->Printf( _L( "Creating downlink...\n" ) ); |
|
623 err = iMccInterface->CreateLink( iSessionId, KMccLinkGeneral, iDownlinkId, iNetSettings ); |
|
624 if ( err == KErrNone ) |
|
625 { |
|
626 iConsole->Printf( _L( "Downlink created, id: %d, port: %d\n" ), |
|
627 iDownlinkId, iNetSettings.iLocalPort ); |
|
628 } |
|
629 else |
|
630 { |
|
631 iConsole->Printf( _L( "Could not create downlink, error %d\n" ), err ); |
|
632 } |
|
633 |
|
634 // Create downstream |
|
635 err = iMccInterface->CreateStream( iSessionId, iDownlinkId, iDownStreamId, |
|
636 EMccAudioDownlinkStream, iCodecArray[iCodecSelected] ); |
|
637 if ( err != KErrNone ) |
|
638 { |
|
639 iConsole->Printf( _L( "\nCould not create downstream, error %d" ), err ); |
|
640 return; |
|
641 } |
|
642 iConsole->Printf( _L( "Downstream created. Sess %d, link %d, stream %d, pt: %d\n" ), |
|
643 iSessionId, iDownlinkId, iDownStreamId, |
|
644 iCodecArray[iCodecSelected]->PayloadType() ); |
|
645 |
|
646 iMccInterface->SetRemoteAddress( iSessionId, iUplinkId, iRemoteAddr ); |
|
647 iMccInterface->SetRemoteAddress( iSessionId, iDownlinkId, iRemoteAddr ); |
|
648 |
|
649 iConsole->Printf( _L( "\nRemote addresses set" ) ); |
|
650 } |
|
651 } |
|
652 |
|
653 // --------------------------------------------------------------------------- |
|
654 // CTestAppConsole::RunTest1c |
|
655 // |
|
656 // --------------------------------------------------------------------------- |
|
657 // |
|
658 void CTestAppConsole::RunTest1c() |
|
659 { |
|
660 TInt err( KErrNone ); |
|
661 if ( KMccFourCCIdDTMF == iCodecArray[iCodecSelected]->FourCC() ) |
|
662 { |
|
663 err = iMccInterface->CreateStream( iDTMFSessionID, iDtmfLinkID, iDTMFStreamID, |
|
664 EMccAudioUplinkStream, iCodecArray[iCodecSelected] ); |
|
665 if ( err != KErrNone ) |
|
666 { |
|
667 iConsole->Printf( _L( "\nCould not create DTMF stream" ) ); |
|
668 return; |
|
669 } |
|
670 iConsole->Printf( _L( "\nEnter the Remote port: " ) ); |
|
671 TInt rport; |
|
672 GetIntegerFromConsole( rport ); |
|
673 iRemoteAddr.SetPort( rport ); |
|
674 iMccInterface->SetRemoteAddress( iDTMFSessionID, iDtmfLinkID, iRemoteAddr ); |
|
675 iConsole->Printf( _L( "Stream created. ID: DTMF %d, pt: %d\n" ), iDTMFStreamID, iCodecArray[iCodecSelected]->PayloadType() ); |
|
676 } |
|
677 else |
|
678 { |
|
679 iConsole->Printf( _L( "\nCreate Uplink or Downlink <u/d>: " ) ); |
|
680 |
|
681 TBuf<20> line; |
|
682 GetStringFromConsole( line ); |
|
683 TChar inputChar = line.Ptr()[0]; |
|
684 |
|
685 if ( inputChar == 'u' ) |
|
686 { |
|
687 err = iMccInterface->CreateStream( iSessionId, iUplinkId, iUpStreamId, |
|
688 EMccAudioUplinkStream, iCodecArray[iCodecSelected] ); |
|
689 if ( err != KErrNone ) |
|
690 { |
|
691 iConsole->Printf( _L( "\nCould not create uplink stream" ) ); |
|
692 return; |
|
693 } |
|
694 } |
|
695 else if ( inputChar == 'd' ) |
|
696 { |
|
697 err = iMccInterface->CreateStream( iSessionId, iDownlinkId, iDownStreamId, |
|
698 EMccAudioDownlinkStream, iCodecArray[iCodecSelected] ); |
|
699 if ( err != KErrNone ) |
|
700 { |
|
701 iConsole->Printf( _L( "\nCould not create downlink stream" ) ); |
|
702 return; |
|
703 } |
|
704 } |
|
705 else |
|
706 { |
|
707 iConsole->Printf( _L( "\nInvalid input" ) ); |
|
708 return; |
|
709 } |
|
710 |
|
711 iConsole->Printf( _L( "\nEnter the Remote port: " ) ); |
|
712 TUint rport; |
|
713 |
|
714 GetStringFromConsole( line ); |
|
715 TLex lex( line ); |
|
716 lex.Val( rport,EDecimal ); |
|
717 |
|
718 iRemoteAddr.SetPort( rport ); |
|
719 if ( inputChar == 'u' ) |
|
720 { |
|
721 err = iMccInterface->SetRemoteAddress( iSessionId, iUplinkId, iRemoteAddr ); |
|
722 if ( err != KErrNone ) |
|
723 { |
|
724 iConsole->Printf( _L( "\nCould not set remote address ( up )" ) ); |
|
725 return; |
|
726 } |
|
727 } |
|
728 else if ( inputChar == 'd' ) |
|
729 { |
|
730 err = iMccInterface->SetRemoteAddress( iSessionId, iDownlinkId, iRemoteAddr ); |
|
731 if ( err != KErrNone ) |
|
732 { |
|
733 iConsole->Printf( _L( "\nCould not set remote address ( down )" ) ); |
|
734 return; |
|
735 } |
|
736 } |
|
737 |
|
738 iConsole->Printf( _L( "Stream created. ID: UL: %d, DL: %d, pt: %d\n" ), iUpStreamId, iDownStreamId, iCodecArray[iCodecSelected]->PayloadType() ); |
|
739 } |
|
740 } |
|
741 |
|
742 // --------------------------------------------------------------------------- |
|
743 // CTestAppConsole::RunTestPrepareStreams |
|
744 // |
|
745 // --------------------------------------------------------------------------- |
|
746 // |
|
747 void CTestAppConsole::RunTestPrepareStreams() |
|
748 { |
|
749 TInt err( KErrNone ); |
|
750 if ( KMccFourCCIdDTMF == iCodecArray[iCodecSelected]->FourCC() ) |
|
751 { |
|
752 if ( KNullId != iDTMFStreamID ) |
|
753 { |
|
754 iMccInterface->SetPriority( iDTMFSessionID, iDtmfLinkID, iDTMFStreamID, KAudioPriorityPhoneCall /*EMdaPriorityNormal*/ ); |
|
755 err = iMccInterface->PrepareStream( iDTMFSessionID, iDtmfLinkID, iDTMFStreamID ); |
|
756 if ( err != KErrNone ) |
|
757 { |
|
758 iConsole->Printf( _L( "\nCould not prepare DTMF stream" ) ); |
|
759 return; |
|
760 } |
|
761 else |
|
762 { |
|
763 iConsole->Printf( _L( "\nDTMF stream prepared" ) ); |
|
764 } |
|
765 } |
|
766 else |
|
767 { |
|
768 iConsole->Printf( _L( "\nCreate DTMF stream first" ) ); |
|
769 } |
|
770 } |
|
771 else |
|
772 { |
|
773 // Set UL priority |
|
774 err = iMccInterface->SetPriority( iSessionId, iUplinkId, iUpStreamId, KAudioPriorityPhoneCall ); |
|
775 if ( err != KErrNone ) |
|
776 { |
|
777 iConsole->Printf( _L( "\nCould not set priority ( up )" ) ); |
|
778 return; |
|
779 } |
|
780 else |
|
781 { |
|
782 iConsole->Printf( _L( "\nUpstream priority set" ) ); |
|
783 } |
|
784 |
|
785 // Set DL priority |
|
786 err = iMccInterface->SetPriority( iSessionId, iDownlinkId, iDownStreamId, KAudioPriorityPhoneCall ); |
|
787 if ( err != KErrNone ) |
|
788 { |
|
789 iConsole->Printf( _L( "\nCould not set priority ( down )" ) ); |
|
790 return; |
|
791 } |
|
792 else |
|
793 { |
|
794 iConsole->Printf( _L( "\nDownstream priority set" ) ); |
|
795 } |
|
796 |
|
797 // Prepare upstream |
|
798 err = iMccInterface->PrepareStream( iSessionId, iUplinkId, iUpStreamId ); // UP |
|
799 if ( err != KErrNone ) |
|
800 { |
|
801 iConsole->Printf( _L( "\nCould not prepare ( up )" ) ); |
|
802 return; |
|
803 } |
|
804 else |
|
805 { |
|
806 iConsole->Printf( _L( "\nUpstream prepared" ) ); |
|
807 } |
|
808 |
|
809 // Prepare downstream |
|
810 err = iMccInterface->PrepareStream( iSessionId, iDownlinkId, iDownStreamId ); // Down |
|
811 if ( err != KErrNone ) |
|
812 { |
|
813 iConsole->Printf( _L( "\nCould not prepare ( down )" ) ); |
|
814 return; |
|
815 } |
|
816 else |
|
817 { |
|
818 iConsole->Printf( _L( "\nDownstream prepared\n" ) ); |
|
819 } |
|
820 } |
|
821 } |
|
822 |
|
823 // --------------------------------------------------------------------------- |
|
824 // CTestAppConsole::RunTest2p |
|
825 // |
|
826 // --------------------------------------------------------------------------- |
|
827 // |
|
828 void CTestAppConsole::RunTest2p() |
|
829 { |
|
830 TUint iUpStreamId; |
|
831 TUint sessionID; |
|
832 TBool inputOK( ETrue ); |
|
833 |
|
834 DisplayMsg( _L( "\nSessionId: " ) ); |
|
835 if ( GetIntegerFromConsole( sessionID ) ) |
|
836 { |
|
837 inputOK = EFalse; |
|
838 } |
|
839 |
|
840 DisplayMsg( _L( "\nStreamId to prepare: " ) ); |
|
841 if ( GetIntegerFromConsole( iUpStreamId ) ) |
|
842 { |
|
843 inputOK = EFalse; |
|
844 } |
|
845 |
|
846 if ( inputOK ) |
|
847 { |
|
848 iMccInterface->SetPriority( sessionID, 0/*TBI*/, iUpStreamId, 100 ); |
|
849 iMccInterface->PrepareStream( sessionID, 0/*TBI*/, iUpStreamId ); |
|
850 } |
|
851 else |
|
852 { |
|
853 DisplayMsg( _L( "Invalid input!" ) ); |
|
854 } |
|
855 } |
|
856 |
|
857 // --------------------------------------------------------------------------- |
|
858 // CTestAppConsole::RunTestStartStream |
|
859 // |
|
860 // --------------------------------------------------------------------------- |
|
861 // |
|
862 void CTestAppConsole::RunTestStartStream() |
|
863 { |
|
864 TBuf<20> line; |
|
865 TUint input; |
|
866 TChar inputChar; |
|
867 TBool inputOK( ETrue ); |
|
868 TInt err( KErrNone ); |
|
869 TUint32 session( 0 ); |
|
870 TUint32 link( 0 ); |
|
871 TUint32 stream( 0 ); |
|
872 TBool startPaused( EFalse ); |
|
873 TBool enableRtcp( EFalse ); |
|
874 |
|
875 DisplayMsg( _L( "\nStart which stream? 1 = up, 2 = down: " ) ); |
|
876 if ( GetIntegerFromConsole( input ) ) |
|
877 { |
|
878 inputOK = EFalse; |
|
879 } |
|
880 if ( !inputOK ) |
|
881 { |
|
882 DisplayMsg( _L( "Invalid input!" ) ); |
|
883 } |
|
884 else if ( input == 1 ) |
|
885 { |
|
886 session = iSessionId; |
|
887 link = iUplinkId; |
|
888 stream = iUpStreamId; |
|
889 } |
|
890 else if ( input == 2 ) |
|
891 { |
|
892 session = iSessionId; |
|
893 link = iDownlinkId; |
|
894 stream = iDownStreamId; |
|
895 } |
|
896 else |
|
897 { |
|
898 DisplayMsg( _L( "Please enter 1 or 2" ) ); |
|
899 } |
|
900 |
|
901 // Get pause mode |
|
902 iConsole->Printf( _L( "\nStart stream paused? <y/n>: " ) ); |
|
903 GetStringFromConsole( line ); |
|
904 inputChar = line.Ptr()[0]; |
|
905 |
|
906 if ( inputChar == 'y' ) |
|
907 { |
|
908 startPaused = ETrue; |
|
909 } |
|
910 |
|
911 // Get RTCP mode |
|
912 iConsole->Printf( _L( "\nEnable RTCP? <y/n>: " ) ); |
|
913 GetStringFromConsole( line ); |
|
914 inputChar = line.Ptr()[0]; |
|
915 if ( inputChar == 'y' ) |
|
916 { |
|
917 enableRtcp = ETrue; |
|
918 } |
|
919 |
|
920 // Start stream |
|
921 iConsole->Printf( _L( "\nStarting stream..." ) ); |
|
922 err = iMccInterface->StartStream( session, link, stream, |
|
923 startPaused, enableRtcp ); |
|
924 if ( err != KErrNone ) |
|
925 { |
|
926 iConsole->Printf( _L( "\nCould not start stream, error %d" ), err ); |
|
927 } |
|
928 else |
|
929 { |
|
930 iConsole->Printf( _L( "\nStream started" ) ); |
|
931 } |
|
932 } |
|
933 |
|
934 // --------------------------------------------------------------------------- |
|
935 // CTestAppConsole::RunTestPauseStreams |
|
936 // |
|
937 // --------------------------------------------------------------------------- |
|
938 // |
|
939 void CTestAppConsole::RunTestPauseStreams() |
|
940 { |
|
941 TBuf<20> line; |
|
942 TUint input; |
|
943 TChar inputChar; |
|
944 TBool enableRtcp( EFalse ); |
|
945 TBool inputOK( ETrue ); |
|
946 TInt err( KErrNone ); |
|
947 |
|
948 DisplayMsg( _L( "\nPause which stream? 1 = up, 2 = down: " ) ); |
|
949 if ( GetIntegerFromConsole( input ) ) |
|
950 { |
|
951 inputOK = EFalse; |
|
952 } |
|
953 |
|
954 if ( !inputOK ) |
|
955 { |
|
956 DisplayMsg( _L( "Invalid input!" ) ); |
|
957 return; |
|
958 } |
|
959 |
|
960 // Get RTCP mode |
|
961 iConsole->Printf( _L( "\nEnable RTCP? <y/n>: " ) ); |
|
962 GetStringFromConsole( line ); |
|
963 inputChar = line.Ptr()[0]; |
|
964 if ( inputChar == 'y' ) |
|
965 { |
|
966 enableRtcp = ETrue; |
|
967 } |
|
968 |
|
969 if ( input == 1 ) |
|
970 { |
|
971 // Pause upstream |
|
972 iConsole->Printf( _L( "\nPausing upstream..." ) ); |
|
973 err = iMccInterface->PauseStream( iSessionId, iUplinkId, |
|
974 iUpStreamId, enableRtcp ); |
|
975 if ( err != KErrNone ) |
|
976 { |
|
977 iConsole->Printf( _L( "\nCould not pause upstream, error %d" ), err ); |
|
978 } |
|
979 else |
|
980 { |
|
981 iConsole->Printf( _L( "\nUpstream paused" ) ); |
|
982 } |
|
983 } |
|
984 else if ( input == 2 ) |
|
985 { |
|
986 // Pause downstream |
|
987 iConsole->Printf( _L( "\nPausing downstream..." ) ); |
|
988 err = iMccInterface->PauseStream( iSessionId, iDownlinkId, |
|
989 iDownStreamId, enableRtcp ); |
|
990 if ( err != KErrNone ) |
|
991 { |
|
992 iConsole->Printf( _L( "\nCould not pause downstream, error %d" ), err ); |
|
993 } |
|
994 else |
|
995 { |
|
996 iConsole->Printf( _L( "\nDownstream paused" ) ); |
|
997 } |
|
998 } |
|
999 else |
|
1000 { |
|
1001 DisplayMsg( _L( "Please enter 1 or 2" ) ); |
|
1002 } |
|
1003 } |
|
1004 |
|
1005 // --------------------------------------------------------------------------- |
|
1006 // CTestAppConsole::RunTestResumeStreams |
|
1007 // |
|
1008 // --------------------------------------------------------------------------- |
|
1009 // |
|
1010 void CTestAppConsole::RunTestResumeStreams() |
|
1011 { |
|
1012 TBuf<20> line; |
|
1013 TUint input; |
|
1014 TBool inputOK( ETrue ); |
|
1015 TChar inputChar; |
|
1016 TBool enableRtcp( EFalse ); |
|
1017 TInt err( KErrNone ); |
|
1018 |
|
1019 DisplayMsg( _L( "\nResume which stream? 1 = up, 2 = down: " ) ); |
|
1020 if ( GetIntegerFromConsole( input ) ) |
|
1021 { |
|
1022 inputOK = EFalse; |
|
1023 } |
|
1024 |
|
1025 if ( !inputOK ) |
|
1026 { |
|
1027 DisplayMsg( _L( "Invalid input!" ) ); |
|
1028 return; |
|
1029 } |
|
1030 |
|
1031 // Get RTCP mode |
|
1032 iConsole->Printf( _L( "\nEnable RTCP? <y/n>: " ) ); |
|
1033 GetStringFromConsole( line ); |
|
1034 inputChar = line.Ptr()[0]; |
|
1035 if ( inputChar == 'y' ) |
|
1036 { |
|
1037 enableRtcp = ETrue; |
|
1038 } |
|
1039 |
|
1040 if ( input == 1 ) |
|
1041 { |
|
1042 // Resume upstream |
|
1043 iConsole->Printf( _L( "\nResuming upstream..." ) ); |
|
1044 err = iMccInterface->ResumeStream( iSessionId, iUplinkId, |
|
1045 iUpStreamId, enableRtcp ); |
|
1046 if ( err != KErrNone ) |
|
1047 { |
|
1048 iConsole->Printf( _L( "\nCould not resume upstream, error %d" ), err ); |
|
1049 } |
|
1050 else |
|
1051 { |
|
1052 iConsole->Printf( _L( "\nUpstream resumed" ) ); |
|
1053 } |
|
1054 } |
|
1055 else if ( input == 2 ) |
|
1056 { |
|
1057 // Resume downstream |
|
1058 iConsole->Printf( _L( "\nResuming downstream..." ) ); |
|
1059 err = iMccInterface->ResumeStream( iSessionId, iDownlinkId, |
|
1060 iDownStreamId, enableRtcp ); |
|
1061 if ( err != KErrNone ) |
|
1062 { |
|
1063 iConsole->Printf( _L( "\nCould not resume downstream, error %d" ), err ); |
|
1064 } |
|
1065 else |
|
1066 { |
|
1067 iConsole->Printf( _L( "\nDownstream resumed" ) ); |
|
1068 } |
|
1069 } |
|
1070 else |
|
1071 { |
|
1072 DisplayMsg( _L( "Please enter 1 or 2" ) ); |
|
1073 } |
|
1074 } |
|
1075 |
|
1076 |
|
1077 |
|
1078 // --------------------------------------------------------------------------- |
|
1079 // CTestAppConsole::RunTestStopStream |
|
1080 // |
|
1081 // --------------------------------------------------------------------------- |
|
1082 // |
|
1083 void CTestAppConsole::RunTestStopStream() |
|
1084 { |
|
1085 TUint input; |
|
1086 TBool inputOK( ETrue ); |
|
1087 TInt err( KErrNone ); |
|
1088 |
|
1089 DisplayMsg( _L( "\nStop which stream? 1 = up, 2 = down: " ) ); |
|
1090 if ( GetIntegerFromConsole( input ) ) |
|
1091 { |
|
1092 inputOK = EFalse; |
|
1093 } |
|
1094 |
|
1095 if ( !inputOK ) |
|
1096 { |
|
1097 DisplayMsg( _L( "Invalid input!" ) ); |
|
1098 } |
|
1099 else if ( input == 1 ) |
|
1100 { |
|
1101 // Stop upstream |
|
1102 iConsole->Printf( _L( "\nStopping upstream..." ) ); |
|
1103 err = iMccInterface->StopStream( iSessionId, iUplinkId, iUpStreamId ); |
|
1104 if ( err != KErrNone ) |
|
1105 { |
|
1106 iConsole->Printf( _L( "\nCould not stop upstream, error %d" ), err ); |
|
1107 } |
|
1108 else |
|
1109 { |
|
1110 iConsole->Printf( _L( "\nUpstream stopped" ) ); |
|
1111 } |
|
1112 } |
|
1113 else if ( input == 2 ) |
|
1114 { |
|
1115 // Stop downstream |
|
1116 iConsole->Printf( _L( "\nStopping downstream..." ) ); |
|
1117 err = iMccInterface->StopStream( iSessionId, iDownlinkId, iDownStreamId ); |
|
1118 if ( err != KErrNone ) |
|
1119 { |
|
1120 iConsole->Printf( _L( "\nCould not stop downstream, error %d" ), err ); |
|
1121 } |
|
1122 else |
|
1123 { |
|
1124 iConsole->Printf( _L( "\nDownstream stopped" ) ); |
|
1125 } |
|
1126 } |
|
1127 else |
|
1128 { |
|
1129 DisplayMsg( _L( "Please enter 1 or 2" ) ); |
|
1130 } |
|
1131 } |
|
1132 |
|
1133 // --------------------------------------------------------------------------- |
|
1134 // CTestAppConsole::RunTestDeleteStreams |
|
1135 // |
|
1136 // --------------------------------------------------------------------------- |
|
1137 // |
|
1138 void CTestAppConsole::RunTestDeleteStreams() |
|
1139 { |
|
1140 TUint input; |
|
1141 TBool inputOK( ETrue ); |
|
1142 TInt err( KErrNone ); |
|
1143 |
|
1144 DisplayMsg( _L( "\nDelete which stream? 1 = up, 2 = down: " ) ); |
|
1145 if ( GetIntegerFromConsole( input ) ) |
|
1146 { |
|
1147 inputOK = EFalse; |
|
1148 } |
|
1149 |
|
1150 if ( !inputOK ) |
|
1151 { |
|
1152 DisplayMsg( _L( "Invalid input!" ) ); |
|
1153 } |
|
1154 else if ( input == 1 ) |
|
1155 { |
|
1156 // Delete upstream |
|
1157 iConsole->Printf( _L( "\nDeleting upstream..." ) ); |
|
1158 err = iMccInterface->DeleteStream( iSessionId, iUplinkId, iUpStreamId ); |
|
1159 if ( err != KErrNone ) |
|
1160 { |
|
1161 iConsole->Printf( _L( "\nCould not delete upstream, error %d" ), err ); |
|
1162 } |
|
1163 else |
|
1164 { |
|
1165 iConsole->Printf( _L( "\nUpstream deleted" ) ); |
|
1166 } |
|
1167 |
|
1168 // Close link too |
|
1169 iConsole->Printf( _L( "\nClosing uplink..." ) ); |
|
1170 err = iMccInterface->CloseLink( iSessionId, iUplinkId ); |
|
1171 if ( err != KErrNone ) |
|
1172 { |
|
1173 iConsole->Printf( _L( "\nCould not close uplink, error %d" ), err ); |
|
1174 } |
|
1175 else |
|
1176 { |
|
1177 iConsole->Printf( _L( "\nUplink closed" ) ); |
|
1178 } |
|
1179 } |
|
1180 else if ( input == 2 ) |
|
1181 { |
|
1182 // Delete downstream |
|
1183 iConsole->Printf( _L( "\nDeleting downstream..." ) ); |
|
1184 err = iMccInterface->DeleteStream( iSessionId, iDownlinkId, iDownStreamId ); |
|
1185 if ( err != KErrNone ) |
|
1186 { |
|
1187 iConsole->Printf( _L( "\nCould not delete downstream, error %d" ), err ); |
|
1188 } |
|
1189 else |
|
1190 { |
|
1191 iConsole->Printf( _L( "\nDownstream deleted" ) ); |
|
1192 } |
|
1193 |
|
1194 // Close link too |
|
1195 iConsole->Printf( _L( "\nClosing downlink..." ) ); |
|
1196 err = iMccInterface->CloseLink( iSessionId, iDownlinkId ); |
|
1197 if ( err != KErrNone ) |
|
1198 { |
|
1199 iConsole->Printf( _L( "\nCould not close downlink, error %d" ), err ); |
|
1200 } |
|
1201 else |
|
1202 { |
|
1203 iConsole->Printf( _L( "\nDownlink closed" ) ); |
|
1204 } |
|
1205 } |
|
1206 else |
|
1207 { |
|
1208 DisplayMsg( _L( "Please enter 1 or 2" ) ); |
|
1209 } |
|
1210 } |
|
1211 |
|
1212 // --------------------------------------------------------------------------- |
|
1213 // CTestAppConsole::RunTestCloseSession |
|
1214 // |
|
1215 // --------------------------------------------------------------------------- |
|
1216 // |
|
1217 void CTestAppConsole::RunTestCloseSession() |
|
1218 { |
|
1219 TUint aSessionId; |
|
1220 iConsole->Printf( _L( "\nEnter SessionId: " ) ); |
|
1221 TBuf<20> line; |
|
1222 |
|
1223 GetStringFromConsole( line ); |
|
1224 TLex lex( line ); |
|
1225 lex.Val( aSessionId,EDecimal ); |
|
1226 |
|
1227 TInt err = iMccInterface->CloseSession( aSessionId ); |
|
1228 if ( err == KErrNone ) |
|
1229 { |
|
1230 iConsole->Printf( _L( "Session Closed.\n" ) ); |
|
1231 } |
|
1232 else |
|
1233 { |
|
1234 iConsole->Printf( _L( "\nCould not close session, error %d" ), err ); |
|
1235 } |
|
1236 } |
|
1237 |
|
1238 // --------------------------------------------------------------------------- |
|
1239 // CTestAppConsole::RunTest7 |
|
1240 // |
|
1241 // --------------------------------------------------------------------------- |
|
1242 // |
|
1243 void CTestAppConsole::RunTest7() |
|
1244 { |
|
1245 //TInt aBitrate = 12200; |
|
1246 TUint aVolume = 5; |
|
1247 TUint aGain = 4; |
|
1248 TInt aBalance = 0; |
|
1249 |
|
1250 iConsole->Printf( _L( "\nEnter volume: " ) ); |
|
1251 GetIntegerFromConsole( aVolume ); |
|
1252 iMccInterface->SetVolume( aVolume ); |
|
1253 |
|
1254 iConsole->Printf( _L( "\nEnter gain: " ) ); |
|
1255 GetIntegerFromConsole( aGain ); |
|
1256 |
|
1257 iMccInterface->SetGain( aGain ); |
|
1258 iMccInterface->SetBalance( iSessionId, iUplinkId, iUpStreamId, aBalance, |
|
1259 EMccAudioPlay ); |
|
1260 iMccInterface->SetBalance( iSessionId, iDownlinkId, iDownStreamId, aBalance, |
|
1261 EMccAudioPlay ); |
|
1262 iConsole->Printf( _L( "Settings done.\n " ) ); |
|
1263 } |
|
1264 |
|
1265 // --------------------------------------------------------------------------- |
|
1266 // CTestAppConsole::RunTestGetCodecAndAudioSettings |
|
1267 // |
|
1268 // --------------------------------------------------------------------------- |
|
1269 // |
|
1270 void CTestAppConsole::RunTestGetCodecAndAudioSettings() |
|
1271 { |
|
1272 // get codec |
|
1273 TInt volume; |
|
1274 TInt maxvolume; |
|
1275 TInt aGain; |
|
1276 TInt aMGain; |
|
1277 CMccCodecInformation* codec( NULL ); |
|
1278 TInt aUpBalance; |
|
1279 TInt aDownBalance; |
|
1280 TInt error; |
|
1281 |
|
1282 iMccInterface->GetGain( aGain ); |
|
1283 iMccInterface->MaxGain( iSessionId, iUplinkId, iUpStreamId, aMGain ); |
|
1284 TRAP( error, codec = iMccInterface->GetCodecL( iSessionId, iUplinkId, iUpStreamId ) ); |
|
1285 if ( error != KErrNone ) |
|
1286 { |
|
1287 iConsole->Printf( _L( "Could not get codec, error %d\n" ), error ); |
|
1288 } |
|
1289 iMccInterface->Volume( volume ); |
|
1290 iMccInterface->MaxVolume( iSessionId, iDownlinkId, iDownStreamId, maxvolume ); |
|
1291 |
|
1292 iMccInterface->Balance( iSessionId, iUplinkId, iUpStreamId, aUpBalance, EMccAudioPlay ); |
|
1293 iMccInterface->Balance( iSessionId, iDownlinkId, iDownStreamId, aDownBalance, EMccAudioPlay ); |
|
1294 |
|
1295 iConsole->Printf( _L( "Gain: %d MaxGain: %d Codec: %d Vol: %d MaxVol: %d uBal: %d dBal: %d\n" ), |
|
1296 aGain, aMGain, codec->FourCC(), volume, maxvolume, aUpBalance, aDownBalance ); |
|
1297 iConsole->Printf( _L( "Get done.\n" ) ); |
|
1298 } |
|
1299 |
|
1300 |
|
1301 // --------------------------------------------------------------------------- |
|
1302 // CTestAppConsole::RunTestDisplaySupportedCodecs |
|
1303 // |
|
1304 // --------------------------------------------------------------------------- |
|
1305 // |
|
1306 void CTestAppConsole::RunTestDisplaySupportedCodecs() |
|
1307 { |
|
1308 iConsole->Printf( _L( "Supported codecs: %d\n" ), iCodecArray.Count() ); |
|
1309 |
|
1310 for ( TInt i=0; i<iCodecArray.Count(); i++ ) |
|
1311 { |
|
1312 iConsole->Printf( _L( "codec %d: br:%d 4cc:%d\n" ), |
|
1313 i, iCodecArray[i]->Bitrate(), iCodecArray[i]->FourCC() ); |
|
1314 } |
|
1315 } |
|
1316 |
|
1317 |
|
1318 // --------------------------------------------------------------------------- |
|
1319 // CTestAppConsole::RunSetCodecSettings |
|
1320 // |
|
1321 // --------------------------------------------------------------------------- |
|
1322 // |
|
1323 void CTestAppConsole::RunSetCodecSettings() |
|
1324 { |
|
1325 iConsole->Printf( _L( "\nEnter PTime: " ) ); |
|
1326 TUint iPTime; |
|
1327 GetIntegerFromConsole( iPTime ); |
|
1328 |
|
1329 iCodecArray[iCodecSelected]->SetPTime( iPTime ); |
|
1330 |
|
1331 iConsole->Printf( _L( "\nEnter MaxPTime: " ) ); |
|
1332 TUint iMaxPTime; |
|
1333 GetIntegerFromConsole( iMaxPTime ); |
|
1334 |
|
1335 iCodecArray[iCodecSelected]->SetMaxPTime( iMaxPTime ); |
|
1336 |
|
1337 iConsole->Printf( _L( "\nSettings done" ) ); |
|
1338 } |
|
1339 |
|
1340 // --------------------------------------------------------------------------- |
|
1341 // CTestAppConsole::RunSetFmtpAttr |
|
1342 // |
|
1343 // --------------------------------------------------------------------------- |
|
1344 // |
|
1345 void CTestAppConsole::RunSetFmtpAttr() |
|
1346 { |
|
1347 TBuf8<50> buf; |
|
1348 TInt err( KErrNone ); |
|
1349 |
|
1350 // First, try to set an invalid FMTP attribute string |
|
1351 _LIT8( KFmtpInvalid, "!PQOI;oOwiU=45;#Ur(%UT" ); |
|
1352 buf.Append( KFmtpInvalid ); |
|
1353 TRAP( err, iCodecArray[iCodecSelected]->SetFmtpAttrL( buf ) ); |
|
1354 if ( err != KErrNone ) |
|
1355 { |
|
1356 iConsole->Printf( _L( "\nCould not set invalid FMTP attribute, err %d" ), err ); |
|
1357 } |
|
1358 else |
|
1359 { |
|
1360 iConsole->Printf( _L( "\nInvalid FMTP attribute set. (no error)" ) ); |
|
1361 } |
|
1362 |
|
1363 // Now make a valid one |
|
1364 _LIT8( KFmtpPayload, "%d " ); |
|
1365 _LIT8( KFmtpOctetAlign, "octet-align=%d;" ); |
|
1366 _LIT8( KFmtpModeSet, "mode-set=%d,%d, %d" ); |
|
1367 |
|
1368 TInt payload( 5 ); |
|
1369 TInt octetAlign( 1 ); |
|
1370 TInt fmtpModeSet( 2 ); |
|
1371 |
|
1372 // The string should look like this: |
|
1373 // "xx octet-align=0/1; mode-set=0-7;" (where xx is the payload type) |
|
1374 |
|
1375 buf.Format( KFmtpPayload, payload ); |
|
1376 buf.AppendFormat( KFmtpOctetAlign, octetAlign ); |
|
1377 buf.AppendFormat( KFmtpModeSet, fmtpModeSet, 0, 5 ); |
|
1378 |
|
1379 TRAP( err, iCodecArray[iCodecSelected]->SetFmtpAttrL( buf ) ); |
|
1380 if ( err != KErrNone ) |
|
1381 { |
|
1382 iConsole->Printf( _L( "\nCould not set FMTP attribute, err %d" ), err ); |
|
1383 } |
|
1384 else |
|
1385 { |
|
1386 iConsole->Printf( _L( "\nFMTP attribute set." ) ); |
|
1387 } |
|
1388 } |
|
1389 |
|
1390 // --------------------------------------------------------------------------- |
|
1391 // CTestAppConsole::ToggleVAD |
|
1392 // |
|
1393 // --------------------------------------------------------------------------- |
|
1394 // |
|
1395 void CTestAppConsole::ToggleVAD() |
|
1396 { |
|
1397 |
|
1398 if ( iCodecArray[iCodecSelected]->VAD() ) |
|
1399 { |
|
1400 iCodecArray[iCodecSelected]->EnableVAD( EFalse ); |
|
1401 iConsole->Printf( _L( "VAD: OFF\n" ) ); |
|
1402 } |
|
1403 else |
|
1404 { |
|
1405 TInt err = iCodecArray[iCodecSelected]->EnableVAD( ETrue ); |
|
1406 if ( err == KErrNotSupported ) |
|
1407 iConsole->Printf( _L( "VAD: Not supported (in current codec)\n" ) ); |
|
1408 else |
|
1409 iConsole->Printf( _L( "VAD: ON\n" ) ); |
|
1410 } |
|
1411 } |
|
1412 |
|
1413 // --------------------------------------------------------------------------- |
|
1414 // CTestAppConsole::ChangeCodec |
|
1415 // |
|
1416 // --------------------------------------------------------------------------- |
|
1417 // |
|
1418 void CTestAppConsole::ChangeCodec() |
|
1419 { |
|
1420 TInt codecs = iCodecArray.Count(); |
|
1421 |
|
1422 if ( codecs == 0 ) |
|
1423 return; |
|
1424 |
|
1425 RDebug::Print( _L( "CodecArray size: %d" ), codecs ); |
|
1426 |
|
1427 iCodecSelected++; |
|
1428 |
|
1429 if ( iCodecSelected >= codecs ) |
|
1430 { |
|
1431 iCodecSelected = 0; |
|
1432 } |
|
1433 |
|
1434 if ( iCodecArray[iCodecSelected]->FourCC() == KMccFourCCIdAMRNB ) |
|
1435 { |
|
1436 iConsole->Printf( _L( "Codec AMR-NB " ) ); |
|
1437 iCodecArray[iCodecSelected]->SetPayloadType( 128 ); |
|
1438 } |
|
1439 |
|
1440 if ( iCodecArray[iCodecSelected]->FourCC() == KMccFourCCIdG711 ) |
|
1441 { |
|
1442 if ( iCodecArray[iCodecSelected]->CodecMode() == EPCMU ) |
|
1443 iConsole->Printf( _L( "Codec PCMU " ) ); |
|
1444 if ( iCodecArray[iCodecSelected]->CodecMode() == EPCMA ) |
|
1445 iConsole->Printf( _L( "Codec PCMA " ) ); |
|
1446 } |
|
1447 |
|
1448 if ( iCodecArray[iCodecSelected]->FourCC() == KMccFourCCIdG729 ) |
|
1449 { |
|
1450 iConsole->Printf( _L( "Codec G.729 " ) ); |
|
1451 } |
|
1452 |
|
1453 if ( iCodecArray[iCodecSelected]->FourCC() == KMccFourCCIdILBC ) |
|
1454 { |
|
1455 iConsole->Printf( _L( "Codec iLBC " ) ); |
|
1456 } |
|
1457 |
|
1458 if ( iCodecArray[iCodecSelected]->FourCC() == KMccFourCCIdDTMF ) |
|
1459 { |
|
1460 iConsole->Printf( _L( "Codec DTMF " ) ); |
|
1461 } |
|
1462 |
|
1463 iConsole->Printf( _L( "4CC: %d\n" ), iCodecArray[iCodecSelected]->FourCC() ); |
|
1464 } |
|
1465 |
|
1466 |
|
1467 |
|
1468 // --------------------------------------------------------------------------- |
|
1469 // CTestAppConsole::SetCodec |
|
1470 // |
|
1471 // --------------------------------------------------------------------------- |
|
1472 // |
|
1473 void CTestAppConsole::SetCodec() |
|
1474 { |
|
1475 iMccInterface->SetCodec( iSessionId, iUplinkId, iUpStreamId, iCodecArray[iCodecSelected] ); |
|
1476 iMccInterface->SetCodec( iSessionId, iDownlinkId, iDownStreamId, iCodecArray[iCodecSelected] ); |
|
1477 iConsole->Printf( _L( "Codec set to %d\n" ), iCodecArray[iCodecSelected]->FourCC() ); |
|
1478 } |
|
1479 |
|
1480 // --------------------------------------------------------------------------- |
|
1481 // CTestAppConsole::SetRemoteAddr |
|
1482 // |
|
1483 // --------------------------------------------------------------------------- |
|
1484 // |
|
1485 void CTestAppConsole::SetRemoteAddr() |
|
1486 { |
|
1487 TBuf<20> line; |
|
1488 TLex lex( line ); |
|
1489 |
|
1490 iConsole->ClearScreen(); |
|
1491 iConsole->Printf( _L( "\nEnter the Remote IP address " ) ); |
|
1492 |
|
1493 GetStringFromConsole( line ); |
|
1494 |
|
1495 iRemoteAddr.Input( line ); |
|
1496 |
|
1497 iConsole->Printf( _L( "\nEnter the Remote port: " ) ); |
|
1498 TUint rport; |
|
1499 |
|
1500 GetStringFromConsole( line ); |
|
1501 lex.Assign( line ); |
|
1502 lex.Val( rport,EDecimal ); |
|
1503 |
|
1504 iRemoteAddr.SetPort( rport ); |
|
1505 |
|
1506 iConsole->Printf( _L( "Addr: %d , port %d\n" ), iRemoteAddr.Address(), rport ); |
|
1507 |
|
1508 // Get link type from user |
|
1509 iConsole->Printf( _L( "Enter link type ( u for up, d for down ):\n" ) ); |
|
1510 GetStringFromConsole( line ); |
|
1511 TChar inputChar = line.Ptr()[0]; |
|
1512 if ( inputChar == 'u' ) |
|
1513 { |
|
1514 iMccInterface->SetRemoteAddress( iSessionId, iUplinkId, iRemoteAddr ); |
|
1515 } |
|
1516 else if ( inputChar == 'd' ) |
|
1517 { |
|
1518 iMccInterface->SetRemoteAddress( iSessionId, iDownlinkId, iRemoteAddr ); |
|
1519 } |
|
1520 else |
|
1521 { |
|
1522 iConsole->Printf( _L( "Invalid input\n" ) ); |
|
1523 } |
|
1524 } |
|
1525 |
|
1526 // --------------------------------------------------------------------------- |
|
1527 // CTestAppConsole::RunTestCodecFactory |
|
1528 // |
|
1529 // --------------------------------------------------------------------------- |
|
1530 // |
|
1531 void CTestAppConsole::RunTestCodecFactory() |
|
1532 { |
|
1533 RArray< CMccCodecInformation > codecArray; |
|
1534 |
|
1535 CMccCodecInformationFactory* infoFactory = CMccCodecInformationFactory::NewL(); |
|
1536 TBuf8<KMaxSdpNameLength> sdpName; |
|
1537 |
|
1538 TInt i; |
|
1539 for ( i = 0; i < iCodecInformation.Count(); i++ ) |
|
1540 { |
|
1541 |
|
1542 sdpName = iCodecInformation[i]->SdpName(); |
|
1543 |
|
1544 CMccCodecInformation* tempInfo = NULL; |
|
1545 |
|
1546 TRAPD( err1, tempInfo = infoFactory->CreateCodecInformationL( sdpName ) ); |
|
1547 if ( err1 ) |
|
1548 { |
|
1549 tempInfo = NULL; |
|
1550 } |
|
1551 else |
|
1552 { |
|
1553 codecArray.Append( *tempInfo ); |
|
1554 delete tempInfo; |
|
1555 } |
|
1556 } |
|
1557 |
|
1558 for ( i = 0; i < codecArray.Count(); i++ ) |
|
1559 { |
|
1560 iCodecArray.Append( &codecArray[ i ] ); |
|
1561 } |
|
1562 |
|
1563 codecArray.Close(); |
|
1564 |
|
1565 RDebug::Print( _L( "CodecArray size: %d" ), iCodecArray.Count() ); |
|
1566 |
|
1567 delete infoFactory; |
|
1568 } |
|
1569 |
|
1570 // --------------------------------------------------------------------------- |
|
1571 // CTestAppConsole::ToggleInactivityTimer |
|
1572 // |
|
1573 // --------------------------------------------------------------------------- |
|
1574 // |
|
1575 void CTestAppConsole::ToggleInactivityTimer() |
|
1576 { |
|
1577 TInt result( KErrNone ); |
|
1578 TUint input; |
|
1579 TBool inputOK( ETrue ); |
|
1580 TUint32 link( 0 ); |
|
1581 TUint32 stream( 0 ); |
|
1582 |
|
1583 const TInt KInactivityTimeout( 8000000 ); |
|
1584 |
|
1585 DisplayMsg( _L( "\nTimer, which stream? 1 = up, 2 = down: " ) ); |
|
1586 if ( GetIntegerFromConsole( input ) ) |
|
1587 { |
|
1588 inputOK = EFalse; |
|
1589 } |
|
1590 |
|
1591 if ( !inputOK ) |
|
1592 { |
|
1593 DisplayMsg( _L( "Invalid input!" ) ); |
|
1594 } |
|
1595 else if ( input == 1 ) |
|
1596 { |
|
1597 link = iUplinkId; |
|
1598 stream = iUpStreamId; |
|
1599 } |
|
1600 else if ( input == 2 ) |
|
1601 { |
|
1602 link = iDownlinkId; |
|
1603 stream = iDownStreamId; |
|
1604 } |
|
1605 else |
|
1606 { |
|
1607 DisplayMsg( _L( "Please enter 1 or 2" ) ); |
|
1608 return; |
|
1609 } |
|
1610 if ( iInactivityTimerActive ) |
|
1611 { |
|
1612 result = iMccInterface->StopInactivityTimer( iSessionId, link, stream ); |
|
1613 if ( result == KErrNone ) |
|
1614 { |
|
1615 iInactivityTimerActive = EFalse; |
|
1616 iConsole->Printf( _L( "Inactivity timer stopped\n" ) ); |
|
1617 } |
|
1618 else |
|
1619 { |
|
1620 iConsole->Printf( _L( "Could not stop timer, error %d\n" ), result ); |
|
1621 } |
|
1622 } |
|
1623 else |
|
1624 { |
|
1625 result = iMccInterface->StartInactivityTimer( iSessionId, link, stream, |
|
1626 KInactivityTimeout ); |
|
1627 if ( result == KErrNone ) |
|
1628 { |
|
1629 iInactivityTimerActive = ETrue; |
|
1630 iConsole->Printf( _L( "Inactivity timer started\n" ) ); |
|
1631 } |
|
1632 else |
|
1633 { |
|
1634 iConsole->Printf( _L( "Could not start timer, error %d\n" ), result ); |
|
1635 } |
|
1636 } |
|
1637 } |
|
1638 |
|
1639 // --------------------------------------------------------------------------- |
|
1640 // CTestAppConsole::SendNonRtcpData |
|
1641 // |
|
1642 // --------------------------------------------------------------------------- |
|
1643 // |
|
1644 void CTestAppConsole::SendNonRtcpData() |
|
1645 { |
|
1646 TBuf8<50> data; |
|
1647 _LIT8( KData, "NonRtcpData #%d" ); |
|
1648 data.Format( KData, iNumOfNonRtcpDataSent++ ); |
|
1649 TInt result = iMccInterface->SendRTCPAnyData( iSessionId, |
|
1650 iDownlinkId, |
|
1651 iDownStreamId, |
|
1652 data ); |
|
1653 if ( result == KErrNone ) |
|
1654 { |
|
1655 iConsole->Printf( _L( "Non-RTCP data sent\n" ) ); |
|
1656 } |
|
1657 else |
|
1658 { |
|
1659 iConsole->Printf( _L( "Could not send data, error %d\n" ), result ); |
|
1660 } |
|
1661 } |
|
1662 |
|
1663 // --------------------------------------------------------------------------- |
|
1664 // CTestAppConsole::MccMediaStarted |
|
1665 // |
|
1666 // --------------------------------------------------------------------------- |
|
1667 // |
|
1668 void CTestAppConsole::MccMediaStarted( TUint32 aSessionID, TUint32 aLinkId, TUint32 aStreamID, TUint32 aSinkSourceId ) |
|
1669 { |
|
1670 RDebug::Print( _L( "CALLBACK: Stream Started: sess %u, link %u, stream %u, sinksource %u" ), |
|
1671 aSessionID, aLinkId, aStreamID, aSinkSourceId ); |
|
1672 iConsole->Printf( _L( "\nCALLBACK: Stream Started: sess %u, link %u, stream %u, sinksource %u\n" ), |
|
1673 aSessionID, aLinkId, aStreamID, aSinkSourceId ); |
|
1674 } |
|
1675 |
|
1676 // --------------------------------------------------------------------------- |
|
1677 // CTestAppConsole::MccMediaStopped |
|
1678 // |
|
1679 // --------------------------------------------------------------------------- |
|
1680 // |
|
1681 void CTestAppConsole::MccMediaStopped( TUint32 aSessionID, TUint32 aLinkId, TUint32 aStreamID, TUint32 aSinkSourceId ) |
|
1682 { |
|
1683 RDebug::Print( _L( "CALLBACK: Stream Stopped: sess %u, link %u, stream %u, sinksource %u" ), |
|
1684 aSessionID, aLinkId, aStreamID, aSinkSourceId ); |
|
1685 iConsole->Printf( _L( "\nCALLBACK: Stream Stopped: sess %u, link %u, stream %u, sinksource %u\n" ), |
|
1686 aSessionID, aLinkId, aStreamID, aSinkSourceId ); |
|
1687 } |
|
1688 |
|
1689 // --------------------------------------------------------------------------- |
|
1690 // CTestAppConsole::MccMediaPaused |
|
1691 // |
|
1692 // --------------------------------------------------------------------------- |
|
1693 // |
|
1694 void CTestAppConsole::MccMediaPaused( TUint32 aSessionID, TUint32 aLinkId, TUint32 aStreamID, TUint32 aSinkSourceId ) |
|
1695 { |
|
1696 RDebug::Print( _L( "CALLBACK: Stream Paused: sess %u, link %u, stream %u, sinksource %u" ), |
|
1697 aSessionID, aLinkId, aStreamID, aSinkSourceId ); |
|
1698 iConsole->Printf( _L( "\nCALLBACK: Stream Paused: sess %u, link %u, stream %u, sinksource %u\n" ), |
|
1699 aSessionID, aLinkId, aStreamID, aSinkSourceId ); |
|
1700 } |
|
1701 |
|
1702 // --------------------------------------------------------------------------- |
|
1703 // CTestAppConsole::SMccMediaResumed |
|
1704 // |
|
1705 // --------------------------------------------------------------------------- |
|
1706 // |
|
1707 void CTestAppConsole::MccMediaResumed( TUint32 aSessionID, TUint32 aLinkId, TUint32 aStreamID, TUint32 aSinkSourceId ) |
|
1708 { |
|
1709 RDebug::Print( _L( "CALLBACK: Stream Resumed: sess %u, link %u, stream %u, sinksource %u" ), |
|
1710 aSessionID, aLinkId, aStreamID, aSinkSourceId ); |
|
1711 iConsole->Printf( _L( "\nCALLBACK: Stream Resumed: sess %u, link %u, stream %u, sinksource %u\n" ), |
|
1712 aSessionID, aLinkId, aStreamID, aSinkSourceId ); |
|
1713 } |
|
1714 |
|
1715 // --------------------------------------------------------------------------- |
|
1716 // CTestAppConsole::MccMediaPrepared |
|
1717 // |
|
1718 // --------------------------------------------------------------------------- |
|
1719 // |
|
1720 void CTestAppConsole::MccMediaPrepared( TUint32 aSessionID, TUint32 aLinkId, TUint32 aStreamID, TUint32 aSinkSourceId ) |
|
1721 { |
|
1722 RDebug::Print( _L( "CALLBACK: Stream Prepared: sess %u, link %u, stream %u, sinksource %u" ), |
|
1723 aSessionID, aLinkId, aStreamID, aSinkSourceId ); |
|
1724 iConsole->Printf( _L( "\nCALLBACK: Stream Prepared: sess %u, link %u, stream %u, sinksource %u" ), |
|
1725 aSessionID, aLinkId, aStreamID, aSinkSourceId ); |
|
1726 } |
|
1727 |
|
1728 // --------------------------------------------------------------------------- |
|
1729 // CTestAppConsole::MccMediaInactive |
|
1730 // |
|
1731 // --------------------------------------------------------------------------- |
|
1732 // |
|
1733 void CTestAppConsole::MccMediaInactive( TUint32 aSessionID, TUint32 aLinkId, TUint32 aStreamID, TUint32 aSinkSourceId ) |
|
1734 { |
|
1735 RDebug::Print( _L( "CALLBACK: Stream Inactive: sess %u, link %u, stream %u, sinksource %u" ), |
|
1736 aSessionID, aLinkId, aStreamID, aSinkSourceId ); |
|
1737 iConsole->Printf( _L( "\nCALLBACK: Stream Inactive: sess %u, link %u, stream %u, sinksource %u\n" ), |
|
1738 aSessionID, aLinkId, aStreamID, aSinkSourceId ); |
|
1739 iInactivityTimerActive = EFalse; |
|
1740 } |
|
1741 |
|
1742 // --------------------------------------------------------------------------- |
|
1743 // CTestAppConsole::MccMediaActive |
|
1744 // |
|
1745 // --------------------------------------------------------------------------- |
|
1746 // |
|
1747 void CTestAppConsole::MccMediaActive( TUint32 aSessionID, TUint32 aLinkId, TUint32 aStreamID, TUint32 aSinkSourceId ) |
|
1748 { |
|
1749 RDebug::Print( _L( "CALLBACK: Stream active: sess %u, link %u, stream %u, sinksource %u" ), |
|
1750 aSessionID, aLinkId, aStreamID, aSinkSourceId ); |
|
1751 iConsole->Printf( _L( "\nCALLBACK: Stream active: sess %u, link %u, stream %u, sinksource %u\n" ), |
|
1752 aSessionID, aLinkId, aStreamID, aSinkSourceId ); |
|
1753 } |
|
1754 |
|
1755 // --------------------------------------------------------------------------- |
|
1756 // CTestAppConsole::MccEventReceived |
|
1757 // |
|
1758 // --------------------------------------------------------------------------- |
|
1759 // |
|
1760 void CTestAppConsole::MccEventReceived( const TMccEvent& aEvent ) |
|
1761 { |
|
1762 if ( aEvent.iEventCategory == KMccEventCategoryDtmf ) |
|
1763 { |
|
1764 TMccDtmfEventDataPackage package; |
|
1765 package.Copy( aEvent.iEventData ); |
|
1766 const TMccDtmfEventData& event = package(); |
|
1767 |
|
1768 switch ( event.iDtmfEventType ) |
|
1769 { |
|
1770 case KMccDtmfManualStart: |
|
1771 DisplayMsg( _L( "Manual start event" ) ); |
|
1772 break; |
|
1773 case KMccDtmfManualStop: |
|
1774 DisplayMsg( _L( "Manual stop event" ) ); |
|
1775 break; |
|
1776 case KMccDtmfManualAbort: |
|
1777 DisplayMsg( _L( "Manual abort event" ) ); |
|
1778 break; |
|
1779 case KMccDtmfSequenceStart: |
|
1780 DisplayMsg( _L( "Seq start event" ) ); |
|
1781 break; |
|
1782 case KMccDtmfSequenceStop: |
|
1783 DisplayMsg( _L( "Seq stop event" ) ); |
|
1784 break; |
|
1785 case KMccDtmfSequenceAbort: |
|
1786 DisplayMsg( _L( "Seq abort event" ) ); |
|
1787 break; |
|
1788 case KMccDtmfStopInDtmfString: |
|
1789 DisplayMsg( _L( "Stop in string" ) ); |
|
1790 break; |
|
1791 } |
|
1792 } |
|
1793 else if ( aEvent.iEventCategory == KMccEventCategoryRtcp ) |
|
1794 { |
|
1795 TMccRtcpEventDataPackage package; |
|
1796 package.Copy( aEvent.iEventData ); |
|
1797 const TMccRtcpEventData& event = package(); |
|
1798 |
|
1799 switch ( event.iRtcpPacketType ) |
|
1800 { |
|
1801 case KRtcpSdesPacket: |
|
1802 RDebug::Print( _L( "CTestAppConsole::MediaSignalReceived RTCP SDES" ) ); |
|
1803 if ( !iSdesReported ) |
|
1804 { |
|
1805 iConsole->Printf( _L( "MediaSignalReceived RTCP SDES" ) ); |
|
1806 iSdesReported = ETrue; |
|
1807 } |
|
1808 break; |
|
1809 |
|
1810 case KRtcpByePacket: |
|
1811 { |
|
1812 RDebug::Print( _L( "CTestAppConsole::MediaSignalReceived RTCP BYE" ) ); |
|
1813 iConsole->Printf( _L( "MediaSignalReceived RTCP BYE" ) ); |
|
1814 } |
|
1815 break; |
|
1816 |
|
1817 case KRtcpAppPacket: |
|
1818 { |
|
1819 RDebug::Print( _L( "CTestAppConsole::MediaSignalReceived RTCP APP" ) ); |
|
1820 iConsole->Printf( _L( "MediaSignalReceived RTCP APP" ) ); |
|
1821 |
|
1822 TPckgBuf<TRtcpApp> appPackage; |
|
1823 appPackage.Copy( event.iRtcpPacketData ); |
|
1824 TRtcpApp app = appPackage(); |
|
1825 } |
|
1826 break; |
|
1827 |
|
1828 case KRtcpSrPacket: |
|
1829 RDebug::Print( _L( "CTestAppConsole::MediaSignalReceived RTCP SR" ) ); |
|
1830 if ( !iSrReported ) |
|
1831 { |
|
1832 iConsole->Printf( _L( "MediaSignalReceived RTCP SR" ) ); |
|
1833 iSrReported = ETrue; |
|
1834 } |
|
1835 break; |
|
1836 |
|
1837 case KRtcpRrPacket: |
|
1838 RDebug::Print( _L( "CTestAppConsole::MediaSignalReceived RTCP RR" ) ); |
|
1839 if ( !iRrReported ) |
|
1840 { |
|
1841 iConsole->Printf( _L( "MediaSignalReceived RTCP RR" ) ); |
|
1842 iRrReported = ETrue; |
|
1843 } |
|
1844 break; |
|
1845 |
|
1846 case KRtcpPacketUndefined: |
|
1847 { |
|
1848 RDebug::Print( _L( "CTestAppConsole::MediaSignalReceived Non-RTCP:" ) ); |
|
1849 iConsole->Printf( _L( "MediaSignalReceived Data" ) ); |
|
1850 |
|
1851 // Convert to 16-bit text and print |
|
1852 HBufC* undefBuf = HBufC::NewLC( event.iRtcpPacketData.Length() ); |
|
1853 undefBuf->Des().Copy( event.iRtcpPacketData ); |
|
1854 RDebug::Print( _L( "%s" ), undefBuf->Des() ); |
|
1855 CleanupStack::PopAndDestroy( undefBuf ); |
|
1856 } |
|
1857 break; |
|
1858 |
|
1859 default: |
|
1860 RDebug::Print( _L( "CTestAppConsole::MediaSignalReceived unknown" ) ); |
|
1861 break; |
|
1862 } |
|
1863 } |
|
1864 } |
|
1865 |
|
1866 // --------------------------------------------------------------------------- |
|
1867 // CTestAppConsole::MccCtrlError |
|
1868 // |
|
1869 // --------------------------------------------------------------------------- |
|
1870 // |
|
1871 void CTestAppConsole::MccCtrlError( TInt aError ) |
|
1872 { |
|
1873 iConsole->Printf( _L( "Mcc error: %d\n" ), aError ); |
|
1874 RDebug::Print( _L( "Mcc Error: %d" ), aError ); |
|
1875 } |
|
1876 |
|
1877 // --------------------------------------------------------------------------- |
|
1878 // CTestAppConsole::MccCtrlError |
|
1879 // |
|
1880 // --------------------------------------------------------------------------- |
|
1881 // |
|
1882 void CTestAppConsole::MccCtrlError( TInt aError, TUint32 aSessionId, TUint32 aLinkId, TUint32 aStreamId, TUint32 aSinkSourceId ) |
|
1883 { |
|
1884 iConsole->Printf( _L( "Mcc error: %d Session: %u, link %u, stream %u, sinksource %u\n" ), |
|
1885 aError, aSessionId, aLinkId, aStreamId, aSinkSourceId ); |
|
1886 RDebug::Print( _L( "Mcc Error: %d Session: %u, link %u, stream %u, sinksource %u" ), |
|
1887 aError, aSessionId, aLinkId, aStreamId, aSinkSourceId ); |
|
1888 } |
|
1889 |
|
1890 // ----------------------------------------------------------------------------- |
|
1891 // CTestAppConsole::GetIntegerFromConsole |
|
1892 // Reads one integer from console to the parameter. |
|
1893 // ----------------------------------------------------------------------------- |
|
1894 // |
|
1895 TInt CTestAppConsole::GetIntegerFromConsole( TInt& aVal ) |
|
1896 { |
|
1897 TBuf<20> line; |
|
1898 GetStringFromConsole( line ); |
|
1899 |
|
1900 TLex lex( line ); |
|
1901 TInt err = lex.Val( aVal ); |
|
1902 |
|
1903 return err; |
|
1904 } |
|
1905 |
|
1906 // ----------------------------------------------------------------------------- |
|
1907 // CTestAppConsole::GetIntegerFromConsole |
|
1908 // Reads one integer from console to the parameter. |
|
1909 // ----------------------------------------------------------------------------- |
|
1910 // |
|
1911 TInt CTestAppConsole::GetIntegerFromConsole( TUint& aVal ) |
|
1912 { |
|
1913 TBuf<20> line; |
|
1914 GetStringFromConsole( line ); |
|
1915 |
|
1916 TLex lex( line ); |
|
1917 TInt err = lex.Val( aVal ); |
|
1918 |
|
1919 return err; |
|
1920 } |
|
1921 |
|
1922 // --------------------------------------------------------------------------- |
|
1923 // CTestAppConsole::ProcessDTMFInput |
|
1924 // |
|
1925 // --------------------------------------------------------------------------- |
|
1926 // |
|
1927 void CTestAppConsole::ProcessDTMFInput() |
|
1928 { |
|
1929 TInt choice; |
|
1930 TInt err( KErrNone ); |
|
1931 GetIntegerFromConsole( choice ); |
|
1932 |
|
1933 TMccEvent event; |
|
1934 event.iSessionId = iDTMFSessionID; |
|
1935 event.iStreamId = iDTMFStreamID; |
|
1936 |
|
1937 TMccDtmfEventData eventData; |
|
1938 |
|
1939 switch ( choice ) |
|
1940 { |
|
1941 case 1: |
|
1942 TUint input; |
|
1943 DisplayMsg( _L( "Digit to send?" ) ); |
|
1944 GetIntegerFromConsole( input ); |
|
1945 eventData.iDtmfEventType = EMccDtmfSigStartTone; |
|
1946 eventData.iDtmfString.Append( TChar( input ) ); |
|
1947 event.iEventData.Copy( TMccDtmfEventDataPackage( eventData ) ); |
|
1948 |
|
1949 TRAP( err, iMccInterface->SendMediaSignalL( event ) ); |
|
1950 if ( err == KErrNone ) |
|
1951 { |
|
1952 DisplayMsg( _L( "Sending started" ) ); |
|
1953 } |
|
1954 else |
|
1955 { |
|
1956 iConsole->Printf( _L( "Could not send, err %d" ), err ); |
|
1957 } |
|
1958 break; |
|
1959 |
|
1960 case 2: |
|
1961 eventData.iDtmfEventType = EMccDtmfSigStopTone; |
|
1962 event.iEventData.Copy( TMccDtmfEventDataPackage( eventData ) ); |
|
1963 |
|
1964 TRAP( err, iMccInterface->SendMediaSignalL( event ) ); |
|
1965 if ( err == KErrNone ) |
|
1966 { |
|
1967 DisplayMsg( _L( "Sending stopped" ) ); |
|
1968 } |
|
1969 else |
|
1970 { |
|
1971 iConsole->Printf( _L( "Could not stop, err %d" ), err ); |
|
1972 } |
|
1973 break; |
|
1974 |
|
1975 case 3: |
|
1976 DisplayMsg( _L( "String to send?" ) ); |
|
1977 TBuf<KMccMaxDtmfStringLength> dtmfString; |
|
1978 GetStringFromConsole( dtmfString ); |
|
1979 eventData.iDtmfString.Copy( dtmfString ); |
|
1980 eventData.iDtmfEventType = EMccDtmfSigSendString; |
|
1981 event.iEventData.Copy( TMccDtmfEventDataPackage( eventData ) ); |
|
1982 TRAP( err, iMccInterface->SendMediaSignalL( event ) ); |
|
1983 if ( err == KErrNone ) |
|
1984 { |
|
1985 DisplayMsg( _L( "Sending started" ) ); |
|
1986 } |
|
1987 else |
|
1988 { |
|
1989 iConsole->Printf( _L( "Could not start, err %d" ), err ); |
|
1990 } |
|
1991 break; |
|
1992 |
|
1993 case 4: |
|
1994 eventData.iDtmfEventType = EMccDtmfSigContinueSending; |
|
1995 eventData.iContinue = ETrue; |
|
1996 event.iEventData.Copy( TMccDtmfEventDataPackage( eventData ) ); |
|
1997 TRAP( err, iMccInterface->SendMediaSignalL( event ) ); |
|
1998 if ( err == KErrNone ) |
|
1999 { |
|
2000 DisplayMsg( _L( "Sending continues" ) ); |
|
2001 } |
|
2002 else |
|
2003 { |
|
2004 iConsole->Printf( _L( "Could not continue, err %d" ), err ); |
|
2005 } |
|
2006 break; |
|
2007 |
|
2008 case 9: |
|
2009 iCurMenu = EMainMenu; |
|
2010 DisplayConsoleMenu( KTxtMainInstructions ); |
|
2011 break; |
|
2012 |
|
2013 default: |
|
2014 _LIT( KTxtWrongOption, "Wrong Option!" ); |
|
2015 DisplayMsg( KTxtWrongOption ); |
|
2016 break; |
|
2017 } |
|
2018 |
|
2019 // Ready to get next input option. |
|
2020 DoRead(); |
|
2021 } |
|
2022 |
|
2023 // ----------------------------------------------------------------------------- |
|
2024 // CTestAppConsole::ProcessCodecInput |
|
2025 // |
|
2026 // ----------------------------------------------------------------------------- |
|
2027 // |
|
2028 void CTestAppConsole::ProcessCodecInput() |
|
2029 { |
|
2030 TInt choice; |
|
2031 GetIntegerFromConsole( choice ); |
|
2032 |
|
2033 switch ( choice ) |
|
2034 { |
|
2035 case 1: |
|
2036 RunTestDisplaySupportedCodecs(); |
|
2037 break; |
|
2038 case 2: |
|
2039 ChangeCodec(); |
|
2040 break; |
|
2041 case 3: |
|
2042 RunSetCodecSettings(); |
|
2043 break; |
|
2044 case 4: |
|
2045 ToggleVAD(); |
|
2046 break; |
|
2047 case 5: |
|
2048 SetCodec(); |
|
2049 break; |
|
2050 case 6: |
|
2051 RunSetFmtpAttr(); |
|
2052 break; |
|
2053 case 9: |
|
2054 iCurMenu = EMainMenu; |
|
2055 DisplayConsoleMenu( KTxtMainInstructions ); |
|
2056 break; |
|
2057 default: |
|
2058 _LIT( KTxtWrongOption, "Wrong Option!" ); |
|
2059 DisplayMsg( KTxtWrongOption ); |
|
2060 break; |
|
2061 } |
|
2062 |
|
2063 // Ready to get next input option. |
|
2064 DoRead(); |
|
2065 } |