internetradio2.0/activeidleenginc/iractiveidleengpubsub.h
changeset 0 09774dfdd46b
equal deleted inserted replaced
-1:000000000000 0:09774dfdd46b
       
     1 /*
       
     2 * Copyright (c) 2006-2007 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:  ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef IRACTIVEIDLEENGPUBSUB_H
       
    19 #define IRACTIVEIDLEENGPUBSUB_H
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <e32property.h>
       
    23 
       
    24 class MIRActiveIdleEngPubSubNotifyHandler;
       
    25 
       
    26 #define KMAXLENGTH 256
       
    27 
       
    28 /**
       
    29 * Listens to one specified Publish & Subscribe key, notifying the observer whenever that key is changed.
       
    30 */
       
    31 NONSHARABLE_CLASS(CIRActiveIdleEngPubSub) : public CActive
       
    32     {
       
    33     public:
       
    34         
       
    35         /**
       
    36         * Static constructor.
       
    37         * @param    aObserver   The observer to be notified of the changes in the listened key.
       
    38         * @param    aCategory   The category of the key.
       
    39         * @param    aKey        The key to listen to.
       
    40         */
       
    41     static CIRActiveIdleEngPubSub* NewL( MIRActiveIdleEngPubSubNotifyHandler& 
       
    42     		aObserver, const TUid& aCategory, TUint aKey , 
       
    43     		const RProperty::TType aPropertyType  );
       
    44         
       
    45         /**
       
    46         * Destructor.
       
    47         */
       
    48         ~CIRActiveIdleEngPubSub();
       
    49         
       
    50         /**
       
    51         * Construction finalizer.
       
    52         * Subscribes the object to listen to the specified key.
       
    53         */
       
    54        	void SecondConstructL();
       
    55         
       
    56     protected: // From CActive
       
    57 
       
    58         /**
       
    59     *void RunL()
       
    60     *The function is called by the active scheduler
       
    61     *when a request completion event occurs,
       
    62         */
       
    63         void RunL();
       
    64         
       
    65         /**
       
    66     *void DoCancel()
       
    67     *Invoked when the active object is cancelled.
       
    68         */
       
    69         void DoCancel();
       
    70         
       
    71     private:
       
    72 
       
    73         /**
       
    74         * Constructor.    
       
    75         * @param    aObserver   The observer to be notified of the changes in the listened key.
       
    76         * @param    aCategory   The category of the key.
       
    77         * @param    aKey        The key to listen to.
       
    78         */
       
    79     CIRActiveIdleEngPubSub( MIRActiveIdleEngPubSubNotifyHandler& aObserver, 
       
    80     	const TUid& aCategory, TUint aKey, const RProperty::TType aPropertyType );
       
    81         
       
    82         /**
       
    83         * Second-phase constructor.
       
    84         */
       
    85         void ConstructL();
       
    86 		
       
    87     protected:
       
    88 
       
    89         /** Handle to the property. */
       
    90         RProperty iProperty;
       
    91         RProperty::TType iPropertyType;
       
    92         /** The observer to be notified of the changes in the listened key. */
       
    93         MIRActiveIdleEngPubSubNotifyHandler& iObserver;
       
    94         /** The category of the key to listen to. */
       
    95         TUid iCategory;
       
    96         /** The key to listen to. */
       
    97         TUint iKey;
       
    98         /** The cached value of the key. */
       
    99         mutable TBuf8<KMAXLENGTH> iText;
       
   100         TInt iValue;
       
   101     };
       
   102 
       
   103 #endif//IRACTIVEIDLEENGPUBSUB_H