taskswitcher/contextengine/tsctxutils/inc/tscenreplistener.h
changeset 4 4d54b72983ae
equal deleted inserted replaced
3:fb3763350a08 4:4d54b72983ae
       
     1 /*
       
     2 * Copyright (c) 2009 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 *
       
    16 */
       
    17 
       
    18 #ifndef CTSCENREPLISTENER_H
       
    19 #define CTSCENREPLISTENER_H
       
    20 
       
    21 #include <e32base.h>
       
    22 
       
    23 class CRepository;
       
    24 
       
    25 /**
       
    26  * Observer interface for getting notifications about a cenrep key change.
       
    27  */
       
    28 class MTsCenrepChangeObserver
       
    29     {
       
    30 public:
       
    31     virtual void CenrepChanged( TUint32 aKey, TInt aNewValue ) = 0;
       
    32     };
       
    33 
       
    34 /**
       
    35  * Class to get notifications about changes to a cenrep key.
       
    36  */
       
    37 NONSHARABLE_CLASS( CTsCenrepListener ) : public CActive
       
    38     {
       
    39 public:
       
    40     /**
       
    41      * Fist step constructor
       
    42      */
       
    43     IMPORT_C static CTsCenrepListener* NewL(const TUid& aRep, TUint32 aKey,
       
    44                                             MTsCenrepChangeObserver& aObserver);
       
    45     
       
    46     /**
       
    47      * Fist step constructor
       
    48      */
       
    49     IMPORT_C static CTsCenrepListener* NewLC(const TUid& aRep, TUint32 aKey,
       
    50                                              MTsCenrepChangeObserver& aObserver);
       
    51     
       
    52     /**
       
    53      * Destructor.
       
    54      */
       
    55     IMPORT_C ~CTsCenrepListener();
       
    56     
       
    57     /**
       
    58      * Returns the current value of the watched key.
       
    59      */
       
    60     IMPORT_C TInt Value();
       
    61     
       
    62 private:
       
    63     /**
       
    64      * Constructor.
       
    65      * Starts listening for the key.
       
    66      */
       
    67     CTsCenrepListener(TUint32 aKey,
       
    68         MTsCenrepChangeObserver& aObserver );
       
    69     
       
    70     /**
       
    71      * Second step constructor 
       
    72      */
       
    73     void ConstructL(const TUid& aRep);
       
    74     
       
    75     void DoCancel();
       
    76     void RunL(); 
       
    77     TInt RunError( TInt aError );
       
    78     
       
    79     MTsCenrepChangeObserver& iObserver;
       
    80     CRepository* iRep;
       
    81     TUint32 iKey;
       
    82     };
       
    83     
       
    84 #endif /*CTSCENREPLISTENER_H*/