resourcemgmt/hwresourcesmgr/common/inc/pspropertyobserver.h
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @internalTechnology 
       
    19 */
       
    20 
       
    21 
       
    22 #ifndef PSPOPERTYOBSERVER_H
       
    23 #define PSPOPERTYOBSERVER_H
       
    24 
       
    25 #include <e32base.h>
       
    26 #include <e32property.h>
       
    27 
       
    28 
       
    29 /**
       
    30 * Callback interface for property change notification.
       
    31 */
       
    32 class MPsPropertyObserver
       
    33     {
       
    34 public:
       
    35     /**
       
    36     * Notifies changes in the property value
       
    37     *
       
    38     * @param aKey key for which value changed.
       
    39     * @param aValue new value.
       
    40     * @param aError KErrNone if successful. otherwise on of system-wide error.
       
    41     */
       
    42     virtual void PsPropertyChanged(TInt aKey, TInt aValue, TInt aError) =0;
       
    43     };
       
    44 
       
    45 /**
       
    46 *  This class observes changes in PS-Property value.
       
    47 *
       
    48 */
       
    49 NONSHARABLE_CLASS(CPsPropertyObserver) : public CActive
       
    50     {
       
    51 public:
       
    52     IMPORT_C static CPsPropertyObserver* NewL(const TUid& aGroup, TInt aKey, MPsPropertyObserver& aObserver);
       
    53     IMPORT_C static TInt Get(const TUid& aGroup, TInt aKey, TInt& value);
       
    54     IMPORT_C TInt Get(TInt& value);
       
    55     void Start();
       
    56     ~CPsPropertyObserver();
       
    57         
       
    58 private:
       
    59     CPsPropertyObserver(TUid aGroup, TInt aKey, MPsPropertyObserver& aObserver);
       
    60     void ConstructL(const TUid& aGroup);
       
    61     
       
    62 protected:
       
    63     void RunL();
       
    64     void DoCancel();
       
    65     
       
    66 private:
       
    67     RProperty iProperty;
       
    68     TUid iGroup;
       
    69     TInt iKey;
       
    70     TInt iValue;
       
    71     MPsPropertyObserver& iObserver;
       
    72     };
       
    73 
       
    74 #endif