vtengines/videoteleng/Src/Commands/TVtEngOperationUtils.cpp
changeset 0 ed9695c8bcbe
equal deleted inserted replaced
-1:000000000000 0:ed9695c8bcbe
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Handler utilities implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include    "TVtEngOperationUtils.h"
       
    22 #include    "VtEngPanic.h"
       
    23 #include    "CVtEngInitializer.h"
       
    24 #include    "VtEngUtils.h"
       
    25 #include    "CVtEngOperation.h"
       
    26 #include    "CVtEngHandlerContainer.h"
       
    27 #include    "CVtEngMediaHandler.h"
       
    28 #include    "CVtEngAudioHandler.h"
       
    29 #include    "CVtEngSessionHandler.h"
       
    30 #include    "CVtEngStateManager.h"
       
    31 #include    "CVtEngSettings.h"
       
    32 #include    "cvtengmdtrcommandsender.h"
       
    33 #include    <cvtlogger.h>
       
    34 
       
    35 // ============================ MEMBER FUNCTIONS ===============================
       
    36 
       
    37 // -----------------------------------------------------------------------------
       
    38 // TVtEngRenderUtil::HandleL
       
    39 // unpacks and handles a rendering command
       
    40 // 
       
    41 // -----------------------------------------------------------------------------
       
    42 //
       
    43 void TVtEngRenderUtil::HandleL( 
       
    44     CVtEngOperation& aOperation,
       
    45     CVtEngHandlerContainer& aHandlers )
       
    46     {
       
    47     CVtEngMediaHandler& media =
       
    48         static_cast<CVtEngMediaHandler&>( aHandlers.Media() );
       
    49 
       
    50     media.HandleL( aOperation );
       
    51     }
       
    52 
       
    53 // -----------------------------------------------------------------------------
       
    54 // TVtEngRenderUtil::Cancel
       
    55 // cancel the specify pending command
       
    56 // 
       
    57 // -----------------------------------------------------------------------------
       
    58 //
       
    59 
       
    60 void TVtEngRenderUtil::Cancel(
       
    61     CVtEngOperation& aOperation,
       
    62     CVtEngHandlerContainer& aHandlers )
       
    63     {    
       
    64     const TVtEngCommandId id = aOperation.Command();
       
    65     __VTPRINTENTER( "TVtEngRenderUtil.Cancel")
       
    66     __VTPRINT2( DEBUG_GEN, "Command id = %d", id)
       
    67     if ( id == KVtEngInitializeShareImage )        
       
    68         {
       
    69         CVtEngMediaHandler& media =
       
    70             static_cast<CVtEngMediaHandler&>( aHandlers.Media() );
       
    71             
       
    72         media.CancelInitializeShareImage();
       
    73         }
       
    74     __VTPRINTEXIT( "TVtEngRenderUtil.Cancel")
       
    75     }
       
    76 // -----------------------------------------------------------------------------
       
    77 // TVtEngAudioRoutingUtil::HandleL
       
    78 // unpacks and handles audio routing command.
       
    79 // 
       
    80 // -----------------------------------------------------------------------------
       
    81 //
       
    82 
       
    83 void TVtEngAudioRoutingUtil::HandleL( 
       
    84     CVtEngOperation& aOperation )
       
    85     {
       
    86     CVtEngUtility::StateManager()->HandleOperationL( aOperation );
       
    87     }
       
    88 
       
    89 // -----------------------------------------------------------------------------
       
    90 // TVtEngAudioPlaybackUtil::HandleL
       
    91 // unpacks and handles audio playback command.
       
    92 // 
       
    93 // -----------------------------------------------------------------------------
       
    94 //
       
    95 void TVtEngAudioPlaybackUtil::HandleL( 
       
    96     CVtEngOperation& aOperation,
       
    97     CVtEngHandlerContainer& aHandlers )
       
    98     {
       
    99     __VTPRINTENTER( "AudioPlaybackUtil.HandleL" )
       
   100     if ( aOperation.Command() == KVtEngSetAudioVolume ) 
       
   101         {
       
   102         CVtEngSettings& settings = CVtEngUtility::Settings();
       
   103         const TPckgC<MVtEngAudio::TVtEngOutputVolume>& pckg = 
       
   104             static_cast<const TPckgC<MVtEngAudio::TVtEngOutputVolume>&>
       
   105             ( *aOperation.Parameters() );
       
   106 
       
   107         settings.SetVolume( pckg().iHandsetVolume, pckg().iHandsfreeVolume,
       
   108             ETrue );
       
   109         }
       
   110 
       
   111     // All the commands are though passed to handler
       
   112     CVtEngMediaHandler& media =
       
   113         static_cast<CVtEngMediaHandler&>( aHandlers.Media() );
       
   114     __VTPRINT( DEBUG_DETAIL, "TVtEngAudioPlaybackUtil::HandleL:Handler fetched")
       
   115 
       
   116     media.HandleL( aOperation );
       
   117     __VTPRINTEXIT( "AudioPlaybackUtil.HandleL" )
       
   118     }
       
   119 
       
   120 // -----------------------------------------------------------------------------
       
   121 // TVtEngMediaTransportUtil::HandleL
       
   122 // unpacks and handles media transport command.
       
   123 // 
       
   124 // -----------------------------------------------------------------------------
       
   125 //
       
   126 void TVtEngMediaTransportUtil::HandleL( 
       
   127     CVtEngOperation& aOperation,
       
   128     CVtEngHandlerContainer& aHandlers )
       
   129     {
       
   130     __VTPRINTENTER( "MediaTransportUtil.HandleL" )
       
   131     const TVtEngCommandId command( aOperation.Command() );
       
   132     if ( command == KVtEngStopDtmfTone ||
       
   133          command == KVtEngStartDtmfTone ||
       
   134 		 // DTMF commands
       
   135 		 command == KVtEngSetUIIDtmfSupport ||
       
   136          command == KVtEngSetUIIBasicStringSupport ||
       
   137          command == KVtEngSetUIIIA5StringSupport ||
       
   138          command == KVtEngSetUIIGeneralStringSupport )
       
   139         {
       
   140         aHandlers.Dtmf().HandleL( aOperation );
       
   141         }
       
   142         
       
   143     __VTPRINTEXIT( "MediaTransportUtil.HandleL" )
       
   144     }
       
   145 
       
   146 // -----------------------------------------------------------------------------
       
   147 // TVtEngViewFinderConfigureUtil::HandleL
       
   148 // unpacks and handles 
       
   149 // 
       
   150 // -----------------------------------------------------------------------------
       
   151 //
       
   152 void TVtEngViewFinderConfigureUtil::HandleL( 
       
   153     CVtEngOperation& aOperation,
       
   154     CVtEngHandlerContainer& aHandlers )
       
   155     {
       
   156     CVtEngMediaHandler& media =
       
   157         static_cast<CVtEngMediaHandler&>( aHandlers.Media() );
       
   158 
       
   159     media.HandleL( aOperation );
       
   160     }
       
   161 
       
   162 // -----------------------------------------------------------------------------
       
   163 // TVtEngCameraConfigUtil::HandleL
       
   164 // unpacks and handles 
       
   165 // 
       
   166 // -----------------------------------------------------------------------------
       
   167 //
       
   168 void TVtEngCameraConfigUtil::HandleL( 
       
   169     CVtEngOperation& /*aOperation*/,
       
   170     CVtEngHandlerContainer& /*aHandlers*/ )
       
   171     {
       
   172     }
       
   173 
       
   174 // -----------------------------------------------------------------------------
       
   175 // TVtEngEngineInitUtil::HandleL
       
   176 // Handles engine initialization and uninitialization command.
       
   177 // 
       
   178 // -----------------------------------------------------------------------------
       
   179 //
       
   180 void TVtEngEngineInitUtil::HandleL( 
       
   181     CVtEngOperation& aOperation,
       
   182     CVtEngHandlerContainer& /* aHandlers */ )
       
   183     {
       
   184     __VTPRINTENTER( "EngineInitUtil.HandleL" )
       
   185     const TVtEngCommandId id = aOperation.Command();
       
   186 
       
   187     CVtEngInitializer& initializer = 
       
   188         CVtEngUtility::EngineUtils()->Initializer();
       
   189 
       
   190     switch ( id )
       
   191         {
       
   192         case KVtEngInitializeEngine:
       
   193         case KVtEngInitializeEngineDiag:
       
   194         case KVtEngInitializeEngineTest:
       
   195             initializer.InitializeL( aOperation );
       
   196             break;
       
   197         case KVtEngResetEngine:
       
   198             initializer.Uninitialize( aOperation );
       
   199             break;
       
   200         case KVtEngTerminateSession:
       
   201             CVtEngUtility::StateManager()->HandleOperationL( aOperation );
       
   202             break;
       
   203         case KVtEngSwitchToVoice:
       
   204             CVtEngUtility::MediatorCommands().SwitchToVoiceL( aOperation );
       
   205             break;
       
   206         default:
       
   207             Panic( EVtEngPanicIncorrectUtility );
       
   208             break;
       
   209         }
       
   210     __VTPRINTEXIT( "EngineInitUtil.HandleL" )
       
   211     }
       
   212 
       
   213 void TVtEngEngineInitUtil::Cancel( CVtEngOperation& aOperation )
       
   214     {
       
   215     const TVtEngCommandId id = aOperation.Command();
       
   216     if ( id == KVtEngInitializeEngine )
       
   217         {
       
   218         CVtEngInitializer& initializer = 
       
   219             CVtEngUtility::EngineUtils()->Initializer();
       
   220         initializer.CancelInit();
       
   221         }
       
   222     }
       
   223 
       
   224 // -----------------------------------------------------------------------------
       
   225 // TVtEngExtensionUtil::HandleL
       
   226 // handles extension operations.
       
   227 //
       
   228 // -----------------------------------------------------------------------------
       
   229 //
       
   230 void TVtEngExtensionUtil::HandleL(
       
   231     CVtEngOperation& aOperation )
       
   232     {
       
   233     CVtEngUtility::StateManager()->HandleOperationL( aOperation );
       
   234     }
       
   235 
       
   236 //  End of File