vtengines/videoteleng/Src/Commands/cvtenginternaloperation.cpp
changeset 0 ed9695c8bcbe
equal deleted inserted replaced
-1:000000000000 0:ed9695c8bcbe
       
     1 /*
       
     2 * Copyright (c) 2008 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:  Internal operation class implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "cvtenginternaloperation.h"
       
    21 #include "mvtengoperationobserver.h"
       
    22 #include "CVtEngStateManager.h"
       
    23 #include "TVtEngOperationUtils.h"
       
    24 #include "VtEngUtils.h"
       
    25 #include "cvtlogger.h"
       
    26 
       
    27 // ============================ MEMBER FUNCTIONS ===============================
       
    28 
       
    29 // -----------------------------------------------------------------------------
       
    30 // CVtEngOperation::NewL
       
    31 // Symbian two-phase constructor
       
    32 //
       
    33 // -----------------------------------------------------------------------------
       
    34 //
       
    35 CVtEngInternalOperation* CVtEngInternalOperation::NewL(
       
    36     TVtEngCommandId aCommandId,
       
    37     CVtEngHandlerContainer& aHandlers,
       
    38     MVtEngOperationObserver& aObserver,
       
    39     TBool aDelete )
       
    40     {
       
    41     __VTPRINTENTER( "CVtEngInternalOperation.NewL<" )
       
    42     CVtEngInternalOperation* self = new ( ELeave )
       
    43         CVtEngInternalOperation( aCommandId, aHandlers, aObserver, aDelete );
       
    44     __VTPRINTEXIT( "CVtEngInternalOperation.NewL>" )
       
    45     return self;
       
    46     }
       
    47 
       
    48 // -----------------------------------------------------------------------------
       
    49 // CVtEngInternalOperation::CVtEngInternalOperation
       
    50 // C++ constructor can NOT contain any code, that
       
    51 // might leave.
       
    52 // -----------------------------------------------------------------------------
       
    53 //
       
    54 CVtEngInternalOperation::CVtEngInternalOperation(
       
    55     TVtEngCommandId aCommandId,
       
    56     CVtEngHandlerContainer& aHandlers,
       
    57     MVtEngOperationObserver& aObserver,
       
    58     TBool aDelete ) : CVtEngOperation( aCommandId, aHandlers, aObserver,
       
    59         aDelete )
       
    60     {
       
    61     __VTPRINTENTER( "CVtEngInternalOperation.CVtEngInternalOperation" )
       
    62     __VTPRINTEXIT( "CVtEngInternalOperation.CVtEngInternalOperation" )
       
    63     }
       
    64 
       
    65 // -----------------------------------------------------------------------------
       
    66 // CVtEngInternalOperation::~CVtEngInternalOperation
       
    67 // Destructor
       
    68 //
       
    69 // -----------------------------------------------------------------------------
       
    70 //
       
    71 CVtEngInternalOperation::~CVtEngInternalOperation()
       
    72     {
       
    73     __VTPRINTENTER( "CVtEngInternalOperation.~" )
       
    74     __VTPRINTEXIT( "CVtEngInternalOperation.~" )
       
    75     }
       
    76 
       
    77 // -----------------------------------------------------------------------------
       
    78 // CVtEngInternalOperation::HandleOpCompleteL
       
    79 // Destructor
       
    80 //
       
    81 // -----------------------------------------------------------------------------
       
    82 //
       
    83 void CVtEngInternalOperation::HandleOpComplete( const TInt aResult )
       
    84     {
       
    85     __VTPRINTENTER( "CVtEngInternalOperation.HandleOpComplete" )
       
    86     #ifdef VTDEBUG
       
    87     TRAPD( err, iObserver.CommandCompleteL( iCommand, aResult ) );
       
    88     __VTPRINT2( DEBUG_GEN, "EngOp.Complete err=", err )
       
    89 #else
       
    90     TRAP_IGNORE( iObserver.CommandCompleteL( iCommand, aResult ) );
       
    91 #endif // VTDEBUG
       
    92     if ( iDelete )
       
    93         {
       
    94         delete this;
       
    95         }
       
    96     __VTPRINTEXITR( "CVtEngInternalOperation.HandleOpComplete %d>", aResult )
       
    97     }
       
    98 
       
    99 // -----------------------------------------------------------------------------
       
   100 // 
       
   101 // -----------------------------------------------------------------------------
       
   102 // CVtEngInternalOperation::ExecuteL
       
   103 // Destructor
       
   104 //
       
   105 // -----------------------------------------------------------------------------
       
   106 //
       
   107 TBool CVtEngInternalOperation::ExecuteL()
       
   108     {
       
   109     __VTPRINTENTER( "CVtEngInternalOperation.ExecuteL" )
       
   110     const CVtEngStateManager* states = CVtEngUtility::StateManager();
       
   111     TInt err( KErrNotReady );
       
   112     if ( states->IsCommandPossible( iCommand ) )
       
   113         {
       
   114         err = KErrNone;
       
   115         switch ( iCommand )
       
   116             {
       
   117             case KVtEngTerminateSession:
       
   118                 TVtEngEngineInitUtil::HandleL( *this, iHandlers );
       
   119                 break;
       
   120             case KVtEngMuteOutgoingAudio:
       
   121             case KVtEngUnmuteOutgoingAudio:
       
   122                 TVtEngAudioPlaybackUtil::HandleL( *this, iHandlers );
       
   123                 break;            
       
   124             default:
       
   125                 __VTPRINT( DEBUG_GEN, "EngOp.ExecuteL not handled" )
       
   126                 err = KErrNotSupported;
       
   127                 break;
       
   128             }        
       
   129         }
       
   130     User::LeaveIfError( err );
       
   131     __VTPRINTEXIT( "CVtEngInternalOperation.ExecuteL" )
       
   132     return EFalse;
       
   133     }
       
   134 
       
   135 //  End of File
       
   136