internetradio2.0/songhistoryinc/irsonghistoryengpubsub.h
changeset 14 896e9dbc5f19
parent 12 608f67c22514
child 15 065198191975
equal deleted inserted replaced
12:608f67c22514 14:896e9dbc5f19
     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:  Active class notifying metada and channel name changes to SongHistoryDb engine
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CIRSONGHISTORYENGPUBSUB_H
       
    19 #define CIRSONGHISTORYENGPUBSUB_H
       
    20 
       
    21 #define KMAXLENGTH 250
       
    22 #include <e32base.h>
       
    23 #include <e32property.h>
       
    24 
       
    25 class MIRSongHistoryEngPubSubNotifyHandler;
       
    26 
       
    27 
       
    28 
       
    29 /**
       
    30 * Listens to one specified Publish & Subscribe key, notifying the observer whenever that key is changed.
       
    31 */
       
    32 NONSHARABLE_CLASS(CIRSongHistoryEngPubSub) : public CActive
       
    33     {
       
    34     public:
       
    35 
       
    36         /**
       
    37         * Static constructor.
       
    38         * @param    aObserver   The observer to be notified of the changes in the listened key.
       
    39         * @param    aCategory   The category of the key.
       
    40         * @param    aKey        The key to listen to.
       
    41         */
       
    42     static CIRSongHistoryEngPubSub* NewL( MIRSongHistoryEngPubSubNotifyHandler&
       
    43     		aPubSubObserver, const TUid& aCategory, TUint aKey ,
       
    44     		const RProperty::TType aPropertyType  );
       
    45         /**
       
    46         * Static constructor.
       
    47         * @param    aObserver   The observer to be notified of the changes in the listened key.
       
    48         * @param    aCategory   The category of the key.
       
    49         * @param    aKey        The key to listen to.
       
    50         */
       
    51     static CIRSongHistoryEngPubSub* NewLC( MIRSongHistoryEngPubSubNotifyHandler&
       
    52     		aPubSubObserver, const TUid& aCategory, TUint aKey ,
       
    53     		const RProperty::TType aPropertyType  );
       
    54         /**
       
    55         * Destructor.
       
    56         */
       
    57         ~CIRSongHistoryEngPubSub();
       
    58 
       
    59 
       
    60     protected: // From CActive
       
    61 
       
    62         /**
       
    63     *void RunL()
       
    64     *The function is called by the active scheduler
       
    65     *when a request completion event occurs,
       
    66         */
       
    67         void RunL();
       
    68 
       
    69         /**
       
    70     *void DoCancel()
       
    71     *Invoked when the active object is cancelled.
       
    72         */
       
    73         void DoCancel();
       
    74 
       
    75     private:
       
    76 
       
    77         /**
       
    78         * Constructor.
       
    79         * @param    aObserver   The observer to be notified of the changes in the listened key.
       
    80         * @param    aCategory   The category of the key.
       
    81         * @param    aKey        The key to listen to.
       
    82         */
       
    83     CIRSongHistoryEngPubSub( MIRSongHistoryEngPubSubNotifyHandler& aPubSubObserver,
       
    84     	const TUid& aCategory, TUint aKey, const RProperty::TType aPropertyType );
       
    85 
       
    86         /**
       
    87         * Second-phase constructor.
       
    88         */
       
    89         void ConstructL();
       
    90 
       
    91     protected:
       
    92 
       
    93         /** Handle to the property. */
       
    94         RProperty iProperty;
       
    95         RProperty::TType iPropertyType;
       
    96 
       
    97         /** The observer to be notified of the changes in the listened key. */
       
    98         MIRSongHistoryEngPubSubNotifyHandler& iPubSubObserver;
       
    99 
       
   100         /** The category of the key to listen to. */
       
   101         TUid iCategory;
       
   102 
       
   103         /** The key to listen to. */
       
   104         TUint iKey;
       
   105 
       
   106         /** The cached value of the key. */
       
   107         mutable TBuf8<KMAXLENGTH> iText;
       
   108 
       
   109 
       
   110     };
       
   111 
       
   112 #endif//IR_SONGHISTORYENGPUBSUB