multimediacommsengine/tsrc/MCETestUI/MCETestUIEngine/src/CMCETestUIEngineCodec.cpp
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:    
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 // MCE API
       
    22 
       
    23 
       
    24 //#include <MCEManager.h>
       
    25 #include <MCESession.h>
       
    26 #include <MCEMediaStream.h>
       
    27 //#include <MCEOneWayStream.h>
       
    28 #include <MCEAudioStream.h>
       
    29 #include <MCEMediaSource.h>
       
    30 #include <MCEMicSource.h>
       
    31 #include <MCEMediaSink.h>
       
    32 #include <MCERtpSink.h>
       
    33 #include <MCERtpSource.h>
       
    34 #include <MCESpeakerSink.h>
       
    35 #include <MCEcodec.h>
       
    36 #include <MCEaudiocodec.h>
       
    37 
       
    38 #include "CMCETestUIEngine.h"
       
    39 #include "MCETestUIEngineConstants.h"
       
    40 #include "CMCETestUIEngineCodec.h"
       
    41 
       
    42 #include "TMCETestUIEngineCmdBase.h"
       
    43 #include "TMCETestUIEngineCmdDeleteAudioCodec.h"
       
    44 
       
    45 // ============================ MEMBER FUNCTIONS ===============================
       
    46 
       
    47 // -----------------------------------------------------------------------------
       
    48 // CMCETestUIEngineCodec::NewL()
       
    49 // -----------------------------------------------------------------------------
       
    50 //
       
    51 CMCETestUIEngineCodec* CMCETestUIEngineCodec::NewL(
       
    52             CMCETestUIEngine& aEngine, 
       
    53             CMceAudioCodec& aCodec )
       
    54     {
       
    55 
       
    56     CMCETestUIEngineCodec* self = 
       
    57         new (ELeave) CMCETestUIEngineCodec( aEngine, 
       
    58                                                   aCodec );
       
    59     CleanupStack::PushL( self );
       
    60     self->ConstructL();
       
    61     CleanupStack::Pop( self );
       
    62     return self;  
       
    63     }
       
    64 
       
    65 // -----------------------------------------------------------------------------
       
    66 // CMCETestUIEngineCodec::CMCETestUIEngineCodec
       
    67 // -----------------------------------------------------------------------------
       
    68 //
       
    69 CMCETestUIEngineCodec::CMCETestUIEngineCodec( 
       
    70                 CMCETestUIEngine& aEngine, 
       
    71             	CMceAudioCodec& aCodec  )
       
    72     : iEngine( aEngine ),
       
    73       iCodec( aCodec )
       
    74     {
       
    75     }
       
    76 
       
    77 // -----------------------------------------------------------------------------
       
    78 // CMCETestUIEngineCodec::ConstructL()
       
    79 // -----------------------------------------------------------------------------
       
    80 //
       
    81 void CMCETestUIEngineCodec::ConstructL()
       
    82     {
       
    83       return;
       
    84     }
       
    85 
       
    86 // -----------------------------------------------------------------------------
       
    87 // CMCETestUIEngineCodec::~CMCETestUIEngineCodec
       
    88 // -----------------------------------------------------------------------------
       
    89 //
       
    90 EXPORT_C CMCETestUIEngineCodec::~CMCETestUIEngineCodec()
       
    91     {
       
    92     iCommands.ResetAndDestroy();
       
    93     }
       
    94 
       
    95 // -----------------------------------------------------------------------------
       
    96 // CMCETestUIEngineCodec::GetCommands
       
    97 // -----------------------------------------------------------------------------
       
    98 //
       
    99 const RPointerArray<TMCETestUIEngineCmdBase>& 
       
   100             CMCETestUIEngineCodec::GetCommandsL()
       
   101     {	
       
   102     iCommands.ResetAndDestroy();
       
   103     if ( iCodec.State() == CMceCodec::EDisabled )
       
   104         {
       
   105         iCommands.Append( new (ELeave) TMCETestUIEngineCmdEnableAudioCodec( 
       
   106                                 iEngine, *this ) );
       
   107         iCommands.Append( new (ELeave) TMCETestUIEngineCmdStandByAudioCodec( 
       
   108                                 iEngine, *this ) );
       
   109         }
       
   110     else if(iCodec.State() == CMceCodec::EEnabled)
       
   111         {
       
   112         iCommands.Append( new (ELeave) TMCETestUIEngineCmdDisableAudioCodec( 
       
   113                                 iEngine, *this ) );
       
   114         iCommands.Append( new (ELeave) TMCETestUIEngineCmdStandByAudioCodec( 
       
   115                                 iEngine, *this ) );
       
   116         }
       
   117     else if(iCodec.State() == CMceCodec::EStandby)
       
   118     	{
       
   119         iCommands.Append( new (ELeave) TMCETestUIEngineCmdEnableAudioCodec( 
       
   120                                 iEngine, *this ) );
       
   121         iCommands.Append( new (ELeave) TMCETestUIEngineCmdDisableAudioCodec( 
       
   122                                 iEngine, *this ) );
       
   123         }  
       
   124     iCommands.Append( new (ELeave) TMCETestUIEngineCmdDeleteAudioCodec( 
       
   125                                 iEngine, *this ) );
       
   126     return iCommands; 
       
   127     }
       
   128 // -----------------------------------------------------------------------------
       
   129 // CMCETestUIEngineCodec::Codec
       
   130 // -----------------------------------------------------------------------------
       
   131 //
       
   132 EXPORT_C CMceAudioCodec& CMCETestUIEngineCodec::Codec()
       
   133 	{
       
   134       return iCodec;
       
   135     }
       
   136 // -----------------------------------------------------------------------------
       
   137 // CMCETestUIEngineCodec::State
       
   138 // -----------------------------------------------------------------------------
       
   139 //
       
   140 EXPORT_C const TDesC16& CMCETestUIEngineCodec::State() const
       
   141     {
       
   142     if(iCodec.State() == CMceCodec::EEnabled) 
       
   143         {
       
   144         return KCodecStateEnabled;
       
   145         }
       
   146     else if(iCodec.State() == CMceCodec::EDisabled) 
       
   147         {
       
   148         return KCodecStateDisabled;
       
   149         }
       
   150     return KCodecStateStandBy;
       
   151     }
       
   152         
       
   153 
       
   154 
       
   155 // -----------------------------------------------------------------------------
       
   156 // CMCETestUIEngineCodec::Type
       
   157 // -----------------------------------------------------------------------------
       
   158 //
       
   159 
       
   160 EXPORT_C TMceCodecType CMCETestUIEngineCodec::Type()
       
   161 {
       
   162 	return iCodec.Type();
       
   163 }