mediakeys/MMKeyBearer/inc/MMKeyBearerObserverPS.h
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 /*
       
     2 * Copyright (c) 2005-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: 
       
    15 *             Declaration of class CMMKeyBearerObserver
       
    16 *   
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #ifndef __MMKEYBEAREROBSERVERPS_H__
       
    22 #define __MMKEYBEAREROBSERVERPS_H__
       
    23 
       
    24 // INCLUDE
       
    25 #include <e32svr.h>
       
    26 #include <e32property.h>
       
    27 
       
    28 // DATA TYPES
       
    29 enum TObserverKeyType
       
    30 {
       
    31     ESideVolumeKeys = 0,
       
    32     EMediaKeys,
       
    33     EAccessoryVolumeKeys,
       
    34     EFileTransferStatus
       
    35 };
       
    36 
       
    37 // CLASS DECLARATION
       
    38 /**
       
    39 *  MCallBackReceiver
       
    40 *     Used to call functions of CMMKeyBearer from CMMKeyBearerObserver
       
    41 *     On receiving event from the P & S, CMMKeyBearerObserver calls 
       
    42 *     this function
       
    43 *  @lib MMKeyBearer.dll
       
    44 *  @since 3.0
       
    45 */
       
    46 class MCallBackReceiver
       
    47     {
       
    48 public:
       
    49     /**
       
    50     Called when event has arrived from P&S.
       
    51     @param aEnumValue: Enum value representing the key and action.
       
    52            aKeyType : will indicate whether it is Volume key or Media key
       
    53     */
       
    54     virtual void ReceivedKeyEvent(TInt aEnumValue, TInt aKeyType) = 0;
       
    55     };
       
    56 
       
    57 /**
       
    58 *  CMMKeyBearerObserver
       
    59 *     This class inplements the Active Object. There will be two instance 
       
    60 *     of this ,one for handling Volume keys and other for Media Keys
       
    61 *  @lib MMKeyBearer.dll
       
    62 *  @since 3.0
       
    63 */
       
    64 class CMMKeyBearerObserver: public CActive
       
    65     {
       
    66     public: // Constructors and destructor
       
    67         /**
       
    68         * Creates instance of the CMMKeyBearerObserver class.
       
    69         * @param aCallBack : reference of the class which implements 
       
    70         *                    MCallBackReceiver for handling call back 
       
    71         *                    functions
       
    72         * @param aKeyType : Indiacates whether it is side volume key or 
       
    73         *                   media key
       
    74         * @return - Instance of the CMMKeyBearerObserver class.
       
    75         */
       
    76         static CMMKeyBearerObserver* NewL(MCallBackReceiver& aCallback, 
       
    77                                           TInt aKeyType);
       
    78         /**
       
    79         * Destructor.
       
    80         */
       
    81         virtual ~CMMKeyBearerObserver();    
       
    82     
       
    83     public: // Base class functions - CActive
       
    84         /** @see CActive::Start() */
       
    85         TInt Start();
       
    86         
       
    87         /** @see CActive::Stop() */
       
    88         void Stop();
       
    89 
       
    90        /**
       
    91         * Gets the current value.
       
    92         * @return - The current value.
       
    93         */
       
    94         TInt GetValue();
       
    95 
       
    96     private: // constructors
       
    97         /**
       
    98         * default constructor.
       
    99         * @param aCallback : reference to callback class
       
   100         */
       
   101         CMMKeyBearerObserver(MCallBackReceiver& aCallback);
       
   102         
       
   103         /**
       
   104         * Two - phase construction.
       
   105         */
       
   106         void ConstructL(TInt aKeyType);
       
   107         
       
   108     private: // Base class functions - CActive    
       
   109         /** @see CActive::RunL() */
       
   110         void RunL();
       
   111         /** @see CActive::DoCancel() */
       
   112         void DoCancel();
       
   113         
       
   114     private: // Data
       
   115         
       
   116         RProperty            iProperty;  // For P & S
       
   117         MCallBackReceiver&   iCallback;
       
   118         TInt                 iKeyType;   // Vol key or media Key
       
   119     };
       
   120 
       
   121 #endif // __MMKEYBEAREROBSERVERPS_H__
       
   122 
       
   123 // End of file