vtengines/videoteleng/Inc/Base/CVtEngEventManager.h
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:  Event manager 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CVTENGEVENTMANAGER_H
       
    21 #define CVTENGEVENTMANAGER_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 #include "VtEngEvents.h"
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class MVtEngEventObserver;
       
    29 
       
    30 // CLASS DECLARATION
       
    31 
       
    32 /**
       
    33 *  This class is responsible for notifying client
       
    34 *  on engine events.
       
    35 *
       
    36 *  @lib videoteleng
       
    37 *  @since 2.6
       
    38 */
       
    39 NONSHARABLE_CLASS( CVtEngEventManager ) : public CActive
       
    40     {
       
    41     public:  // Constructors and destructor
       
    42         
       
    43         /**
       
    44         * Two-phased constructor.
       
    45         */
       
    46         static CVtEngEventManager* NewL( 
       
    47             MVtEngEventObserver& aEventObserver );
       
    48         
       
    49         /**
       
    50         * Destructor.
       
    51         */
       
    52         virtual ~CVtEngEventManager();
       
    53 
       
    54     public: // New functions
       
    55         
       
    56         /**
       
    57         * Notifies client on session state change.
       
    58         */
       
    59         void SessionStateChanged();
       
    60 
       
    61         /**
       
    62         * Notifies event to observer.
       
    63         * @param aEvent event
       
    64         */
       
    65         static void NotifyEvent( const TInt aEvent );
       
    66         
       
    67         void AddObserverL( MVtEngEventObserver* aObserver );
       
    68         
       
    69         void RemoveObserver( const MVtEngEventObserver* aObserver );
       
    70 
       
    71     private: // from CActive
       
    72 
       
    73         void RunL();
       
    74 
       
    75         void DoCancel();
       
    76 
       
    77     private:
       
    78 
       
    79         /**
       
    80         * Notifies event to observer
       
    81         */
       
    82         void DoNotifyEvent( const TInt aEvent );
       
    83 
       
    84         TBool QueueAsyncEvent( const TInt aEvent );
       
    85         
       
    86         /**
       
    87         * Queue event and signal AO.
       
    88         * @param aEvent Asynchronous event to be signalled.
       
    89         */        
       
    90         void QueueAndSignal( const TInt aEvent );
       
    91 
       
    92         /**
       
    93         * Signals AO.
       
    94         */
       
    95         void Signal();
       
    96 
       
    97     private:
       
    98 
       
    99         /**
       
   100         * C++ default constructor.
       
   101         */
       
   102         CVtEngEventManager();
       
   103         
       
   104         // 2nd phase constructor
       
   105         void ConstructL( MVtEngEventObserver& aEventObserver );
       
   106 
       
   107     private:     // Data
       
   108         
       
   109         RPointerArray<MVtEngEventObserver> iObservers;
       
   110         
       
   111         // Asynchronous events are stored in this array and 
       
   112         // executed in order
       
   113         CArrayFixFlat< TInt >*  iEventQueue;
       
   114 
       
   115     };
       
   116 
       
   117 #endif      // CVTENGEVENTMANAGER_H
       
   118             
       
   119 // End of File