multimediacommscontroller/tsrc/TestConsoles/McpSubThreads/ClientTests/Src/testconsole.cpp
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     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 <e32base.h>
       
    24 #include "TestConsole.h"
       
    25 #include "mccsymsubthreadclient.h"
       
    26 #include "mcculdlclient.h"
       
    27 #include "mccdefs.h"
       
    28 #include "mccinternalcodecs.h"
       
    29 #include "mcculdlclient.h"
       
    30 #include <mmf/server/mmfaudioinput.h>
       
    31 #include "mccrtpdatasource.h"
       
    32 #include "mccrtpdatasink.h"
       
    33 
       
    34 const TUint32 KUplinkStreamId = 1;
       
    35 const TUint32 KDownlinkStreamId = 2;
       
    36 
       
    37 // Main Instruction Text
       
    38 _LIT(KTxtMainInstructions, "Please select one option:\n"
       
    39  L"1. Test basic controls in UL/DL 1\n"
       
    40  L"3. Test UL Basic controls\n"
       
    41  L"4. Test DL Basic controls\n"
       
    42  L"5. Test memory management\n"
       
    43  L"9. Quit\n");
       
    44 
       
    45 //*******************************************************************************
       
    46 // Method      : CTestAppConsole::NewL()
       
    47 // Purpose     : 
       
    48 // Parameters  : 
       
    49 // Return Value: 
       
    50 //*******************************************************************************
       
    51 CTestAppConsole* CTestAppConsole::NewL( )
       
    52     {
       
    53 	CTestAppConsole* self = new(ELeave)CTestAppConsole();
       
    54     CleanupStack::PushL(self);
       
    55 
       
    56     self->ConstructL();
       
    57 
       
    58     CleanupStack::Pop();
       
    59     return self;
       
    60     }
       
    61 
       
    62 //*******************************************************************************
       
    63 // Method      : CTestAppConsole::CTestAppConsole()
       
    64 // Purpose     : Constructor
       
    65 // Parameters  : 
       
    66 // Return Value: 
       
    67 //*******************************************************************************
       
    68 CTestAppConsole::CTestAppConsole( ) : CActive(EPriorityStandard)
       
    69     {
       
    70 	CActiveScheduler::Add(this);
       
    71     }
       
    72 
       
    73 //*******************************************************************************
       
    74 // Method      : CTestAppConsole::ConstructL()
       
    75 // Purpose     : 
       
    76 // Parameters  : 
       
    77 // Return Value: 
       
    78 //*******************************************************************************
       
    79 void CTestAppConsole::ConstructL()
       
    80     {
       
    81     _LIT(KTxtTitle, " RTP Test ");
       
    82 	iConsole = Console::NewL(KTxtTitle, TSize(KConsFullScreen, KConsFullScreen));
       
    83 	DisplayConsoleMenu(KTxtMainInstructions);
       
    84 
       
    85 	// Create Log files
       
    86     /*
       
    87 	TFileUtil::InitLogFile(KLogFileTest);	// test events
       
    88 	TFileUtil::InitLogFile(KLogFileRtp);	// Rtp packets
       
    89 	TFileUtil::InitLogFile(KLogFileRtcp);	// Rtcp packets
       
    90 	TFileUtil::InitLogFile(KLogFileStat);	// Statistic
       
    91     */
       
    92     ConstructDlSinkSource();
       
    93     ConstructUlSinkSource();
       
    94     }
       
    95 
       
    96 //*******************************************************************************
       
    97 // Method      : CTestAppConsole::~CTestAppConsole()
       
    98 // Purpose     : Destructor
       
    99 // Parameters  : 
       
   100 // Return Value: 
       
   101 //*******************************************************************************
       
   102 CTestAppConsole::~CTestAppConsole()
       
   103     {
       
   104     Cancel(); // any outstanding request
       
   105    
       
   106 	if (iConsole)
       
   107 	    {
       
   108 		delete iConsole;
       
   109 		}
       
   110 		
       
   111 	delete iInstruct;
       
   112     
       
   113     if(iDlsource)
       
   114         delete iDlsource;
       
   115 
       
   116     if(iUlsink)
       
   117         delete iUlsink;
       
   118 
       
   119     if(iDlsink)   
       
   120         delete iDlsink;
       
   121     
       
   122     if(iUlsource)
       
   123         delete iUlsource;
       
   124     }
       
   125 
       
   126 //*******************************************************************************
       
   127 // Method      : CRtpAppConsole::StartTesting()
       
   128 // Purpose     : start this AO 
       
   129 // Parameters  : 
       
   130 // Return Value: 
       
   131 //*******************************************************************************
       
   132 void CTestAppConsole::StartTesting()
       
   133     {
       
   134 	DoRead();
       
   135     }
       
   136 
       
   137 //*******************************************************************************
       
   138 // Method      : CRtpAppConsole::DoRead()
       
   139 // Purpose     : get the user's option and send request to scheduler
       
   140 // Parameters  : 
       
   141 // Return Value: 
       
   142 //*******************************************************************************
       
   143 void CTestAppConsole::DoRead()
       
   144     {
       
   145 	iConsole->Read(iStatus);
       
   146 	SetActive();
       
   147     }
       
   148 
       
   149 //*******************************************************************************
       
   150 // Method      : CRtpAppConsole::RunL()
       
   151 // Purpose     : 
       
   152 // Parameters  : 
       
   153 // Return Value: 
       
   154 //*******************************************************************************
       
   155 void CTestAppConsole::RunL()
       
   156     {	
       
   157 	// According to current test case and direct the user's command
       
   158 	// to proper command handler.
       
   159     ProcessMainInput();
       
   160     }
       
   161 
       
   162 //*******************************************************************************
       
   163 // Method      : CRtpAppConsole::DoCancel()
       
   164 // Purpose     : 
       
   165 // Parameters  : 
       
   166 // Return Value: 
       
   167 //*******************************************************************************
       
   168 void CTestAppConsole::DoCancel()
       
   169     {
       
   170 	iConsole->ReadCancel();
       
   171     }
       
   172 
       
   173 
       
   174 //*******************************************************************************
       
   175 // Method      : CRtpAppConsole::DisplayConsoleMenu()
       
   176 // Purpose     : Display main or sub console menus for different test cases
       
   177 // Parameters  : TDesc &aInstructions
       
   178 // Return Value: void
       
   179 //*******************************************************************************
       
   180 
       
   181 void CTestAppConsole::DisplayConsoleMenu(const TDesC &aInstructions)
       
   182 	{
       
   183 	if (iInstruct)
       
   184 	    {
       
   185 	    delete iInstruct;
       
   186 	    iInstruct = NULL;
       
   187 	    }
       
   188 	iInstruct = aInstructions.AllocL();
       
   189 	iConsole->ClearScreen();
       
   190 	iConsole->Write(*iInstruct);
       
   191 	}
       
   192 
       
   193 //*******************************************************************************
       
   194 // Method      : CTestAppConsole::ProcessMainInput()
       
   195 // Purpose     : Obtain user's option and decide which test case to run next.
       
   196 // Parameters  : 
       
   197 // Return Value: 
       
   198 //*******************************************************************************
       
   199 void CTestAppConsole::ProcessMainInput()
       
   200 	{
       
   201 	TChar inputChar = iConsole->KeyCode();
       
   202 
       
   203 	switch(inputChar)
       
   204         {
       
   205         case '1':
       
   206             __UHEAP_MARK;
       
   207             RunTest1();
       
   208             __UHEAP_MARKEND;
       
   209             break;
       
   210         case '3':
       
   211             __UHEAP_MARK;
       
   212             RunTest3();
       
   213             __UHEAP_MARKEND;
       
   214             break;
       
   215         case '4':
       
   216             __UHEAP_MARK;
       
   217             RunTest4();
       
   218             __UHEAP_MARKEND;
       
   219             break;
       
   220         case '5':
       
   221             __UHEAP_MARK;
       
   222             RunTest5();
       
   223             __UHEAP_MARKEND;
       
   224             break;
       
   225         case '6':
       
   226             RunTest6();
       
   227             break;
       
   228         case '9':
       
   229             CActiveScheduler::Stop();
       
   230             break;
       
   231         default:
       
   232 			_LIT(KTxtWrongOption, "Wrong Option! Try Again.");
       
   233             DisplayMsg(KTxtWrongOption);
       
   234             break;		
       
   235         }
       
   236 
       
   237 	// Ready to get next input option.
       
   238    	DoRead();
       
   239 	}
       
   240 
       
   241 //*******************************************************************************
       
   242 // Method      : CRtpAppConsole::DisplayMsg()
       
   243 // Purpose     : Display testing message on screen
       
   244 // Parameters  : TDesC &
       
   245 // Return Value: 
       
   246 //*******************************************************************************
       
   247 void CTestAppConsole::DisplayMsg(const TDesC &aMsg)
       
   248 	{
       
   249 	iConsole->ClearScreen();
       
   250 	iConsole->Write(*iInstruct);
       
   251 	iConsole->Printf(KTxtLineBreak);
       
   252 	iConsole->Printf(aMsg);
       
   253 	iConsole->Printf(KTxtLineBreak);
       
   254 	}
       
   255 
       
   256 //*******************************************************************************
       
   257 // Method      : CTestAppConsole::GetAddrFromConsole()
       
   258 // Purpose     : 
       
   259 // Parameters  : 
       
   260 // Return Value: 
       
   261 //*******************************************************************************
       
   262 TKeyCode CTestAppConsole::GetStringFromConsole(TDes &aAddr)
       
   263     {
       
   264 	// Get a line from console
       
   265     TKeyCode input = EKeyNull;
       
   266     const TInt start_pos = iConsole->WhereX();
       
   267     aAddr.Zero();
       
   268 
       
   269     // loop until descriptor full or EKeyEnter or EKeyEscape entered
       
   270     do {
       
   271         // get one character
       
   272         input = iConsole->Getch();
       
   273         // process it
       
   274         if(input == EKeyBackspace  ||  input == EKeyDelete)
       
   275             {
       
   276             // backspace or delete
       
   277             if(iConsole->WhereX() > start_pos)
       
   278                 {
       
   279 				iConsole->SetPos(iConsole->WhereX() - 1);
       
   280 				iConsole->ClearToEndOfLine();
       
   281 				if(aAddr.Length() > 0) 
       
   282                     {
       
   283 					aAddr.SetLength(aAddr.Length() - 1);
       
   284                     }
       
   285                 }
       
   286             }
       
   287         else
       
   288             {
       
   289             // other than backspace or delete
       
   290             TChar ch(input);
       
   291             if(ch.IsPrint())
       
   292                 {
       
   293                 aAddr.Append(ch);
       
   294                 iConsole->Printf(_L("%c"), input);
       
   295                 }
       
   296             }   
       
   297         } 
       
   298     while(aAddr.Length() < aAddr.MaxLength()  &&  input != EKeyEnter  &&  input != EKeyEscape);
       
   299 
       
   300     DisplayMsg(KTxtLineBreak);
       
   301     return input;
       
   302     }
       
   303 
       
   304 //*******************************************************************************
       
   305 // Method      : CTestAppConsole::RunTest1()
       
   306 // Purpose     : 
       
   307 // Parameters  : 
       
   308 // Return Value: 
       
   309 //*******************************************************************************
       
   310 void CTestAppConsole::RunTest1()
       
   311     {
       
   312     SetUpRtpStack();
       
   313 
       
   314     TInt cells = User::CountAllocCells();
       
   315     iConsole->Printf( _L("Allocated cells: %d\n"), cells);
       
   316 
       
   317     iKeepgoingUL = ETrue;
       
   318     CMccSymSubthreadClient* ul_client = CMccSymSubthreadClient::NewL(this);
       
   319     
       
   320     iKeepgoingDL = ETrue;
       
   321     CMccSymSubthreadClient* dl_client = CMccSymSubthreadClient::NewL(this);
       
   322 
       
   323     if(!ul_client)
       
   324         {
       
   325         iKeepgoingUL = EFalse;
       
   326         }
       
   327 
       
   328     if(!dl_client)
       
   329         {
       
   330         iKeepgoingDL = EFalse;
       
   331         }
       
   332 
       
   333     iUlError = KErrNone;
       
   334     iDlError = KErrNone;
       
   335 
       
   336     if(iKeepgoingUL && iKeepgoingDL)
       
   337         {
       
   338         iConsole->Printf( _L("Allocations OK for UL & DL, going on...\n") );
       
   339         }
       
   340     else
       
   341         {
       
   342         if(!iKeepgoingDL)
       
   343             {
       
   344             iConsole->Printf( _L("DL Allocations failed...\n") );
       
   345             }
       
   346         else if(!iKeepgoingDL)
       
   347             {
       
   348             iConsole->Printf( _L("UL Allocations failed...\n") );
       
   349             }
       
   350         else
       
   351             {
       
   352             iConsole->Printf( _L("DL & UL Allocations failed!!!\n") );
       
   353             }
       
   354         }
       
   355     
       
   356     for(TInt k = 0; k < 1; k++)
       
   357         {
       
   358         TestOpen( ul_client, dl_client );
       
   359 
       
   360         TestParameters( ul_client, dl_client );
       
   361 
       
   362         TestPrepare( ul_client, dl_client );
       
   363 
       
   364         TestControls( ul_client, dl_client );
       
   365         }
       
   366 
       
   367     if(iKeepgoingDL && iKeepgoingDL)
       
   368         {
       
   369         iConsole->Printf( _L("All tests ran OK\n") );
       
   370         }
       
   371     else
       
   372         {
       
   373         iConsole->Printf( _L("Not all tests done\n") );
       
   374         }
       
   375 
       
   376     
       
   377     delete ul_client;
       
   378     delete dl_client;
       
   379 
       
   380     cells = User::CountAllocCells();
       
   381     iConsole->Printf( _L("Allocated cells: %d\n"), cells);
       
   382     
       
   383     iConsole->Getch();
       
   384    };
       
   385 
       
   386 void CTestAppConsole::ErrorNotify(TInt aError)
       
   387     {
       
   388     iConsole->Printf( _L("Error notify: %d"), aError );
       
   389     };
       
   390 
       
   391 void CTestAppConsole::RunTest3()
       
   392     {
       
   393     SetUpRtpStack();
       
   394     TInt cells = User::CountAllocCells();
       
   395     iConsole->Printf( _L("Allocated cells: %d\n"), cells);
       
   396 
       
   397     CMccSymSubthreadClient* ul_client = CMccSymSubthreadClient::NewL(this);
       
   398     
       
   399     TFourCC fourAMR(KMccFourCCIdAMRNB);
       
   400     TRtpId ulsession = KNullId;
       
   401     TRtpId ulstream = KNullId;
       
   402 
       
   403     ul_client->CreateSessionL(iPort, iIapid, EFalse, 0);
       
   404     iConsole->Printf( _L("UL Session created\n") );
       
   405     iConsole->Getch();
       
   406 
       
   407     TMMFPrioritySettings prior;
       
   408     prior.iPriority = EMdaPriorityNormal;
       
   409     prior.iPref = EMdaPriorityPreferenceQuality;
       
   410     
       
   411     ul_client->OpenL(EMccAudioUplinkStream, fourAMR, iUlsource, iUlsink, KUplinkStreamId, prior );
       
   412    
       
   413     iConsole->Printf( _L("UL stream created\n") );
       
   414     iConsole->Getch();
       
   415 
       
   416     ul_client->SetRemoteAddressL(iRemoteAddr);
       
   417     iConsole->Printf( _L("Setted remote address\n") );
       
   418     iConsole->Getch();
       
   419 
       
   420     ul_client->SetPrioritySettingsL( KUplinkStreamId, prior );
       
   421     iConsole->Printf( _L("Setted priority settings\n") );
       
   422     iConsole->Getch();
       
   423 
       
   424 
       
   425     ul_client->PrepareL( KUplinkStreamId, 0 );
       
   426     iConsole->Printf( _L("Stream prepared\n") );
       
   427     iConsole->Getch();
       
   428 
       
   429     ul_client->PlayL( KUplinkStreamId, 0, EFalse, ETrue );
       
   430     iConsole->Printf( _L("Stream recording\n") );
       
   431     iConsole->Getch();
       
   432     
       
   433     
       
   434     ul_client->PauseL( KUplinkStreamId, 0, ETrue );
       
   435     iConsole->Printf( _L("Stream paused\n") );
       
   436     iConsole->Getch();
       
   437 
       
   438     ul_client->ResumeL( KUplinkStreamId, 0, ETrue );
       
   439     iConsole->Printf( _L("Stream resumed\n") );
       
   440     iConsole->Getch();
       
   441     
       
   442     ul_client->StopL( KUplinkStreamId, 0 );
       
   443     iConsole->Printf( _L("Stream stopped\n") );
       
   444     iConsole->Getch();
       
   445 
       
   446     ul_client->CloseL( KUplinkStreamId );
       
   447     iConsole->Printf( _L("Stream closed\n") );
       
   448     
       
   449     delete ul_client;
       
   450 
       
   451     cells = User::CountAllocCells();
       
   452     iConsole->Printf( _L("Allocated cells: %d\n"), cells);
       
   453     iConsole->Getch();   
       
   454     };
       
   455 
       
   456 void CTestAppConsole::RunTest4()
       
   457     {
       
   458     SetUpRtpStack();
       
   459 
       
   460     TInt cells = User::CountAllocCells();
       
   461     iConsole->Printf( _L("Allocated cells: %d\n"), cells);
       
   462 
       
   463     CMccSymSubthreadClient* dl_client = CMccSymSubthreadClient::NewL(this);
       
   464     
       
   465     TFourCC fourAMR(KMccFourCCIdAMRNB);
       
   466     TRtpId dlsession = KNullId;
       
   467     TRtpId dlstream = KNullId;
       
   468 
       
   469     dl_client->CreateSessionL(iPort, iIapid, EFalse, 0);
       
   470     iConsole->Printf( _L("DL Session created\n") );
       
   471     iConsole->Getch();
       
   472 
       
   473         
       
   474     TMMFPrioritySettings prior;
       
   475     prior.iPriority = EMdaPriorityNormal;
       
   476     prior.iPref = EMdaPriorityPreferenceQuality;
       
   477     
       
   478     dl_client->OpenL( EMccAudioDownlinkStream, fourAMR, iDlsource, iDlsink, KDownlinkStreamId, prior );
       
   479     iConsole->Printf( _L("DL stream created\n") );
       
   480     iConsole->Getch();
       
   481 
       
   482 
       
   483     dl_client->SetPrioritySettingsL( KDownlinkStreamId, prior );
       
   484     iConsole->Printf( _L("Setted priority settings\n") );
       
   485     iConsole->Getch();
       
   486 
       
   487     dl_client->PrepareL( KDownlinkStreamId, 0 );
       
   488     iConsole->Printf( _L("Stream prepared\n") );
       
   489     iConsole->Getch();
       
   490 
       
   491     dl_client->PlayL( KDownlinkStreamId, 0, EFalse, ETrue );
       
   492     iConsole->Printf( _L("Stream playing\n") );
       
   493     iConsole->Getch();
       
   494     
       
   495     dl_client->PauseL( KDownlinkStreamId, 0, ETrue );
       
   496     iConsole->Printf( _L("Stream paused\n") );
       
   497     iConsole->Getch();
       
   498 
       
   499     dl_client->ResumeL( KDownlinkStreamId, 0, ETrue );
       
   500     iConsole->Printf( _L("Stream resumed\n") );
       
   501     iConsole->Getch();
       
   502 
       
   503     dl_client->StopL( KDownlinkStreamId, 0 );
       
   504     iConsole->Printf( _L("Stream stopped\n") );
       
   505     iConsole->Getch();
       
   506 
       
   507     dl_client->CloseL( KDownlinkStreamId );
       
   508     iConsole->Printf( _L("Stream closed\n") );
       
   509     
       
   510     delete dl_client;
       
   511 
       
   512     cells = User::CountAllocCells();
       
   513     iConsole->Printf( _L("Allocated cells: %d\n"), cells);
       
   514     iConsole->Getch();
       
   515     };
       
   516 
       
   517 void CTestAppConsole::RunTest5()
       
   518     {
       
   519     TFourCC fourAMR(KMccFourCCIdAMRNB);
       
   520     TInt bitrate = 12200;
       
   521 
       
   522     iConsole->Printf( _L("Memory allocate/deallocate tests\n") );
       
   523     iConsole->Getch();
       
   524 
       
   525     __UHEAP_MARK;
       
   526     TInt cells = User::CountAllocCells();
       
   527     iConsole->Printf( _L("Allocated cells: %d\n"), cells);
       
   528     CMccSymSubthreadClient* dl_client = CMccSymSubthreadClient::NewL(this);
       
   529     delete dl_client;
       
   530     cells = User::CountAllocCells();
       
   531     iConsole->Printf( _L("Allocated cells: %d\n"), cells);
       
   532     __UHEAP_MARKEND;
       
   533     iConsole->Printf( _L("Basic DL Create/Delete OK\n") );
       
   534     iConsole->Getch();
       
   535 
       
   536     __UHEAP_MARK;
       
   537     cells = User::CountAllocCells();
       
   538     iConsole->Printf( _L("Allocated cells: %d\n"), cells);
       
   539     CMccSymSubthreadClient* ul_client = CMccSymSubthreadClient::NewL(this);
       
   540     delete ul_client;
       
   541     cells = User::CountAllocCells();
       
   542     iConsole->Printf( _L("Allocated cells: %d\n"), cells);
       
   543     __UHEAP_MARKEND;
       
   544     iConsole->Printf( _L("Basic UL Create/Delete OK\n") );
       
   545     iConsole->Getch();
       
   546     
       
   547     SetUpRtpStack();
       
   548 
       
   549     __UHEAP_MARK;
       
   550     cells = User::CountAllocCells();
       
   551     iConsole->Printf( _L("Allocated cells: %d\n"), cells);
       
   552     ul_client = CMccSymSubthreadClient::NewL(this);
       
   553     ul_client->CreateSessionL(iPort, iIapid, EFalse, 0);
       
   554     delete ul_client;
       
   555     cells = User::CountAllocCells();
       
   556     iConsole->Printf( _L("Allocated cells: %d\n"), cells);
       
   557     __UHEAP_MARKEND;
       
   558     iConsole->Printf( _L("UL Create session OK\n") );
       
   559     iConsole->Getch();
       
   560     
       
   561     __UHEAP_MARK;
       
   562     cells = User::CountAllocCells();
       
   563     iConsole->Printf( _L("Allocated cells: %d\n"), cells);
       
   564     dl_client = CMccSymSubthreadClient::NewL(this);
       
   565     dl_client->CreateSessionL(iPort, iIapid, EFalse, 0);
       
   566     delete dl_client;
       
   567     cells = User::CountAllocCells();
       
   568     iConsole->Printf( _L("Allocated cells: %d\n"), cells);
       
   569     __UHEAP_MARKEND;
       
   570     iConsole->Printf( _L("DL Create session OK\n") );
       
   571     iConsole->Getch();
       
   572 
       
   573     __UHEAP_MARK;
       
   574     cells = User::CountAllocCells();
       
   575     iConsole->Printf( _L("Allocated cells: %d\n"), cells);
       
   576     ul_client = CMccSymSubthreadClient::NewL(this);
       
   577     ul_client->CreateSessionL(iPort, iIapid, EFalse, 0);
       
   578     
       
   579     TMMFPrioritySettings prior;
       
   580     prior.iPriority = EMdaPriorityNormal;
       
   581     prior.iPref = EMdaPriorityPreferenceQuality;
       
   582     
       
   583     ul_client->OpenL( EMccAudioUplinkStream, fourAMR, iUlsource, iUlsink, KUplinkStreamId, prior );
       
   584     ul_client->CloseL();
       
   585     delete ul_client;
       
   586     cells = User::CountAllocCells();
       
   587     iConsole->Printf( _L("Allocated cells: %d\n"), cells);
       
   588     __UHEAP_MARKEND;
       
   589     iConsole->Printf( _L("UL Open/Close OK\n") );
       
   590     iConsole->Getch();
       
   591     
       
   592     __UHEAP_MARK;
       
   593     cells = User::CountAllocCells();
       
   594     iConsole->Printf( _L("Allocated cells: %d\n"), cells);
       
   595     dl_client = CMccSymSubthreadClient::NewL(this);
       
   596     dl_client->CreateSessionL(iPort, iIapid, EFalse, 0);
       
   597     
       
   598     dl_client->OpenL( EMccAudioDownlinkStream, fourAMR, iDlsource, iDlsink, KDownlinkStreamId, prior );
       
   599     dl_client->CloseL();
       
   600     delete dl_client;
       
   601     cells = User::CountAllocCells();
       
   602     iConsole->Printf( _L("Allocated cells: %d\n"), cells);
       
   603     __UHEAP_MARKEND;
       
   604     iConsole->Printf( _L("DL Open/Close OK\n") );
       
   605     iConsole->Getch();
       
   606     
       
   607     __UHEAP_MARK;
       
   608     cells = User::CountAllocCells();
       
   609     iConsole->Printf( _L("UL Allocated cells: %d\n"), cells);
       
   610     ul_client = CMccSymSubthreadClient::NewL(this);
       
   611 
       
   612     ul_client->CreateSessionL(iPort, iIapid, EFalse, 0);
       
   613 
       
   614     ul_client->OpenL( EMccAudioUplinkStream, fourAMR, iUlsource, iUlsink, KUplinkStreamId, prior );
       
   615 
       
   616     ul_client->PrepareL( KUplinkStreamId, 0 );
       
   617     
       
   618     ul_client->PlayL( KUplinkStreamId, 0, EFalse, ETrue );
       
   619     iConsole->Getch();
       
   620     ul_client->StopL( KUplinkStreamId, 0 );
       
   621     
       
   622     //ul_client->CloseL();
       
   623 
       
   624     delete ul_client;
       
   625 
       
   626     cells = User::CountAllocCells();
       
   627     iConsole->Printf( _L("UL Allocated cells: %d\n"), cells);
       
   628     __UHEAP_MARKEND;
       
   629     iConsole->Printf( _L("UL Open/Close/Prepare OK\n") );
       
   630     iConsole->Getch();
       
   631 
       
   632     __UHEAP_MARK;
       
   633     cells = User::CountAllocCells();
       
   634     iConsole->Printf( _L("Allocated cells: %d\n"), cells);
       
   635     dl_client = CMccSymSubthreadClient::NewL(this);
       
   636     dl_client->CreateSessionL(iPort, iIapid, EFalse, 0 );
       
   637     dl_client->OpenL( EMccAudioDownlinkStream, fourAMR, iDlsource, iDlsink, KDownlinkStreamId, prior );
       
   638     dl_client->PrepareL( KDownlinkStreamId, 0 );
       
   639     dl_client->PlayL( KDownlinkStreamId, 0, EFalse, ETrue );
       
   640 
       
   641     iConsole->Getch();
       
   642 
       
   643     dl_client->StopL( KDownlinkStreamId, 0 );
       
   644     //dl_client->CloseL();
       
   645     delete dl_client;
       
   646     cells = User::CountAllocCells();
       
   647     iConsole->Printf( _L("Allocated cells: %d\n"), cells);
       
   648     __UHEAP_MARKEND;
       
   649     iConsole->Printf( _L("DL Open/Close/Prepare OK\n") );
       
   650     iConsole->Getch();
       
   651     };
       
   652 
       
   653 
       
   654 void CTestAppConsole::RunTest6()
       
   655     {
       
   656     TFourCC fourAMR(KMccFourCCIdAMRNB);
       
   657 
       
   658     SetUpRtpStack();
       
   659 
       
   660     for(TInt k = 0; k < 2; k++)
       
   661         {
       
   662         iConsole->Printf( _L("Cells BEFORE Tests: %d"), User::CountAllocCells() );
       
   663 
       
   664         iClient = CMccUlDlClient::NewL(this, iSessionID);
       
   665         
       
   666         iClient->CreateLinkL( KMccLinkGeneral, iLinkId, iPort, iIapid, 0, 0 );
       
   667         
       
   668         TMMFPrioritySettings prior;
       
   669         prior.iPriority = EMdaPriorityNormal;
       
   670         prior.iPref = EMdaPriorityPreferenceQuality;
       
   671         
       
   672         TFourCC fourAMR(KMccFourCCIdAMRNB);
       
   673     
       
   674         TInt ulstream = iClient->OpenL( iLinkId, EMccAudioUplinkStream, fourAMR, iUlsource, iUlsink, prior );
       
   675         TInt dlstream = iClient->OpenL( iLinkId, EMccAudioDownlinkStream, fourAMR, iDlsource, iDlsink, prior );
       
   676         /*
       
   677         iClient->SetRemoteAddressL( iRemoteAddr, ulstream );
       
   678         iClient->SetRemoteAddressL( iRemoteAddr, dlstream );
       
   679         iClient->SetTargetBitrateL(ulstream, 12200);
       
   680         iClient->SetTargetBitrateL(dlstream, 12200);
       
   681         */
       
   682         //iClient->PrepareL(ulstream);
       
   683         //iClient->PrepareL(dlstream);
       
   684 
       
   685         //iClient->CloseL(ulstream);
       
   686         //iClient->CloseL(dlstream);
       
   687         delete iClient;
       
   688 
       
   689         iConsole->Printf( _L("Cells AFTER Tests: %d"), User::CountAllocCells() );
       
   690 
       
   691         iConsole->Printf( _L("Test 6 OK if you see this") );
       
   692         iConsole->Getch();
       
   693         }
       
   694 
       
   695     };
       
   696 
       
   697 void CTestAppConsole::ErrorOccured( TInt aError,
       
   698                                     TUint32 aSessionId,
       
   699                                     TUint32 aLinkId,
       
   700             	                    TUint32 aStreamId, 
       
   701             	                    TUint32 aEndpointId )
       
   702     {
       
   703     iConsole->Printf( _L("Error Occured: %d, Session: %u, Link: %u, Stream: %u, Endpoint %u"), 
       
   704                       aError,
       
   705                       aSessionId,
       
   706                       aLinkId,
       
   707             	      aStreamId, 
       
   708             	      aEndpointId );
       
   709     };
       
   710 
       
   711 void CTestAppConsole::StateChange( TInt aState, TUint32 aLink )
       
   712     {
       
   713     iConsole->Printf( _L("State change STATE: %d, LINK: %u"), aState, aLink );
       
   714     };
       
   715 
       
   716 TInt CTestAppConsole::SendMccEventToClient( TMccEvent& /*aEvent*/ )
       
   717     {
       
   718     iConsole->Printf( _L("Event received...") );
       
   719     
       
   720     return KErrNone;
       
   721     };
       
   722 
       
   723 void CTestAppConsole::SetUpRtpStack()
       
   724     {
       
   725     TDes* line = new TBuf<80>;
       
   726    
       
   727     iConsole->ClearScreen();
       
   728     iConsole->Printf( _L("\nEnter the IAP ID: ") );
       
   729     GetStringFromConsole(*line);
       
   730 
       
   731     TLex lex(*line);
       
   732     lex.Val(iIapid,EDecimal);
       
   733 
       
   734     // Get Remote Port number
       
   735 	iConsole->ClearScreen();
       
   736     iConsole->Printf(_L("\nMccEnter the Local port number "));
       
   737 
       
   738 	GetStringFromConsole(*line);
       
   739 
       
   740     //Use INPUT
       
   741     TLex lex2(*line);
       
   742     lex2.Val(iPort,EDecimal);
       
   743 
       
   744     //Use INPUT
       
   745     iConsole->ClearScreen();
       
   746 		
       
   747 	TBuf<128> theInput;
       
   748 
       
   749 	iConsole->Printf(_L("\nEnter the Remote IP address "));	
       
   750 	GetStringFromConsole(*line);
       
   751 
       
   752 	theInput.Copy( *line );
       
   753 	iRemoteAddr.SetFamily(KAfInet);
       
   754 	iRemoteAddr.Input(theInput);
       
   755     iRemoteAddr.SetPort(iPort);
       
   756     
       
   757     delete line;
       
   758     };
       
   759 
       
   760 void CTestAppConsole::TestOpen(CMccSymSubthreadClient* aUlclient, CMccSymSubthreadClient* aDlclient)
       
   761     {
       
   762     TFourCC fourAMR(KMccFourCCIdAMRNB);
       
   763     
       
   764     TMMFPrioritySettings prior;
       
   765     prior.iPriority = EMdaPriorityNormal;
       
   766     prior.iPref = EMdaPriorityPreferenceQuality;
       
   767 
       
   768     // Test session creation
       
   769     if(iKeepgoingUL)
       
   770         {
       
   771         TRAP(iUlError, aUlclient->CreateSessionL(iPort, iIapid, EFalse, 0) );
       
   772         if(iUlError != KErrNone)
       
   773             {
       
   774             iKeepgoingUL = EFalse;
       
   775             iConsole->Printf( _L("Error in UL CreateSessionL: %d\n"), iUlError );
       
   776             iConsole->Getch();
       
   777             }
       
   778         else
       
   779             {
       
   780             iConsole->Printf( _L("UL CreateSessionL OK\n") );
       
   781             iConsole->Getch();
       
   782             }
       
   783         }
       
   784     else
       
   785         {
       
   786         iConsole->Printf( _L("UL CreateSessionL Test not run\n") );
       
   787         iConsole->Getch();
       
   788         }
       
   789 
       
   790     if(iKeepgoingDL)
       
   791         {
       
   792         TRAP(iDlError, aDlclient->CreateSessionL(iPort, iIapid, EFalse, 0) );
       
   793         if(iDlError != KErrNone)
       
   794             {
       
   795             iKeepgoingDL = EFalse;
       
   796             iConsole->Printf( _L("Error in DL CreateSessionL: %d\n"), iDlError );
       
   797             iConsole->Getch();
       
   798             }
       
   799         else
       
   800             {
       
   801             iConsole->Printf( _L("DL CreateSessionL OK\n") );
       
   802             iConsole->Getch();
       
   803             }
       
   804         }
       
   805     else
       
   806         {
       
   807         iConsole->Printf( _L("DL CreateSessionL Test not run\n") );
       
   808         iConsole->Getch();
       
   809         }
       
   810 
       
   811     if(iKeepgoingUL)
       
   812         {
       
   813         TRAP(iUlError, aUlclient->OpenL(EMccAudioUplinkStream, fourAMR, iUlsource, iUlsink, KUplinkStreamId, prior) );
       
   814         if(iUlError != KErrNone)
       
   815             {
       
   816             iKeepgoingUL = EFalse;
       
   817             iConsole->Printf( _L("Error in UL OpenL: %d\n"), iUlError );
       
   818             iConsole->Getch();
       
   819             }
       
   820         else
       
   821             {
       
   822             iConsole->Printf( _L("UL OpenL OK\n") );
       
   823             iConsole->Getch();
       
   824             }
       
   825         }
       
   826     else
       
   827         {
       
   828         iConsole->Printf( _L("UL OpenL Test not run\n") );
       
   829         iConsole->Getch();
       
   830         }
       
   831 
       
   832     if(iKeepgoingDL)
       
   833         {
       
   834         TRAP(iDlError, aDlclient->OpenL(EMccAudioDownlinkStream, fourAMR, iDlsource, iDlsink, KDownlinkStreamId, prior ) );
       
   835         if(iDlError != KErrNone)
       
   836             {
       
   837             iKeepgoingDL = EFalse;
       
   838             iConsole->Printf( _L("Error in DL OpenL: %d\n"), iDlError );
       
   839             iConsole->Getch();
       
   840             }
       
   841         else
       
   842             {
       
   843             iConsole->Printf( _L("DL OpenL OK\n") );
       
   844             iConsole->Getch();
       
   845             }
       
   846         }
       
   847     else
       
   848         {
       
   849         iConsole->Printf( _L("DL OpenL Test not run\n") );
       
   850         iConsole->Getch();
       
   851         }
       
   852 
       
   853     // Test remote address setup...
       
   854     if(iKeepgoingUL)
       
   855         {
       
   856         TRAP(iUlError, aUlclient->SetRemoteAddressL(iRemoteAddr) );
       
   857         if(iUlError != KErrNone)
       
   858             {
       
   859             iKeepgoingUL = EFalse;
       
   860             iConsole->Printf( _L("Error in UL SetRemoteAddress: %d\n"), iUlError );
       
   861             iConsole->Getch();
       
   862             }
       
   863         else
       
   864             {
       
   865             iConsole->Printf( _L("UL SetRemoteAddress OK\n") );
       
   866             iConsole->Getch();
       
   867             }
       
   868         }
       
   869     else
       
   870         {
       
   871         iConsole->Printf( _L("UL SetRemoteAddress Test not run\n") );
       
   872         iConsole->Getch();
       
   873         }
       
   874 
       
   875     if(iKeepgoingDL)
       
   876         {
       
   877         TRAP( iDlError, aDlclient->SetRemoteAddressL(iRemoteAddr) );
       
   878         if(iDlError != KErrNone)
       
   879             {
       
   880             iKeepgoingDL = EFalse;
       
   881             iConsole->Printf( _L("Error in DL SetRemoteAddress: %d\n"), iDlError );
       
   882             iConsole->Getch();
       
   883             }
       
   884         else
       
   885             {
       
   886             iConsole->Printf( _L("DL SetRemoteAddress OK\n") );
       
   887             iConsole->Getch();
       
   888             }
       
   889         }
       
   890     else
       
   891         {
       
   892         iConsole->Printf( _L("DL SetRemoteAddress Test not run\n") );
       
   893         iConsole->Getch();
       
   894         }
       
   895     };
       
   896 
       
   897 void CTestAppConsole::TestParameters(CMccSymSubthreadClient* aUlclient, CMccSymSubthreadClient* aDlclient)
       
   898     {
       
   899     TFourCC fourAMR(KMccFourCCIdAMRNB);
       
   900     TFourCC fourG711(KMccFourCCIdG711);
       
   901     TFourCC fourILBC(KMccFourCCIdILBC);
       
   902     
       
   903     TMccCodecInfo codec;
       
   904     codec.iFourCC = fourAMR;
       
   905     codec.iBitrate = 12200;
       
   906     codec.iPtime = 20;
       
   907     codec.iMaxPtime = 40;
       
   908     codec.iAlgoUsed = ENoAlgoUsed;
       
   909     codec.iCodecMode = KAmrCodecModeOctetAlign;
       
   910     codec.iEnableDTX = EFalse;
       
   911     
       
   912     /*
       
   913     if(iKeepgoingUL)
       
   914         {
       
   915         TRAP( iUlError, aUlclient->SetCodecL(fourG711) );
       
   916         if(iUlError != KErrNone)
       
   917             {
       
   918             iKeepgoingUL = EFalse;
       
   919             iConsole->Printf( _L("Error in UL SetCodecL G.711: %d\n"), iUlError );
       
   920             iConsole->Getch();
       
   921             }
       
   922         else
       
   923             {
       
   924             iConsole->Printf( _L("UL SetCodecL G.711 OK\n") );
       
   925             iConsole->Getch();
       
   926             }
       
   927         }
       
   928     else
       
   929         {
       
   930         iConsole->Printf( _L("UL SetCodecL G.711 Test not run\n") );
       
   931         iConsole->Getch();
       
   932         }
       
   933 
       
   934     if(iKeepgoingDL)
       
   935         {
       
   936         TRAP( iDlError, aDlclient->SetCodecL(fourG711) );
       
   937         if(iDlError != KErrNone)
       
   938             {
       
   939             iKeepgoingDL =EFalse;
       
   940             iConsole->Printf( _L("Error in DL SetCodecL G.711: %d\n"), iDlError );
       
   941             iConsole->Getch();
       
   942             }
       
   943         else
       
   944             {
       
   945             iConsole->Printf( _L("DL SetCodecL G.711 OK\n") );
       
   946             iConsole->Getch();
       
   947             }
       
   948         }
       
   949     else
       
   950         {
       
   951         iConsole->Printf( _L("DL SetCodecL G.711 Test not run\n") );
       
   952         iConsole->Getch();
       
   953         }
       
   954     */
       
   955  
       
   956     
       
   957     TMMFPrioritySettings prior;
       
   958     prior.iPriority = EMdaPriorityMax;
       
   959     prior.iPref = EMdaPriorityPreferenceTimeAndQuality;
       
   960     
       
   961     if(iKeepgoingUL)
       
   962         {
       
   963         TRAP( iUlError, aUlclient->SetPrioritySettingsL(KUplinkStreamId, prior) );
       
   964         if(iUlError != KErrNone)
       
   965             {
       
   966             iKeepgoingUL = EFalse;
       
   967             iConsole->Printf( _L("Error in UL SetPrioritySettingsL: %d\n"), iUlError );
       
   968             iConsole->Getch();
       
   969             }
       
   970         else
       
   971             {
       
   972             iConsole->Printf( _L("UL SetPrioritySettingsL OK\n") );
       
   973             iConsole->Getch();
       
   974             }
       
   975         }
       
   976     else
       
   977         {
       
   978         iConsole->Printf( _L("UL SetPrioritySettingsL Test not run\n") );
       
   979         iConsole->Getch();
       
   980         }
       
   981 
       
   982     if(iKeepgoingDL)
       
   983         {
       
   984         TRAP( iDlError, aDlclient->SetPrioritySettingsL(KDownlinkStreamId, prior) );
       
   985         if(iDlError != KErrNone)
       
   986             {
       
   987             iKeepgoingDL =EFalse;
       
   988             iConsole->Printf( _L("Error in DL SetPrioritySettingsL: %d\n"), iDlError );
       
   989             iConsole->Getch();
       
   990             }
       
   991         else
       
   992             {
       
   993             iConsole->Printf( _L("DL SetPrioritySettingsL OK\n") );
       
   994             iConsole->Getch();
       
   995             }
       
   996         }
       
   997     else
       
   998         {
       
   999         iConsole->Printf( _L("DL SetPrioritySettingsL Test not run\n") );
       
  1000         iConsole->Getch();
       
  1001         }
       
  1002     
       
  1003     TInt volume = 0;
       
  1004     
       
  1005     if(iKeepgoingUL)
       
  1006         {
       
  1007         TRAP( iUlError, aUlclient->MaxGainL(volume) );
       
  1008         if(iUlError != KErrNone)
       
  1009             {
       
  1010             iKeepgoingUL =EFalse;
       
  1011             iConsole->Printf( _L("Error in UL MaxGainL: %d\n"), iUlError );
       
  1012             iConsole->Getch();
       
  1013             }
       
  1014         else
       
  1015             {
       
  1016             iConsole->Printf( _L("UL MaxGainL OK\n") );
       
  1017             iConsole->Getch();
       
  1018             }
       
  1019         }
       
  1020 
       
  1021     if(iKeepgoingUL)
       
  1022         {
       
  1023         TRAP( iUlError, aUlclient->SetGainL(volume) );
       
  1024         if(iUlError != KErrNone)
       
  1025             {
       
  1026             iKeepgoingUL =EFalse;
       
  1027             iConsole->Printf( _L("Error in UL SetGainL: %d\n"), iUlError );
       
  1028             iConsole->Getch();
       
  1029             }
       
  1030         else
       
  1031             {
       
  1032             iConsole->Printf( _L("UL SetGainL OK\n") );
       
  1033             iConsole->Getch();
       
  1034             }
       
  1035         }
       
  1036     
       
  1037     if(iKeepgoingDL)
       
  1038         {
       
  1039         TRAP( iDlError, aDlclient->MaxVolumeL(volume) );
       
  1040         if(iDlError != KErrNone)
       
  1041             {
       
  1042             iKeepgoingDL =EFalse;
       
  1043             iConsole->Printf( _L("Error in DL MaxVolumeL: %d\n"), iDlError );
       
  1044             iConsole->Getch();
       
  1045             }
       
  1046         else
       
  1047             {
       
  1048             iConsole->Printf( _L("DL MaxVolumeL OK\n") );
       
  1049             iConsole->Getch();
       
  1050             }
       
  1051         }
       
  1052 
       
  1053     if(iKeepgoingDL)
       
  1054         {
       
  1055         TRAP( iDlError, aDlclient->SetVolumeL(volume) );
       
  1056         if(iDlError != KErrNone)
       
  1057             {
       
  1058             iKeepgoingDL =EFalse;
       
  1059             iConsole->Printf( _L("Error in DL SetVolumeL: %d\n"), iDlError );
       
  1060             iConsole->Getch();
       
  1061             }
       
  1062         else
       
  1063             {
       
  1064             iConsole->Printf( _L("DL SetVolumeL OK\n") );
       
  1065             iConsole->Getch();
       
  1066             }
       
  1067         }
       
  1068     
       
  1069     if(iKeepgoingUL)
       
  1070         {
       
  1071         TRAP( iUlError, aUlclient->SetBalanceL(KUplinkStreamId, 50, 50) );
       
  1072         if(iUlError != KErrNone)
       
  1073             {
       
  1074             iKeepgoingUL = EFalse;
       
  1075             iConsole->Printf( _L("Error in UL SetBalanceL: %d\n"), iUlError);
       
  1076             iConsole->Getch();
       
  1077             }
       
  1078         else
       
  1079             {
       
  1080             iConsole->Printf( _L("UL SetBalanceL OK\n") );
       
  1081             iConsole->Getch();
       
  1082             }
       
  1083         }
       
  1084 
       
  1085     if(iKeepgoingDL)
       
  1086         {
       
  1087         TRAP( iDlError, aDlclient->SetBalanceL(KDownlinkStreamId, 50, 50) );
       
  1088         if(iDlError != KErrNone)
       
  1089             {
       
  1090             iKeepgoingDL = EFalse;
       
  1091             iConsole->Printf( _L("Error in DL SetBalanceL: %d\n"), iDlError);
       
  1092             iConsole->Getch();
       
  1093             }
       
  1094         else
       
  1095             {
       
  1096             iConsole->Printf( _L("DL SetBalanceL OK\n") );
       
  1097             iConsole->Getch();
       
  1098             }
       
  1099         }
       
  1100  
       
  1101     TInt lbal = 0;
       
  1102     TInt rbal = 0;
       
  1103     
       
  1104     if(iKeepgoingUL)
       
  1105         {
       
  1106         TRAP( iUlError, aUlclient->GetBalanceL(KUplinkStreamId, lbal, rbal) );
       
  1107         if(iUlError != KErrNone)
       
  1108             {
       
  1109             iKeepgoingUL = EFalse;
       
  1110             iConsole->Printf( _L("Error in UL GetRecordBalanceL: %d\n"), iUlError);
       
  1111             iConsole->Getch();
       
  1112             }
       
  1113         else
       
  1114             {
       
  1115             iConsole->Printf( _L("UL GetRecordBalanceL OK: %d ja %d\n"), lbal, rbal );
       
  1116             iConsole->Getch();
       
  1117             }
       
  1118         }
       
  1119 
       
  1120     if(iKeepgoingDL)
       
  1121         {
       
  1122         TRAP( iDlError, aDlclient->GetBalanceL(KDownlinkStreamId, lbal, rbal) );
       
  1123         if(iDlError != KErrNone)
       
  1124             {
       
  1125             iKeepgoingDL = EFalse;
       
  1126             iConsole->Printf( _L("Error in DL GetPlayBalanceL: %d\n"), iDlError);
       
  1127             iConsole->Getch();
       
  1128             }
       
  1129         else
       
  1130             {
       
  1131             iConsole->Printf( _L("DL GetPlayBalanceL OK: %d ja %d\n"), lbal, rbal );
       
  1132             iConsole->Getch();
       
  1133             }
       
  1134         }
       
  1135         
       
  1136     if(iKeepgoingUL)
       
  1137         {
       
  1138         TRAP( iUlError, aUlclient->SetCodecInformationL(KUplinkStreamId, codec, KNullDesC8) );
       
  1139         if(iUlError != KErrNone)
       
  1140             {
       
  1141             iKeepgoingUL = EFalse;
       
  1142             iConsole->Printf( _L("Error in UL SetCodecInformationL: %d\n"), iUlError);
       
  1143             iConsole->Getch();
       
  1144             }
       
  1145         else
       
  1146             {
       
  1147             iConsole->Printf( _L("UL SetCodecInformationL OK\n") );
       
  1148             iConsole->Getch();
       
  1149             }
       
  1150         }
       
  1151 
       
  1152     if(iKeepgoingDL)
       
  1153         {
       
  1154         TRAP( iDlError, aDlclient->SetCodecInformationL(KDownlinkStreamId, codec, KNullDesC8) );
       
  1155         if(iDlError != KErrNone)
       
  1156             {
       
  1157             iKeepgoingDL = EFalse;
       
  1158             iConsole->Printf( _L("Error in DL SetCodecInformationL: %d\n"), iDlError);
       
  1159             iConsole->Getch();
       
  1160             }
       
  1161         else
       
  1162             {
       
  1163             iConsole->Printf( _L("DL SetCodecInformationL OK\n") );
       
  1164             iConsole->Getch();
       
  1165             }
       
  1166         }        
       
  1167     };
       
  1168 
       
  1169 void CTestAppConsole::TestPrepare(CMccSymSubthreadClient* aUlclient, CMccSymSubthreadClient* aDlclient)
       
  1170     {
       
  1171     if(iKeepgoingUL)
       
  1172         {
       
  1173         TRAP( iUlError, aUlclient->PrepareL( KUplinkStreamId, 0 ) );
       
  1174         if(iUlError != KErrNone)
       
  1175             {
       
  1176             iKeepgoingUL = EFalse;
       
  1177             iConsole->Printf( _L("Error in UL PrepareL: %d\n"), iUlError );
       
  1178             iConsole->Getch();
       
  1179             }
       
  1180         else
       
  1181             {
       
  1182             iConsole->Printf( _L("UL PrepareL OK\n") );
       
  1183             iConsole->Getch();
       
  1184             }
       
  1185         }
       
  1186 
       
  1187     if(iKeepgoingDL)
       
  1188         {
       
  1189         TRAP( iDlError, aDlclient->PrepareL( KDownlinkStreamId, 0 ) );
       
  1190         if(iDlError != KErrNone)
       
  1191             {
       
  1192             iKeepgoingDL = EFalse;
       
  1193             iConsole->Printf( _L("Error in DL PrepareL: %d\n"), iDlError );
       
  1194             iConsole->Getch();
       
  1195             }
       
  1196         else
       
  1197             {
       
  1198             iConsole->Printf( _L("DL PrepareL OK\n") );
       
  1199             iConsole->Getch();
       
  1200             }
       
  1201         }
       
  1202     };
       
  1203 
       
  1204 void CTestAppConsole::TestControls(CMccSymSubthreadClient* aUlclient, CMccSymSubthreadClient* aDlclient)
       
  1205     {
       
  1206     if(iKeepgoingUL)
       
  1207         {
       
  1208         TRAP( iUlError, aUlclient->PlayL(KUplinkStreamId, 0, EFalse, ETrue) );
       
  1209         if(iUlError != KErrNone)
       
  1210             {
       
  1211             iKeepgoingUL = EFalse;
       
  1212             iConsole->Printf( _L("Error in UL PlayL: %d\n"), iUlError );
       
  1213             iConsole->Getch();
       
  1214             }
       
  1215         else
       
  1216             {
       
  1217             iConsole->Printf( _L("UL PlayL OK\n") );
       
  1218             iConsole->Getch();
       
  1219             }
       
  1220         }
       
  1221     
       
  1222     if(iKeepgoingDL)
       
  1223         {
       
  1224         TRAP( iDlError, aDlclient->PlayL(KDownlinkStreamId, 0, EFalse, ETrue) );
       
  1225         if(iDlError != KErrNone)
       
  1226             {
       
  1227             iKeepgoingDL = EFalse;
       
  1228             iConsole->Printf( _L("Error in DL PlayL: %d\n"), iDlError );
       
  1229             iConsole->Getch();
       
  1230             }
       
  1231         else
       
  1232             {
       
  1233             iConsole->Printf( _L("DL PlayL OK\n") );
       
  1234             iConsole->Getch();
       
  1235             }
       
  1236         }
       
  1237 
       
  1238     /*
       
  1239     TTimeIntervalMicroSeconds32 wait(20000000);
       
  1240     User::After(wait);
       
  1241     
       
  1242     if(iKeepgoingUL)
       
  1243         {
       
  1244         TRAP( iUlError, aUlclient->PauseL() );
       
  1245         if(iUlError != KErrNone)
       
  1246             {
       
  1247             iKeepgoingUL = EFalse;
       
  1248             iConsole->Printf( _L("Error in UL PauseL: %d\n"), iUlError );
       
  1249             iConsole->Getch();
       
  1250             }
       
  1251         else
       
  1252             {
       
  1253             iConsole->Printf( _L("UL PauseL OK\n") );
       
  1254             iConsole->Getch();
       
  1255             }
       
  1256         }
       
  1257 
       
  1258     
       
  1259     if(iKeepgoingDL)
       
  1260         {
       
  1261         TRAP( iDlError, aDlclient->PauseL() );
       
  1262         if(iDlError != KErrNone)
       
  1263             {
       
  1264             iKeepgoingDL = EFalse;
       
  1265             iConsole->Printf( _L("Error in DL PauseL: %d\n"), iDlError );
       
  1266             iConsole->Getch();
       
  1267             }
       
  1268         else
       
  1269             {
       
  1270             iConsole->Printf( _L("DL PauseL OK\n") );
       
  1271             iConsole->Getch();
       
  1272             }
       
  1273         }
       
  1274     
       
  1275     if(iKeepgoingUL)
       
  1276         {
       
  1277         TRAP( iUlError, aUlclient->ResumeL() );
       
  1278         if(iUlError != KErrNone)
       
  1279             {
       
  1280             iKeepgoingUL = EFalse;
       
  1281             iConsole->Printf( _L("Error in UL ResumeL: %d\n"), iUlError );
       
  1282             iConsole->Getch();
       
  1283             }
       
  1284         else
       
  1285             {
       
  1286             iConsole->Printf( _L("UL ResumeL OK\n") );
       
  1287             iConsole->Getch();
       
  1288             }
       
  1289         }
       
  1290     
       
  1291     if(iKeepgoingDL)
       
  1292         {
       
  1293         TRAP( iDlError, aDlclient->ResumeL() );
       
  1294         if(iDlError != KErrNone)
       
  1295             {
       
  1296             iKeepgoingDL = EFalse;
       
  1297             iConsole->Printf( _L("Error in DL ResumeL: %d\n"), iDlError );
       
  1298             iConsole->Getch();
       
  1299             }
       
  1300         else
       
  1301             {
       
  1302             iConsole->Printf( _L("DL ResumeL OK\n") );
       
  1303             iConsole->Getch();
       
  1304             }
       
  1305         }
       
  1306     */
       
  1307     TRAP( iUlError, aUlclient->StopL(KUplinkStreamId, 0) );
       
  1308     if(iUlError != KErrNone)
       
  1309         {
       
  1310         iConsole->Printf( _L("Error in UL StopL: %d\n"), iUlError );
       
  1311         iConsole->Getch();
       
  1312         iKeepgoingUL = EFalse;
       
  1313         }
       
  1314     else
       
  1315         {
       
  1316         iConsole->Printf( _L("UL StopL OK\n") );
       
  1317         iConsole->Getch();
       
  1318         }
       
  1319     
       
  1320     TRAP( iDlError, aDlclient->StopL(KDownlinkStreamId, 0) );
       
  1321     if(iDlError != KErrNone)
       
  1322         {
       
  1323         iConsole->Printf( _L("Error in DL StopL: %d\n"), iDlError );
       
  1324         iConsole->Getch();
       
  1325         iKeepgoingDL = EFalse;
       
  1326         }
       
  1327     else
       
  1328         {
       
  1329         iConsole->Printf( _L("DL StopL OK\n") );
       
  1330         iConsole->Getch();
       
  1331         }
       
  1332        
       
  1333 
       
  1334     TRAP( iUlError, aUlclient->CloseL() );
       
  1335     if(iUlError != KErrNone)
       
  1336         {
       
  1337         iConsole->Printf( _L("Error in UL CloseL: %d\n"), iUlError );
       
  1338         iConsole->Getch();
       
  1339         iKeepgoingUL = EFalse;
       
  1340         }
       
  1341     else
       
  1342         {
       
  1343         iConsole->Printf( _L("UL CloseL OK\n") );
       
  1344         iConsole->Getch();
       
  1345         }
       
  1346 
       
  1347     TRAP( iDlError, aDlclient->CloseL() );
       
  1348     if(iDlError != KErrNone)
       
  1349         {
       
  1350         iConsole->Printf( _L("Error in DL CloseL: %d\n"), iDlError );
       
  1351         iConsole->Getch();
       
  1352         iKeepgoingDL = EFalse;
       
  1353         }
       
  1354     else
       
  1355         {
       
  1356         iConsole->Printf( _L("DL CloseL OK\n") );
       
  1357         iConsole->Getch();
       
  1358         }
       
  1359     };
       
  1360 
       
  1361 void CTestAppConsole::ConstructUlSinkSource()
       
  1362     {
       
  1363     TUid rtpsnk;
       
  1364     rtpsnk.iUid = 0x10202861;
       
  1365     
       
  1366     iKeepgoingUL = EFalse;
       
  1367     TInt allocerror = KErrNone;
       
  1368 
       
  1369     TRAP( allocerror, iUlsink = MDataSink::NewSinkL(rtpsnk, KNullDesC8) );
       
  1370     if(allocerror != KErrNone)
       
  1371         {
       
  1372         iKeepgoingUL = EFalse;
       
  1373         iConsole->Printf( _L("Error alloc UL SRC %d\n"), allocerror );
       
  1374         iConsole->Getch();
       
  1375         return;
       
  1376         }
       
  1377 
       
  1378     TRAP( allocerror, iUlsource = MDataSource::NewSourceL(KUidMmfAudioInput, KNullDesC8) );
       
  1379     if(allocerror != KErrNone)
       
  1380         {
       
  1381         iKeepgoingUL = EFalse;
       
  1382         iConsole->Printf( _L("Error alloc UL SNK %d\n"), allocerror );
       
  1383         iConsole->Getch();
       
  1384         return;
       
  1385         }
       
  1386 
       
  1387     iKeepgoingUL = ETrue;
       
  1388     };
       
  1389 
       
  1390 void CTestAppConsole::ConstructDlSinkSource()
       
  1391     {
       
  1392     TUid rtpsrc;
       
  1393     rtpsrc.iUid = 0x1020285F;
       
  1394 
       
  1395     iKeepgoingDL = EFalse;
       
  1396     
       
  1397     TInt allocerror = KErrNone;
       
  1398 
       
  1399     TRAP( allocerror, iDlsource = MDataSource::NewSourceL(rtpsrc, KNullDesC8) );
       
  1400     if(allocerror != KErrNone)
       
  1401         {
       
  1402         iKeepgoingDL = EFalse;
       
  1403         iConsole->Printf( _L("Error alloc DL SRC %d\n"), allocerror );
       
  1404         iConsole->Getch();
       
  1405         return;
       
  1406         }
       
  1407 
       
  1408     TRAP( allocerror, iDlsink = MDataSink::NewSinkL(KUidMmfAudioOutput, KNullDesC8) );
       
  1409     if(allocerror != KErrNone)
       
  1410         {
       
  1411         iKeepgoingDL = EFalse;
       
  1412         iConsole->Printf( _L("Error alloc DL SNK %d\n"), allocerror );
       
  1413         iConsole->Getch();
       
  1414         return;
       
  1415         }
       
  1416     //iDlsink->SinkStopL();
       
  1417     iKeepgoingDL = ETrue;
       
  1418     };
       
  1419 
       
  1420 void CTestAppConsole::DestructSinksSources()
       
  1421     {
       
  1422     
       
  1423     };