homescreenplugins/videochplugin/inc/videochpssubscriber.h
changeset 0 96612d01cf9f
equal deleted inserted replaced
-1:000000000000 0:96612d01cf9f
       
     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 the License "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:    Class to handle subscribtions from PS*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __VCXNS_CONTENTHARVERSTERPSSUBSCRI_H
       
    21 #define __VCXNS_CONTENTHARVERSTERPSSUBSCRI_H
       
    22 
       
    23 #include <e32base.h>	
       
    24 #include <e32property.h>
       
    25 
       
    26 NONSHARABLE_CLASS ( MCHPSObserver )
       
    27     {
       
    28     public:
       
    29         virtual void ValueChanged( const TUint32& aKey, const TInt& aValue ) = 0;  
       
    30     
       
    31     };
       
    32 
       
    33  
       
    34 NONSHARABLE_CLASS ( CVcxNsCHPSSubscriber ) : public CActive
       
    35     {
       
    36 
       
    37     public: // constuct / destruct
       
    38     
       
    39         /**
       
    40          * Construction.
       
    41          * 
       
    42          * @param aUid      category for the property
       
    43          * @param aKey      key id for the property
       
    44          * @param aType     type of the key (at the moment only int -type is supported)
       
    45          * @param aObserver observer to who to notify about changes
       
    46          * 
       
    47          * @return The newly constructed CVcxConnUtilPubSub
       
    48          */
       
    49         static CVcxNsCHPSSubscriber* NewL( const TUid aUid, 
       
    50                                            const TUint32 aKey,
       
    51                                            RProperty::TType aType,
       
    52                                            MCHPSObserver* aObserver );
       
    53         
       
    54         /**
       
    55          * Destructor.
       
    56          *
       
    57          */
       
    58         virtual ~CVcxNsCHPSSubscriber();
       
    59         
       
    60         /**
       
    61          * Returns a pubsub value from this property
       
    62          * 
       
    63          *@param &aValue value to fetch
       
    64          * 
       
    65          *@return TInt KErrNone or some system level error code
       
    66          */
       
    67         TInt Get( TInt& aValue );
       
    68             
       
    69         /**
       
    70          * Start subscribing if not already started
       
    71          */
       
    72         void Start();
       
    73         
       
    74         
       
    75     private:  // constuct / destruct
       
    76         
       
    77         /**
       
    78          * Constructor
       
    79          *
       
    80          */
       
    81         CVcxNsCHPSSubscriber( const TUid aUid, 
       
    82                               const TUint32 aKey, 
       
    83                               RProperty::TType aType, 
       
    84                               MCHPSObserver* aObserver );
       
    85         
       
    86         /**
       
    87          * Symbian 2nd phase construction
       
    88          *   
       
    89          */
       
    90         void ConstructL();
       
    91      
       
    92     private: // from CActive
       
    93         
       
    94         /**
       
    95          * From CActive. Calles when value subscribed to changes 
       
    96          * 
       
    97          */  
       
    98         void RunL();
       
    99         
       
   100         /**
       
   101          * From CActive. Cancels subscribtion
       
   102          * 
       
   103          */
       
   104         void DoCancel();
       
   105         
       
   106     private:
       
   107         
       
   108         /**
       
   109          * ETrue if object is initialized and subscribtion starts
       
   110          */
       
   111         TBool            iInitialized;
       
   112         
       
   113         /**
       
   114          * Property to subscribe
       
   115          */
       
   116         RProperty        iProperty;
       
   117         
       
   118         /**
       
   119          * Category uid for the property
       
   120          */
       
   121         const TUid       iUid;
       
   122         
       
   123         /**
       
   124          * Key id for the property
       
   125          */
       
   126         const TUint32    iKey;
       
   127         
       
   128         /**
       
   129          * type of the property
       
   130          */
       
   131         RProperty::TType iKeyType;
       
   132         
       
   133         /**
       
   134          * observer, not owned
       
   135          */
       
   136         MCHPSObserver*   iObserver;
       
   137 
       
   138     };      
       
   139 
       
   140 #endif // __VCXNS_CONTENTHARVERSTERPSSUBSCRI_H