mmmw_plat/voip_audio_services_api/tsrc/VoIPAudioServicesTestClass/src/VoIPAudioServicesTestClassBlocks.cpp
changeset 55 e267340986c9
parent 0 71ca22bcf22a
equal deleted inserted replaced
52:4ce423f34688 55:e267340986c9
     1 /*
     1 /*
     2 * Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
     2  * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3  * All rights reserved.
     4 * This component and the accompanying materials are made available
     4  * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5  * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6  * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     8  *
     9 * Initial Contributors:
     9  * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10  * Nokia Corporation - initial contribution.
    11 *
    11  *
    12 * Contributors:
    12  * Contributors:
    13 *
    13  *
    14 * Description: voip audio service -
    14  * Description: voip audio service -
    15 *
    15  *
    16 */
    16  */
    17 
       
    18 
       
    19 
    17 
    20 // INCLUDE FILES
    18 // INCLUDE FILES
    21 #include <e32svr.h>
    19 #include <e32svr.h>
    22 #include <StifParser.h>
    20 #include <StifParser.h>
    23 #include <Stiftestinterface.h>
    21 #include <Stiftestinterface.h>
    24 #include "VoIPAudioServicesTestClass.h"
    22 #include "VoIPAudioServicesTestClass.h"
    25 #include "debug.h"
    23 #include "debug.h"
    26 
       
    27 // EXTERNAL DATA STRUCTURES
       
    28 //extern  ?external_data;
       
    29 
       
    30 // EXTERNAL FUNCTION PROTOTYPES
       
    31 //extern ?external_function( ?arg_type,?arg_type );
       
    32 
       
    33 // CONSTANTS
       
    34 //const ?type ?constant_var = ?constant;
       
    35 
       
    36 // MACROS
       
    37 //#define ?macro ?macro_def
       
    38 
       
    39 // LOCAL CONSTANTS AND MACROS
       
    40 //const ?type ?constant_var = ?constant;
       
    41 //#define ?macro_name ?macro_def
       
    42 
       
    43 // MODULE DATA STRUCTURES
       
    44 //enum ?declaration
       
    45 //typedef ?declaration
       
    46 
       
    47 // LOCAL FUNCTION PROTOTYPES
       
    48 //?type ?function_name( ?arg_type, ?arg_type );
       
    49 
       
    50 // FORWARD DECLARATIONS
       
    51 //class ?FORWARD_CLASSNAME;
       
    52 
       
    53 // ============================= LOCAL FUNCTIONS ===============================
       
    54 
       
    55 // -----------------------------------------------------------------------------
       
    56 // ?function_name ?description.
       
    57 // ?description
       
    58 // Returns: ?value_1: ?description
       
    59 //          ?value_n: ?description_line1
       
    60 //                    ?description_line2
       
    61 // -----------------------------------------------------------------------------
       
    62 //
       
    63 /*
       
    64 ?type ?function_name(
       
    65     ?arg_type arg,  // ?description
       
    66     ?arg_type arg)  // ?description
       
    67     {
       
    68 
       
    69     ?code  // ?comment
       
    70 
       
    71     // ?comment
       
    72     ?code
       
    73     }
       
    74 */
       
    75 
       
    76 // ============================ MEMBER FUNCTIONS ===============================
       
    77 
    24 
    78 // -----------------------------------------------------------------------------
    25 // -----------------------------------------------------------------------------
    79 // CVoIPAudioServicesTestClass::Delete
    26 // CVoIPAudioServicesTestClass::Delete
    80 // Delete here all resources allocated and opened from test methods.
    27 // Delete here all resources allocated and opened from test methods.
    81 // Called from destructor.
    28 // Called from destructor.
    82 // -----------------------------------------------------------------------------
    29 // -----------------------------------------------------------------------------
    83 //
    30 //
    84 void CVoIPAudioServicesTestClass::Delete()
    31 void CVoIPAudioServicesTestClass::Delete()
    85 {
    32     {
    86 
    33 
    87     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::Delete")));
    34     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::Delete")));
    88 
    35 
    89     iExpectedEvents.Close();
    36     iExpectedEvents.Close();
    90     iOcurredEvents.Close();
    37     iOcurredEvents.Close();
    91 
    38 
    92     iLog->Log(_L("Deleting test class..."));
    39     iLog->Log(_L("Deleting test class..."));
    93 	iLog->Log(_L(""));
    40     iLog->Log(_L(""));
    94 	iLog->Log(_L(""));
    41     iLog->Log(_L(""));
    95 
    42 
    96 	iBitratesArray.Reset();
    43     iBitratesArray.Reset();
       
    44     iBitratesArray.Close();
    97 
    45 
    98     delete iG711DecFormatIntfc;
    46     delete iG711DecFormatIntfc;
    99     delete iG711EncFormatIntfc;
    47     delete iG711EncFormatIntfc;
   100     delete iG729EncFormatIntfc;
    48     delete iG729EncFormatIntfc;
   101     delete iG729DecFormatIntfc;
    49     delete iG729DecFormatIntfc;
   109     delete iRingTonePlayer;
    57     delete iRingTonePlayer;
   110     delete iRingToneFactory;
    58     delete iRingToneFactory;
   111     delete iDTMFTonePlayerDn;
    59     delete iDTMFTonePlayerDn;
   112     delete iDTMFTonePlayerUp;
    60     delete iDTMFTonePlayerUp;
   113 
    61 
   114     delete iPlayBuf;
       
   115 
       
   116 #ifdef __JITTER_BUFFER_TEST__
       
   117     delete iJBIntfc;
    62     delete iJBIntfc;
   118     delete iPlayJBuf;
    63     delete iPlayBuf; //will also remove iPlayJBuf
   119 #endif //__JITTER_BUFFER_TEST__
    64 
   120 
    65     if (iVoIPDnlink)
   121     if (iVoIPDnlink )
    66         {
   122     	{
       
   123         if (iDnLinkStatus != ENotReady)
    67         if (iDnLinkStatus != ENotReady)
   124         	{
    68             {
   125             iVoIPDnlink->Close();
    69             iVoIPDnlink->Close();
   126         	}
    70             }
   127         delete iVoIPDnlink;
    71         delete iVoIPDnlink;
   128         iVoIPDnlink = NULL;
    72         iVoIPDnlink = NULL;
   129     	}
    73         }
   130 
    74 
   131     if (iVoIPUplink )
    75     if (iVoIPUplink)
   132     	{
    76         {
   133         if (iUpLinkStatus != ENotReady)
    77         if (iUpLinkStatus != ENotReady)
   134         	{
    78             {
   135             iVoIPUplink->Close();
    79             iVoIPUplink->Close();
   136         	}
    80             }
   137         delete iVoIPUplink;
    81         delete iVoIPUplink;
   138         iVoIPUplink = NULL;
    82         iVoIPUplink = NULL;
   139     	}
    83         }
   140 
       
   141     delete iFactory;
       
   142 
    84 
   143     delete iDecFormatIntfc;
    85     delete iDecFormatIntfc;
   144     delete iEncFormatIntfc;
    86     delete iEncFormatIntfc;
   145 }
    87     delete iFactory;
       
    88     }
   146 
    89 
   147 // -----------------------------------------------------------------------------
    90 // -----------------------------------------------------------------------------
   148 // CVoIPAudioServicesTestClass::RunMethodL
    91 // CVoIPAudioServicesTestClass::RunMethodL
   149 // Run specified method. Contains also table of test mothods and their names.
    92 // Run specified method. Contains also table of test mothods and their names.
   150 // -----------------------------------------------------------------------------
    93 // -----------------------------------------------------------------------------
   151 //
    94 //
   152 TInt CVoIPAudioServicesTestClass::RunMethodL( CStifItemParser& aItem )
    95 TInt CVoIPAudioServicesTestClass::RunMethodL(CStifItemParser& aItem)
   153 {
    96     {
   154 
       
   155     static TStifFunctionInfo const KFunctions[] =
    97     static TStifFunctionInfo const KFunctions[] =
   156         {
    98         {
   157         // Copy this line for every implemented function.
    99         // Copy this line for every implemented function.
   158         // First string is the function name used in TestScripter script file.
   100         // First string is the function name used in TestScripter script file.
   159         // Second is the actual implementation member function.
   101         // Second is the actual implementation member function.
   160 
   102 
   161         ENTRY( "SetTimeout", CVoIPAudioServicesTestClass::SetTimeout ),
   103         ENTRY("SetTimeout", CVoIPAudioServicesTestClass::SetTimeout),
   162         ENTRY( "CreateFactory", CVoIPAudioServicesTestClass::CreateVoIPUtilityFactory ),
   104         ENTRY("CreateFactory", CVoIPAudioServicesTestClass::CreateVoIPUtilityFactory),
   163         ENTRY( "CreateRingToneFactory", CVoIPAudioServicesTestClass::CreateRingToneFactory ),
   105         ENTRY("CreateRingToneFactory", CVoIPAudioServicesTestClass::CreateRingToneFactory),
   164         ENTRY( "CreateDownlinkStream", CVoIPAudioServicesTestClass::CreateDownlinkStream ),
   106         ENTRY("CreateDownlinkStream", CVoIPAudioServicesTestClass::CreateDownlinkStream),
   165         ENTRY( "CreateUplinkStream", CVoIPAudioServicesTestClass::CreateUplinkStream ),
   107         ENTRY("CreateDownlinkStreamJB", CVoIPAudioServicesTestClass::CreateDownlinkStreamJB),
   166         ENTRY( "CreateDTMFTonePlayer", CVoIPAudioServicesTestClass::CreateDTMFTonePlayer ),
   108         ENTRY("CreateUplinkStream", CVoIPAudioServicesTestClass::CreateUplinkStream),
   167         ENTRY( "CreateRingTonePlayer", CVoIPAudioServicesTestClass::CreateRingTonePlayer ),
   109         ENTRY("CreateDTMFTonePlayer", CVoIPAudioServicesTestClass::CreateDTMFTonePlayer),
   168         ENTRY( "GetSupportedDownlinkFormats", CVoIPAudioServicesTestClass::GetSupportedDownlinkFormats ),
   110         ENTRY("CreateRingTonePlayer", CVoIPAudioServicesTestClass::CreateRingTonePlayer),
   169         ENTRY( "GetSupportedUplinkFormats", CVoIPAudioServicesTestClass::GetSupportedUplinkFormats ),
   111         ENTRY("GetSupportedDownlinkFormats", CVoIPAudioServicesTestClass::GetSupportedDownlinkFormats),
   170         ENTRY( "SetDownlinkFormat", CVoIPAudioServicesTestClass::SetDownlinkFormat ),
   112         ENTRY("GetSupportedUplinkFormats", CVoIPAudioServicesTestClass::GetSupportedUplinkFormats),
   171         ENTRY( "SetUplinkFormat", CVoIPAudioServicesTestClass::SetUplinkFormat ),
   113         ENTRY("SetDownlinkFormat", CVoIPAudioServicesTestClass::SetDownlinkFormat),
   172         ENTRY( "OpenDownlink", CVoIPAudioServicesTestClass::OpenDownlink ),
   114         ENTRY("SetUplinkFormat", CVoIPAudioServicesTestClass::SetUplinkFormat),
   173         ENTRY( "OpenUplink", CVoIPAudioServicesTestClass::OpenUplink ),
   115         ENTRY("OpenDownlink", CVoIPAudioServicesTestClass::OpenDownlink),
   174         ENTRY( "Gain", CVoIPAudioServicesTestClass::Gain ),
   116         ENTRY("OpenUplink", CVoIPAudioServicesTestClass::OpenUplink),
   175         ENTRY( "Volume", CVoIPAudioServicesTestClass::Volume ),
   117         ENTRY("Gain", CVoIPAudioServicesTestClass::Gain),
   176         ENTRY( "SetDevice", CVoIPAudioServicesTestClass::SetDevice ),
   118         ENTRY("Volume", CVoIPAudioServicesTestClass::Volume),
   177         ENTRY( "Close", CVoIPAudioServicesTestClass::Close ),
   119         ENTRY("SetDevice", CVoIPAudioServicesTestClass::SetDevice),
   178         ENTRY( "Start", CVoIPAudioServicesTestClass::Start ),
   120         ENTRY("Close", CVoIPAudioServicesTestClass::Close),
   179         ENTRY( "Stop", CVoIPAudioServicesTestClass::Stop ),
   121         ENTRY("Start", CVoIPAudioServicesTestClass::Start),
   180         ENTRY( "InitDTMFTonePlayer", CVoIPAudioServicesTestClass::InitDTMFTonePlayer ),
   122         ENTRY("Stop", CVoIPAudioServicesTestClass::Stop),
   181         ENTRY( "DTMFTonePlay", CVoIPAudioServicesTestClass::DTMFTonePlay ),
   123         ENTRY("SetLoopPlay", CVoIPAudioServicesTestClass::SetLoopPlay),
   182         ENTRY( "CloseDTMFPlayer", CVoIPAudioServicesTestClass::CloseDTMFPlayer ),
   124         ENTRY("InitDTMFTonePlayer", CVoIPAudioServicesTestClass::InitDTMFTonePlayer),
   183         ENTRY( "StopDTMFPlayer", CVoIPAudioServicesTestClass::StopDTMFTonePlayer ),
   125         ENTRY("DTMFTonePlay", CVoIPAudioServicesTestClass::DTMFTonePlay),
   184         ENTRY( "GetDownlinkVersion", CVoIPAudioServicesTestClass::GetDownlinkVersion ),
   126         ENTRY("CloseDTMFPlayer", CVoIPAudioServicesTestClass::CloseDTMFPlayer),
   185         ENTRY( "GetUplinkVersion", CVoIPAudioServicesTestClass::GetUplinkVersion ),
   127         ENTRY("StopDTMFPlayer", CVoIPAudioServicesTestClass::StopDTMFTonePlayer),
   186         ENTRY( "InitRingTonePlayer", CVoIPAudioServicesTestClass::InitRingTonePlayer ),
   128         ENTRY("GetDownlinkVersion", CVoIPAudioServicesTestClass::GetDownlinkVersion),
   187         ENTRY( "CloseRingTonePlayer", CVoIPAudioServicesTestClass::CloseRingTonePlayer ),
   129         ENTRY("GetUplinkVersion", CVoIPAudioServicesTestClass::GetUplinkVersion),
   188         ENTRY( "PlayRingTone", CVoIPAudioServicesTestClass::PlayRingTone ),
   130         ENTRY("InitRingTonePlayer", CVoIPAudioServicesTestClass::InitRingTonePlayer),
   189         ENTRY( "PauseRingTone", CVoIPAudioServicesTestClass::PauseRingTone ),
   131         ENTRY("CloseRingTonePlayer", CVoIPAudioServicesTestClass::CloseRingTonePlayer),
   190         ENTRY( "ResumeRingTone", CVoIPAudioServicesTestClass::ResumeRingTone ),
   132         ENTRY("PlayRingTone", CVoIPAudioServicesTestClass::PlayRingTone),
   191         ENTRY( "StopRingTone", CVoIPAudioServicesTestClass::StopRingTone ),
   133         ENTRY("PauseRingTone", CVoIPAudioServicesTestClass::PauseRingTone),
   192         ENTRY( "GetSupportedBitrates", CVoIPAudioServicesTestClass::GetSupportedBitrates ),
   134         ENTRY("ResumeRingTone", CVoIPAudioServicesTestClass::ResumeRingTone),
   193         ENTRY( "SetBitrate", CVoIPAudioServicesTestClass::SetBitrate ),
   135         ENTRY("StopRingTone", CVoIPAudioServicesTestClass::StopRingTone),
   194         ENTRY( "GetBitrate", CVoIPAudioServicesTestClass::GetBitrate ),
   136         ENTRY("GetSupportedBitrates", CVoIPAudioServicesTestClass::GetSupportedBitrates),
   195         ENTRY( "GetVAD", CVoIPAudioServicesTestClass::GetVAD ),
   137         ENTRY("SetBitrate", CVoIPAudioServicesTestClass::SetBitrate),
   196         ENTRY( "ToggleVAD", CVoIPAudioServicesTestClass::ToggleVAD ),
   138         ENTRY("GetBitrate", CVoIPAudioServicesTestClass::GetBitrate),
   197         ENTRY( "GetFrameMode", CVoIPAudioServicesTestClass::GetFrameMode ),
   139         ENTRY("GetVAD", CVoIPAudioServicesTestClass::GetVAD),
   198         ENTRY( "ToggleFrameMode", CVoIPAudioServicesTestClass::ToggleFrameMode ),
   140         ENTRY("ToggleVAD", CVoIPAudioServicesTestClass::ToggleVAD),
   199         ENTRY( "GetFrameModeRqrdForEC", CVoIPAudioServicesTestClass::GetFrameModeRqrdForEC ),
   141         ENTRY("GetFrameMode", CVoIPAudioServicesTestClass::GetFrameMode),
   200         ENTRY( "ConcealErrForNextBuf", CVoIPAudioServicesTestClass::ConcealErrForNextBuf ),
   142         ENTRY("ToggleFrameMode", CVoIPAudioServicesTestClass::ToggleFrameMode),
   201         ENTRY( "GetMode", CVoIPAudioServicesTestClass::GetMode ),
   143         ENTRY("GetFrameModeRqrdForEC", CVoIPAudioServicesTestClass::GetFrameModeRqrdForEC),
   202         ENTRY( "SetMode", CVoIPAudioServicesTestClass::SetMode ),
   144         ENTRY("ConcealErrForNextBuf", CVoIPAudioServicesTestClass::ConcealErrForNextBuf),
   203         ENTRY( "GetCNG", CVoIPAudioServicesTestClass::GetCNG ),
   145         ENTRY("GetMode", CVoIPAudioServicesTestClass::GetMode),
   204         ENTRY( "ToggleCNG", CVoIPAudioServicesTestClass::ToggleCNG ),
   146         ENTRY("SetMode", CVoIPAudioServicesTestClass::SetMode),
   205         ENTRY( "GetPLC", CVoIPAudioServicesTestClass::GetPLC ),
   147         ENTRY("GetCNG", CVoIPAudioServicesTestClass::GetCNG),
   206         ENTRY( "TogglePLC", CVoIPAudioServicesTestClass::TogglePLC ),
   148         ENTRY("ToggleCNG", CVoIPAudioServicesTestClass::ToggleCNG),
   207         ENTRY( "BadLsfNextBuffer", CVoIPAudioServicesTestClass::BadLsfNextBuffer ),
   149         ENTRY("GetPLC", CVoIPAudioServicesTestClass::GetPLC),
   208         ENTRY( "GetBufferType", CVoIPAudioServicesTestClass::GetBufferType ),
   150         ENTRY("TogglePLC", CVoIPAudioServicesTestClass::TogglePLC),
   209 
   151         ENTRY("BadLsfNextBuffer", CVoIPAudioServicesTestClass::BadLsfNextBuffer),
   210         ENTRY( "ConfigEncAudDevice", CVoIPAudioServicesTestClass::ConfigEncAudDevice ),
   152         ENTRY("GetBufferType", CVoIPAudioServicesTestClass::GetBufferType),
   211 
   153         ENTRY("ConfigEncAudDevice", CVoIPAudioServicesTestClass::ConfigEncAudDevice),
   212         ENTRY( "Example", CVoIPAudioServicesTestClass::ExampleL ),
   154         ENTRY("ConfigureJB", CVoIPAudioServicesTestClass::ConfigureJB),
   213 
   155         ENTRY("ResetJB", CVoIPAudioServicesTestClass::ResetJB),
   214 #ifdef __JITTER_BUFFER_TEST__
   156         ENTRY("DelayDown", CVoIPAudioServicesTestClass::DelayDown),
   215         ENTRY( "ConfigureJB", CVoIPAudioServicesTestClass::ConfigureJB ),
   157         ENTRY("DelayUp", CVoIPAudioServicesTestClass::DelayUp),
   216         ENTRY( "ResetJB", CVoIPAudioServicesTestClass::ResetJB ),
   158         ENTRY("TestNullObjects", CVoIPAudioServicesTestClass::TestNullObjects)
   217         ENTRY( "DelayDown", CVoIPAudioServicesTestClass::DelayDown ),
       
   218         ENTRY( "DelayUp", CVoIPAudioServicesTestClass::DelayUp ),
       
   219 #endif //__JITTER_BUFFER_TEST__
       
   220 
       
   221         };
   159         };
   222 
   160 
   223     const TInt count = sizeof( KFunctions ) /
   161     const TInt count = sizeof(KFunctions) / sizeof(TStifFunctionInfo);
   224                         sizeof( TStifFunctionInfo );
   162     return RunInternalL(KFunctions, count, aItem);
   225 
   163     }
   226     return RunInternalL( KFunctions, count, aItem );
       
   227 
       
   228 }
       
   229 
       
   230 
   164 
   231 // -----------------------------------------------------------------------------
   165 // -----------------------------------------------------------------------------
   232 // CVoIPAudioServicesTestClass::EventName
   166 // CVoIPAudioServicesTestClass::EventName
   233 // Return descriptor with the notification description
   167 // Return descriptor with the notification description
   234 // -----------------------------------------------------------------------------
   168 // -----------------------------------------------------------------------------
   235 TPtrC CVoIPAudioServicesTestClass::EventName( TInt aKey )
   169 TPtrC CVoIPAudioServicesTestClass::EventName(TInt aKey)
   236 {
   170     {
   237     static TText* const badKeyword = (TText*)L"BadKeyword";
   171     static TText* const badKeyword = (TText*) L"BadKeyword";
   238     static TText* const keywords[] =
   172     static TText* const keywords[] =
   239     {
   173         {
   240 
       
   241         (TText*)L"EOpenDownlinkComplete",
   174         (TText*)L"EOpenDownlinkComplete",
   242         (TText*)L"EOpenUplinkComplete",
   175         (TText*)L"EOpenUplinkComplete",
   243         (TText*)L"EDownlinkClosed",
   176         (TText*)L"EDownlinkClosed",
   244         (TText*)L"EUplinkClosed",
   177         (TText*)L"EUplinkClosed",
   245         (TText*)L"EOpenCompleteDNL",
   178         (TText*)L"EOpenCompleteDNL",
   246         (TText*)L"EOpenCompleteUPL",
   179         (TText*)L"EOpenCompleteUPL",
   247         (TText*)L"EOpenComplete",
   180         (TText*)L"EOpenComplete",
   248         (TText*)L"EPlaybackComplete",
   181         (TText*)L"EPlaybackComplete",
   249         (TText*)L"EEmptyBuffer",
   182         (TText*)L"EEmptyBuffer",
   250         (TText*)L"EFillBuffer",
   183         (TText*)L"EFillBuffer",
   251 
   184         (TText*)L"EDownlinkError",
   252     };
   185         (TText*)L"EUplinkError"
   253 
   186         };
   254 
       
   255 
   187 
   256     if( (TUint)aKey >= (sizeof( keywords )/sizeof(TText*)) )
   188     if( (TUint)aKey >= (sizeof( keywords )/sizeof(TText*)) )
   257     	{
   189         {
   258         iLog->Log(_L("Keyword out of bounds"));
   190         iLog->Log(_L("Keyword out of bounds"));
   259         TPtrC keyword( badKeyword );
   191         TPtrC keyword( badKeyword );
   260         return keyword;
   192         return keyword;
   261     	}
   193         }
   262     else
   194     else
   263     	{
   195         {
   264         TPtrC keyword( keywords[aKey] );
   196         TPtrC keyword( keywords[aKey] );
   265         return keyword;
   197         return keyword;
   266     	}
   198         }
   267 }
   199     }
   268 
   200 
   269 // -----------------------------------------------------------------------------
   201     // -----------------------------------------------------------------------------
   270 // CVoIPAudioServicesTestClass::AddExpectedEvent
   202     // CVoIPAudioServicesTestClass::AddExpectedEvent
   271 // Add an event to the expected events' list
   203     // Add an event to the expected events' list
   272 // -----------------------------------------------------------------------------
   204     // -----------------------------------------------------------------------------
   273 void CVoIPAudioServicesTestClass::AddExpectedEvent(TVoIPExpectedEvent event, TInt ms)
   205 void CVoIPAudioServicesTestClass::AddExpectedEvent(TVoIPExpectedEvent event,
   274 {
   206         TInt ms)
       
   207     {
   275     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::AddExpectedEvent")));
   208     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::AddExpectedEvent")));
   276     iExpectedEvents.Append(event);
   209     iExpectedEvents.Append(event);
   277     TPtrC eventName = EventName(event);
   210     TPtrC eventName = EventName(event);
   278     iLog->Log(_L("Adding expected event:(0x%02x)%S Total=%d"), event, &eventName, iExpectedEvents.Count() );
   211     iLog->Log(_L("Adding expected event:(0x%02x)%S Total=%d"), event,
   279 
   212             &eventName, iExpectedEvents.Count());
   280     if ( iTimeoutController && !iTimeoutController->IsActive() )
   213 
   281     	{
   214     if (iTimeoutController && !iTimeoutController->IsActive())
       
   215         {
   282         if (ms > 0)
   216         if (ms > 0)
   283             {
   217             {
   284             iTimeoutController->Start( TTimeIntervalMicroSeconds(ms * 1000) );
   218             iTimeoutController->Start(TTimeIntervalMicroSeconds(ms * 1000));
   285             }
   219             }
   286         else
   220         else
   287             {
   221             {
   288             iLog->Log(_L("Timeout with default value (1s)"));
   222             iLog->Log(_L("Timeout with default value (1s)"));
   289             iTimeoutController->Start( TTimeIntervalMicroSeconds(1000000) );
   223             iTimeoutController->Start(TTimeIntervalMicroSeconds(1000000));
   290             }
   224             }
   291     	}
   225         }
   292 }
   226     }
   293 
   227 
   294 // -----------------------------------------------------------------------------
   228 // -----------------------------------------------------------------------------
   295 // CVoIPAudioServicesTestClass::RemoveExpectedEvent
   229 // CVoIPAudioServicesTestClass::RemoveExpectedEvent
   296 // Remove the indicated event from the expected events' list
   230 // Remove the indicated event from the expected events' list
   297 // -----------------------------------------------------------------------------
   231 // -----------------------------------------------------------------------------
   298 TBool CVoIPAudioServicesTestClass::RemoveExpectedEvent(TVoIPExpectedEvent aEvent)
   232 TBool CVoIPAudioServicesTestClass::RemoveExpectedEvent(
   299 {
   233         TVoIPExpectedEvent aEvent)
       
   234     {
   300     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::RemoveExpectedEvent")));
   235     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::RemoveExpectedEvent")));
   301     iLog->Log(_L("CVoIPAudioServicesTestClass::RemoveExpectedEvent"));
   236     iLog->Log(_L("CVoIPAudioServicesTestClass::RemoveExpectedEvent"));
   302     TBool match = EFalse;
   237     TBool match = EFalse;
   303     for (TUint i=0; i < iExpectedEvents.Count() ; i++)
   238     for (TUint i = 0; i < iExpectedEvents.Count(); i++)
   304     	{
   239         {
   305         if (iExpectedEvents[i] == aEvent)
   240         if (iExpectedEvents[i] == aEvent)
   306         	{
   241             {
   307         	iLog->Log(_L("Expeted events: %d"), iExpectedEvents.Count());
   242             iLog->Log(_L("Expeted events: %d"), iExpectedEvents.Count());
   308             iExpectedEvents.Remove(i);
   243             iExpectedEvents.Remove(i);
   309             match = ETrue;
   244             match = ETrue;
   310             break;
   245             break;
   311         	}
   246             }
   312     	}
   247         }
   313 
   248 
   314     return match;
   249     return match;
   315 }
   250     }
   316 
       
   317 
   251 
   318 // -----------------------------------------------------------------------------
   252 // -----------------------------------------------------------------------------
   319 // CVoIPAudioServicesTestClass::RemoveAllExpectedEvents
   253 // CVoIPAudioServicesTestClass::RemoveAllExpectedEvents
   320 // Remove the indicated event from the expected events' list
   254 // Remove the indicated event from the expected events' list
   321 // -----------------------------------------------------------------------------
   255 // -----------------------------------------------------------------------------
   322 void CVoIPAudioServicesTestClass::RemoveAllExpectedEvents()
   256 void CVoIPAudioServicesTestClass::RemoveAllExpectedEvents()
   323 {
   257     {
   324     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::RemoveAllExpectedEvents")));
   258     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::RemoveAllExpectedEvents")));
   325     iLog->Log(_L("Removing all expected events"));
   259     iLog->Log(_L("Removing all expected events"));
   326 
   260 
   327     iExpectedEvents.Reset();
   261     iExpectedEvents.Reset();
   328     iOcurredEvents.Reset();
   262     iOcurredEvents.Reset();
   329 }
   263     }
   330 
       
   331 
   264 
   332 // -----------------------------------------------------------------------------
   265 // -----------------------------------------------------------------------------
   333 // CVoIPAudioServicesTestClass::ProcessEvent
   266 // CVoIPAudioServicesTestClass::ProcessEvent
   334 // -----------------------------------------------------------------------------
   267 // -----------------------------------------------------------------------------
   335 void CVoIPAudioServicesTestClass::ProcessEvent(TVoIPExpectedEvent aEvent, TInt aError)
   268 void CVoIPAudioServicesTestClass::ProcessEvent(TVoIPExpectedEvent aEvent,
   336 {
   269         TInt aError)
       
   270     {
   337     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::ProcessExpectedEvent")));
   271     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::ProcessExpectedEvent")));
   338     iLog->Log(_L("CVoIPAudioServicesTestClass::ProcessExpectedEvent"));
   272     iLog->Log(_L("CVoIPAudioServicesTestClass::ProcessExpectedEvent"));
   339     TPtrC nameEvent = EventName(aEvent);
   273     TPtrC nameEvent = EventName(aEvent);
   340 
   274 
   341     if (aError == KErrNone)
   275     if (aError == KErrNone)
   342     	{
   276         {
   343         if (RemoveExpectedEvent(aEvent))
   277         if (RemoveExpectedEvent(aEvent))
   344         	{
   278             {
   345             iLog->Log(_L("Expected Event: (0x%02x)%S has ocurred Total=%d"), aEvent, &nameEvent,iExpectedEvents.Count());
   279             iLog->Log(_L("Expected Event: (0x%02x)%S has ocurred Total=%d"),
   346         	}
   280                     aEvent, &nameEvent, iExpectedEvents.Count());
       
   281             }
   347         else
   282         else
   348         	{
   283             {
   349             iLog->Log(_L("Event: (0x%02x)%S has ocurred"), aEvent, &nameEvent);
   284             iLog->Log(_L("Event: (0x%02x)%S has ocurred"), aEvent, &nameEvent);
   350             return;
   285             return;
   351         	}
   286             }
   352 
   287 
   353         if (iExpectedEvents.Count() == 0 )
   288         if (iExpectedEvents.Count() == 0)
   354         	{
   289             {
   355             Signal();
   290             Signal();
   356             iTimeoutController->Cancel();
   291             iTimeoutController->Cancel();
   357         	}
   292             }
   358 
   293         }
   359     	}
       
   360     else
   294     else
   361     	{
   295         {
   362         iLog->Log(_L("[Error] Event: (0x%02x)%S return with error code=%d"), aEvent, &nameEvent, aError);
   296         iLog->Log(_L("[Error] Event: (0x%02x)%S return with error code=%d"),
   363         if (iExpectedEvents.Count() != 0 )
   297                 aEvent, &nameEvent, aError);
   364         	{
   298         if (iExpectedEvents.Count() != 0)
       
   299             {
   365             RemoveExpectedEvent(aEvent);
   300             RemoveExpectedEvent(aEvent);
   366         	}
   301             }
   367         iTimeoutController->Cancel();
   302         iTimeoutController->Cancel();
   368         Signal(KErrCallbackErrorCode);
   303         Signal(KErrCallbackErrorCode);
   369     	}
   304         }
   370 }
   305     }
   371 
   306 
   372 // -----------------------------------------------------------------------------
   307 // -----------------------------------------------------------------------------
   373 // CVoIPAudioServicesTestClass::HandleTimeout
   308 // CVoIPAudioServicesTestClass::HandleTimeout
   374 // Review if all the expected events have ocurred once the time is over
   309 // Review if all the expected events have ocurred once the time is over
   375 // -----------------------------------------------------------------------------
   310 // -----------------------------------------------------------------------------
   376 
   311 
   377 void CVoIPAudioServicesTestClass::HandleTimeout(TInt aError)
   312 void CVoIPAudioServicesTestClass::HandleTimeout(TInt aError)
   378 {
   313     {
   379     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::HandleTimeout")));
   314     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::HandleTimeout")));
   380 
   315 
   381     if (aError != KErrNone)
   316     if (aError != KErrNone)
   382     	{
   317         {
   383         if (iExpectedEvents.Count() == 0 )
   318         if (iExpectedEvents.Count() == 0)
   384         	{
   319             {
   385             iLog->Log(_L("Timing out but events have ocurred"));
   320             iLog->Log(_L("Timing out but events have ocurred"));
   386             Signal();
   321             Signal();
   387         	}
   322             }
   388         else
   323         else
   389         	{
   324             {
   390             RemoveAllExpectedEvents();
   325             RemoveAllExpectedEvents();
   391             iLog->Log(_L("Timing out and events still pending"));
   326             iLog->Log(_L("Timing out and events still pending"));
   392             Signal(KErrEventPending);
   327             Signal(KErrEventPending);
   393         	}
   328             }
   394     	}
   329         }
   395     else
   330     else
   396     	{
   331         {
   397         iLog->Log(_L("Timing out return a error %d"), aError);
   332         iLog->Log(_L("Timing out return a error %d"), aError);
   398         Signal(aError);
   333         Signal(aError);
   399     	}
   334         }
   400 }
   335     }
   401 
   336 
   402 // -----------------------------------------------------------------------------
   337 // -----------------------------------------------------------------------------
   403 // CVoIPAudioServicesTestClass::SetTimeout
   338 // CVoIPAudioServicesTestClass::SetTimeout
   404 // Create a timer and set a timeout
   339 // Create a timer and set a timeout
   405 // When the timeout is reached the test case is marked as failed
   340 // When the timeout is reached the test case is marked as failed
   406 // It's used rather than the "timeout" keyword in the configuration file
   341 // It's used rather than the "timeout" keyword in the configuration file
   407 // because in this way the log continues
   342 // because in this way the log continues
   408 // -----------------------------------------------------------------------------
   343 // -----------------------------------------------------------------------------
   409 TInt CVoIPAudioServicesTestClass::SetTimeout( CStifItemParser& aItem )
   344 TInt CVoIPAudioServicesTestClass::SetTimeout(CStifItemParser& aItem)
   410 {
   345     {
   411     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::SetTimeout")));
   346     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::SetTimeout")));
   412     TInt timeout=0;
   347     TInt timeout = 0;
   413     TInt error = aItem.GetNextInt(timeout) ;
   348     TInt error = aItem.GetNextInt(timeout);
   414     if ( iTimeoutController )
   349     if (iTimeoutController)
   415     	{
   350         {
   416         if ( timeout > 0 )
   351         if (timeout > 0)
   417         	{
   352             {
   418             iTimeoutController->Start( TTimeIntervalMicroSeconds(timeout*1000) );
   353             iTimeoutController->Start(TTimeIntervalMicroSeconds(timeout *1000));
   419         	}
   354             }
   420         else
   355         else
   421         	{
   356             {
   422             iTimeoutController->Start( TTimeIntervalMicroSeconds(1000000) );
   357             iTimeoutController->Start(TTimeIntervalMicroSeconds(1000000));
   423         	}
   358             }
   424     	}
   359         }
   425     else
   360     else
   426     	{
   361         {
   427         iLog->Log(_L("Timeout Controller doesn't exist"));
   362         iLog->Log(_L("Timeout Controller doesn't exist"));
   428         error = KErrTimeoutController;
   363         error = KErrTimeoutController;
   429     	}
   364         }
   430 
   365     return error;
   431     return error;
   366     }
   432 }
       
   433 
       
   434 
   367 
   435 // -----------------------------------------------------------------------------
   368 // -----------------------------------------------------------------------------
   436 // Uses the TestModuleBase API to allow a panic as exit reason for a test case
   369 // Uses the TestModuleBase API to allow a panic as exit reason for a test case
   437 // -----------------------------------------------------------------------------
   370 // -----------------------------------------------------------------------------
   438 TInt CVoIPAudioServicesTestClass::SetAllowedPanic( CStifItemParser& aItem )
   371 TInt CVoIPAudioServicesTestClass::SetAllowedPanic(CStifItemParser& aItem)
   439 {
   372     {
   440     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::SetAllowedPanic")));
   373     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::SetAllowedPanic")));
   441     TInt error = KErrNone;
   374     TInt error = KErrNone;
   442     TInt panicCode;
   375     TInt panicCode;
   443     TPtrC panicType;
   376     TPtrC panicType;
   444     if (  ( KErrNone == aItem.GetNextString(panicType) ) &&
   377     if ((KErrNone == aItem.GetNextString(panicType)) && (KErrNone
   445     ( KErrNone == aItem.GetNextInt(panicCode) )  )
   378             == aItem.GetNextInt(panicCode)))
   446     	{
   379         {
   447         iLog->Log(_L("Allowing panic: %S %d"), &panicType, panicCode);
   380         iLog->Log(_L("Allowing panic: %S %d"), &panicType, panicCode);
   448         iTestModuleIf.SetExitReason( CTestModuleIf::EPanic, panicCode );
   381         iTestModuleIf.SetExitReason(CTestModuleIf::EPanic, panicCode);
   449         iNormalExitReason = EFalse;
   382         iNormalExitReason = EFalse;
   450     	}
   383         }
   451     else
   384     else
   452     	{
   385         {
   453         iLog->Log(KMsgBadTestParameters);
   386         iLog->Log(KMsgBadTestParameters);
   454         error = KErrBadTestParameter;
   387         error = KErrBadTestParameter;
   455     	}
   388         }
   456 
   389     return error;
   457     return error;
   390     }
   458 }
       
   459 
   391 
   460 // -----------------------------------------------------------------------------
   392 // -----------------------------------------------------------------------------
   461 // CVoIPAudioServicesTestClass::SetExpectedEvents()
   393 // CVoIPAudioServicesTestClass::SetExpectedEvents()
   462 // -----------------------------------------------------------------------------
   394 // -----------------------------------------------------------------------------
   463 TInt CVoIPAudioServicesTestClass::SetExpectedEvents( CStifItemParser& aItem )
   395 TInt CVoIPAudioServicesTestClass::SetExpectedEvents(CStifItemParser& aItem)
   464 {
   396     {
   465     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::SetExpectedEvents")));
   397     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::SetExpectedEvents")));
   466     TInt error = KErrNone;
   398     TInt error = KErrNone;
   467     TInt event=0;
   399     TInt event = 0;
   468     while ( KErrNone == aItem.GetNextInt(event))
   400     while (KErrNone == aItem.GetNextInt(event))
   469     	{
   401         {
   470         AddExpectedEvent(static_cast<TVoIPExpectedEvent>(event), 0); // Default timeout value
   402         // Default timeout value
   471     	}
   403         AddExpectedEvent(static_cast<TVoIPExpectedEvent> (event), 0);
   472 
   404         }
   473     return error;
   405     return error;
   474 }
   406     }
   475 
   407 
   476 
   408 TInt CVoIPAudioServicesTestClass::CreateVoIPUtilityFactory(
   477 // -----------------------------------------------------------------------------
   409         CStifItemParser& /*aItem */)
   478 // CVoIPAudioServicesTestClass::ExampleL
   410     {
   479 // Example test method function.
       
   480 // (other items were commented in a header).
       
   481 // -----------------------------------------------------------------------------
       
   482 //
       
   483 TInt CVoIPAudioServicesTestClass::ExampleL( CStifItemParser& aItem )
       
   484 {
       
   485 
       
   486     // Print to UI
       
   487     _LIT( KVoIPAudioServicesTestClass, "VoIPAudioServicesTestClass" );
       
   488     _LIT( KExample, "In Example" );
       
   489     TestModuleIf().Printf( 0, KVoIPAudioServicesTestClass, KExample );
       
   490     // Print to log file
       
   491     iLog->Log( KExample );
       
   492 
       
   493     TInt i = 0;
       
   494     TPtrC string;
       
   495     _LIT( KParam, "Param[%i]: %S" );
       
   496     while ( aItem.GetNextString ( string ) == KErrNone )
       
   497         {
       
   498         TestModuleIf().Printf( i, KVoIPAudioServicesTestClass, KParam, i, &string );
       
   499         i++;
       
   500         }
       
   501 
       
   502     return KErrNone;
       
   503 }
       
   504 
       
   505 TInt CVoIPAudioServicesTestClass::CreateVoIPUtilityFactory( CStifItemParser& /*aItem */)
       
   506 {
       
   507     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::CreateFactory")));
   411     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::CreateFactory")));
   508     iLog->Log(_L("CVoIPAudioServicesTestClass::CreateFactory"));
   412     iLog->Log(_L("CVoIPAudioServicesTestClass::CreateFactory"));
   509     TInt error = KErrNone;
   413     TInt error = KErrNone;
   510 
       
   511     error = CVoIPUtilityFactory::CreateFactory(iFactory);
   414     error = CVoIPUtilityFactory::CreateFactory(iFactory);
   512 
   415     return error;
   513     return error;
   416     }
   514 }
   417 
   515 
   418 TInt CVoIPAudioServicesTestClass::CreateRingToneFactory(
   516 
   419         CStifItemParser& /*aItem */)
   517 TInt CVoIPAudioServicesTestClass::CreateRingToneFactory( CStifItemParser& /*aItem */)
   420     {
   518 {
       
   519     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::CreateRingToneFactory")));
   421     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::CreateRingToneFactory")));
   520     iLog->Log(_L("CVoIPAudioServicesTestClass::CreateRingToneFactory"));
   422     iLog->Log(_L("CVoIPAudioServicesTestClass::CreateRingToneFactory"));
   521     TInt error = KErrNone;
   423     TInt error = KErrNone;
   522 
       
   523     error = CRingToneFactory::CreateFactory(iRingToneFactory);
   424     error = CRingToneFactory::CreateFactory(iRingToneFactory);
   524 
   425     return error;
   525     return error;
   426     }
   526 }
   427 
   527 
   428 TInt CVoIPAudioServicesTestClass::CreateDownlinkStream(
   528 TInt CVoIPAudioServicesTestClass::CreateDownlinkStream( CStifItemParser& /*aItem */)
   429         CStifItemParser& /*aItem */)
   529 {
   430     {
   530 	iLog->Log(_L("MVoIPUplinkObserver::KOpenComplete: iUpLinkStatus = %d"), iUpLinkStatus);
       
   531     FTRACE(FPrint(_L("MVoIPUplinkObserver::KOpenComplete: iUpLinkStatus = %d"), iUpLinkStatus));
       
   532     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::CreateDownlinkStream")));
   431     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::CreateDownlinkStream")));
   533     iLog->Log(_L("CVoIPAudioServicesTestClass::CreateDownlinkStream"));
   432     iLog->Log(_L("CVoIPAudioServicesTestClass::CreateDownlinkStream"));
   534     TInt error = KErrNone;
   433     TInt error = KErrNone;
   535 
       
   536     const TVersion ver(1, 0, 0);
   434     const TVersion ver(1, 0, 0);
   537 
   435 
   538 #ifdef __JITTER_BUFFER_TEST__
   436     // Create DNL without JB interface
       
   437     error = iFactory->CreateDownlinkStream(ver,
       
   438             CVoIPUtilityFactory::EVoIPCall, iVoIPDnlink);
       
   439     return error;
       
   440     }
       
   441 
       
   442 TInt CVoIPAudioServicesTestClass::CreateDownlinkStreamJB(
       
   443         CStifItemParser& /*aItem */)
       
   444     {
       
   445     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::CreateDownlinkStreamJB")));
       
   446     iLog->Log(_L("CVoIPAudioServicesTestClass::CreateDownlinkStreamJB"));
       
   447     TInt error = KErrNone;
       
   448     const TVersion ver(1, 0, 0);
       
   449 
   539     // Create DNL with JB interface
   450     // Create DNL with JB interface
   540     error = iFactory->CreateDownlinkStream(ver, iJBIntfc, iVoIPDnlink);
   451     error = iFactory->CreateDownlinkStream(ver, iJBIntfc, iVoIPDnlink);
   541 
   452 
   542     if (error == KErrNone && iJBIntfc)
   453     if (error == KErrNone && iJBIntfc)
   543         {
   454         {
   544         iJBIntfc->SetObserver(*this);
   455         iJBIntfc->SetObserver(*this);
   545         }
   456         }
   546 #else  //__JITTER_BUFFER_TEST__
   457 
   547     // Create DNL without JB interface
   458     return error;
   548     error = iFactory->CreateDownlinkStream(ver,
   459     }
   549                                            CVoIPUtilityFactory::EVoIPCall,
   460 
   550                                            iVoIPDnlink);
   461 TInt CVoIPAudioServicesTestClass::GetDownlinkVersion(
   551 #endif //__JITTER_BUFFER_TEST__
   462         CStifItemParser& /*aItem */)
   552 
   463     {
   553     return error;
   464     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetDownlinkVersion")));
   554 }
       
   555 
       
   556 
       
   557 TInt CVoIPAudioServicesTestClass::GetDownlinkVersion( CStifItemParser& /*aItem */)
       
   558 {
       
   559 	FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetDownlinkVersion")));
       
   560     iLog->Log(_L("CVoIPAudioServicesTestClass::GetDownlinkVersion"));
   465     iLog->Log(_L("CVoIPAudioServicesTestClass::GetDownlinkVersion"));
   561     TInt error = KErrNone;
   466     TInt error = KErrNone;
   562 
   467     TVersion ver(0, 0, 0);
   563     TVersion ver(0,0,0);
       
   564     error = iVoIPDnlink->GetVersion(ver);
   468     error = iVoIPDnlink->GetVersion(ver);
   565 
   469     return error;
   566     return error;
   470     }
   567 }
   471 
   568 
   472 TInt CVoIPAudioServicesTestClass::CreateUplinkStream(
   569 
   473         CStifItemParser& /*aItem */)
   570 TInt CVoIPAudioServicesTestClass::CreateUplinkStream( CStifItemParser& /*aItem */)
   474     {
   571 {
       
   572     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::CreateUplinkStream")));
   475     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::CreateUplinkStream")));
   573     iLog->Log(_L("CVoIPAudioServicesTestClass::CreateUplinkStream"));
   476     iLog->Log(_L("CVoIPAudioServicesTestClass::CreateUplinkStream"));
   574     TInt error = KErrNone;
   477     TInt error = KErrNone;
   575 
       
   576     const TVersion ver(1, 0, 0);
   478     const TVersion ver(1, 0, 0);
   577     error = iFactory->CreateUplinkStream(ver,
   479     error = iFactory->CreateUplinkStream(ver, CVoIPUtilityFactory::EVoIPCall,
   578                                        CVoIPUtilityFactory::EVoIPCall,
   480             iVoIPUplink);
   579                                        iVoIPUplink);
   481     return error;
   580     return error;
   482     }
   581 }
   483 
   582 
   484 TInt CVoIPAudioServicesTestClass::GetUplinkVersion(
   583 
   485         CStifItemParser& /*aItem */)
   584 TInt CVoIPAudioServicesTestClass::GetUplinkVersion( CStifItemParser& /*aItem */)
   486     {
   585 {
   487     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetUplinkVersion")));
   586 	FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetUplinkVersion")));
       
   587     iLog->Log(_L("CVoIPAudioServicesTestClass::GetUplinkVersion"));
   488     iLog->Log(_L("CVoIPAudioServicesTestClass::GetUplinkVersion"));
   588     TInt error = KErrNone;
   489     TInt error = KErrNone;
   589 
   490     TVersion ver(0, 0, 0);
   590     TVersion ver(0,0,0);
       
   591     error = iVoIPUplink->GetVersion(ver);
   491     error = iVoIPUplink->GetVersion(ver);
   592 
   492     return error;
   593     return error;
   493     }
   594 }
   494 
   595 
   495 TInt CVoIPAudioServicesTestClass::CreateDTMFTonePlayer(CStifItemParser& aItem)
   596 
   496     {
   597 TInt CVoIPAudioServicesTestClass::CreateDTMFTonePlayer( CStifItemParser& /*aItem */)
       
   598 {
       
   599     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::CreateDTMFTonePlayer")));
   497     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::CreateDTMFTonePlayer")));
   600     iLog->Log(_L("CVoIPAudioServicesTestClass::CreateDTMFTonePlayer"));
   498     iLog->Log(_L("CVoIPAudioServicesTestClass::CreateDTMFTonePlayer"));
   601     TInt error = KErrNone;
   499     TInt error = KErrNone;
   602 
   500     TPtrC startType;
   603     if (iVoIPDnlink)
   501     error = aItem.GetNextString(startType);
   604     	{
   502 
   605         error = iFactory->CreateDTMFTonePlayer(iDTMFTonePlayerDn);
   503     if (error == KErrNone)
   606     	}
   504         {
   607 
   505         if (startType == KTagUplink)
   608     if (iVoIPUplink)
   506             {
   609     	{
   507             error = iFactory->CreateDTMFTonePlayer(iDTMFTonePlayerUp);
   610     	error = iFactory->CreateDTMFTonePlayer(iDTMFTonePlayerUp);
   508             }
   611     	}
   509         else if (startType == KTagDnlink)
   612 
   510             {
   613     return error;
   511             error = iFactory->CreateDTMFTonePlayer(iDTMFTonePlayerDn);
   614 }
   512             }
   615 
   513         else
   616 
   514             {
   617 TInt CVoIPAudioServicesTestClass::CreateRingTonePlayer( CStifItemParser& /*aItem */)
   515             iLog->Log(KMsgBadTestParameters);
   618 {
   516             error = KErrBadTestParameter;
       
   517             }
       
   518         }
       
   519     return error;
       
   520     }
       
   521 
       
   522 TInt CVoIPAudioServicesTestClass::CreateRingTonePlayer(
       
   523         CStifItemParser& /*aItem */)
       
   524     {
   619     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::CreateRingTonePlayer")));
   525     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::CreateRingTonePlayer")));
   620     iLog->Log(_L("CVoIPAudioServicesTestClass::CreateRingTonePlayer"));
   526     iLog->Log(_L("CVoIPAudioServicesTestClass::CreateRingTonePlayer"));
   621     TInt error = KErrNone;
   527     TInt error = KErrNone;
   622 
   528 
   623     if (iRingToneFactory)
   529     if (iRingToneFactory)
   624     	{
   530         {
   625         error = iRingToneFactory->CreateRingTonePlayer(iRingTonePlayer);
   531         error = iRingToneFactory->CreateRingTonePlayer(iRingTonePlayer);
   626     	}
   532         }
   627 
   533 
   628     return error;
   534     return error;
   629 }
   535     }
   630 
   536 
   631 
   537 TInt CVoIPAudioServicesTestClass::GetSupportedDownlinkFormats(
   632 
   538         CStifItemParser& /*aItem */)
   633 TInt CVoIPAudioServicesTestClass::GetSupportedDownlinkFormats( CStifItemParser& /*aItem */)
   539     {
   634 {
       
   635     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetSupportedDownlinkFormats")));
   540     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetSupportedDownlinkFormats")));
   636     iLog->Log(_L("CVoIPAudioServicesTestClass::GetSupportedDownlinkFormats"));
   541     iLog->Log(_L("CVoIPAudioServicesTestClass::GetSupportedDownlinkFormats"));
   637     TInt error = KErrNone;
   542     TInt error = KErrNone;
   638 
   543 
   639     RArray<TVoIPCodecFormat> formats;
   544     RArray<TVoIPCodecFormat> formats;
   657         }
   562         }
   658 
   563 
   659     formats.Close();
   564     formats.Close();
   660 
   565 
   661     return error;
   566     return error;
   662 }
   567     }
   663 
   568 
   664 TInt CVoIPAudioServicesTestClass::GetSupportedUplinkFormats( CStifItemParser& /*aItem */)
   569 TInt CVoIPAudioServicesTestClass::GetSupportedUplinkFormats(
   665 {
   570         CStifItemParser& /*aItem */)
       
   571     {
   666     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetSupportedUplinkFormats")));
   572     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetSupportedUplinkFormats")));
   667     iLog->Log(_L("CVoIPAudioServicesTestClass::GetSupportedUplinkFormats"));
   573     iLog->Log(_L("CVoIPAudioServicesTestClass::GetSupportedUplinkFormats"));
   668     TInt error = KErrNone;
   574     TInt error = KErrNone;
   669 
   575 
   670     RArray<TVoIPCodecFormat> formats;
   576     RArray<TVoIPCodecFormat> formats;
   688         }
   594         }
   689 
   595 
   690     formats.Close();
   596     formats.Close();
   691 
   597 
   692     return error;
   598     return error;
   693 }
   599     }
   694 
   600 
   695 
   601 TInt CVoIPAudioServicesTestClass::SetDownlinkFormat(CStifItemParser& aItem)
   696 
   602     {
   697 
       
   698 
       
   699 TInt CVoIPAudioServicesTestClass::SetDownlinkFormat( CStifItemParser& aItem )
       
   700 {
       
   701     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::SetDownlinkFormat")));
   603     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::SetDownlinkFormat")));
   702     iLog->Log(_L("CVoIPAudioServicesTestClass::SetDownlinkFormat"));
   604     iLog->Log(_L("CVoIPAudioServicesTestClass::SetDownlinkFormat"));
   703     TInt error = KErrNone;
   605     TInt error = KErrNone;
   704 
   606 
   705     TPtrC decoderType;
   607     TPtrC decoderType;
   706     error = aItem.GetNextString(decoderType);
   608     error = aItem.GetNextString(decoderType);
   707     if (error == KErrNone)
   609     if (error == KErrNone)
   708     	{
   610         {
   709         CVoIPFormatIntfc* formatIntfc = NULL;
   611         CVoIPFormatIntfc* formatIntfc = NULL;
   710 
   612 
   711         // NOTE: We can now set either 10ms or 20ms G.711 frame;
       
   712         //	 	 call GetSupportedDownlinkFormats() to see if it
       
   713         //		 returns EG711 or EG711_10MS and set codec accordingly.
       
   714         if (decoderType == KTagG711)
   613         if (decoderType == KTagG711)
   715         	{
   614             {
   716         	error = iVoIPDnlink->SetFormat(EG711, formatIntfc);
   615             error = iVoIPDnlink->SetFormat(EG711, formatIntfc);
   717         	if (error == KErrNone)
   616             if (error == KErrNone)
   718         		{
   617                 {
   719                 if (iG711DecFormatIntfc)
   618                 if (iG711DecFormatIntfc)
   720                 	{
   619                     {
   721                 	delete iG711DecFormatIntfc;
   620                     delete iG711DecFormatIntfc;
   722                 	iG711DecFormatIntfc = NULL;
   621                     iG711DecFormatIntfc = NULL;
   723                 	}
   622                     }
   724 
   623 
   725 		            iG711DecFormatIntfc = (CVoIPG711DecoderIntfc*)formatIntfc;
   624                 iG711DecFormatIntfc = (CVoIPG711DecoderIntfc*) formatIntfc;
   726 		            error = iG711DecFormatIntfc->SetObserver(*this);
   625                 error = iG711DecFormatIntfc->SetObserver(*this);
   727 		            iDnLinkCodec = EG711;
   626                 iDnLinkCodec = EG711;
   728 
   627                 iLog->Log(_L("G.711 DNL Codec Set: error = %d"), error);
   729 		            iLog->Log(_L("G.711 DNL Codec Set: error = %d"), error);
   628                 }
   730         		}
   629             else
   731         	else
       
   732                 {
   630                 {
   733                 iLog->Log(_L("DNL Codec Setting Failed: error = %d"), error);
   631                 iLog->Log(_L("DNL Codec Setting Failed: error = %d"), error);
   734                 }
   632                 }
   735         	}
   633             }
       
   634         else if (decoderType == KTagG711_10MS)
       
   635             {
       
   636             error = iVoIPDnlink->SetFormat(EG711_10MS, formatIntfc);
       
   637             if (error == KErrNone)
       
   638                 {
       
   639                 if (iG711DecFormatIntfc)
       
   640                     {
       
   641                     delete iG711DecFormatIntfc;
       
   642                     iG711DecFormatIntfc = NULL;
       
   643                     }
       
   644 
       
   645                 iG711DecFormatIntfc = (CVoIPG711DecoderIntfc*) formatIntfc;
       
   646                 error = iG711DecFormatIntfc->SetObserver(*this);
       
   647                 iDnLinkCodec = EG711_10MS;
       
   648                 iLog->Log(_L("G.711 10ms DNL Codec Set: error = %d"), error);
       
   649                 }
       
   650             else
       
   651                 {
       
   652                 iLog->Log(_L("DNL Codec Setting Failed: error = %d"), error);
       
   653                 }
       
   654             }
   736         else if (decoderType == KTagG729)
   655         else if (decoderType == KTagG729)
   737         	{
   656             {
   738         	error = iVoIPDnlink->SetFormat(EG729, formatIntfc);
   657             error = iVoIPDnlink->SetFormat(EG729, formatIntfc);
   739         	if (error == KErrNone)
   658             if (error == KErrNone)
   740         		{
   659                 {
   741                 if (iG729DecFormatIntfc)
   660                 if (iG729DecFormatIntfc)
   742                 	{
   661                     {
   743 		            delete iG729DecFormatIntfc;
   662                     delete iG729DecFormatIntfc;
   744 		            iG729DecFormatIntfc = NULL;
   663                     iG729DecFormatIntfc = NULL;
   745 		            }
   664                     }
   746 
   665 
   747 	            iG729DecFormatIntfc = (CVoIPG729DecoderIntfc*)formatIntfc;
   666                 iG729DecFormatIntfc = (CVoIPG729DecoderIntfc*) formatIntfc;
   748 	            error = iG729DecFormatIntfc->SetObserver(*this);
   667                 error = iG729DecFormatIntfc->SetObserver(*this);
   749 	            iDnLinkCodec = EG729;
   668                 iDnLinkCodec = EG729;
   750 
   669 
   751 	            iLog->Log(_L("G.729 DNL Codec Set: error = %d"), error);
   670                 iLog->Log(_L("G.729 DNL Codec Set: error = %d"), error);
   752         		}
   671                 }
   753         	else
   672             else
   754                 {
   673                 {
   755                 iLog->Log(_L("DNL Codec Setting Failed: error = %d"), error);
   674                 iLog->Log(_L("DNL Codec Setting Failed: error = %d"), error);
   756                 }
   675                 }
   757         	}
   676             }
   758         else if (decoderType == KTagILBC)
   677         else if (decoderType == KTagILBC)
   759         	{
   678             {
   760         	error = iVoIPDnlink->SetFormat(EILBC, formatIntfc);
   679             error = iVoIPDnlink->SetFormat(EILBC, formatIntfc);
   761         	if (error == KErrNone)
   680             if (error == KErrNone)
   762         		{
   681                 {
   763                 if (iILBCDecFormatIntfc)
   682                 if (iILBCDecFormatIntfc)
   764 		            {
   683                     {
   765 		            delete iILBCDecFormatIntfc;
   684                     delete iILBCDecFormatIntfc;
   766 		            iILBCDecFormatIntfc = NULL;
   685                     iILBCDecFormatIntfc = NULL;
   767 		            }
   686                     }
   768 
   687 
   769 		            iILBCDecFormatIntfc = (CVoIPILBCDecoderIntfc*)formatIntfc;
   688                 iILBCDecFormatIntfc = (CVoIPILBCDecoderIntfc*) formatIntfc;
   770 		            error = iILBCDecFormatIntfc->SetObserver(*this);
   689                 error = iILBCDecFormatIntfc->SetObserver(*this);
   771 		            iDnLinkCodec = EILBC;
   690                 iDnLinkCodec = EILBC;
   772 
   691 
   773 		            iLog->Log(_L("iLBC DNL Codec Set: error = %d"), error);
   692                 iLog->Log(_L("iLBC DNL Codec Set: error = %d"), error);
   774         		}
   693                 }
   775         	else
   694             else
   776                 {
   695                 {
   777                 iLog->Log(_L("DNL Codec Setting Failed: error = %d"), error);
   696                 iLog->Log(_L("DNL Codec Setting Failed: error = %d"), error);
   778                 }
   697                 }
   779         	}
   698             }
   780         else if (decoderType == KTagAMRNB)
   699         else if (decoderType == KTagAMRNB)
   781         	{
   700             {
   782         	error = iVoIPDnlink->SetFormat(EAMR_NB, formatIntfc);
   701             error = iVoIPDnlink->SetFormat(EAMR_NB, formatIntfc);
   783         	if (error == KErrNone)
   702             if (error == KErrNone)
   784         		{
   703                 {
   785                 if (iAMRNBDecFormatIntfc)
   704                 if (iAMRNBDecFormatIntfc)
   786 		            {
   705                     {
   787 		            delete iAMRNBDecFormatIntfc;
   706                     delete iAMRNBDecFormatIntfc;
   788 		            iAMRNBDecFormatIntfc = NULL;
   707                     iAMRNBDecFormatIntfc = NULL;
   789 		            }
   708                     }
   790 
   709 
   791 		            iAMRNBDecFormatIntfc = formatIntfc;
   710                 iAMRNBDecFormatIntfc = formatIntfc;
   792 		            error = iAMRNBDecFormatIntfc->SetObserver(*this);
   711                 error = iAMRNBDecFormatIntfc->SetObserver(*this);
   793 		            iDnLinkCodec = EAMR_NB;
   712                 iDnLinkCodec = EAMR_NB;
   794 
   713 
   795 		            iLog->Log(_L("AMR-NB DNL Codec Set: error = %d"), error);
   714                 iLog->Log(_L("AMR-NB DNL Codec Set: error = %d"), error);
   796         		}
   715                 }
   797         	else
   716             else
   798                 {
   717                 {
   799                 iLog->Log(_L("DNL Codec Setting Failed: error = %d"), error);
   718                 iLog->Log(_L("DNL Codec Setting Failed: error = %d"), error);
   800                 }
   719                 }
   801         	}
   720             }
   802         else if (decoderType == KTagPCM16)
   721         else if (decoderType == KTagPCM16)
   803         	{
   722             {
   804         	error = iVoIPDnlink->SetFormat(EPCM16, formatIntfc);
   723             error = iVoIPDnlink->SetFormat(EPCM16, formatIntfc);
   805         	if (error == KErrNone)
   724             if (error == KErrNone)
   806         		{
   725                 {
   807                 if (iPCM16DecFormatIntfc)
   726                 if (iPCM16DecFormatIntfc)
   808 		            {
   727                     {
   809 		            delete iPCM16DecFormatIntfc;
   728                     delete iPCM16DecFormatIntfc;
   810 		            iPCM16DecFormatIntfc = NULL;
   729                     iPCM16DecFormatIntfc = NULL;
   811 		            }
   730                     }
   812 
   731 
   813 		            iPCM16DecFormatIntfc = formatIntfc;
   732                 iPCM16DecFormatIntfc = formatIntfc;
   814 		            error = iPCM16DecFormatIntfc->SetObserver(*this);
   733                 error = iPCM16DecFormatIntfc->SetObserver(*this);
   815 		            iDnLinkCodec = EPCM16;
   734                 iDnLinkCodec = EPCM16;
   816 
   735 
   817 		            iLog->Log(_L("PCM16 DNL Codec Set: error = %d"), error);
   736                 iLog->Log(_L("PCM16 DNL Codec Set: error = %d"), error);
   818         		}
   737                 }
   819         	else
   738             else
   820                 {
   739                 {
   821                 iLog->Log(_L("DNL Codec Setting Failed: error = %d"), error);
   740                 iLog->Log(_L("DNL Codec Setting Failed: error = %d"), error);
   822                 }
   741                 }
   823         	}
   742             }
       
   743         else if (decoderType == KTagNULL)
       
   744             {
       
   745             error = iVoIPDnlink->SetFormat(ENULL, formatIntfc);
       
   746             iLog->Log(_L("NULL DNL Codec Set: error = %d"), error);
       
   747             }
   824         else
   748         else
   825         	{
   749             {
   826             iLog->Log(KMsgBadTestParameters);
   750             iLog->Log(KMsgBadTestParameters);
   827             error = KErrBadTestParameter;
   751             error = KErrBadTestParameter;
   828             return error;
   752             return error;
   829         	}
   753             }
   830     	}
   754         }
   831 
   755 
       
   756     return error;
       
   757     }
       
   758 
       
   759 TInt CVoIPAudioServicesTestClass::OpenDownlink(CStifItemParser& aItem)
       
   760     {
       
   761     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::OpenDownlink")));
       
   762     iLog->Log(_L("CVoIPAudioServicesTestClass::OpenDownlink"));
       
   763     TInt error = KErrNone;
       
   764 
       
   765     TPtrC bufType;
       
   766     error = aItem.GetNextString(bufType);
   832     if (error == KErrNone)
   767     if (error == KErrNone)
   833         {
   768         {
   834         delete iPlayBuf;
   769         delete iPlayBuf;
   835         iPlayBuf = NULL;
   770         iPlayBuf = NULL;
   836 
       
   837 #ifdef __JITTER_BUFFER_TEST__
       
   838         iPlayJBuf = NULL;
   771         iPlayJBuf = NULL;
   839         if (iDnLinkCodec != EPCM16)
   772 
   840             {
   773         if (bufType == KTagJbBuf)
   841             iFactory->CreateBuffer(iPlayBuf,
   774             {
   842                                    CVoIPDataBuffer::EJitterBuffer,
   775             error = iFactory->CreateBuffer(iPlayBuf,
   843                                    iDnLinkCodec);
   776                     CVoIPDataBuffer::EJitterBuffer, iDnLinkCodec);
   844             iPlayJBuf = static_cast<CVoIPJBDataBuffer*>(iPlayBuf);
   777             iPlayJBuf = static_cast<CVoIPJBDataBuffer*> (iPlayBuf);
   845             }
   778             }
   846 #else  //__JITTER_BUFFER_TEST__
   779         else
   847         iFactory->CreateBuffer(iPlayBuf,
   780             {
   848                                CVoIPDataBuffer::EStandard,
   781             error = iFactory->CreateBuffer(iPlayBuf,
   849                                iDnLinkCodec);
   782                     CVoIPDataBuffer::EStandard, iDnLinkCodec);
   850 #endif //__JITTER_BUFFER_TEST__
   783             }
   851         }
   784         }
   852 
   785 
   853     return error;
   786     if (iDnLinkStatus == ENotReady && error == KErrNone)
   854 }
   787         {
   855 
   788         error = iVoIPDnlink->Open(*this);
   856 
   789         if (error == KErrNone)
   857 TInt CVoIPAudioServicesTestClass::OpenDownlink(CStifItemParser& /*aItem */ )
   790             {
   858 {
   791             iDnLinkStatus = EReady;
   859     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::OpenDownlink")));
   792             AddExpectedEvent(EOpenDownlinkComplete, KShortTimeout);
   860     iLog->Log(_L("CVoIPAudioServicesTestClass::OpenDownlink"));
   793             }
   861     TInt error = KErrNone;
   794         else
   862 
   795             {
   863     if (iDnLinkStatus == ENotReady)
       
   864     	{
       
   865     	error = iVoIPDnlink->Open(*this);
       
   866     	if (error != KErrNone)
       
   867     		{
       
   868             iLog->Log(_L("DNL open error: error = %d"), error);
   796             iLog->Log(_L("DNL open error: error = %d"), error);
   869     		}
   797             }
   870     	else
   798         }
   871     		{
       
   872       		iDnLinkStatus = EReady;
       
   873             AddExpectedEvent(EOpenDownlinkComplete, KMediumTimeout);
       
   874     		}
       
   875     	}
       
   876     else
   799     else
   877     	{
   800         {
   878     	iLog->Log(_L("DNL already open: error = %d"), KErrInUse);
   801         iLog->Log(_L("DNL open error = %d"), error);
   879     	}
   802         }
   880 
   803 
   881   return error;
   804     return error;
   882 }
   805     }
   883 
   806 
   884 
   807 TInt CVoIPAudioServicesTestClass::SetUplinkFormat(CStifItemParser& aItem)
   885 TInt CVoIPAudioServicesTestClass::SetUplinkFormat( CStifItemParser& aItem )
   808     {
   886 {
       
   887     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::SetUplinkFormat")));
   809     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::SetUplinkFormat")));
   888     iLog->Log(_L("CVoIPAudioServicesTestClass::SetUplinkFormat"));
   810     iLog->Log(_L("CVoIPAudioServicesTestClass::SetUplinkFormat"));
   889     TInt error = KErrNone;
   811     TInt error = KErrNone;
   890 
   812 
   891     TPtrC encoderType;
   813     TPtrC encoderType;
   892     error = aItem.GetNextString(encoderType);
   814     error = aItem.GetNextString(encoderType);
   893     if (error == KErrNone)
   815     if (error == KErrNone)
   894     	{
   816         {
   895         CVoIPFormatIntfc* formatIntfc = NULL;
   817         CVoIPFormatIntfc* formatIntfc = NULL;
   896         if (encoderType == KTagG711)
   818         if (encoderType == KTagG711)
   897         	{
   819             {
   898 		    // NOTE: We can now set either 10ms or 20ms G.711 frame;
   820             error = iVoIPUplink->SetFormat(EG711, formatIntfc);
   899 		    //	 	 call GetSupportedDownlinkFormats() to see if it
   821             if (error == KErrNone)
   900 		    //		 returns EG711 or EG711_10MS and set codec accordingly.
   822                 {
   901         	error = iVoIPUplink->SetFormat(EG711, formatIntfc);
       
   902         	if (error == KErrNone)
       
   903         		{
       
   904                 if (iG711EncFormatIntfc)
   823                 if (iG711EncFormatIntfc)
   905 		            {
   824                     {
   906 		            delete iG711EncFormatIntfc;
   825                     delete iG711EncFormatIntfc;
   907 		            iG711EncFormatIntfc = NULL;
   826                     iG711EncFormatIntfc = NULL;
   908 		            }
   827                     }
   909 
   828 
   910                 iG711EncFormatIntfc = (CVoIPG711EncoderIntfc*)formatIntfc;
   829                 iG711EncFormatIntfc = (CVoIPG711EncoderIntfc*) formatIntfc;
   911                 error = iG711EncFormatIntfc->SetObserver(*this);
   830                 error = iG711EncFormatIntfc->SetObserver(*this);
   912                 iUpLinkCodec = EG711;
   831                 iUpLinkCodec = EG711;
   913 
   832 
   914                 iLog->Log(_L("G.711 UPL Codec Set: error = %d"), error);
   833                 iLog->Log(_L("G.711 UPL Codec Set: error = %d"), error);
   915         		}
   834                 }
   916         	else
   835             else
   917                 {
   836                 {
   918                 iLog->Log(_L("UPL Codec Setting Failed: error = %d"), error);
   837                 iLog->Log(_L("UPL Codec Setting Failed: error = %d"), error);
   919                 }
   838                 }
   920         	}
   839             }
       
   840         else if (encoderType == KTagG711_10MS)
       
   841             {
       
   842             error = iVoIPUplink->SetFormat(EG711_10MS, formatIntfc);
       
   843             if (error == KErrNone)
       
   844                 {
       
   845                 if (iG711EncFormatIntfc)
       
   846                     {
       
   847                     delete iG711EncFormatIntfc;
       
   848                     iG711EncFormatIntfc = NULL;
       
   849                     }
       
   850 
       
   851                 iG711EncFormatIntfc = (CVoIPG711EncoderIntfc*) formatIntfc;
       
   852                 error = iG711EncFormatIntfc->SetObserver(*this);
       
   853                 iUpLinkCodec = EG711_10MS;
       
   854                 iLog->Log(_L("G.711 10ms UPL Codec Set: error = %d"), error);
       
   855                 }
       
   856             else
       
   857                 {
       
   858                 iLog->Log(_L("UPL Codec Setting Failed: error = %d"), error);
       
   859                 }
       
   860             }
   921         else if (encoderType == KTagG729)
   861         else if (encoderType == KTagG729)
   922         	{
   862             {
   923         	error = iVoIPUplink->SetFormat(EG729, formatIntfc);
   863             error = iVoIPUplink->SetFormat(EG729, formatIntfc);
   924         	if (error == KErrNone)
   864             if (error == KErrNone)
   925         		{
   865                 {
   926                 if (iG729EncFormatIntfc)
   866                 if (iG729EncFormatIntfc)
   927 		            {
   867                     {
   928 		            delete iG729EncFormatIntfc;
   868                     delete iG729EncFormatIntfc;
   929 		            iG729EncFormatIntfc = NULL;
   869                     iG729EncFormatIntfc = NULL;
   930 		            }
   870                     }
   931 
   871 
   932                 iG729EncFormatIntfc = formatIntfc;
   872                 iG729EncFormatIntfc = formatIntfc;
   933                 error = iG729EncFormatIntfc->SetObserver(*this);
   873                 error = iG729EncFormatIntfc->SetObserver(*this);
   934                 iUpLinkCodec = EG729;
   874                 iUpLinkCodec = EG729;
   935 
   875 
   936                 iLog->Log(_L("G.729 UPL Codec Set: error = %d"), error);
   876                 iLog->Log(_L("G.729 UPL Codec Set: error = %d"), error);
   937         		}
   877                 }
   938         	else
   878             else
   939                 {
   879                 {
   940                 iLog->Log(_L("UPL Codec Setting Failed: error = %d"), error);
   880                 iLog->Log(_L("UPL Codec Setting Failed: error = %d"), error);
   941                 }
   881                 }
   942         	}
   882             }
   943         else if (encoderType == KTagILBC)
   883         else if (encoderType == KTagILBC)
   944         	{
   884             {
   945         	error = iVoIPUplink->SetFormat(EILBC, formatIntfc);
   885             error = iVoIPUplink->SetFormat(EILBC, formatIntfc);
   946         	if (error == KErrNone)
   886             if (error == KErrNone)
   947         		{
   887                 {
   948         		if (iILBCEncFormatIntfc)
   888                 if (iILBCEncFormatIntfc)
   949 		            {
   889                     {
   950 		            delete iILBCEncFormatIntfc;
   890                     delete iILBCEncFormatIntfc;
   951 		            iILBCEncFormatIntfc = NULL;
   891                     iILBCEncFormatIntfc = NULL;
   952 		            }
   892                     }
   953 
   893 
   954         		iILBCEncFormatIntfc = (CVoIPILBCEncoderIntfc*)formatIntfc;
   894                 iILBCEncFormatIntfc = (CVoIPILBCEncoderIntfc*) formatIntfc;
   955         		error = iILBCEncFormatIntfc->SetObserver(*this);
   895                 error = iILBCEncFormatIntfc->SetObserver(*this);
   956         		iUpLinkCodec = EILBC;
   896                 iUpLinkCodec = EILBC;
   957 
   897 
   958         		iLog->Log(_L("iLBC UPL Codec Set: error = %d"), error);
   898                 iLog->Log(_L("iLBC UPL Codec Set: error = %d"), error);
   959         		}
   899                 }
   960         	else
   900             else
   961                 {
   901                 {
   962                 iLog->Log(_L("UPL Codec Setting Failed: error = %d"), error);
   902                 iLog->Log(_L("UPL Codec Setting Failed: error = %d"), error);
   963                 }
   903                 }
   964         	}
   904             }
   965         else if (encoderType == KTagAMRNB)
   905         else if (encoderType == KTagAMRNB)
   966         	{
   906             {
   967         	error = iVoIPUplink->SetFormat(EAMR_NB, formatIntfc);
   907             error = iVoIPUplink->SetFormat(EAMR_NB, formatIntfc);
   968         	if (error == KErrNone)
   908             if (error == KErrNone)
   969         		{
   909                 {
   970                 if (iAMRNBEncFormatIntfc)
   910                 if (iAMRNBEncFormatIntfc)
   971 		            {
   911                     {
   972 		            delete iAMRNBEncFormatIntfc;
   912                     delete iAMRNBEncFormatIntfc;
   973 		            iAMRNBEncFormatIntfc = NULL;
   913                     iAMRNBEncFormatIntfc = NULL;
   974 		            }
   914                     }
   975 
   915 
   976                 iAMRNBEncFormatIntfc = formatIntfc;
   916                 iAMRNBEncFormatIntfc = formatIntfc;
   977                 error = iAMRNBEncFormatIntfc->SetObserver(*this);
   917                 error = iAMRNBEncFormatIntfc->SetObserver(*this);
   978                 iUpLinkCodec = EAMR_NB;
   918                 iUpLinkCodec = EAMR_NB;
   979 
   919 
   980                 iLog->Log(_L("AMR-NB UPL Codec Set: error = %d"), error);
   920                 iLog->Log(_L("AMR-NB UPL Codec Set: error = %d"), error);
   981         		}
   921                 }
   982         	else
   922             else
   983                 {
   923                 {
   984                 iLog->Log(_L("UPL Codec Setting Failed: error = %d"), error);
   924                 iLog->Log(_L("UPL Codec Setting Failed: error = %d"), error);
   985                 }
   925                 }
   986         	}
   926             }
   987         else if (encoderType == KTagPCM16)
   927         else if (encoderType == KTagPCM16)
   988         	{
   928             {
   989         	error = iVoIPUplink->SetFormat(EPCM16, formatIntfc);
   929             error = iVoIPUplink->SetFormat(EPCM16, formatIntfc);
   990         	if (error == KErrNone)
   930             if (error == KErrNone)
   991         		{
   931                 {
   992                 if (iPCM16EncFormatIntfc)
   932                 if (iPCM16EncFormatIntfc)
   993 		            {
   933                     {
   994 		            delete iPCM16EncFormatIntfc;
   934                     delete iPCM16EncFormatIntfc;
   995 		            iPCM16EncFormatIntfc = NULL;
   935                     iPCM16EncFormatIntfc = NULL;
   996 		            }
   936                     }
   997 
   937 
   998                 iPCM16EncFormatIntfc = formatIntfc;
   938                 iPCM16EncFormatIntfc = formatIntfc;
   999                 error = iPCM16EncFormatIntfc->SetObserver(*this);
   939                 error = iPCM16EncFormatIntfc->SetObserver(*this);
  1000                 iUpLinkCodec = EPCM16;
   940                 iUpLinkCodec = EPCM16;
  1001 
   941 
  1002                 iLog->Log(_L("PCM16 UPL Codec Set: error = %d"), error);
   942                 iLog->Log(_L("PCM16 UPL Codec Set: error = %d"), error);
  1003         		}
   943                 }
  1004         	else
   944             else
  1005                 {
   945                 {
  1006                 iLog->Log(_L("UPL Codec Setting Failed: error = %d"), error);
   946                 iLog->Log(_L("UPL Codec Setting Failed: error = %d"), error);
  1007                 }
   947                 }
  1008         	}
   948             }
       
   949         else if (encoderType == KTagNULL)
       
   950             {
       
   951             error = iVoIPUplink->SetFormat(ENULL, formatIntfc);
       
   952             iLog->Log(_L("NULL UPL Codec Set: error = %d"), error);
       
   953             }
  1009         else
   954         else
  1010         	{
   955             {
  1011             iLog->Log(KMsgBadTestParameters);
   956             iLog->Log(KMsgBadTestParameters);
  1012             error = KErrBadTestParameter;
   957             error = KErrBadTestParameter;
  1013             return error;
   958             return error;
  1014         	}
   959             }
  1015     	}
   960         }
  1016 
   961 
  1017         iFactory->CreateBuffer(iRecBuf,
   962     iFactory->CreateBuffer(iRecBuf, CVoIPDataBuffer::EStandard, iUpLinkCodec);
  1018         											 CVoIPDataBuffer::EStandard,
   963     return error;
  1019                                iUpLinkCodec);
   964     }
  1020                                
   965 
  1021     return error;
   966 TInt CVoIPAudioServicesTestClass::OpenUplink(CStifItemParser& /*aItem */)
  1022 }
   967     {
  1023 
       
  1024 
       
  1025 
       
  1026 TInt CVoIPAudioServicesTestClass::OpenUplink(CStifItemParser& /*aItem */ )
       
  1027 {
       
  1028     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::OpenUplink")));
   968     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::OpenUplink")));
  1029     iLog->Log(_L("CVoIPAudioServicesTestClass::OpenUplink"));
   969     iLog->Log(_L("CVoIPAudioServicesTestClass::OpenUplink"));
  1030     TInt error = KErrNone;
   970     TInt error = KErrNone;
  1031 
   971 
  1032     if (iUpLinkStatus == ENotReady)
   972     if (iUpLinkStatus == ENotReady)
  1033     	{
   973         {
  1034     	error = iVoIPUplink->Open(*this);
   974         error = iVoIPUplink->Open(*this);
  1035     	if (error != KErrNone)
   975         if (error != KErrNone)
  1036     		{
   976             {
  1037             iLog->Log(_L("UPL open error: error = %d"), error);
   977             iLog->Log(_L("UPL open error: error = %d"), error);
  1038     		}
   978             }
  1039     	else
   979         else
  1040     		{
   980             {
  1041             AddExpectedEvent(EOpenUplinkComplete, KMediumTimeout);
   981             AddExpectedEvent(EOpenUplinkComplete, KShortTimeout);
  1042             iUpLinkStatus = EReady;
   982             iUpLinkStatus = EReady;
  1043     		}
   983             }
  1044     	}
   984         }
  1045     else
   985     else
  1046     	{
   986         {
  1047     	iLog->Log(_L("UPL already open: error = %d"), KErrInUse);
   987         iLog->Log(_L("UPL already open: error = %d"), KErrInUse);
  1048     	}
   988         }
  1049 
   989 
  1050     return error;
   990     return error;
  1051 }
   991     }
  1052 
   992 
  1053 // ----------------------------------------------------------------------------
   993 // ----------------------------------------------------------------------------
  1054 // CVoIPAudioServicesTestClass::DisplayFormat
   994 // CVoIPAudioServicesTestClass::DisplayFormat
  1055 //
   995 //
  1056 // ----------------------------------------------------------------------------
   996 // ----------------------------------------------------------------------------
  1057 //
   997 //
  1058 void CVoIPAudioServicesTestClass::DisplayFormat(TVoIPCodecFormat aFormat)
   998 void CVoIPAudioServicesTestClass::DisplayFormat(TVoIPCodecFormat aFormat)
  1059 {
   999     {
  1060     if (aFormat == EAMR_NB)
  1000     if (aFormat == EAMR_NB)
  1061         {
  1001         {
  1062         iLog->Log(_L("AMR-NB"));
  1002         iLog->Log(_L("AMR-NB"));
  1063         }
  1003         }
  1064     else if (aFormat == EG711)
  1004     else if (aFormat == EG711)
  1075         }
  1015         }
  1076     else if (aFormat == EPCM16)
  1016     else if (aFormat == EPCM16)
  1077         {
  1017         {
  1078         iLog->Log(_L("PCM-16"));
  1018         iLog->Log(_L("PCM-16"));
  1079         }
  1019         }
  1080 }
  1020     }
  1081 
  1021 
  1082 
  1022 TInt CVoIPAudioServicesTestClass::Close(CStifItemParser& aItem)
  1083 TInt CVoIPAudioServicesTestClass::Close(CStifItemParser& aItem  )
  1023     {
  1084 {
       
  1085     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::Close")));
  1024     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::Close")));
  1086     iLog->Log(_L("CVoIPAudioServicesTestClass::Close"));
  1025     iLog->Log(_L("CVoIPAudioServicesTestClass::Close"));
  1087     TInt error = KErrNone;
  1026     TInt error = KErrNone;
  1088 
  1027     iLoopPlay = EFalse;
  1089     TPtrC closeType;
  1028     TPtrC closeType;
  1090     error = aItem.GetNextString(closeType);
  1029     error = aItem.GetNextString(closeType);
  1091     if (error == KErrNone)
  1030     if (error == KErrNone)
  1092     	{
  1031         {
  1093         if (closeType == KTagUplink)
  1032         if (closeType == KTagUplink)
  1094         	{
  1033             {
  1095 	    	iRecBufPtr.Set(NULL, 0, 0);
  1034             iRecBufPtr.Set(NULL, 0, 0);
  1096 	        iRecBufReady = EFalse;
  1035             iRecBufReady = EFalse;
  1097 	        iUpLinkCodec = ENULL;
  1036             iUpLinkCodec = ENULL;
  1098 	        iVoIPUplink->Close();
  1037             iVoIPUplink->Close();
  1099 	        iUpLinkStatus = ENotReady;
  1038             iUpLinkStatus = ENotReady;
  1100 	        iLog->Log(_L("Close Uplink"));
  1039             iLog->Log(_L("Close Uplink"));
  1101 	        AddExpectedEvent(EUplinkClosed, KMediumTimeout);
  1040             AddExpectedEvent(EUplinkClosed, KShortTimeout);
  1102         	}
  1041             }
  1103 	    else if (closeType == KTagDnlink)
  1042         else if (closeType == KTagDnlink)
  1104 	    	{
  1043             {
  1105 	    	iPlayBufPtr.Set(NULL, 0, 0);
  1044             iPlayBufPtr.Set(NULL, 0, 0);
  1106 	        iVoIPDnlink->Close();
  1045             iVoIPDnlink->Close();
  1107 	        iDnLinkStatus = ENotReady;
  1046             iDnLinkStatus = ENotReady;
  1108 	        iPlayBufReady = EFalse;
  1047             iPlayBufReady = EFalse;
  1109 	        iDnLinkCodec = ENULL;
  1048             iDnLinkCodec = ENULL;
  1110 	        iLog->Log(_L("Close Dnlink"));
  1049             iLog->Log(_L("Close Dnlink"));
  1111 	        AddExpectedEvent(EDownlinkClosed, KMediumTimeout);
  1050             AddExpectedEvent(EDownlinkClosed, KShortTimeout);
  1112 		    }
  1051             }
  1113 		else
  1052         else
  1114 		    {
  1053             {
  1115 		    iLog->Log(KMsgBadTestParameters);
  1054             iLog->Log(KMsgBadTestParameters);
  1116 		    error = KErrBadTestParameter;
  1055             error = KErrBadTestParameter;
  1117 		    }
  1056             }
  1118     	}
  1057         }
  1119 
  1058 
  1120     return error;
  1059     return error;
  1121 }
  1060     }
  1122 
  1061 
  1123 
  1062 TInt CVoIPAudioServicesTestClass::Start(CStifItemParser& aItem)
  1124 TInt CVoIPAudioServicesTestClass::Start(CStifItemParser& aItem  )
  1063     {
  1125 {
       
  1126     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::Start")));
  1064     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::Start")));
  1127     iLog->Log(_L("CVoIPAudioServicesTestClass::Start"));
  1065     iLog->Log(_L("CVoIPAudioServicesTestClass::Start"));
  1128     TInt error = KErrNone;
  1066     TInt error = KErrNone;
  1129 
  1067 
  1130     TPtrC startType;
  1068     TPtrC startType;
  1131     error = aItem.GetNextString(startType);
  1069     error = aItem.GetNextString(startType);
  1132     if (error == KErrNone)
  1070     if (error == KErrNone)
  1133     	{
  1071         {
  1134         if (startType == KTagUplink)
  1072         if (startType == KTagUplink)
  1135         	{
  1073             {
  1136         	if (iUpLinkStatus == EReady)
  1074             if (iUpLinkStatus == EReady)
  1137         		{
  1075                 {
  1138 	            iVoIPUplink->Start();
  1076                 iVoIPUplink->Start();
  1139 	            iUpLinkStatus = EStreaming;
  1077                 iUpLinkStatus = EStreaming;
  1140 	            iLog->Log(_L("Start Uplink"));
  1078                 iRecCounter = 0;
  1141 	            AddExpectedEvent(EEmptyBuffer, KMediumTimeout);
  1079                 iLog->Log(_L("Start Uplink"));
  1142         		}
  1080                 }
  1143 
  1081             else
  1144         	else
  1082                 {
  1145         		{
  1083                 iLog->Log(_L("UPL not ready"));
  1146 	            iLog->Log(_L("UPL not ready"));
  1084                 error = KErrNotReady;
  1147 	            error = KErrNotReady;
  1085                 }
  1148         		}
  1086             }
  1149         	}
       
  1150         else if (startType == KTagDnlink)
  1087         else if (startType == KTagDnlink)
  1151         	{
  1088             {
  1152         	if (iDnLinkStatus == EReady)
  1089             if (iDnLinkStatus == EReady)
  1153         		{
  1090                 {
  1154 	            iVoIPDnlink->Start();
  1091                 iVoIPDnlink->Start();
  1155 	            iDnLinkStatus = EStreaming;
  1092                 iDnLinkStatus = EStreaming;
  1156 	            iLog->Log(_L("Start Dnlink"));
  1093                 iPlayCounter = 0;
  1157 	            AddExpectedEvent(EFillBuffer, KMediumTimeout);
  1094                 iLog->Log(_L("Start Dnlink"));
  1158         		}
  1095                 }
  1159 
  1096             else
  1160         	else
  1097                 {
  1161         		{
  1098                 iLog->Log(_L("DNL not ready"));
  1162 	            iLog->Log(_L("DNL not ready"));
  1099                 error = KErrNotReady;
  1163 	            error = KErrNotReady;
  1100                 }
  1164         		}
  1101             }
  1165         	}
       
  1166         else
  1102         else
  1167         	{
  1103             {
  1168         	iLog->Log(KMsgBadTestParameters);
  1104             iLog->Log(KMsgBadTestParameters);
  1169             error = KErrBadTestParameter;
  1105             error = KErrBadTestParameter;
  1170         	}
  1106             }
  1171     	}
  1107         }
  1172 
  1108 
  1173     return error;
  1109     return error;
  1174 }
  1110     }
  1175 
  1111 
  1176 
  1112 TInt CVoIPAudioServicesTestClass::Stop(CStifItemParser& aItem)
  1177 TInt CVoIPAudioServicesTestClass::Stop(CStifItemParser& aItem  )
  1113     {
  1178 {
       
  1179     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::Stop")));
  1114     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::Stop")));
  1180     iLog->Log(_L("CVoIPAudioServicesTestClass::Stop"));
  1115     iLog->Log(_L("CVoIPAudioServicesTestClass::Stop"));
  1181     TInt error = KErrNone;
  1116     TInt error = KErrNone;
  1182 
  1117 
  1183     TPtrC stopType;
  1118     TPtrC stopType;
  1184     error = aItem.GetNextString(stopType);
  1119     error = aItem.GetNextString(stopType);
  1185     if (error == KErrNone)
  1120     if (error == KErrNone)
  1186     	{
  1121         {
  1187         if (stopType == KTagUplink)
  1122         if (stopType == KTagUplink)
  1188         	{
  1123             {
  1189         	if (iUpLinkStatus == EStreaming)
  1124             if (iUpLinkStatus == EStreaming)
  1190         		{
  1125                 {
  1191 	            iVoIPUplink->Stop();
  1126                 iVoIPUplink->Stop();
  1192 	            iUpLinkStatus = EReady;
  1127                 iUpLinkStatus = EReady;
  1193 	            iLog->Log(_L("Stop Uplink"));
  1128                 iLog->Log(_L("Stop Uplink"));
  1194         		}
  1129                 }
  1195         	else
  1130             else
  1196         		{
  1131                 {
  1197 	            iLog->Log(_L("UPL not started"));
  1132                 iLog->Log(_L("UPL not started"));
  1198 	            error = KErrNotReady;
  1133                 error = KErrNotReady;
  1199         		}
  1134                 }
  1200         	}
  1135             }
  1201         else if (stopType == KTagDnlink)
  1136         else if (stopType == KTagDnlink)
  1202         	{
  1137             {
  1203         	if (iDnLinkStatus == EStreaming)
  1138             if (iDnLinkStatus == EStreaming)
  1204         		{
  1139                 {
  1205 	            iVoIPDnlink->Stop();
  1140                 iVoIPDnlink->Stop();
  1206 	            iDnLinkStatus = EReady;
  1141                 iDnLinkStatus = EReady;
  1207 	            iLog->Log(_L("Stop Dnlink"));
  1142                 iLog->Log(_L("Stop Dnlink"));
  1208         		}
  1143                 }
  1209         	else
  1144             else
  1210         		{
  1145                 {
  1211         		iLog->Log(_L("DNL not started"));
  1146                 iLog->Log(_L("DNL not started"));
  1212         		error = KErrNotReady;
  1147                 error = KErrNotReady;
  1213         		}
  1148                 }
  1214         	}
  1149             }
  1215         else
  1150         else
  1216         	{
  1151             {
  1217         	iLog->Log(KMsgBadTestParameters);
  1152             iLog->Log(KMsgBadTestParameters);
  1218             error = KErrBadTestParameter;
  1153             error = KErrBadTestParameter;
  1219         	}
  1154             }
  1220     	}
  1155         }
  1221 
  1156 
  1222     return error;
  1157     return error;
  1223 }
  1158     }
  1224 
  1159 
  1225 
  1160 TInt CVoIPAudioServicesTestClass::Gain(CStifItemParser& /*aItem */)
  1226 TInt CVoIPAudioServicesTestClass::Gain(CStifItemParser& /*aItem */ )
  1161     {
  1227 {
       
  1228     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::Gain")));
  1162     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::Gain")));
  1229     iLog->Log(_L("CVoIPAudioServicesTestClass::Gain"));
  1163     iLog->Log(_L("CVoIPAudioServicesTestClass::Gain"));
  1230     TInt error = KErrNone;
  1164     TInt error = KErrNone;
  1231 
  1165 
  1232     iVoIPUplink->GetMaxGain(iMaxGain);
  1166     iVoIPUplink->GetMaxGain(iMaxGain);
  1233     iVoIPUplink->SetGain(iMaxGain);
  1167     iVoIPUplink->SetGain(iMaxGain);
  1234     iLog->Log(_L("SetMaxGain: %d"), iMaxGain);
  1168     iLog->Log(_L("SetMaxGain: %d"), iMaxGain);
  1235     iVoIPUplink->GetGain(iGain);
  1169     iVoIPUplink->GetGain(iGain);
  1236     if (iGain != iMaxGain)
  1170     if (iGain != iMaxGain)
  1237     	{
  1171         {
  1238         iLog->Log(_L("GetGain doesn't return expected MaxGain!!! returned Gain = %d"), iGain);
  1172         iLog->Log(_L("GetGain doesn't return expected MaxGain!!! returned Gain = %d"),
       
  1173                 iGain);
  1239         return KErrUnexpectedValue;
  1174         return KErrUnexpectedValue;
  1240     	}
  1175         }
  1241 
  1176 
  1242     iVoIPUplink->SetGain(0);
  1177     iVoIPUplink->SetGain(0);
  1243     iLog->Log(_L("MuteMic"));
  1178     iLog->Log(_L("MuteMic"));
  1244     iVoIPUplink->GetGain(iGain);
  1179     iVoIPUplink->GetGain(iGain);
  1245 
  1180 
  1246     if (iGain != 0)
  1181     if (iGain != 0)
  1247     	{
  1182         {
  1248         iLog->Log(_L("GetGain does not return expected Mute value!!! returned Gain = %d"), iGain);
  1183         iLog->Log(_L("GetGain does not return expected Mute value!!! returned Gain = %d"),
       
  1184                 iGain);
  1249         return KErrUnexpectedValue;
  1185         return KErrUnexpectedValue;
  1250     	}
  1186         }
  1251 
  1187 
  1252   return error;
  1188     return error;
  1253 }
  1189     }
  1254 
  1190 
  1255 
  1191 TInt CVoIPAudioServicesTestClass::Volume(CStifItemParser& /*aItem */)
  1256 TInt CVoIPAudioServicesTestClass::Volume(CStifItemParser& /*aItem */ )
  1192     {
  1257 {
       
  1258     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::Volume")));
  1193     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::Volume")));
  1259     iLog->Log(_L("CVoIPAudioServicesTestClass::Volume"));
  1194     iLog->Log(_L("CVoIPAudioServicesTestClass::Volume"));
  1260     TInt error = KErrNone;
  1195     TInt error = KErrNone;
  1261 
  1196 
  1262     iVoIPDnlink->GetMaxVolume(iMaxVolume);
  1197     iVoIPDnlink->GetMaxVolume(iMaxVolume);
  1263     iVoIPDnlink->SetVolume(iMaxVolume);
  1198     iVoIPDnlink->SetVolume(iMaxVolume);
  1264     iLog->Log(_L("SetMaxVolume: %d"), iMaxVolume);
  1199     iLog->Log(_L("SetMaxVolume: %d"), iMaxVolume);
  1265     iVoIPDnlink->GetVolume(iVolume);
  1200     iVoIPDnlink->GetVolume(iVolume);
  1266     if (iVolume != iMaxVolume)
  1201     if (iVolume != iMaxVolume)
  1267     	{
  1202         {
  1268         iLog->Log(_L("GetVolume doesn't return expected MaxVolume!!! returned Volume = %d"), iVolume);
  1203         iLog->Log(_L("GetVolume doesn't return expected MaxVolume!!! returned Volume = %d"),
       
  1204                 iVolume);
  1269         return KErrUnexpectedValue;
  1205         return KErrUnexpectedValue;
  1270     	}
  1206         }
  1271 
  1207 
  1272     iVoIPDnlink->SetVolume(0);
  1208     iVoIPDnlink->SetVolume(0);
  1273     iLog->Log(_L("Mute Volume"));
  1209     iLog->Log(_L("Mute Volume"));
  1274     iVoIPDnlink->GetVolume(iVolume);
  1210     iVoIPDnlink->GetVolume(iVolume);
  1275 
  1211 
  1276     if (iVolume != 0)
  1212     if (iVolume != 0)
  1277     	{
  1213         {
  1278         iLog->Log(_L("GetVolume does not return expected Mute value!!! returned Volume = %d"), iVolume);
  1214         iLog->Log(_L("GetVolume does not return expected Mute value!!! returned Volume = %d"),
       
  1215                 iVolume);
  1279         return KErrUnexpectedValue;
  1216         return KErrUnexpectedValue;
  1280     	}
  1217         }
  1281 
  1218 
  1282   return error;
  1219     return error;
  1283 }
  1220     }
  1284 
  1221 
  1285 
  1222 TInt CVoIPAudioServicesTestClass::SetDevice(CStifItemParser& aItem)
  1286 
  1223     {
  1287 TInt CVoIPAudioServicesTestClass::SetDevice(CStifItemParser& aItem  )
       
  1288 {
       
  1289     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::SetDevice")));
  1224     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::SetDevice")));
  1290     iLog->Log(_L("CVoIPAudioServicesTestClass::SetDevice"));
  1225     iLog->Log(_L("CVoIPAudioServicesTestClass::SetDevice"));
  1291     TInt error = KErrNone;
  1226     TInt error = KErrNone;
  1292 
  1227 
  1293     TPtrC deviceType;
  1228     TPtrC deviceType;
  1294     error = aItem.GetNextString(deviceType);
  1229     error = aItem.GetNextString(deviceType);
  1295     if (error == KErrNone)
  1230     if (error == KErrNone)
  1296     	{
  1231         {
  1297         if (deviceType == KTagHandset)
  1232         if (deviceType == KTagHandset)
  1298         	{
  1233             {
  1299         	iVoIPDnlink->SetAudioDevice(CVoIPAudioDownlinkStream::EHandset);
  1234             iVoIPDnlink->SetAudioDevice(CVoIPAudioDownlinkStream::EHandset);
  1300         	}
  1235             }
  1301         else if (deviceType == KTagLoudSpeaker)
  1236         else if (deviceType == KTagLoudSpeaker)
  1302         	{
  1237             {
  1303         	iVoIPDnlink->SetAudioDevice(CVoIPAudioDownlinkStream::ELoudSpeaker);
  1238             iVoIPDnlink->SetAudioDevice(
  1304         	}
  1239                     CVoIPAudioDownlinkStream::ELoudSpeaker);
       
  1240             }
  1305         else
  1241         else
  1306         	{
  1242             {
  1307             iLog->Log(KMsgBadTestParameters);
  1243             iLog->Log(KMsgBadTestParameters);
  1308             error = KErrBadTestParameter;
  1244             error = KErrBadTestParameter;
  1309             return error;
  1245             return error;
  1310         	}
  1246             }
  1311     	}
  1247         }
  1312 
  1248 
  1313     CVoIPAudioDownlinkStream::TVoIPOutputDevice device;
  1249     CVoIPAudioDownlinkStream::TVoIPOutputDevice device;
  1314     iVoIPDnlink->GetAudioDevice(device);
  1250     iVoIPDnlink->GetAudioDevice(device);
  1315     if ((device == CVoIPAudioDownlinkStream::EHandset) && (deviceType == KTagHandset))
  1251     if ((device == CVoIPAudioDownlinkStream::EHandset) &&
  1316     	{
  1252             (deviceType == KTagHandset))
       
  1253         {
  1317         iLog->Log(_L("Routing to Private Spkr"));
  1254         iLog->Log(_L("Routing to Private Spkr"));
  1318     	}
  1255         }
  1319     else if((device == CVoIPAudioDownlinkStream::ELoudSpeaker) && (deviceType == KTagLoudSpeaker))
  1256     else if ((device == CVoIPAudioDownlinkStream::ELoudSpeaker)
  1320     	{
  1257             && (deviceType == KTagLoudSpeaker))
       
  1258         {
  1321         iLog->Log(_L("Routing to Loudspeaker"));
  1259         iLog->Log(_L("Routing to Loudspeaker"));
  1322     	}
  1260         }
  1323     else
  1261     else
  1324     	{
  1262         {
  1325     	iLog->Log(_L("SetDevice failed"));
  1263         iLog->Log(_L("SetDevice failed"));
  1326     	}
  1264         }
  1327 
  1265 
  1328     return error;
  1266     return error;
  1329 }
  1267     }
  1330 
  1268 
  1331 
  1269 TInt CVoIPAudioServicesTestClass::InitDTMFTonePlayer(CStifItemParser& aItem)
  1332 TInt CVoIPAudioServicesTestClass::InitDTMFTonePlayer(CStifItemParser& aItem  )
  1270     {
  1333 {
       
  1334     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::InitDTMFTonePlayer")));
  1271     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::InitDTMFTonePlayer")));
  1335     iLog->Log(_L("CVoIPAudioServicesTestClass::InitDTMFTonePlayer"));
  1272     iLog->Log(_L("CVoIPAudioServicesTestClass::InitDTMFTonePlayer"));
  1336     TInt error = KErrNone;
  1273     TInt error = KErrNone;
  1337 
  1274 
  1338     TPtrC initLink;
  1275     TPtrC initLink;
  1339     error = aItem.GetNextString(initLink);
  1276     error = aItem.GetNextString(initLink);
  1340     if (error == KErrNone)
  1277     if (error == KErrNone)
  1341     	{
  1278         {
  1342         if (initLink == KTagDnlink)
  1279         if (initLink == KTagDnlink)
  1343         	{
  1280             {
  1344         	if (iDTMFTonePlayerDn && (iDnLinkStatus == EReady || iDnLinkStatus == EStreaming))
  1281             if (iDTMFTonePlayerDn && (iDnLinkStatus == EReady
  1345         		{
  1282                     || iDnLinkStatus == EStreaming))
  1346         		error = iDTMFTonePlayerDn->AddVoIPAudioDownlinkStream(*iVoIPDnlink);
  1283                 {
  1347 
  1284                 error = iDTMFTonePlayerDn->AddVoIPAudioDownlinkStream(
  1348         		if (error == KErrNone)
  1285                         *iVoIPDnlink);
  1349         			{
  1286 
  1350         			error = iDTMFTonePlayerDn->Open(*this); //sync call
  1287                 if (error == KErrNone)
  1351         			if (error == KErrNone)
  1288                     {
  1352         				{
  1289                     error = iDTMFTonePlayerDn->Open(*this); //sync call
  1353         				iLog->Log(_L("DTMF DNL Initialized: error = %d"), error);
  1290                     if (error == KErrNone)
  1354         				AddExpectedEvent(EOpenCompleteDNL, KMediumTimeout);
  1291                         {
  1355         				}
  1292                         iLog->Log(_L("DTMF DNL Initialized: error=%d"), error);
  1356         			}
  1293                         AddExpectedEvent(EOpenCompleteDNL, KShortTimeout);
  1357 
  1294                         }
  1358         		if (error != KErrNone)
  1295                     }
  1359         			{
  1296 
  1360         			iLog->Log(_L("DTMF DNL-PLR Error"), error);
  1297                 if (error != KErrNone)
  1361         			}
  1298                     {
  1362         		}
  1299                     iLog->Log(_L("DTMF DNL-PLR Error"), error);
  1363         	else
  1300                     }
  1364         		{
  1301                 }
  1365         		iLog->Log(_L("Open DNL first"), KErrNotFound);
  1302             else
  1366         		}
  1303                 {
  1367         	}
  1304                 error = iDTMFTonePlayerDn->AddVoIPAudioDownlinkStream(
       
  1305                         *iVoIPDnlink);
       
  1306                 iLog->Log(_L("Open NULL DNL"), error);
       
  1307                 }
       
  1308             }
  1368         else if (initLink == KTagUplink)
  1309         else if (initLink == KTagUplink)
  1369         	{
  1310             {
  1370         	if (iDTMFTonePlayerUp && (iUpLinkStatus == EReady || iUpLinkStatus == EStreaming))
  1311             if (iDTMFTonePlayerUp && (iUpLinkStatus == EReady
  1371         		{
  1312                     || iUpLinkStatus == EStreaming))
  1372         		error = iDTMFTonePlayerUp->AddVoIPAudioUplinkStream(*iVoIPUplink);
  1313                 {
  1373 
  1314                 error = iDTMFTonePlayerUp->AddVoIPAudioUplinkStream(
  1374         		if (error == KErrNone)
  1315                         *iVoIPUplink);
  1375         			{
  1316 
  1376         			error = iDTMFTonePlayerUp->Open(*this); //sync call
  1317                 if (error == KErrNone)
  1377         			if (error == KErrNone)
  1318                     {
  1378         				{
  1319                     error = iDTMFTonePlayerUp->Open(*this); //sync call
  1379 		                iLog->Log(_L("DTMF UPL Initialized: error = %d"), error);
  1320                     if (error == KErrNone)
  1380 		                AddExpectedEvent(EOpenCompleteUPL, KMediumTimeout);
  1321                         {
  1381 		                }
  1322                         iLog->Log(_L("DTMF UPL Initialized: error=%d"), error);
  1382         			}
  1323                         AddExpectedEvent(EOpenCompleteUPL, KShortTimeout);
  1383 
  1324                         }
  1384         		if (error != KErrNone)
  1325                     }
  1385         			{
  1326 
  1386         			iLog->Log(_L("DTMF UPL-PLR Error"), error);
  1327                 if (error != KErrNone)
  1387         			}
  1328                     {
  1388         		}
  1329                     iLog->Log(_L("DTMF UPL-PLR Error"), error);
  1389         	else
  1330                     }
  1390         		{
  1331                 }
  1391         		iLog->Log(_L("Open UPL first"), KErrNotFound);
  1332             else
  1392         		}
  1333                 {
  1393         	}
  1334                 error = iDTMFTonePlayerUp->AddVoIPAudioUplinkStream(
       
  1335                         *iVoIPUplink);
       
  1336                 iLog->Log(_L("Open NULL UPL"), error);
       
  1337                 }
       
  1338             }
  1394         else
  1339         else
  1395         	{
  1340             {
  1396         	iLog->Log(KMsgBadTestParameters);
  1341             iLog->Log(KMsgBadTestParameters);
  1397         	error = KErrBadTestParameter;
  1342             error = KErrBadTestParameter;
  1398             }
  1343             }
  1399     }
  1344         }
  1400 
  1345 
  1401     return error;
  1346     return error;
  1402 }
  1347     }
  1403 
  1348 
  1404 
  1349 TInt CVoIPAudioServicesTestClass::DTMFTonePlay(CStifItemParser& aItem)
  1405 
  1350     {
  1406 
       
  1407 TInt CVoIPAudioServicesTestClass::DTMFTonePlay(CStifItemParser& aItem  )
       
  1408 {
       
  1409     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::DTMFTonePlay")));
  1351     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::DTMFTonePlay")));
  1410     iLog->Log(_L("CVoIPAudioServicesTestClass::DTMFTonePlay"));
  1352     iLog->Log(_L("CVoIPAudioServicesTestClass::DTMFTonePlay"));
  1411     TInt error = KErrNone;
  1353     TInt error = KErrNone;
  1412 
  1354 
  1413     TPtrC initLink;
  1355     TPtrC initLink;
  1414     error = aItem.GetNextString(initLink);
  1356     error = aItem.GetNextString(initLink);
  1415     if (error == KErrNone)
  1357     if (error == KErrNone)
  1416     	{
  1358         {
  1417         if (initLink == KTagDnlink)
  1359         if (initLink == KTagDnlink)
  1418         	{
  1360             {
  1419         	if (iDTMFTonePlayerDn && (iDnLinkStatus == EReady || iDnLinkStatus == EStreaming))
  1361             if (iDTMFTonePlayerDn && (iDnLinkStatus == EReady
  1420         		{
  1362                     || iDnLinkStatus == EStreaming))
  1421 	            TChar tone1 = '0';
  1363                 {
  1422 	            TChar tone2 = '1';
  1364                 TChar tone1 = '0';
  1423 	            TChar tone3 = '2';
  1365                 TChar tone2 = '1';
  1424 	            TBufC<KTonesBufSize> tones;
  1366                 TChar tone3 = '2';
  1425 	            TPtr ptr = tones.Des();
  1367                 TBufC<KTonesBufSize> tones;
  1426 	            ptr.Append(tone1);
  1368                 TPtr ptr = tones.Des();
  1427 	            ptr.Append(tone2);
  1369                 ptr.Append(tone1);
  1428 	            ptr.Append(tone3);
  1370                 ptr.Append(tone2);
  1429 	            iDTMFTonePlayerDn->Play(ptr);
  1371                 ptr.Append(tone3);
  1430 	            iLog->Log(_L("Start to play DTMF"));
  1372                 iDTMFTonePlayerDn->Play(ptr);
  1431         		}
  1373                 iLog->Log(_L("Start to play DTMF"));
  1432             else
  1374                 }
  1433             	{
  1375             else
  1434             	iLog->Log(_L("Open DNL first"), KErrNotFound);
  1376                 {
  1435             	}
  1377                 iLog->Log(_L("Open DNL first"), KErrNotFound);
  1436         	}
  1378                 }
       
  1379             }
  1437         else if (initLink == KTagUplink)
  1380         else if (initLink == KTagUplink)
  1438         	{
  1381             {
  1439         	if (iDTMFTonePlayerUp && (iUpLinkStatus == EReady || iUpLinkStatus == EStreaming))
  1382             if (iDTMFTonePlayerUp && (iUpLinkStatus == EReady
  1440         		{
  1383                     || iUpLinkStatus == EStreaming))
  1441 	            TChar tone1 = '9';
  1384                 {
  1442 	            TChar tone2 = '8';
  1385                 TChar tone1 = '9';
  1443 	            TChar tone3 = '7';
  1386                 TChar tone2 = '8';
  1444 	            TBufC<KTonesBufSize> tones;
  1387                 TChar tone3 = '7';
  1445 	            TPtr ptr = tones.Des();
  1388                 TBufC<KTonesBufSize> tones;
  1446 	            ptr.Append(tone1);
  1389                 TPtr ptr = tones.Des();
  1447 	            ptr.Append(tone2);
  1390                 ptr.Append(tone1);
  1448 	            ptr.Append(tone3);
  1391                 ptr.Append(tone2);
  1449 
  1392                 ptr.Append(tone3);
  1450 	            iDTMFTonePlayerUp->Play(ptr);
  1393 
  1451 	            iLog->Log(_L("Start to play DTMF"));
  1394                 iDTMFTonePlayerUp->Play(ptr);
  1452         		}
  1395                 iLog->Log(_L("Start to play DTMF"));
  1453             else
  1396                 }
  1454 	            {
  1397             else
  1455 	            iLog->Log(_L("Open UPL first"), KErrNotFound);
  1398                 {
  1456 	            }
  1399                 iLog->Log(_L("Open UPL first"), KErrNotFound);
  1457         	}
  1400                 }
       
  1401             }
  1458         else
  1402         else
  1459         	{
  1403             {
  1460         	iLog->Log(KMsgBadTestParameters);
  1404             iLog->Log(KMsgBadTestParameters);
  1461         	error = KErrBadTestParameter;
  1405             error = KErrBadTestParameter;
  1462             }
  1406             }
  1463     }
  1407         }
  1464 
  1408 
  1465     return error;
  1409     return error;
  1466 }
  1410     }
  1467 
  1411 
  1468 
  1412 TInt CVoIPAudioServicesTestClass::CloseDTMFPlayer(CStifItemParser& aItem)
  1469 TInt CVoIPAudioServicesTestClass::CloseDTMFPlayer(CStifItemParser& aItem  )
  1413     {
  1470 {
       
  1471     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::CloseDTMFPlayer")));
  1414     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::CloseDTMFPlayer")));
  1472     iLog->Log(_L("CVoIPAudioServicesTestClass::CloseDTMFPlayer"));
  1415     iLog->Log(_L("CVoIPAudioServicesTestClass::CloseDTMFPlayer"));
  1473     TInt error = KErrNone;
  1416     TInt error = KErrNone;
  1474 
  1417 
  1475     TPtrC closedLink;
  1418     TPtrC closedLink;
  1476     error = aItem.GetNextString(closedLink);
  1419     error = aItem.GetNextString(closedLink);
  1477     if (error == KErrNone)
  1420     if (error == KErrNone)
  1478     	{
  1421         {
  1479         if (closedLink == KTagDnlink)
  1422         if (closedLink == KTagDnlink)
  1480         	{
  1423             {
  1481             if (iDTMFTonePlayerDn && (iDnLinkStatus == EReady || iDnLinkStatus == EStreaming))
  1424             if (iDTMFTonePlayerDn && (iDnLinkStatus == EReady ||
  1482             	{
  1425                     iDnLinkStatus == EStreaming))
       
  1426                 {
  1483                 iDTMFTonePlayerDn->Close();
  1427                 iDTMFTonePlayerDn->Close();
  1484                 error = iDTMFTonePlayerDn->RemoveVoIPAudioDownlinkStream(*iVoIPDnlink);
  1428                 error = iDTMFTonePlayerDn->RemoveVoIPAudioDownlinkStream(
       
  1429                         *iVoIPDnlink);
  1485                 iLog->Log(_L("DTMF DNL Closed: error = %d"), error);
  1430                 iLog->Log(_L("DTMF DNL Closed: error = %d"), error);
  1486             	}
  1431                 }
  1487             else
  1432             else
  1488             	{
  1433                 {
  1489             	iLog->Log(_L("DTMF DNL-PLR not open"), KErrNotFound);
  1434                 iLog->Log(_L("DTMF DNL-PLR not open"), KErrNotFound);
  1490             	}
  1435                 }
  1491         	}
  1436             }
  1492         else if (closedLink == KTagUplink)
  1437         else if (closedLink == KTagUplink)
  1493         	{
  1438             {
  1494             if (iDTMFTonePlayerUp && (iUpLinkStatus == EReady || iUpLinkStatus == EStreaming))
  1439             if (iDTMFTonePlayerUp && (iUpLinkStatus == EReady
  1495             	{
  1440                     || iUpLinkStatus == EStreaming))
       
  1441                 {
  1496                 iDTMFTonePlayerUp->Close();
  1442                 iDTMFTonePlayerUp->Close();
  1497                 error = iDTMFTonePlayerUp->RemoveVoIPAudioUplinkStream(*iVoIPUplink);
  1443                 error = iDTMFTonePlayerUp->RemoveVoIPAudioUplinkStream(
       
  1444                         *iVoIPUplink);
  1498                 iLog->Log(_L("DTMF UPL Closed: error = %d"), error);
  1445                 iLog->Log(_L("DTMF UPL Closed: error = %d"), error);
  1499             	}
  1446                 }
  1500             else
  1447             else
  1501             	{
  1448                 {
  1502             	iLog->Log(_L("DTMF UPL-PLR not open"), KErrNotFound);
  1449                 iLog->Log(_L("DTMF UPL-PLR not open"), KErrNotFound);
  1503             	}
  1450                 }
  1504         	}
  1451             }
  1505         else
  1452         else
  1506         	{
  1453             {
  1507             iLog->Log(KMsgBadTestParameters);
  1454             iLog->Log(KMsgBadTestParameters);
  1508             error = KErrBadTestParameter;
  1455             error = KErrBadTestParameter;
  1509         	}
  1456             }
  1510     }
  1457         }
  1511 
  1458 
  1512     return error;
  1459     return error;
  1513 }
  1460     }
  1514 
  1461 
  1515 
  1462 TInt CVoIPAudioServicesTestClass::StopDTMFTonePlayer(CStifItemParser& aItem)
  1516 TInt CVoIPAudioServicesTestClass::StopDTMFTonePlayer( CStifItemParser& aItem )
  1463     {
  1517 {
  1464     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::StopDTMFTonePlayer")));
  1518 	FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::StopDTMFTonePlayer")));
       
  1519     iLog->Log(_L("CVoIPAudioServicesTestClass::StopDTMFTonePlay"));
  1465     iLog->Log(_L("CVoIPAudioServicesTestClass::StopDTMFTonePlay"));
  1520     TInt error = KErrNone;
  1466     TInt error = KErrNone;
  1521 
  1467 
  1522     TPtrC stopLink;
  1468     TPtrC stopLink;
  1523     error = aItem.GetNextString(stopLink);
  1469     error = aItem.GetNextString(stopLink);
  1524     if (error == KErrNone)
  1470     if (error == KErrNone)
  1525         {
  1471         {
  1526         if (stopLink == KTagDnlink)
  1472         if (stopLink == KTagDnlink)
  1527         	{
  1473             {
  1528         	iDTMFTonePlayerDn->Stop();
  1474             iDTMFTonePlayerDn->Stop();
  1529         	iLog->Log(_L("DTMF DNL Stoped"));
  1475             iLog->Log(_L("DTMF DNL Stoped"));
  1530         	}
  1476             }
  1531         else if (stopLink == KTagUplink)
  1477         else if (stopLink == KTagUplink)
  1532         	{
  1478             {
  1533         	iDTMFTonePlayerUp->Stop();
  1479             iDTMFTonePlayerUp->Stop();
  1534         	iLog->Log(_L("DTMF UPL Stoped"));
  1480             iLog->Log(_L("DTMF UPL Stoped"));
  1535         	}
  1481             }
  1536         else
  1482         else
  1537         	{
  1483             {
  1538         	iLog->Log(KMsgBadTestParameters);
  1484             iLog->Log(KMsgBadTestParameters);
  1539         	error = KErrBadTestParameter;
  1485             error = KErrBadTestParameter;
  1540             }
  1486             }
  1541         }
  1487         }
  1542 
  1488 
  1543     return error;
  1489     return error;
  1544 }
  1490     }
  1545 
  1491 
  1546 
  1492 TInt CVoIPAudioServicesTestClass::InitRingTonePlayer(CStifItemParser& aItem)
  1547 TInt CVoIPAudioServicesTestClass::InitRingTonePlayer(CStifItemParser& aItem  )
  1493     {
  1548 {
       
  1549     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::InitRingTonePlayer")));
  1494     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::InitRingTonePlayer")));
  1550     iLog->Log(_L("CVoIPAudioServicesTestClass::InitRingTonePlayer"));
  1495     iLog->Log(_L("CVoIPAudioServicesTestClass::InitRingTonePlayer"));
  1551     TInt error = KErrNone;
  1496     TInt error = KErrNone;
  1552 
  1497 
  1553     TPtrC file;
  1498     TPtrC file;
  1554     TPtrC fileType;
  1499     TPtrC fileType;
  1555     error = aItem.GetNextString(fileType);
  1500     error = aItem.GetNextString(fileType);
  1556     if (error == KErrNone && iRingTonePlayer)
  1501     if (error == KErrNone && iRingTonePlayer)
  1557     	{
  1502         {
  1558         if (fileType == KTagFile)
  1503         if (fileType == KTagFile)
  1559         	{
  1504             {
  1560         	iLog->Log(_L("InitRingTonePlayerFromFile"));
  1505             iLog->Log(_L("InitRingTonePlayerFromFile"));
  1561         	error = aItem.GetNextString(file);
  1506             error = aItem.GetNextString(file);
  1562         	if (error == KErrNone)
  1507             if (error == KErrNone)
  1563         		{
  1508                 {
  1564         		if (file == KTagFile1)
  1509                 if (file == KTagFile1)
  1565         			{
  1510                     {
  1566         			TBufC<KMaxFileName> file(KTestFile1);
  1511                     TBufC<KMaxFileName> file(KTestFile1);
  1567         			error = iRingTonePlayer->Open(*this, file.Des());
  1512                     error = iRingTonePlayer->Open(*this, file.Des());
  1568         			AddExpectedEvent(EOpenComplete, KMediumTimeout);
  1513                     AddExpectedEvent(EOpenComplete, KShortTimeout);
  1569         			}
  1514                     }
  1570         		else if (file == KTagFile2)
  1515                 }
  1571         			{
  1516             else
  1572         			TBufC<KMaxFileName> file(KTestFile2);
  1517                 {
  1573         			error = iRingTonePlayer->Open(*this, file.Des());
  1518                 iLog->Log(KMsgBadTestParameters);
  1574         			AddExpectedEvent(EOpenComplete, KMediumTimeout);
  1519                 error = KErrBadTestParameter;
  1575         			}
  1520                 }
  1576         		}
  1521             }
  1577         	else
       
  1578         		{
       
  1579         		iLog->Log(KMsgBadTestParameters);
       
  1580         		error = KErrBadTestParameter;
       
  1581         		}
       
  1582         	}
       
  1583 
  1522 
  1584         else if (fileType == KTagRFile)
  1523         else if (fileType == KTagRFile)
  1585         	{
  1524             {
  1586         	iLog->Log(_L("InitRingTonePlayerFromRFile"));
  1525             iLog->Log(_L("InitRingTonePlayerFromRFile"));
  1587         	error = iFs.Connect();
  1526             error = iFs.Connect();
  1588 
  1527 
  1589         	if (error == KErrNone)
  1528             if (error == KErrNone)
  1590 	        	{
  1529                 {
  1591 	            error = iFs.ShareProtected();
  1530                 error = iFs.ShareProtected();
  1592 	        	}
  1531                 }
  1593 
  1532 
  1594 	        if (error == KErrNone)
  1533             if (error == KErrNone)
  1595 	        	{
  1534                 {
  1596 	        	error = aItem.GetNextString(file);
  1535                 error = aItem.GetNextString(file);
  1597 	        	if (error == KErrNone)
  1536                 if (error == KErrNone)
  1598 	        		{
  1537                     {
  1599 	        		if (file == KTagFile1)
  1538                     if (file == KTagFile1)
  1600 	        			{
  1539                         {
  1601 	        			error = iRTFile.Open(iFs, KTestFile1, EFileRead);
  1540                         error = iRTFile.Open(iFs, KTestFile1, EFileRead);
  1602 	        			}
  1541                         }
  1603 	        		else if (file == KTagFile2)
  1542                     }
  1604 	        			{
  1543                 else
  1605 	        			error = iRTFile.Open(iFs, KTestFile2, EFileRead);
  1544                     {
  1606 	        			}
  1545                     iLog->Log(KMsgBadTestParameters);
  1607 	        		}
  1546                     error = KErrBadTestParameter;
  1608 	        	else
  1547                     }
  1609 	        		{
  1548 
  1610 	        		iLog->Log(KMsgBadTestParameters);
  1549                 if (error == KErrNone)
  1611 	        		error = KErrBadTestParameter;
  1550                     {
  1612 	        		}
  1551                     error = iRingTonePlayer->Open(*this, iRTFile);
  1613 
  1552                     AddExpectedEvent(EOpenComplete, KShortTimeout);
  1614 	        	if (error == KErrNone)
  1553                     }
  1615 	        		{
  1554                 }
  1616 	                error = iRingTonePlayer->Open(*this, iRTFile);
  1555             }
  1617 	                AddExpectedEvent(EOpenComplete, KMediumTimeout);
  1556 
  1618 	        		}
  1557         else if (fileType == KTagProfile)
  1619 	        	}
  1558             {
  1620         	}
  1559             iLog->Log(_L("InitRingTonePlayerFromProfile"));
  1621 
  1560             error = iRingTonePlayer->Open(*this);
  1622 	    else if (fileType == KTagProfile)
  1561             AddExpectedEvent(EOpenComplete, KShortTimeout);
  1623 	    	{
  1562             }
  1624 	    	iLog->Log(_L("InitRingTonePlayerFromProfile"));
  1563 
  1625 	    	error = iRingTonePlayer->Open(*this);
  1564         else if (fileType == KTagDesL)
  1626 	    	AddExpectedEvent(EOpenComplete, KMediumTimeout);
  1565             {
  1627 	    	}
  1566             iLog->Log(_L("InitRingTonePlayerFromDesL"));
  1628 
  1567             TBufC8<KMimeStringSize> mimeType;
  1629 	    else if (fileType == KTagDesL)
  1568             TPtr8 pMime = mimeType.Des();
  1630 	    	{
  1569             pMime.Copy(KMimetypeWAV);
  1631 	    	iLog->Log(_L("InitRingTonePlayerFromDesL"));
  1570             error = iFs.Connect();
  1632 	        TBufC8<KMimeStringSize> mimeType;
  1571 
  1633 	        TPtr8 pMime = mimeType.Des();
  1572             if (error == KErrNone)
  1634 	        pMime.Copy(KMimetypeWAV);
  1573                 {
  1635 	        error = iFs.Connect();
  1574                 error = iRTFile.Open(iFs, KTestFile1, EFileRead);
  1636 
  1575                 if (error == KErrNone)
  1637 	        if (error == KErrNone)
  1576                     {
  1638 	        	{
  1577                     TInt size;
  1639 	            error = iRTFile.Open(iFs, KTestFile3, EFileRead);
  1578                     iRTFile.Size(size);
  1640 	            if (error == KErrNone)
  1579                     HBufC8* tone = HBufC8::NewLC(size / 5);
  1641 	                {
  1580                     TPtr8 pTone = tone->Des();
  1642 	                TInt size;
  1581                     iRTFile.Read(pTone, size / 5);
  1643 	                iRTFile.Size(size);
  1582                     error = iRingTonePlayer->Open(*this, pTone, pMime);
  1644 	                HBufC8* tone = HBufC8::NewLC(size);
  1583                     CleanupStack::PopAndDestroy(tone);
  1645 	                TPtr8 pTone = tone->Des();
  1584                     AddExpectedEvent(EOpenComplete, KShortTimeout);
  1646 	                iRTFile.Read(pTone);
  1585                     }
  1647 	                iRTFile.Close();
  1586                 else
  1648 	                error = iRingTonePlayer->Open(*this, pTone, pMime);
  1587                     {
  1649 	                CleanupStack::PopAndDestroy(tone);
  1588                     iLog->Log(_L("RT Open from DesL failed"));
  1650 	                AddExpectedEvent(EOpenComplete, KMediumTimeout);
  1589                     }
  1651 	                }
  1590                 iRTFile.Close();
  1652 	            else
  1591                 }
  1653 	            	{
  1592             else
  1654 	            	iLog->Log(_L("RT Open from DesL failed"));
  1593                 {
  1655 	            	}
  1594                 iLog->Log(_L("RT Connect failed"));
  1656 	            iFs.Close();
  1595                 }
  1657 	        	}
  1596             iFs.Close();
  1658 
  1597             }
  1659 	        else
  1598         else
  1660 	        	{
  1599             {
  1661 	        	iLog->Log(_L("RT Connect failed"));
  1600             iLog->Log(KMsgBadTestParameters);
  1662 	        	}
  1601             error = KErrBadTestParameter;
  1663 
  1602             }
  1664 	    	}
  1603         }
  1665 
       
  1666 	    else
       
  1667 	        {
       
  1668 	        iLog->Log(KMsgBadTestParameters);
       
  1669 	        error = KErrBadTestParameter;
       
  1670 	        }
       
  1671     	}
       
  1672 
       
  1673     else
  1604     else
  1674     	{
  1605         {
  1675         if (!iRingTonePlayer)
  1606         if (!iRingTonePlayer)
  1676         	{
  1607             {
  1677             iLog->Log(_L("RT PLR Open failed"));
  1608             iLog->Log(_L("RT PLR Open failed"));
  1678         	}
  1609             }
  1679     	}
  1610         }
  1680 
  1611 
  1681     return error;
  1612     return error;
  1682 }
  1613     }
  1683 
  1614 
  1684 
  1615 TInt CVoIPAudioServicesTestClass::CloseRingTonePlayer(CStifItemParser& /*aItem*/)
  1685 TInt CVoIPAudioServicesTestClass::CloseRingTonePlayer(CStifItemParser& /*aItem*/  )
  1616     {
  1686 {
       
  1687     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::CloseRingTonePlayer")));
  1617     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::CloseRingTonePlayer")));
  1688     iLog->Log(_L("CVoIPAudioServicesTestClass::CloseRingTonePlayer"));
  1618     iLog->Log(_L("CVoIPAudioServicesTestClass::CloseRingTonePlayer"));
  1689     TInt error = KErrNone;
  1619     TInt error = KErrNone;
  1690 
  1620 
  1691   if (iRingTonePlayer)
  1621     if (iRingTonePlayer)
  1692 	  {
  1622         {
  1693       iRTFile.Close();
  1623         iRTFile.Close();
  1694       iFs.Close();
  1624         iFs.Close();
  1695       iRingTonePlayer->Close();
  1625         iRingTonePlayer->Close();
  1696 
  1626         iLog->Log(_L("RT Player Closed"));
  1697       iLog->Log(_L("RT Player Closed"));
  1627         }
  1698 	  }
  1628     else
  1699   else
  1629         {
  1700 	  {
  1630         iLog->Log(_L("RT PLR Not Ready: error = %d"), KErrNotFound);
  1701       iLog->Log(_L("RT PLR Not Ready: error = %d"), KErrNotFound);
  1631         }
  1702 	  }
  1632 
  1703 
  1633     return error;
  1704   return error;
  1634     }
  1705 }
  1635 
  1706 
  1636 TInt CVoIPAudioServicesTestClass::PlayRingTone(CStifItemParser& /*aItem*/)
  1707 
  1637     {
  1708 
       
  1709 TInt CVoIPAudioServicesTestClass::PlayRingTone( CStifItemParser& /*aItem*/ )
       
  1710 {
       
  1711     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::PlayRingTone")));
  1638     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::PlayRingTone")));
  1712     iLog->Log(_L("CVoIPAudioServicesTestClass::PlayRingTone"));
  1639     iLog->Log(_L("CVoIPAudioServicesTestClass::PlayRingTone"));
  1713     TInt error = KErrNone;
  1640     TInt error = KErrNone;
  1714 
  1641 
  1715     if (iRingTonePlayer)
  1642     if (iRingTonePlayer)
  1716     	{
  1643         {
  1717         iRingTonePlayer->Play();
  1644         iRingTonePlayer->Play();
  1718         AddExpectedEvent(EPlaybackComplete, KLongTimeout);  // Played ringing tone file has to be shorter than KLongTimeout
  1645         AddExpectedEvent(EPlaybackComplete, KLongTimeout);
  1719     	}
  1646         // Played ringing tone file has to be shorter than KLongTimeout
  1720   else
  1647         }
  1721 	  {
  1648     else
  1722       iLog->Log(_L("RT PLR Not Ready: error = %d"), KErrNotFound);
  1649         {
  1723       error = KErrNotFound;
  1650         iLog->Log(_L("RT PLR Not Ready: error = %d"), KErrNotFound);
  1724 	  }
  1651         error = KErrNotFound;
  1725 
  1652         }
  1726     return error;
  1653 
  1727 }
  1654     return error;
  1728 
  1655     }
  1729 
  1656 
  1730 
  1657 TInt CVoIPAudioServicesTestClass::PauseRingTone(CStifItemParser& /*aItem*/)
  1731 TInt CVoIPAudioServicesTestClass::PauseRingTone( CStifItemParser& /*aItem*/ )
  1658     {
  1732 {
       
  1733     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::PauseRingTone")));
  1659     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::PauseRingTone")));
  1734     iLog->Log(_L("CVoIPAudioServicesTestClass::PauseRingTone"));
  1660     iLog->Log(_L("CVoIPAudioServicesTestClass::PauseRingTone"));
  1735     TInt error = KErrNone;
  1661     TInt error = KErrNone;
  1736 
  1662 
  1737     if (iRingTonePlayer)
  1663     if (iRingTonePlayer)
  1738     	{
  1664         {
  1739         iRingTonePlayer->Pause();
  1665         iRingTonePlayer->Pause();
  1740     	}
  1666         }
  1741     else
  1667     else
  1742 	  {
  1668         {
  1743       iLog->Log(_L("RT PLR Not Ready: error = %d"), KErrNotFound);
  1669         iLog->Log(_L("RT PLR Not Ready: error = %d"), KErrNotFound);
  1744       error = KErrNotFound;
  1670         error = KErrNotFound;
  1745 	  }
  1671         }
  1746 
  1672 
  1747     return error;
  1673     return error;
  1748 }
  1674     }
  1749 
  1675 
  1750 
  1676 TInt CVoIPAudioServicesTestClass::ResumeRingTone(CStifItemParser& /*aItem*/)
  1751 TInt CVoIPAudioServicesTestClass::ResumeRingTone( CStifItemParser& /*aItem*/ )
  1677     {
  1752 {
       
  1753     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::ResumeRingTone")));
  1678     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::ResumeRingTone")));
  1754     iLog->Log(_L("CVoIPAudioServicesTestClass::ResumeRingTone"));
  1679     iLog->Log(_L("CVoIPAudioServicesTestClass::ResumeRingTone"));
  1755     TInt error = KErrNone;
  1680     TInt error = KErrNone;
  1756 
  1681 
  1757     if (iRingTonePlayer)
  1682     if (iRingTonePlayer)
  1758     	{
  1683         {
  1759         iRingTonePlayer->Resume();
  1684         iRingTonePlayer->Resume();
  1760     	}
  1685         }
  1761     else
  1686     else
  1762     	{
  1687         {
  1763     	iLog->Log(_L("RT PLR Not Ready: error = %d"), KErrNotFound);
  1688         iLog->Log(_L("RT PLR Not Ready: error = %d"), KErrNotFound);
  1764     	error = KErrNotFound;
  1689         error = KErrNotFound;
  1765     	}
  1690         }
  1766 
  1691 
  1767     return error;
  1692     return error;
  1768 }
  1693     }
  1769 
  1694 
  1770 
  1695 TInt CVoIPAudioServicesTestClass::GetSupportedBitrates(CStifItemParser& /*aItem*/)
  1771 
  1696     {
  1772 TInt CVoIPAudioServicesTestClass::GetSupportedBitrates( CStifItemParser& /*aItem*/ )
       
  1773 {
       
  1774     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetSupportedBitrates")));
  1697     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetSupportedBitrates")));
  1775     iLog->Log(_L("CVoIPAudioServicesTestClass::GetSupportedBitrates"));
  1698     iLog->Log(_L("CVoIPAudioServicesTestClass::GetSupportedBitrates"));
  1776     TInt error = KErrNone;
  1699     TInt error = KErrNone;
  1777 
  1700 
  1778     iBitratesArray.Reset();
  1701     iBitratesArray.Reset();
  1779     GetSupportedBitrates(iBitratesArray);
  1702     error = GetSupportedBitrates(iBitratesArray);
  1780 
  1703 
  1781     TInt numOfItems = iBitratesArray.Count();
  1704     TInt numOfItems = iBitratesArray.Count();
  1782 
  1705 
  1783     for (TInt i = 0; i < numOfItems; i++)
  1706     for (TInt i = 0; i < numOfItems; i++)
  1784         {
  1707         {
  1785         iLog->Log(_L("BR %d"), iBitratesArray[i]);
  1708         iLog->Log(_L("BR %d"), iBitratesArray[i]);
  1786         }
  1709         }
  1787 
  1710 
  1788     return error;
  1711     return error;
  1789 }
  1712     }
  1790 
       
  1791 
       
  1792 
  1713 
  1793 // ----------------------------------------------------------------------------
  1714 // ----------------------------------------------------------------------------
  1794 // CVoIPTestEngine::GetSupportedBitrates
  1715 // CVoIPTestEngine::GetSupportedBitrates
  1795 //
  1716 //
  1796 // ----------------------------------------------------------------------------
  1717 // ----------------------------------------------------------------------------
  1797 //
  1718 //
  1798 void CVoIPAudioServicesTestClass::GetSupportedBitrates(RArray<TUint>& aBrArr)
  1719 TInt CVoIPAudioServicesTestClass::GetSupportedBitrates(RArray<TUint>& aBrArr)
  1799 {
  1720     {
       
  1721     TInt error = KErrNone;
       
  1722 
  1800     switch (iUpLinkCodec)
  1723     switch (iUpLinkCodec)
  1801         {
  1724         {
  1802         case EG711:
  1725         case EG711:
  1803             iG711EncFormatIntfc->GetSupportedBitRates(aBrArr);
  1726             error = iG711EncFormatIntfc->GetSupportedBitRates(aBrArr);
  1804             break;
  1727             break;
  1805         case EG729:
  1728         case EG729:
  1806             iG729EncFormatIntfc->GetSupportedBitRates(aBrArr);
  1729             error = iG729EncFormatIntfc->GetSupportedBitRates(aBrArr);
  1807             break;
  1730             break;
  1808         case EILBC:
  1731         case EILBC:
  1809             iILBCEncFormatIntfc->GetSupportedBitRates(aBrArr);
  1732             error = iILBCEncFormatIntfc->GetSupportedBitRates(aBrArr);
  1810             break;
  1733             break;
  1811         case EAMR_NB:
  1734         case EAMR_NB:
  1812             iAMRNBEncFormatIntfc->GetSupportedBitRates(aBrArr);
  1735             error = iAMRNBEncFormatIntfc->GetSupportedBitRates(aBrArr);
  1813             break;
  1736             break;
  1814         case EPCM16:
  1737         case EPCM16: //Not supported
  1815             iPCM16EncFormatIntfc->GetSupportedBitRates(aBrArr);
  1738             error = iPCM16EncFormatIntfc->GetSupportedBitRates(aBrArr);
  1816             break;
  1739             break;
  1817         default:
  1740         default:
  1818             break;
  1741             break;
  1819         }
  1742         }
  1820 }
  1743     return error;
  1821 
  1744     }
  1822 
  1745 
  1823 TInt CVoIPAudioServicesTestClass::SetBitrate( CStifItemParser& aItem )
  1746 TInt CVoIPAudioServicesTestClass::SetBitrate(CStifItemParser& aItem)
  1824 {
  1747     {
  1825     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::SetBitrate")));
  1748     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::SetBitrate")));
  1826     iLog->Log(_L("CVoIPAudioServicesTestClass::SetBitrate"));
  1749     iLog->Log(_L("CVoIPAudioServicesTestClass::SetBitrate"));
  1827     TInt error = KErrNone;
  1750     TInt error = KErrNone;
  1828 
  1751 
  1829     TPtrC bitRate;
  1752     TPtrC bitRate;
  1830     error = aItem.GetNextString(bitRate);
  1753     error = aItem.GetNextString(bitRate);
  1831     if (error == KErrNone)
  1754     if (error == KErrNone)
  1832     	{
  1755         {
  1833         if (bitRate == KTagMin)
  1756         if (bitRate == KTagMin)
  1834         	{
  1757             {
  1835         	if (iBitratesArray.Count() > 0)
  1758             if (iBitratesArray.Count() > 0)
  1836         		{
  1759                 {
  1837 	            iBitrate = iBitratesArray[0];
  1760                 iBitrate = iBitratesArray[0];
  1838 	            SetBitrate(iBitrate);
  1761                 error = SetBitrate(iBitrate);
  1839 	            iLog->Log(_L("BR set %d"), iBitrate);
  1762                 iLog->Log(_L("BR set %d"), iBitrate);
  1840         		}
  1763                 }
  1841         	}
  1764             }
  1842         else if (bitRate == KTagMax)
  1765         else if (bitRate == KTagMax)
  1843         	{
  1766             {
  1844         	TInt numOfItems = iBitratesArray.Count();
  1767             TInt numOfItems = iBitratesArray.Count();
  1845             if (numOfItems > 0)
  1768             if (numOfItems > 0)
  1846             	{
  1769                 {
  1847 	            iBitrate = iBitratesArray[numOfItems-1];
  1770                 iBitrate = iBitratesArray[numOfItems - 1];
  1848 	            SetBitrate(iBitrate);
  1771                 error = SetBitrate(iBitrate);
  1849 	            iLog->Log(_L("BR set %d"), iBitrate);
  1772                 iLog->Log(_L("BR set %d"), iBitrate);
  1850             	}
  1773                 }
  1851         	}
  1774             }
  1852         else
  1775         }
  1853         	{
  1776     else if (error == KErrNotFound) //No parameter
  1854         	iLog->Log(KMsgBadTestParameters);
  1777 
  1855         	error = KErrBadTestParameter;
  1778         {
  1856         	}
  1779         // Fail case - setting random bitrate
  1857     	}
  1780         error = SetBitrate(1234);
  1858 
  1781         iLog->Log(_L("Random BR set"));
  1859     return error;
  1782         }
  1860 }
  1783 
  1861 
  1784     return error;
       
  1785     }
  1862 
  1786 
  1863 // ----------------------------------------------------------------------------
  1787 // ----------------------------------------------------------------------------
  1864 // CVoIPAudioServicesTestClass::SetBitrate
  1788 // CVoIPAudioServicesTestClass::SetBitrate
  1865 //
  1789 //
  1866 // ----------------------------------------------------------------------------
  1790 // ----------------------------------------------------------------------------
  1867 //
  1791 //
  1868 void CVoIPAudioServicesTestClass::SetBitrate(TUint aBitrate)
  1792 TInt CVoIPAudioServicesTestClass::SetBitrate(TUint aBitrate)
  1869 {
  1793     {
       
  1794     TInt error = KErrNone;
       
  1795 
  1870     switch (iUpLinkCodec)
  1796     switch (iUpLinkCodec)
  1871         {
  1797         {
  1872         case EG711:
  1798         case EG711:
  1873             iG711EncFormatIntfc->SetBitRate(aBitrate);
  1799             error = iG711EncFormatIntfc->SetBitRate(aBitrate);
  1874             break;
  1800             break;
  1875         case EG729:
  1801         case EG729:
  1876             iG729EncFormatIntfc->SetBitRate(aBitrate);
  1802             error = iG729EncFormatIntfc->SetBitRate(aBitrate);
  1877             break;
  1803             break;
  1878         case EILBC:
  1804         case EILBC:
  1879             iILBCEncFormatIntfc->SetBitRate(aBitrate);
  1805             error = iILBCEncFormatIntfc->SetBitRate(aBitrate);
  1880             break;
  1806             break;
  1881         case EAMR_NB:
  1807         case EAMR_NB:
  1882             iAMRNBEncFormatIntfc->SetBitRate(aBitrate);
  1808             error = iAMRNBEncFormatIntfc->SetBitRate(aBitrate);
  1883             break;
  1809             break;
  1884         case EPCM16:
  1810         case EPCM16: //Fail case
  1885             iPCM16EncFormatIntfc->SetBitRate(aBitrate);
  1811             error = iPCM16EncFormatIntfc->SetBitRate(aBitrate);
       
  1812             AddExpectedEvent(EUplinkError, KShortTimeout);
  1886             break;
  1813             break;
  1887         default:
  1814         default:
  1888             break;
  1815             break;
  1889         }
  1816         }
  1890 
  1817 
  1891     iLog->Log(_L("Set Uplink BR: %d "), iBitrate);
  1818     iLog->Log(_L("Set Uplink BR: %d "), iBitrate);
  1892 }
  1819     return error;
  1893 
  1820     }
  1894 
  1821 
  1895 
  1822 TInt CVoIPAudioServicesTestClass::GetBitrate(CStifItemParser& /*aItem*/)
  1896 
  1823     {
  1897 TInt CVoIPAudioServicesTestClass::GetBitrate( CStifItemParser& /*aItem*/ )
       
  1898 {
       
  1899     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetBitrate")));
  1824     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetBitrate")));
  1900     iLog->Log(_L("CVoIPAudioServicesTestClass::GetBitrate"));
  1825     iLog->Log(_L("CVoIPAudioServicesTestClass::GetBitrate"));
  1901     TInt error = KErrNone;
  1826     TInt error = KErrNone;
  1902 
  1827 
  1903     TUint currentBitrate;
  1828     TUint currentBitrate;
  1904     GetBitrate(currentBitrate);
  1829     error = GetBitrate(currentBitrate);
  1905     iLog->Log(_L("Current BR: %d"), currentBitrate);
  1830     if (error == KErrNone)
  1906     if (iBitrate != currentBitrate)
  1831         {
  1907     	{
  1832         iLog->Log(_L("Current BR: %d"), currentBitrate);
  1908         iLog->Log(_L("returned bitRate doesn't match set bitRate: Failed"));
  1833         if (iBitrate != currentBitrate)
  1909         error = KErrUnexpectedValue;
  1834             {
  1910     	}
  1835             iLog->Log(
  1911 
  1836                     _L("returned bitRate doesn't match set bitRate: Failed"));
  1912     return error;
  1837             error = KErrUnexpectedValue;
  1913 }
  1838             }
  1914 
  1839         }
       
  1840 
       
  1841     return error;
       
  1842     }
  1915 
  1843 
  1916 // ----------------------------------------------------------------------------
  1844 // ----------------------------------------------------------------------------
  1917 // CVoIPAudioServicesTestClass::GetBitrate
  1845 // CVoIPAudioServicesTestClass::GetBitrate
  1918 //
  1846 //
  1919 // ----------------------------------------------------------------------------
  1847 // ----------------------------------------------------------------------------
  1920 //
  1848 //
  1921 void CVoIPAudioServicesTestClass::GetBitrate(TUint& aBitrate)
  1849 TInt CVoIPAudioServicesTestClass::GetBitrate(TUint& aBitrate)
  1922 {
  1850     {
       
  1851     TInt error = KErrNotSupported;
       
  1852 
  1923     switch (iUpLinkCodec)
  1853     switch (iUpLinkCodec)
  1924         {
  1854         {
  1925         case EG711:
  1855         case EG711:
  1926             iG711EncFormatIntfc->GetBitRate(aBitrate);
  1856             error = iG711EncFormatIntfc->GetBitRate(aBitrate);
  1927             break;
  1857             break;
  1928         case EG729:
  1858         case EG729:
  1929             iG729EncFormatIntfc->GetBitRate(aBitrate);
  1859             error = iG729EncFormatIntfc->GetBitRate(aBitrate);
  1930             break;
  1860             break;
  1931         case EILBC:
  1861         case EILBC:
  1932             iILBCEncFormatIntfc->GetBitRate(aBitrate);
  1862             error = iILBCEncFormatIntfc->GetBitRate(aBitrate);
  1933             break;
  1863             break;
  1934         case EAMR_NB:
  1864         case EAMR_NB:
  1935             iAMRNBEncFormatIntfc->GetBitRate(aBitrate);
  1865             error = iAMRNBEncFormatIntfc->GetBitRate(aBitrate);
  1936             break;
  1866             break;
  1937         case EPCM16:
  1867         case EPCM16: //Not supported
  1938             iPCM16EncFormatIntfc->GetBitRate(aBitrate);
  1868             error = iPCM16EncFormatIntfc->GetBitRate(aBitrate);
  1939             break;
  1869             break;
  1940         default:
  1870         default:
  1941             break;
  1871             break;
  1942         }
  1872         }
  1943 
  1873 
  1944     iLog->Log(_L("Get Uplink BR: %d "), aBitrate);
  1874     iLog->Log(_L("Get Uplink BR: %d "), aBitrate);
  1945 }
  1875     return error;
  1946 
  1876     }
  1947 
  1877 
  1948 
  1878 TInt CVoIPAudioServicesTestClass::GetVAD(CStifItemParser& /*aItem*/)
  1949 TInt CVoIPAudioServicesTestClass::GetVAD( CStifItemParser& /*aItem*/ )
  1879     {
  1950 {
       
  1951     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetVAD")));
  1880     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetVAD")));
  1952     iLog->Log(_L("CVoIPAudioServicesTestClass::GetVAD"));
  1881     iLog->Log(_L("CVoIPAudioServicesTestClass::GetVAD"));
  1953     TInt error = KErrNone;
  1882     TInt error = KErrNone;
  1954 
  1883 
  1955     TBool aVad;
  1884     TBool aVad;
  1956 
  1885 
  1957     switch (iUpLinkCodec)
  1886     switch (iUpLinkCodec)
  1958     	{
  1887         {
  1959         case EG711:
  1888         case EG711:
  1960             error = iG711EncFormatIntfc->GetVAD(aVad);
  1889             error = iG711EncFormatIntfc->GetVAD(aVad);
  1961             break;
  1890             break;
  1962         case EG729:
  1891         case EG729:
  1963             error = iG729EncFormatIntfc->GetVAD(aVad);
  1892             error = iG729EncFormatIntfc->GetVAD(aVad);
  1966             error = iILBCEncFormatIntfc->GetVAD(aVad);
  1895             error = iILBCEncFormatIntfc->GetVAD(aVad);
  1967             break;
  1896             break;
  1968         case EAMR_NB:
  1897         case EAMR_NB:
  1969             error = iAMRNBEncFormatIntfc->GetVAD(aVad);
  1898             error = iAMRNBEncFormatIntfc->GetVAD(aVad);
  1970             break;
  1899             break;
  1971         case EPCM16:
  1900         case EPCM16: //Not supported
  1972             error = iPCM16EncFormatIntfc->GetVAD(aVad);
  1901             error = iPCM16EncFormatIntfc->GetVAD(aVad);
  1973             break;
  1902             break;
  1974         default:
  1903         default:
  1975             break;
  1904             break;
  1976     	}
  1905         }
  1977 
  1906 
  1978      iLog->Log(_L("get VAD: %d"), aVad);
  1907     iLog->Log(_L("get VAD: %d"), aVad);
  1979 
  1908 
  1980      if (aVad != iVad)
  1909     if (aVad != iVad)
  1981         {
  1910         {
  1982         iLog->Log(_L("returned VAD doesn't match set VAD: Failed"));
  1911         iLog->Log(_L("returned VAD doesn't match set VAD: Failed"));
  1983         error = KErrUnexpectedValue;
  1912         error = KErrUnexpectedValue;
  1984         }
  1913         }
  1985 
  1914 
  1986     return error;
  1915     return error;
  1987 }
  1916     }
  1988 
  1917 
  1989 
  1918 TInt CVoIPAudioServicesTestClass::ToggleVAD(CStifItemParser& /*aItem*/)
  1990 
  1919     {
  1991 TInt CVoIPAudioServicesTestClass::ToggleVAD( CStifItemParser& /*aItem*/ )
       
  1992 {
       
  1993     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::ToggleVAD")));
  1920     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::ToggleVAD")));
  1994     iLog->Log(_L("CVoIPAudioServicesTestClass::ToggleVAD"));
  1921     iLog->Log(_L("CVoIPAudioServicesTestClass::ToggleVAD"));
  1995     TInt error = KErrNone;
  1922     TInt error = KErrNone;
  1996 
  1923 
  1997     iVad = (iVad)? EFalse : ETrue;
  1924     iVad = (iVad) ? EFalse : ETrue;
  1998 
  1925 
  1999     switch (iUpLinkCodec)
  1926     switch (iUpLinkCodec)
  2000     	{
  1927         {
  2001         case EG711:
  1928         case EG711:
  2002             error = iG711EncFormatIntfc->SetVAD(iVad);
  1929             error = iG711EncFormatIntfc->SetVAD(iVad);
  2003             break;
  1930             break;
  2004         case EG729:
  1931         case EG729:
  2005             error = iG729EncFormatIntfc->SetVAD(iVad);
  1932             error = iG729EncFormatIntfc->SetVAD(iVad);
  2008             error = iILBCEncFormatIntfc->SetVAD(iVad);
  1935             error = iILBCEncFormatIntfc->SetVAD(iVad);
  2009             break;
  1936             break;
  2010         case EAMR_NB:
  1937         case EAMR_NB:
  2011             error = iAMRNBEncFormatIntfc->SetVAD(iVad);
  1938             error = iAMRNBEncFormatIntfc->SetVAD(iVad);
  2012             break;
  1939             break;
  2013         case EPCM16:
  1940         case EPCM16: //Fail case
  2014             error = iPCM16EncFormatIntfc->SetVAD(iVad);
  1941             error = iPCM16EncFormatIntfc->SetVAD(iVad);
       
  1942             AddExpectedEvent(EUplinkError, KShortTimeout);
  2015             break;
  1943             break;
  2016         default:
  1944         default:
  2017             break;
  1945             break;
  2018     	}
  1946         }
  2019 
  1947 
  2020     iLog->Log(_L("VAD set: %d"), iVad);
  1948     iLog->Log(_L("VAD set: %d"), iVad);
  2021 
  1949 
  2022     return error;
  1950     return error;
  2023 }
  1951     }
  2024 
  1952 
  2025 
  1953 TInt CVoIPAudioServicesTestClass::GetFrameMode(CStifItemParser& /*aItem*/)
  2026 
  1954     {
  2027 TInt CVoIPAudioServicesTestClass::GetFrameMode( CStifItemParser& /*aItem*/ )
       
  2028 {
       
  2029     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetFrameMode")));
  1955     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetFrameMode")));
  2030     iLog->Log(_L("CVoIPAudioServicesTestClass::GetFrameMode"));
  1956     iLog->Log(_L("CVoIPAudioServicesTestClass::GetFrameMode"));
  2031     TInt error = KErrNone;
  1957     TInt error = KErrNone;
  2032 
  1958 
  2033     TBool aFrameMode = EFalse;
  1959     TBool frameMode = EFalse;
  2034     switch (iDnLinkCodec)
  1960     switch (iDnLinkCodec)
  2035         {
  1961         {
  2036         case EG711:
  1962         case EG711:
  2037             error = iG711DecFormatIntfc->GetFrameMode(aFrameMode);
  1963             error = iG711DecFormatIntfc->GetFrameMode(frameMode);
  2038             iLog->Log(_L("FrameMode: %d"), aFrameMode);
  1964             iLog->Log(_L("FrameMode: %d"), frameMode);
  2039             break;
  1965             break;
  2040         case EG729:
  1966         case EG729:
  2041             error = iG729DecFormatIntfc->GetFrameMode(aFrameMode);
  1967             error = iG729DecFormatIntfc->GetFrameMode(frameMode);
  2042             iLog->Log(_L("FrameMode: %d"), aFrameMode);
  1968             iLog->Log(_L("FrameMode: %d"), frameMode);
  2043             break;
  1969             break;
  2044         case EILBC:
  1970         case EILBC:
  2045             error = iILBCDecFormatIntfc->GetFrameMode(iFrameMode);
  1971             error = iILBCDecFormatIntfc->GetFrameMode(frameMode);
  2046             iLog->Log(_L("FrameMode: %d"), aFrameMode);
  1972             iLog->Log(_L("FrameMode: %d"), frameMode);
  2047             break;
  1973             break;
  2048         case EAMR_NB:
  1974         case EAMR_NB:
  2049             error = iAMRNBDecFormatIntfc->GetFrameMode(iFrameMode);
  1975             error = iAMRNBDecFormatIntfc->GetFrameMode(frameMode);
  2050             iLog->Log(_L("FrameMode: %d"), aFrameMode);
  1976             iLog->Log(_L("FrameMode: %d"), frameMode);
  2051             break;
  1977             break;
  2052         case EPCM16:
  1978         case EPCM16:
       
  1979             error = iPCM16DecFormatIntfc->GetFrameMode(frameMode);
       
  1980             break;
  2053         default:
  1981         default:
  2054             break;
  1982             break;
  2055         }
  1983         }
  2056 
  1984 
  2057       if (aFrameMode != iFrameMode)
  1985     if (error == KErrNone)
  2058     	  {
  1986         {
  2059     	  iLog->Log(_L("returned FrameMode doesn't match set FrameMode: Failed"));
  1987         if (frameMode != iFrameMode)
  2060     	  error = KErrUnexpectedValue;
  1988             {
  2061     	  }
  1989             iLog->Log(
  2062 
  1990                     _L("returned FrameMode doesn't match set FrameMode: Failed"));
  2063     return error;
  1991             error = KErrUnexpectedValue;
  2064 }
  1992             }
  2065 
  1993         }
  2066 
  1994 
  2067 
  1995     return error;
  2068 TInt CVoIPAudioServicesTestClass::ToggleFrameMode( CStifItemParser& /*aItem*/ )
  1996     }
  2069 {
  1997 
       
  1998 TInt CVoIPAudioServicesTestClass::ToggleFrameMode(CStifItemParser& /*aItem*/)
       
  1999     {
  2070     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::ToggleFrameMode")));
  2000     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::ToggleFrameMode")));
  2071     iLog->Log(_L("CVoIPAudioServicesTestClass::ToggleFrameMode"));
  2001     iLog->Log(_L("CVoIPAudioServicesTestClass::ToggleFrameMode"));
  2072     TInt error = KErrNone;
  2002     TInt error = KErrNone;
  2073 
  2003 
  2074     iFrameMode = (iFrameMode)? EFalse : ETrue;
  2004     iFrameMode = (iFrameMode) ? EFalse : ETrue;
  2075 
  2005 
  2076     switch (iDnLinkCodec)
  2006     switch (iDnLinkCodec)
  2077         {
  2007         {
  2078         case EG711:
  2008         case EG711:
  2079             error = iG711DecFormatIntfc->SetFrameMode(iFrameMode);
  2009             error = iG711DecFormatIntfc->SetFrameMode(iFrameMode);
  2089             break;
  2019             break;
  2090         case EAMR_NB:
  2020         case EAMR_NB:
  2091             error = iAMRNBDecFormatIntfc->SetFrameMode(iFrameMode);
  2021             error = iAMRNBDecFormatIntfc->SetFrameMode(iFrameMode);
  2092             iLog->Log(_L("FrameMode Set: %d"), iFrameMode);
  2022             iLog->Log(_L("FrameMode Set: %d"), iFrameMode);
  2093             break;
  2023             break;
  2094         case EPCM16:
  2024         case EPCM16: //Fail case
       
  2025             AddExpectedEvent(EDownlinkError, KShortTimeout);
       
  2026             error = iPCM16DecFormatIntfc->SetFrameMode(iFrameMode);
       
  2027             break;
  2095         default:
  2028         default:
  2096             break;
  2029             break;
  2097         }
  2030         }
  2098 
  2031 
  2099     return error;
  2032     return error;
  2100 }
  2033     }
  2101 
  2034 
  2102 
  2035 TInt CVoIPAudioServicesTestClass::GetFrameModeRqrdForEC(CStifItemParser& /*aItem*/)
  2103 
  2036     {
  2104 TInt CVoIPAudioServicesTestClass::GetFrameModeRqrdForEC( CStifItemParser& /*aItem*/ )
       
  2105 {
       
  2106     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetFrameModeRqrdForEC")));
  2037     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetFrameModeRqrdForEC")));
  2107     iLog->Log(_L("CVoIPAudioServicesTestClass::GetFrameModeRqrdForEC"));
  2038     iLog->Log(_L("CVoIPAudioServicesTestClass::GetFrameModeRqrdForEC"));
  2108     TInt error = KErrNone;
  2039     TInt error = KErrNone;
  2109 
  2040 
  2110     switch (iDnLinkCodec)
  2041     switch (iDnLinkCodec)
  2111         {
  2042         {
  2112         case EG711:
  2043         case EG711:
  2113             error = iG711DecFormatIntfc->FrameModeRequiredForErrorConcealment(
  2044             error
  2114                                  iFrameModeReqEC);
  2045                     = iG711DecFormatIntfc->FrameModeRequiredForErrorConcealment(
       
  2046                             iFrameModeReqEC);
  2115             iLog->Log(_L("FrmModeRqdForEC: %d"), iFrameModeReqEC);
  2047             iLog->Log(_L("FrmModeRqdForEC: %d"), iFrameModeReqEC);
  2116             break;
  2048             break;
  2117         case EG729:
  2049         case EG729:
  2118             error = iG729DecFormatIntfc->FrameModeRequiredForErrorConcealment(
  2050             error
  2119                                  iFrameModeReqEC);
  2051                     = iG729DecFormatIntfc->FrameModeRequiredForErrorConcealment(
       
  2052                             iFrameModeReqEC);
  2120             iLog->Log(_L("FrmModeRqdForEC: %d"), iFrameModeReqEC);
  2053             iLog->Log(_L("FrmModeRqdForEC: %d"), iFrameModeReqEC);
  2121             break;
  2054             break;
  2122         case EILBC:
  2055         case EILBC:
  2123             error = iILBCDecFormatIntfc->FrameModeRequiredForErrorConcealment(
  2056             error
  2124                                  iFrameModeReqEC);
  2057                     = iILBCDecFormatIntfc->FrameModeRequiredForErrorConcealment(
       
  2058                             iFrameModeReqEC);
  2125             iLog->Log(_L("FrmModeRqdForEC: %d"), iFrameModeReqEC);
  2059             iLog->Log(_L("FrmModeRqdForEC: %d"), iFrameModeReqEC);
  2126             break;
  2060             break;
  2127         case EAMR_NB:
  2061         case EAMR_NB:
  2128             error = iAMRNBDecFormatIntfc->FrameModeRequiredForErrorConcealment(
  2062             error
  2129                                   iFrameModeReqEC);
  2063                     = iAMRNBDecFormatIntfc->FrameModeRequiredForErrorConcealment(
       
  2064                             iFrameModeReqEC);
  2130             iLog->Log(_L("FrmModeRqdForEC: %d"), iFrameModeReqEC);
  2065             iLog->Log(_L("FrmModeRqdForEC: %d"), iFrameModeReqEC);
  2131             break;
  2066             break;
  2132         case EPCM16:
  2067         case EPCM16: //Not supported
       
  2068             error
       
  2069                     = iPCM16DecFormatIntfc->FrameModeRequiredForErrorConcealment(
       
  2070                             iFrameModeReqEC);
       
  2071             break;
  2133         default:
  2072         default:
  2134             break;
  2073             break;
  2135         }
  2074         }
  2136 
  2075 
  2137     return error;
  2076     return error;
  2138 }
  2077     }
  2139 
  2078 
  2140 
  2079 TInt CVoIPAudioServicesTestClass::ConcealErrForNextBuf(CStifItemParser& /*aItem*/)
  2141 
  2080     {
  2142 TInt CVoIPAudioServicesTestClass::ConcealErrForNextBuf( CStifItemParser& /*aItem*/ )
       
  2143 {
       
  2144     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::ConcealErrForNextBuf")));
  2081     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::ConcealErrForNextBuf")));
  2145     iLog->Log(_L("CVoIPAudioServicesTestClass::ConcealErrForNextBuf"));
  2082     iLog->Log(_L("CVoIPAudioServicesTestClass::ConcealErrForNextBuf"));
  2146     TInt error = KErrNone;
  2083     TInt error = KErrNone;
  2147 
  2084 
  2148     switch (iDnLinkCodec)
  2085     switch (iDnLinkCodec)
  2161             break;
  2098             break;
  2162         case EAMR_NB:
  2099         case EAMR_NB:
  2163             error = iAMRNBDecFormatIntfc->ConcealErrorForNextBuffer();
  2100             error = iAMRNBDecFormatIntfc->ConcealErrorForNextBuffer();
  2164             iLog->Log(_L("Conceal Error for next buf"));
  2101             iLog->Log(_L("Conceal Error for next buf"));
  2165             break;
  2102             break;
  2166         case EPCM16:
  2103         case EPCM16: //Fail case
       
  2104             AddExpectedEvent(EDownlinkError, KShortTimeout);
       
  2105             error = iPCM16DecFormatIntfc->ConcealErrorForNextBuffer();
       
  2106             break;
  2167         default:
  2107         default:
  2168             break;
  2108             break;
  2169         }
  2109         }
  2170 
  2110 
  2171     return error;
  2111     return error;
  2172 }
  2112     }
  2173 
  2113 
  2174 
  2114 TInt CVoIPAudioServicesTestClass::GetMode(CStifItemParser& aItem)
  2175 
  2115     {
  2176 TInt CVoIPAudioServicesTestClass::GetMode( CStifItemParser& aItem )
       
  2177 {
       
  2178     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetMode")));
  2116     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetMode")));
  2179     iLog->Log(_L("CVoIPAudioServicesTestClass::GetMode"));
  2117     iLog->Log(_L("CVoIPAudioServicesTestClass::GetMode"));
  2180     TInt error = KErrNone;
  2118     TInt error = KErrNone;
  2181 
  2119 
  2182     TPtrC linkType;
  2120     TPtrC linkType;
  2183     error = aItem.GetNextString(linkType);
  2121     error = aItem.GetNextString(linkType);
  2184     if (error == KErrNone)
  2122     if (error == KErrNone)
  2185     	{
  2123         {
  2186         if ((linkType == KTagUplink)&&(iUpLinkCodec == EG711))
  2124         if ((linkType == KTagUplink) && (iUpLinkCodec == EG711))
  2187         	{
  2125             {
  2188         	CVoIPFormatIntfc::TG711CodecMode aMode;
  2126             CVoIPFormatIntfc::TG711CodecMode aMode;
  2189         	iG711EncFormatIntfc->GetMode(aMode);
  2127             iG711EncFormatIntfc->GetMode(aMode);
  2190         	if (aMode == CVoIPFormatIntfc::EG711ALaw)
  2128             if (aMode == CVoIPFormatIntfc::EG711ALaw)
  2191         		{
  2129                 {
  2192         		iLog->Log(_L("UPL Mode: aLaw"));
  2130                 iLog->Log(_L("UPL Mode: aLaw"));
  2193         		}
  2131                 }
  2194             else if (aMode == CVoIPFormatIntfc::EG711uLaw)
  2132             else if (aMode == CVoIPFormatIntfc::EG711uLaw)
  2195             	{
  2133                 {
  2196             	iLog->Log(_L("UPL Mode: uLaw"));
  2134                 iLog->Log(_L("UPL Mode: uLaw"));
  2197             	}
  2135                 }
  2198             else
  2136             else
  2199             	{
  2137                 {
  2200                 iLog->Log(_L("UPL Mode: unknown"));
  2138                 iLog->Log(_L("UPL Mode: unknown"));
  2201             	}
  2139                 }
  2202         	}
  2140             }
  2203         else if ((linkType == KTagUplink) && (iUpLinkCodec == EILBC) )
  2141         else if ((linkType == KTagUplink) && (iUpLinkCodec == EILBC))
  2204         	{
  2142             {
  2205         	CVoIPFormatIntfc::TILBCCodecMode aMode;
  2143             CVoIPFormatIntfc::TILBCCodecMode aMode;
  2206             iILBCEncFormatIntfc->GetMode(aMode);
  2144             iILBCEncFormatIntfc->GetMode(aMode);
  2207             if (aMode == CVoIPFormatIntfc::EiLBC20mSecFrame)
  2145             if (aMode == CVoIPFormatIntfc::EiLBC20mSecFrame)
  2208             	{
  2146                 {
  2209                 iLog->Log(_L("UPL Mode: 20ms frame"));
  2147                 iLog->Log(_L("UPL Mode: 20ms frame"));
  2210             	}
  2148                 }
  2211             else if (aMode == CVoIPFormatIntfc::EiLBC30mSecFrame)
  2149             else if (aMode == CVoIPFormatIntfc::EiLBC30mSecFrame)
  2212             	{
  2150                 {
  2213                 iLog->Log(_L("UPL Mode: 30ms frame"));
  2151                 iLog->Log(_L("UPL Mode: 30ms frame"));
  2214             	}
  2152                 }
  2215             else
  2153             else
  2216             	{
  2154                 {
  2217                 iLog->Log(_L("UPL Mode: unknown"));
  2155                 iLog->Log(_L("UPL Mode: unknown"));
  2218             	}
  2156                 }
  2219         	}
  2157             }
  2220         else if ((linkType == KTagDnlink)&&(iDnLinkCodec == EG711))
  2158         else if ((linkType == KTagDnlink) && (iDnLinkCodec == EG711))
  2221         	{
  2159             {
  2222         	CVoIPFormatIntfc::TG711CodecMode aMode;
  2160             CVoIPFormatIntfc::TG711CodecMode aMode;
  2223         	iG711DecFormatIntfc->GetMode(aMode);
  2161             iG711DecFormatIntfc->GetMode(aMode);
  2224         	if (aMode == CVoIPFormatIntfc::EG711ALaw)
  2162             if (aMode == CVoIPFormatIntfc::EG711ALaw)
  2225 	            {
  2163                 {
  2226 	            iLog->Log(_L("DNL Mode: aLaw"));
  2164                 iLog->Log(_L("DNL Mode: aLaw"));
  2227 	            }
  2165                 }
  2228             else if (aMode == CVoIPFormatIntfc::EG711uLaw)
  2166             else if (aMode == CVoIPFormatIntfc::EG711uLaw)
  2229 	            {
  2167                 {
  2230 	            iLog->Log(_L("DNL Mode: uLaw"));
  2168                 iLog->Log(_L("DNL Mode: uLaw"));
  2231 	            }
  2169                 }
  2232             else
  2170             else
  2233             	{
  2171                 {
  2234                 iLog->Log(_L("DNL Mode: unknown"));
  2172                 iLog->Log(_L("DNL Mode: unknown"));
  2235             	}
  2173                 }
  2236         	}
  2174             }
  2237         else if ((linkType == KTagDnlink) && (iDnLinkCodec == EILBC) )
  2175         else if ((linkType == KTagDnlink) && (iDnLinkCodec == EILBC))
  2238         	{
  2176             {
  2239         	CVoIPFormatIntfc::TILBCCodecMode aMode;
  2177             CVoIPFormatIntfc::TILBCCodecMode aMode;
  2240             iILBCDecFormatIntfc->GetMode(aMode);
  2178             iILBCDecFormatIntfc->GetMode(aMode);
  2241             if (aMode == CVoIPFormatIntfc::EiLBC20mSecFrame)
  2179             if (aMode == CVoIPFormatIntfc::EiLBC20mSecFrame)
  2242             	{
  2180                 {
  2243                 iLog->Log(_L("DNL Mode: 20ms frame"));
  2181                 iLog->Log(_L("DNL Mode: 20ms frame"));
  2244             	}
  2182                 }
  2245             else if (aMode == CVoIPFormatIntfc::EiLBC30mSecFrame)
  2183             else if (aMode == CVoIPFormatIntfc::EiLBC30mSecFrame)
  2246             	{
  2184                 {
  2247                 iLog->Log(_L("DNL Mode: 30ms frame"));
  2185                 iLog->Log(_L("DNL Mode: 30ms frame"));
  2248             	}
  2186                 }
  2249             else
  2187             else
  2250             	{
  2188                 {
  2251                 iLog->Log(_L("DNL Mode: unknown"));
  2189                 iLog->Log(_L("DNL Mode: unknown"));
  2252             	}
  2190                 }
  2253         	}
  2191             }
  2254         else
  2192         else
  2255         	{
  2193             {
  2256         	iLog->Log(KMsgBadTestParameters);
  2194             iLog->Log(KMsgBadTestParameters);
  2257             error = KErrBadTestParameter;
  2195             error = KErrBadTestParameter;
  2258         	}
  2196             }
  2259 
  2197 
  2260     	}
  2198         }
  2261 
  2199 
  2262     return error;
  2200     return error;
  2263 }
  2201     }
  2264 
  2202 
  2265 
  2203 TInt CVoIPAudioServicesTestClass::SetMode(CStifItemParser& aItem)
  2266 
  2204     {
  2267 
       
  2268 TInt CVoIPAudioServicesTestClass::SetMode( CStifItemParser& aItem )
       
  2269 {
       
  2270     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::SetMode")));
  2205     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::SetMode")));
  2271     iLog->Log(_L("CVoIPAudioServicesTestClass::SetMode"));
  2206     iLog->Log(_L("CVoIPAudioServicesTestClass::SetMode"));
  2272     TInt error = KErrNone;
  2207     TInt error = KErrNone;
  2273 
  2208 
  2274     TPtrC linkType;
  2209     TPtrC linkType;
  2275     error = aItem.GetNextString(linkType);
  2210     error = aItem.GetNextString(linkType);
  2276     if (error != KErrNone)
  2211     if (error != KErrNone)
  2277     	{
  2212         {
  2278         return error;
  2213         return error;
  2279     	}
  2214         }
  2280 
  2215 
  2281     TPtrC mode;
  2216     TPtrC mode;
  2282     error = aItem.GetNextString(mode);
  2217     error = aItem.GetNextString(mode);
  2283     if (error == KErrNone)
  2218     if (error == KErrNone)
  2284     	{
  2219         {
  2285         if ((linkType == KTagUplink) && (iUpLinkCodec == EG711) && (mode == KTagALaw))
  2220         if ((linkType == KTagUplink) && (iUpLinkCodec == EG711) && (mode
  2286         	{
  2221                 == KTagALaw))
  2287 	        iG711EncFormatIntfc->SetMode(CVoIPFormatIntfc::EG711ALaw);
  2222             {
  2288 	        iLog->Log(_L("UPL Mode Set: aLaw"));
  2223             iG711EncFormatIntfc->SetMode(CVoIPFormatIntfc::EG711ALaw);
  2289         	}
  2224             iLog->Log(_L("UPL Mode Set: aLaw"));
  2290         else if ((linkType == KTagUplink) && (iUpLinkCodec == EG711) && (mode == KTagULaw))
  2225             }
  2291         	{
  2226         else if ((linkType == KTagUplink) && (iUpLinkCodec == EG711) && (mode
  2292         	iG711EncFormatIntfc->SetMode(CVoIPFormatIntfc::EG711uLaw);
  2227                 == KTagULaw))
  2293         	iLog->Log(_L("UPL Mode Set: uLaw"));
  2228             {
  2294         	}
  2229             iG711EncFormatIntfc->SetMode(CVoIPFormatIntfc::EG711uLaw);
  2295         else if ((linkType == KTagUplink) && (iUpLinkCodec == EILBC)&& (mode == KTag20ms ))
  2230             iLog->Log(_L("UPL Mode Set: uLaw"));
  2296         	{
  2231             }
  2297         	iILBCEncFormatIntfc->SetMode(CVoIPFormatIntfc::EiLBC20mSecFrame);
  2232         else if ((linkType == KTagUplink) && (iUpLinkCodec == EILBC) && (mode
  2298         	iLog->Log(_L("UPL Mode Set: 20ms frame"));
  2233                 == KTag20ms))
  2299         	}
  2234             {
  2300         else if ((linkType == KTagUplink) && (iUpLinkCodec == EILBC)&& (mode == KTag30ms ))
  2235             iILBCEncFormatIntfc->SetMode(CVoIPFormatIntfc::EiLBC20mSecFrame);
  2301         	{
  2236             iLog->Log(_L("UPL Mode Set: 20ms frame"));
  2302         	iILBCEncFormatIntfc->SetMode(CVoIPFormatIntfc::EiLBC30mSecFrame);
  2237             }
  2303         	iLog->Log(_L("UPL Mode Set: 30ms frame"));
  2238         else if ((linkType == KTagUplink) && (iUpLinkCodec == EILBC) && (mode
  2304         	}
  2239                 == KTag30ms))
  2305         else if ((linkType == KTagDnlink) && (iDnLinkCodec == EG711) && (mode == KTagALaw) )
  2240             {
  2306         	{
  2241             iILBCEncFormatIntfc->SetMode(CVoIPFormatIntfc::EiLBC30mSecFrame);
  2307         	iG711DecFormatIntfc->SetMode(CVoIPFormatIntfc::EG711ALaw);
  2242             iLog->Log(_L("UPL Mode Set: 30ms frame"));
  2308         	iLog->Log(_L("DNL Mode Set: aLaw"));
  2243             }
  2309         	}
  2244         else if ((linkType == KTagDnlink) && (iDnLinkCodec == EG711) && (mode
  2310         else if ((linkType == KTagDnlink) && (iDnLinkCodec == EG711) && (mode == KTagULaw) )
  2245                 == KTagALaw))
  2311         	{
  2246             {
  2312         	iG711DecFormatIntfc->SetMode(CVoIPFormatIntfc::EG711uLaw);
  2247             iG711DecFormatIntfc->SetMode(CVoIPFormatIntfc::EG711ALaw);
  2313 	        iLog->Log(_L("DNL Mode Set: uLaw"));
  2248             iLog->Log(_L("DNL Mode Set: aLaw"));
  2314         	}
  2249             }
  2315         else if ((linkType == KTagDnlink) && (iDnLinkCodec == EILBC) && (mode == KTag20ms) )
  2250         else if ((linkType == KTagDnlink) && (iDnLinkCodec == EG711) && (mode
  2316         	{
  2251                 == KTagULaw))
  2317         	iILBCDecFormatIntfc->SetMode(CVoIPFormatIntfc::EiLBC20mSecFrame);
  2252             {
  2318         	iLog->Log(_L("DNL Mode Set: 20ms frame"));
  2253             iG711DecFormatIntfc->SetMode(CVoIPFormatIntfc::EG711uLaw);
  2319         	}
  2254             iLog->Log(_L("DNL Mode Set: uLaw"));
  2320         else if ((linkType == KTagDnlink) && (iDnLinkCodec == EILBC) && (mode == KTag30ms) )
  2255             }
  2321         	{
  2256         else if ((linkType == KTagDnlink) && (iDnLinkCodec == EILBC) && (mode
  2322         	iILBCDecFormatIntfc->SetMode(CVoIPFormatIntfc::EiLBC30mSecFrame);
  2257                 == KTag20ms))
  2323         	iLog->Log(_L("DNL Mode Set: 30ms frame"));
  2258             {
  2324         	}
  2259             iILBCDecFormatIntfc->SetMode(CVoIPFormatIntfc::EiLBC20mSecFrame);
       
  2260             iLog->Log(_L("DNL Mode Set: 20ms frame"));
       
  2261             }
       
  2262         else if ((linkType == KTagDnlink) && (iDnLinkCodec == EILBC) && (mode
       
  2263                 == KTag30ms))
       
  2264             {
       
  2265             iILBCDecFormatIntfc->SetMode(CVoIPFormatIntfc::EiLBC30mSecFrame);
       
  2266             iLog->Log(_L("DNL Mode Set: 30ms frame"));
       
  2267             }
  2325         else
  2268         else
  2326         	{
  2269             {
  2327         	iLog->Log(KMsgBadTestParameters);
  2270             iLog->Log(KMsgBadTestParameters);
  2328             error = KErrBadTestParameter;
  2271             error = KErrBadTestParameter;
  2329         	}
  2272             }
  2330     	}
  2273         }
  2331 
  2274 
  2332     return error;
  2275     return error;
  2333 }
  2276     }
  2334 
  2277 
  2335 
  2278 TInt CVoIPAudioServicesTestClass::GetCNG(CStifItemParser& /*aItem*/)
  2336 
  2279     {
  2337 TInt CVoIPAudioServicesTestClass::GetCNG( CStifItemParser& /*aItem*/ )
       
  2338 {
       
  2339     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetCNG")));
  2280     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetCNG")));
  2340     iLog->Log(_L("CVoIPAudioServicesTestClass::GetCNG"));
  2281     iLog->Log(_L("CVoIPAudioServicesTestClass::GetCNG"));
  2341     TInt error = KErrNone;
  2282     TInt error = KErrNone;
  2342 
  2283 
  2343     TBool aCng = EFalse;
  2284     TBool aCng = EFalse;
  2353             break;
  2294             break;
  2354         default:
  2295         default:
  2355             break;
  2296             break;
  2356         }
  2297         }
  2357 
  2298 
  2358       if (aCng != iCng)
  2299     if (aCng != iCng)
  2359     	  {
  2300         {
  2360     	  iLog->Log(_L("returned Cng doesn't match set Cng: Failed"));
  2301         iLog->Log(_L("returned Cng doesn't match set Cng: Failed"));
  2361     	  error = KErrUnexpectedValue;
  2302         error = KErrUnexpectedValue;
  2362     	  }
  2303         }
  2363 
  2304 
  2364     return error;
  2305     return error;
  2365 }
  2306     }
  2366 
  2307 
  2367 
  2308 TInt CVoIPAudioServicesTestClass::ToggleCNG(CStifItemParser& /*aItem*/)
  2368 
  2309     {
  2369 TInt CVoIPAudioServicesTestClass::ToggleCNG( CStifItemParser& /*aItem*/ )
       
  2370 {
       
  2371     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::ToggleCNG")));
  2310     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::ToggleCNG")));
  2372     iLog->Log(_L("CVoIPAudioServicesTestClass::ToggleCNG"));
  2311     iLog->Log(_L("CVoIPAudioServicesTestClass::ToggleCNG"));
  2373     TInt error = KErrNone;
  2312     TInt error = KErrNone;
  2374 
  2313 
  2375     iCng = (iCng)? EFalse : ETrue;
  2314     iCng = (iCng) ? EFalse : ETrue;
  2376 
  2315 
  2377     switch (iDnLinkCodec)
  2316     switch (iDnLinkCodec)
  2378         {
  2317         {
  2379         case EG711:
  2318         case EG711:
  2380             iG711DecFormatIntfc->SetCNG(iCng);
  2319             iG711DecFormatIntfc->SetCNG(iCng);
  2387         default:
  2326         default:
  2388             break;
  2327             break;
  2389         }
  2328         }
  2390 
  2329 
  2391     return error;
  2330     return error;
  2392 }
  2331     }
  2393 
  2332 
  2394 
  2333 TInt CVoIPAudioServicesTestClass::GetPLC(CStifItemParser& /*aItem*/)
  2395 
  2334     {
  2396 TInt CVoIPAudioServicesTestClass::GetPLC( CStifItemParser& /*aItem*/ )
       
  2397 {
       
  2398     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetPLC")));
  2335     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetPLC")));
  2399     iLog->Log(_L("CVoIPAudioServicesTestClass::GetPLC"));
  2336     iLog->Log(_L("CVoIPAudioServicesTestClass::GetPLC"));
  2400     TInt error = KErrNone;
  2337     TInt error = KErrNone;
  2401 
  2338 
  2402     TBool aPlc = EFalse;
  2339     TBool aPlc = EFalse;
  2403     if (iDnLinkCodec == EG711)
  2340     if (iDnLinkCodec == EG711)
  2404     	{
  2341         {
  2405         iG711DecFormatIntfc->GetPLC(aPlc);
  2342         iG711DecFormatIntfc->GetPLC(aPlc);
  2406         iLog->Log(_L("PLC: %d"), aPlc);
  2343         iLog->Log(_L("PLC: %d"), aPlc);
  2407     	}
  2344         }
  2408 
  2345 
  2409     return error;
  2346     return error;
  2410 }
  2347     }
  2411 
  2348 
  2412 
  2349 TInt CVoIPAudioServicesTestClass::TogglePLC(CStifItemParser& /*aItem*/)
  2413 
  2350     {
  2414 TInt CVoIPAudioServicesTestClass::TogglePLC( CStifItemParser& /*aItem*/ )
       
  2415 {
       
  2416     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::TogglePLC")));
  2351     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::TogglePLC")));
  2417     iLog->Log(_L("CVoIPAudioServicesTestClass::TogglePLC"));
  2352     iLog->Log(_L("CVoIPAudioServicesTestClass::TogglePLC"));
  2418     TInt error = KErrNone;
  2353     TInt error = KErrNone;
  2419 
  2354 
  2420     iPlc = (iPlc)? EFalse : ETrue;
  2355     iPlc = (iPlc) ? EFalse : ETrue;
  2421 
  2356 
  2422     if (iDnLinkCodec == EG711)
  2357     if (iDnLinkCodec == EG711)
  2423         {
  2358         {
  2424         error = iG711DecFormatIntfc->SetPLC(ETrue);
  2359         error = iG711DecFormatIntfc->SetPLC(ETrue);
  2425         iLog->Log(_L("PLC set: %d"), iPlc);
  2360         iLog->Log(_L("PLC set: %d"), iPlc);
  2426         }
  2361         }
  2427 
  2362 
  2428     return error;
  2363     return error;
  2429 }
  2364     }
  2430 
  2365 
  2431 
  2366 TInt CVoIPAudioServicesTestClass::BadLsfNextBuffer(CStifItemParser& /*aItem*/)
  2432 
  2367     {
  2433 TInt CVoIPAudioServicesTestClass::BadLsfNextBuffer( CStifItemParser& /*aItem*/ )
  2368     return BadLsfNextBuffer();
  2434 {
  2369     }
       
  2370 
       
  2371 TInt CVoIPAudioServicesTestClass::BadLsfNextBuffer()
       
  2372     {
  2435     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::BadLsfNextBuffer")));
  2373     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::BadLsfNextBuffer")));
  2436     iLog->Log(_L("CVoIPAudioServicesTestClass::BadLsfNextBuffer"));
  2374     iLog->Log(_L("CVoIPAudioServicesTestClass::BadLsfNextBuffer"));
  2437     TInt error = KErrNone;
  2375     TInt error = KErrNone;
  2438 
  2376     if (iG729DecFormatIntfc)
  2439     if (iDnLinkCodec == EG729)
       
  2440         {
  2377         {
  2441         error = iG729DecFormatIntfc->BadLsfNextBuffer();
  2378         error = iG729DecFormatIntfc->BadLsfNextBuffer();
       
  2379         if (iDnLinkStatus != EStreaming)
       
  2380             {
       
  2381             AddExpectedEvent(EDownlinkError, KShortTimeout);
       
  2382             }
  2442         iLog->Log(_L("BadLsf for next buf"));
  2383         iLog->Log(_L("BadLsf for next buf"));
  2443         }
  2384         }
  2444 
  2385     return error;
  2445     return error;
  2386     }
  2446 }
  2387 
  2447 
  2388 TInt CVoIPAudioServicesTestClass::StopRingTone(CStifItemParser& /*aItem*/)
  2448 
  2389     {
  2449 
       
  2450 TInt CVoIPAudioServicesTestClass::StopRingTone( CStifItemParser& /*aItem*/ )
       
  2451 {
       
  2452     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::StopRingTone")));
  2390     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::StopRingTone")));
  2453     iLog->Log(_L("CVoIPAudioServicesTestClass::StopRingTone"));
  2391     iLog->Log(_L("CVoIPAudioServicesTestClass::StopRingTone"));
  2454     TInt error = KErrNone;
  2392     TInt error = KErrNone;
  2455 
  2393 
  2456     if (iRingTonePlayer)
  2394     if (iRingTonePlayer)
  2457     	{
  2395         {
  2458         iRingTonePlayer->Stop();
  2396         iRingTonePlayer->Stop();
  2459         RemoveExpectedEvent(EPlaybackComplete);
  2397         RemoveExpectedEvent(EPlaybackComplete);
  2460     	}
  2398         }
  2461     else
  2399     else
  2462 	  {
  2400         {
  2463       iLog->Log(_L("RT PLR Not Ready: error = %d"), KErrNotFound);
  2401         iLog->Log(_L("RT PLR Not Ready: error = %d"), KErrNotFound);
  2464       error = KErrNotFound;
  2402         error = KErrNotFound;
  2465 	  }
  2403         }
  2466 
  2404 
  2467     return error;
  2405     return error;
  2468 }
  2406     }
  2469 
  2407 
  2470 
  2408 TInt CVoIPAudioServicesTestClass::GetBufferType(CStifItemParser& /*aItem*/)
  2471 TInt CVoIPAudioServicesTestClass::GetBufferType( CStifItemParser& /*aItem*/ )
  2409     {
  2472 {
       
  2473     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetBufferType")));
  2410     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::GetBufferType")));
  2474     iLog->Log(_L("CVoIPAudioServicesTestClass::GetBufferType"));
  2411     iLog->Log(_L("CVoIPAudioServicesTestClass::GetBufferType"));
  2475     TInt error = KErrNone;
  2412     TInt error = KErrNotFound;
  2476 
  2413 
  2477     CVoIPDataBuffer::TVoIPBufferType BufType;
  2414     CVoIPDataBuffer::TVoIPBufferType BufType;
  2478     iPlayBuf->GetBufferType(BufType);
  2415     if (iPlayBuf)
  2479 
  2416         {
  2480     if (BufType != CVoIPDataBuffer::EStandard && BufType != CVoIPDataBuffer::EJitterBuffer)
  2417         iPlayBuf->GetBufferType(BufType);
  2481     	{
  2418         error = KErrNone;
  2482     	error = KErrUnknown;
  2419 
  2483     	FTRACE(FPrint(_L("Buffer Type Unknown")));
  2420         if (BufType != CVoIPDataBuffer::EStandard && BufType
  2484         iLog->Log(_L("Buffer Type Unknown"));
  2421                 != CVoIPDataBuffer::EJitterBuffer)
  2485     	}
  2422             {
  2486 
  2423             error = KErrUnknown;
  2487     return error;
  2424             FTRACE(FPrint(_L("Buffer Type Unknown")));
  2488 }
  2425             iLog->Log(_L("Buffer Type Unknown"));
  2489 
  2426             }
  2490 
  2427         }
  2491 #ifdef __JITTER_BUFFER_TEST__
  2428     return error;
       
  2429     }
       
  2430 
  2492 // ----------------------------------------------------------------------------
  2431 // ----------------------------------------------------------------------------
  2493 // CVoIPAudioServicesTestClass::ConfigureJB
  2432 // CVoIPAudioServicesTestClass::ConfigureJB
  2494 //
  2433 //
  2495 // ----------------------------------------------------------------------------
  2434 // ----------------------------------------------------------------------------
  2496 //
  2435 //
  2497 TInt CVoIPAudioServicesTestClass::ConfigureJB()
  2436 TInt CVoIPAudioServicesTestClass::ConfigureJB(CStifItemParser& /*aItem*/)
  2498 {
  2437     {
       
  2438     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::ConfigureJB")));
       
  2439     iLog->Log(_L("CVoIPAudioServicesTestClass::ConfigureJB"));
  2499     TInt err = KErrNotSupported;
  2440     TInt err = KErrNotSupported;
  2500 
  2441 
  2501     if (iJBIntfc && iDnLinkCodec != EPCM16)
  2442     if (iJBIntfc /*&& iDnLinkCodec != EPCM16*/)
  2502         {
  2443         {
  2503         TVoIPJBConfig jBConfig;
  2444         TVoIPJBConfig jBConfig;
  2504 
  2445 
  2505         // Select number of JB slots. Current VAS server's heap size limit
  2446         // Select number of JB slots. Current VAS server's heap size limit
  2506         // is 16k. This means, JB buffer with 100 slots, each 162-byte long
  2447         // is 16k. This means, JB buffer with 100 slots, each 162-byte long
  2524 
  2465 
  2525         // Relevant only to AMR (jb is reset upon talk-burst timeout)
  2466         // Relevant only to AMR (jb is reset upon talk-burst timeout)
  2526         jBConfig.iJBInactivityTimeOut = 30;
  2467         jBConfig.iJBInactivityTimeOut = 30;
  2527 
  2468 
  2528         // Configure reset buffer tone playback params
  2469         // Configure reset buffer tone playback params
  2529 //      jBConfig.iJitterBufPlayToneDuration = ?;
  2470         //      jBConfig.iJitterBufPlayToneDuration = ?;
  2530 //      jBConfig.iJitterBufPlayToneFrequency = ?;
  2471         //      jBConfig.iJitterBufPlayToneFrequency = ?;
  2531 //      jBConfig.iJitterBufPlayToneTimeout = ?;
  2472         //      jBConfig.iJitterBufPlayToneTimeout = ?;
  2532 
  2473 
  2533         err = iJBIntfc->ConfigureJitterBuffer(jBConfig);
  2474         err = iJBIntfc->ConfigureJitterBuffer(jBConfig);
  2534         }
  2475         iLog->Log(_L("JB Configure and start requested"));
  2535 
  2476         AddExpectedEvent(EFillBuffer, KShortTimeout);
  2536 //    	DisplayText(_L("JB Initialized"));
  2477         }
  2537 
       
  2538     return err;
  2478     return err;
  2539 }
  2479     }
  2540 
  2480 
  2541 // ----------------------------------------------------------------------------
  2481 // ----------------------------------------------------------------------------
  2542 // CVoIPAudioServicesTestClass::ResetJB
  2482 // CVoIPAudioServicesTestClass::ResetJB
  2543 //
  2483 //
  2544 // ----------------------------------------------------------------------------
  2484 // ----------------------------------------------------------------------------
  2545 //
  2485 //
  2546 TInt CVoIPAudioServicesTestClass::ResetJB()
  2486 TInt CVoIPAudioServicesTestClass::ResetJB(CStifItemParser& /*aItem*/)
  2547 {
  2487     {
       
  2488     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::ResetJB")));
       
  2489     iLog->Log(_L("CVoIPAudioServicesTestClass::ResetJB"));
  2548     TInt err = KErrNotSupported;
  2490     TInt err = KErrNotSupported;
  2549 
  2491 
  2550     if (iJBIntfc && iDnLinkCodec != EPCM16)
  2492     if (iJBIntfc && iDnLinkCodec != EPCM16)
  2551         {
  2493         {
  2552         err = iJBIntfc->ResetJitterBuffer(ETrue);
  2494         err = iJBIntfc->ResetJitterBuffer(ETrue);
  2553         }
  2495         }
  2554 
       
  2555     return err;
  2496     return err;
  2556 }
  2497     }
  2557 
  2498 
  2558 // ----------------------------------------------------------------------------
  2499 // ----------------------------------------------------------------------------
  2559 // CVoIPAudioServicesTestClass::DelayDown
  2500 // CVoIPAudioServicesTestClass::DelayDown
  2560 //
  2501 //
  2561 // ----------------------------------------------------------------------------
  2502 // ----------------------------------------------------------------------------
  2562 //
  2503 //
  2563 void CVoIPAudioServicesTestClass::DelayDown()
  2504 TInt CVoIPAudioServicesTestClass::DelayDown(CStifItemParser& /*aItem*/)
  2564 {
  2505     {
       
  2506     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::DelayDown")));
       
  2507     iLog->Log(_L("CVoIPAudioServicesTestClass::DelayDown"));
       
  2508     TInt err = KErrNotSupported;
  2565     if (iJBIntfc && iDnLinkCodec != EPCM16)
  2509     if (iJBIntfc && iDnLinkCodec != EPCM16)
  2566         {
  2510         {
  2567         iJBIntfc->DelayDown();
  2511         err = iJBIntfc->DelayDown();
  2568         }
  2512         }
  2569 }
  2513     return err;
       
  2514     }
  2570 
  2515 
  2571 // ----------------------------------------------------------------------------
  2516 // ----------------------------------------------------------------------------
  2572 // CVoIPAudioServicesTestClass::DelayUp
  2517 // CVoIPAudioServicesTestClass::DelayUp
  2573 //
  2518 //
  2574 // ----------------------------------------------------------------------------
  2519 // ----------------------------------------------------------------------------
  2575 //
  2520 //
  2576 void CVoIPAudioServicesTestClass::DelayUp()
  2521 TInt CVoIPAudioServicesTestClass::DelayUp(CStifItemParser& /*aItem*/)
  2577 {
  2522     {
       
  2523     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::DelayUp")));
       
  2524     iLog->Log(_L("CVoIPAudioServicesTestClass::DelayUp"));
       
  2525     TInt err = KErrNotSupported;
  2578     if (iJBIntfc && iDnLinkCodec != EPCM16)
  2526     if (iJBIntfc && iDnLinkCodec != EPCM16)
  2579         {
  2527         {
  2580         iJBIntfc->DelayUp();
  2528         err = iJBIntfc->DelayUp();
  2581         }
  2529         }
  2582 }
  2530     return err;
  2583 #endif //__JITTER_BUFFER_TEST__
  2531     }
  2584 
       
  2585 
  2532 
  2586 // ----------------------------------------------------------------------------
  2533 // ----------------------------------------------------------------------------
  2587 // CVoIPTestEngine::DoLoopback
  2534 // CVoIPTestEngine::SetLoopPlay
  2588 //
  2535 //
  2589 // ----------------------------------------------------------------------------
  2536 // ----------------------------------------------------------------------------
  2590 //
  2537 //
  2591 /*void CVoIPAudioServicesTestClass::DoLoopback()
  2538 TInt CVoIPAudioServicesTestClass::SetLoopPlay(CStifItemParser& /*aItem*/)
  2592     {
  2539     {
  2593    	iLog->Log(_L("CVoIPAudioServicesTestClass::DoLoopback"));
  2540     iLog->Log(_L("CVoIPAudioServicesTestClass::SetLoopPlay"));
  2594  		if (iPlayBufReady && iRecBufReady)
  2541     iLoopPlay = ETrue;
  2595         {
  2542     return 0;
  2596         iPlayBufPtr.Copy(iRecBufPtr);
  2543     }
  2597 
       
  2598 
       
  2599 #ifdef __JITTER_BUFFER_TEST__
       
  2600         if (iDnLinkCodec != EPCM16)
       
  2601             {
       
  2602             // We need to generate sequence number for each frame.
       
  2603             // Real client should get sequence number from the RTP header.
       
  2604             // Max possible sequence number of RTP packet with standard
       
  2605             // RTP header is 0xFFFF (16-bit value)
       
  2606             if (iSeqNum < (KMaxSeqNumber - iSeqNumIncrement))
       
  2607             	{
       
  2608                 iSeqNum += iSeqNumIncrement;
       
  2609             	}
       
  2610             else
       
  2611             	{
       
  2612                 iSeqNum = iSeqNumIncrement; //wrap-around
       
  2613             	}
       
  2614 
       
  2615             iPlayJBuf->SetPayloadPtr(iPlayBufPtr);
       
  2616             iPlayJBuf->SetBufferSequence(iSeqNum);
       
  2617             iVoIPDnlink->BufferFilled(iPlayJBuf);
       
  2618             iPlayBufReady = ETrue; // no FillBuffer events in JB mode
       
  2619             iRecBufReady = EFalse; // consumed, ready for EmptyBuffer
       
  2620             }
       
  2621         else
       
  2622         	{
       
  2623         	; // PCM not supported in Jitter Buffer mode
       
  2624         	}
       
  2625 #else  //__JITTER_BUFFER_TEST__
       
  2626 
       
  2627         iPlayBuf->SetPayloadPtr(iPlayBufPtr);
       
  2628         iVoIPDnlink->BufferFilled(iPlayBuf);
       
  2629         iLog->Log(_L("CVoIPAudioServicesTestClass::played"));
       
  2630         iPlayBufReady = EFalse;
       
  2631         iRecBufReady = EFalse;
       
  2632 #endif //__JITTER_BUFFER_TEST__
       
  2633         }
       
  2634     iLog->Log(_L("CVoIPAudioServicesTestClass::DoLoopback END"));
       
  2635     }
       
  2636 */
       
  2637 
       
  2638 
       
  2639 
  2544 
  2640 // ----------------------------------------------------------------------------
  2545 // ----------------------------------------------------------------------------
  2641 // CVoIPTestEngine::DoLoopback
  2546 // CVoIPTestEngine::DoLoopback
  2642 //
  2547 //
  2643 // ----------------------------------------------------------------------------
  2548 // ----------------------------------------------------------------------------
  2644 //
  2549 //
  2645 void CVoIPAudioServicesTestClass::DoLoopback()
  2550 void CVoIPAudioServicesTestClass::DoLoopback()
  2646 {
  2551     {
  2647     
  2552     iLog->Log(_L("CVoIPAudioServicesTestClass::DoLoopback"));
  2648   
  2553 
  2649 	iLog->Log(_L("CVoIPAudioServicesTestClass::DoLoopback"));
  2554     if (!iLoopPlay)
  2650 	iLog->Log(_L("loopbackCount = %d"), loopbackCount);
  2555         {
  2651   if ((0<loopbackCount) && (loopbackCount<= 20))
  2556         if (iPlayBufReady)
  2652   {
  2557             {
  2653     if (iPlayBufReady && iRecBufReady)
  2558             // Just keep D/S NULL playback going
  2654         {
  2559             iPlayBufReady = EFalse;
  2655         iPlayBufPtr.Copy(iRecBufPtr);
  2560             iPlayBufPtr.Copy(_L("0000"));
  2656 
  2561             iPlayBuf->SetPayloadPtr(iPlayBufPtr);
  2657 
  2562             iVoIPDnlink->BufferFilled(iPlayBuf);
  2658 #ifdef __JITTER_BUFFER_TEST__
  2563             }
  2659         if (iDnLinkCodec != EPCM16)
  2564         else if (iRecBufReady)
  2660             {
  2565             {
  2661             // We need to generate sequence number for each frame.
  2566             // Keep recording ongoing
  2662             // Real client should get sequence number from the RTP header.
  2567             iRecBufReady = EFalse;
  2663             // Max possible sequence number of RTP packet with standard
  2568             iRecBuf->SetPayloadPtr(iRecBufPtr);
  2664             // RTP header is 0xFFFF (16-bit value)
  2569             iVoIPUplink->BufferEmptied(iRecBuf);
  2665             if (iSeqNum < (KMaxSeqNumber - iSeqNumIncrement))
  2570             }
  2666             	{
  2571         }
  2667                 iSeqNum += iSeqNumIncrement;
  2572     else
  2668             	}
  2573         {
  2669             else
  2574         if (iPlayBufReady && iRecBufReady)
  2670             	{
  2575             {
  2671                 iSeqNum = iSeqNumIncrement; //wrap-around
  2576             iPlayBufReady = EFalse;
  2672             	}
  2577             iRecBufReady = EFalse;
  2673 
  2578             iPlayBufPtr.Copy(iRecBufPtr);
  2674             iPlayJBuf->SetPayloadPtr(iPlayBufPtr);
  2579             iRecBuf->SetPayloadPtr(iRecBufPtr);
  2675             iPlayJBuf->SetBufferSequence(iSeqNum);
  2580             iVoIPUplink->BufferEmptied(iRecBuf);
  2676             iLog->Log(_L("CVoIPAudioServicesTestClass::DoLoopback, loopbackCount == %d"), loopbackCount);
  2581             iPlayBuf->SetPayloadPtr(iPlayBufPtr);
  2677             //sue add
  2582             iVoIPDnlink->BufferFilled(iPlayBuf);
  2678             if (loopbackCount == 10)
  2583             }
  2679             {
  2584         }
  2680             	ResetJB();
  2585     }
  2681             }
  2586 
  2682             if (loopbackCount == 12)
  2587 // ----------------------------------------------------------------------------
  2683             {
  2588 // CVoIPTestEngine::DoJBLoopback
  2684             	DelayDown();
  2589 //
  2685             }
  2590 // ----------------------------------------------------------------------------
  2686             if (loopbackCount == 14)
  2591 //
  2687             {
  2592 void CVoIPAudioServicesTestClass::DoJBLoopback()
  2688             	DelayUp();
  2593     {
  2689             }
  2594 
  2690             // end sue
  2595     iLog->Log(_L("CVoIPAudioServicesTestClass::DoJBLoopback"));
  2691             iRecBuf->SetPayloadPtr(iRecBufPtr); //sue add
  2596 
  2692             iVoIPDnlink->BufferFilled(iPlayJBuf);
  2597     if (iPlayBufReady && iRecBufReady && iDnLinkCodec != EPCM16)
  2693             iVoIPUplink->BufferEmptied(iRecBuf); 
  2598         {
  2694             iPlayBufReady = ETrue; // no FillBuffer events in JB mode
  2599         // We need to generate sequence number for each frame.
  2695             iRecBufReady = EFalse; // consumed, ready for EmptyBuffer
  2600         // Real client should get sequence number from the RTP header.
  2696             loopbackCount++;	
  2601         // Max possible sequence number of RTP packet with standard
       
  2602         // RTP header is 0xFFFF (16-bit value)
       
  2603         if (iSeqNum < (KMaxSeqNumber - iSeqNumIncrement))
       
  2604             {
       
  2605             iSeqNum += iSeqNumIncrement;
  2697             }
  2606             }
  2698         else
  2607         else
  2699         	{
  2608             {
  2700         	; // PCM not supported in Jitter Buffer mode
  2609             iSeqNum = iSeqNumIncrement; //wrap-around
  2701         	}
  2610             }
  2702 #else  //__JITTER_BUFFER_TEST__
  2611 
  2703 
       
  2704         iPlayBuf->SetPayloadPtr(iPlayBufPtr);
       
  2705         iRecBuf->SetPayloadPtr(iRecBufPtr); 
       
  2706         iVoIPDnlink->BufferFilled(iPlayBuf);
       
  2707         iVoIPUplink->BufferEmptied(iRecBuf); 
       
  2708         iPlayBufReady = EFalse;
  2612         iPlayBufReady = EFalse;
  2709         iRecBufReady = EFalse;
  2613         iRecBufReady = EFalse;
  2710         loopbackCount++;	
  2614         iPlayBufPtr.Copy(iRecBufPtr);
  2711         
  2615         iRecBuf->SetPayloadPtr(iRecBufPtr);
  2712         
  2616         iVoIPUplink->BufferEmptied(iRecBuf);
  2713 
  2617         iPlayJBuf->SetPayloadPtr(iPlayBufPtr);
  2714 #endif //__JITTER_BUFFER_TEST__
  2618         iPlayJBuf->SetBufferSequence(iSeqNum);
  2715         }
  2619         iVoIPDnlink->BufferFilled(iPlayJBuf);
  2716 	}
  2620         }
  2717   else
  2621     }
  2718   {
  2622 
  2719     loopbackCount = 0;
  2623 TInt CVoIPAudioServicesTestClass::ConfigEncAudDevice(CStifItemParser& /*aItem*/)
  2720     iLog->Log(_L("CVoIPAudioServicesTestClass::DoLoopback test end"));
  2624     {
  2721   }
       
  2722  }
       
  2723 
       
  2724 
       
  2725 
       
  2726 TInt CVoIPAudioServicesTestClass::ConfigEncAudDevice( CStifItemParser& /*aItem*/ )
       
  2727 {
       
  2728     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::ConfigEncAudDevice")));
  2625     FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::ConfigEncAudDevice")));
  2729     iLog->Log(_L("CVoIPAudioServicesTestClass::ConfigEncAudDevice"));
  2626     iLog->Log(_L("CVoIPAudioServicesTestClass::ConfigEncAudDevice"));
  2730     TInt error = KErrNone;
  2627     TInt error = KErrNone;
  2731     if (iUpLinkStatus == EReady)
  2628     if (iUpLinkStatus == EReady)
  2732     	{
  2629         {
  2733     // Now we can configure encoder and audio device
  2630         // Now we can configure encoder and audio device
  2734     	iVoIPUplink->GetMaxGain(iMaxGain);
  2631         iVoIPUplink->GetMaxGain(iMaxGain);
  2735     	iVoIPUplink->SetGain(iMaxGain);
  2632         iVoIPUplink->SetGain(iMaxGain);
  2736     	}
  2633         }
  2737 
  2634 
  2738     return error;
  2635     return error;
  2739 }
  2636     }
  2740 
  2637 
  2741 
  2638 //class CVoIPAudioDownlinkStream2 : public CVoIPAudioDownlinkStream {};
       
  2639 
       
  2640 TInt CVoIPAudioServicesTestClass::TestNullObjects(CStifItemParser& /*aItem*/)
       
  2641     {
       
  2642     //FTRACE(FPrint(_L("CVoIPAudioServicesTestClass::CreateFactory")));
       
  2643     //iLog->Log(_L("CVoIPAudioServicesTestClass::CreateFactory"));
       
  2644 
       
  2645     TInt error = KErrNone;
       
  2646    // CVoIPAudioDownlinkStream2* dnl = new CVoIPAudioDownlinkStream2();
       
  2647 
       
  2648 //    error = CVoIPUtilityFactory::CreateFactory(iFactory);
       
  2649 //    iFactory->CreateDownlinkStream(TVersion(0,0,0),
       
  2650 //            CVoIPUtilityFactory::EVoIPCall, iVoIPDnlink);
       
  2651     //TInt vol;
       
  2652  //   dnl->GetVolume(vol);
       
  2653     //delete dnl;
       
  2654     return error;
       
  2655     }
  2742 
  2656 
  2743 //  End of File
  2657 //  End of File