vtengines/videoteleng/Inc/Base/cvtengmediatorservice.h
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:  Handles commands received via Mediator
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_VTENGMEDIATORSERVICE_H
       
    20 #define C_VTENGMEDIATORSERVICE_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>
       
    24 #include "mvtengoperationobserver.h"
       
    25 #include "MVtEngEventObserver.h"
       
    26 #include "vtengcommands.h"
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class CMediatorCommandResponder;
       
    30 class CVtEngOperation;
       
    31 class CVtEngInternalOperation;
       
    32 class CVtEngUtility;
       
    33 
       
    34 // CLASS DECLARATION
       
    35 
       
    36 /**
       
    37 *  Handles shutdown and audio commands from mediator. Deletes itself
       
    38 *  after service is completed.
       
    39 *
       
    40 *  @lib videoteleng
       
    41 *  @since 5.0
       
    42 */
       
    43 NONSHARABLE_CLASS( CVtEngMediatorService ) : 
       
    44     public CBase, 
       
    45     private MVtEngOperationObserver,
       
    46     private MVtEngEventObserver
       
    47     {
       
    48 public: // constructor and destructors
       
    49 
       
    50     /**
       
    51      * Starts requested service.
       
    52      * @param aResponder target for mediator response
       
    53      * @param aUtils engine internal utility
       
    54      * @param aCommandId service to start
       
    55      */
       
    56     static void StartLD( 
       
    57         CMediatorCommandResponder& aResponder,
       
    58         CVtEngUtility& aUtils,
       
    59         const TUid aCategory,
       
    60         const TInt aCommandId );
       
    61     
       
    62     ~CVtEngMediatorService();
       
    63     
       
    64 public: // from MVtEngOperationObserver
       
    65 
       
    66     /**
       
    67     * @see MVtEngOperationObserver
       
    68     */
       
    69     virtual void SetOperation( CVtEngOperation* aActiveOp );
       
    70     
       
    71     /**
       
    72     * @see MVtEngOperationObserver
       
    73     */
       
    74     virtual void CommandCompleteL(
       
    75         const TVtEngCommandId aCommand,
       
    76         const TInt aResult );
       
    77 
       
    78 public: // from MVtEngEventObserver
       
    79 
       
    80     // handles event according to ongoing operation
       
    81     virtual void HandleVtEventL( TInt aEvent );
       
    82 
       
    83 private: // c++ constructor
       
    84 
       
    85     CVtEngMediatorService( 
       
    86         CMediatorCommandResponder& aResponder,
       
    87         CVtEngUtility& aUtils,
       
    88         const TUid aCategory, 
       
    89         const TInt aCommandId );
       
    90     
       
    91 private:
       
    92     
       
    93     // prepares and starts requested operation
       
    94     void ConstructAndDoServiceL();
       
    95     
       
    96     // sends response to shutdown command if shutdown already ongoing
       
    97     TBool IsShuttingDown() const;
       
    98     
       
    99     void StartOperationL( const TVtEngCommandId aCommand );
       
   100         
       
   101     // Sends mediator response for shutdown or audio mute/unmute commands.
       
   102     // deletes itself if not waiting internal command response.
       
   103     void SendMediatorResponseD( const TBool aDeleteThis );
       
   104     
       
   105 private:
       
   106     CMediatorCommandResponder& iResponder;
       
   107 
       
   108     CVtEngInternalOperation* iOperation;
       
   109     
       
   110     CVtEngUtility& iUtils;
       
   111     
       
   112     // mediator Category [KCatVideotelInternalCommands, KCatPhoneToVideotelCommands]
       
   113     TUid iCategory;
       
   114     
       
   115     // mediator command [shutdown, mute mic, unmute mic]
       
   116     TInt iCommandId;
       
   117     
       
   118     // this is used for controlling 
       
   119     TInt iServiceStatus;
       
   120     };
       
   121 
       
   122 #endif // T_VTENGMEDIATORSERVICE_H
       
   123 
       
   124 // End of File