devencdiskutils/DevEncStarter/inc/DevEncStarterPropertyObserver.h
changeset 0 164170e6151a
equal deleted inserted replaced
-1:000000000000 0:164170e6151a
       
     1 /*
       
     2 * Copyright (c) 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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef DEVENCSTARTERPROPERTYOBSERVER_H
       
    20 #define DEVENCSTARTERPROPERTYOBSERVER_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <e32property.h>
       
    25 
       
    26 // CLASS DECLARATION
       
    27 
       
    28 /**
       
    29  * MDevEncStarterPropertyChangeObserver
       
    30  * Abstract interface for handling property change events.
       
    31  **/
       
    32 
       
    33 class MDevEncStarterPropertyChangeObserver
       
    34     {
       
    35     public:
       
    36         /**
       
    37          * This is a callback function which is called when a property value is changed.
       
    38          * @param aObserver a refference to the observer interface implementer
       
    39          * @param aCategory UID of Publish And Subscribe category
       
    40          * @param aKey subkey to specify the category event; to be used with Publish And Subscribe
       
    41          * @param aValue the new value
       
    42          * Event enumerations and uid:s of Publish And Subscribe can be found from PSVariables.h
       
    43          **/
       
    44         virtual void HandlePropertyChangeL( const TUid& aCategory,
       
    45                                             const TUint aKey,
       
    46                                             const TInt aValue ) = 0;
       
    47 
       
    48         /**
       
    49          * This is a callback function which is called when a P&S components returns an error
       
    50          * @param aCategory UID of Publish And Subscribe category
       
    51          * @param aKey subkey to specify the category event
       
    52          * @param aError an error code
       
    53          **/
       
    54         virtual void HandlePropertyChangeErrorL( const TUid& aCategory,
       
    55                                                  const TUint aKey,
       
    56                                                  TInt aError ) = 0;
       
    57     };
       
    58 
       
    59 // INCLUDES
       
    60 
       
    61 // CONSTANTS
       
    62 
       
    63 // CLASS DECLARATION
       
    64 
       
    65 /**
       
    66  * Observer class that observes changes of Property values and propogates them further.
       
    67  * The class defines a handle to a property, a single data value representing
       
    68  * an item of state information.
       
    69  *
       
    70  **/
       
    71 class CDevEncStarterPropertyObserver : public CActive
       
    72 	{
       
    73 public:  // Constructors and destructor
       
    74 
       
    75     /**
       
    76      * Two-phased constructor.
       
    77      * @param aObserver a reference to the observer interface implementer
       
    78      * @param aCategory UID of Publish And Subscribe category
       
    79      * @param aKey subkey to specify the category event; to be used with Publish And Subscribe
       
    80      * Event enumerations and uid:s of Publish And Subscribe can be found from PSVariables.h
       
    81      **/
       
    82     static CDevEncStarterPropertyObserver* NewL( MDevEncStarterPropertyChangeObserver& aObserver,
       
    83                                             const TUid& aCategory,
       
    84                                             const TUint aKey );
       
    85 
       
    86     /**
       
    87      * Destructor.
       
    88      **/
       
    89     ~CDevEncStarterPropertyObserver();
       
    90 
       
    91     /**
       
    92      * Updates a value reference in correspondence with the current Property value
       
    93      * @param handle to a value which will be updated
       
    94      * @return KErrNone if operation was successful
       
    95      **/
       
    96 	void GetValue( TInt& aValue ) const;
       
    97 
       
    98  private:
       
    99     /**
       
   100      * C++ default constructor overload.
       
   101      * Two-phased constructor.
       
   102      * @param aObserver a reference to the observer interface implementer
       
   103      * @param aCategory UID of Publish And Subscribe category
       
   104      * @param aKey subkey to specify the category event; to be used with Publish And Subscribe
       
   105      * Event enumerations and uid:s of Publish And Subscribe can be found from PSVariables.h
       
   106      **/
       
   107 	CDevEncStarterPropertyObserver( MDevEncStarterPropertyChangeObserver& aObserver,
       
   108 	                           const TUid& aCategory,
       
   109 	                           const TUint aKey );
       
   110 
       
   111     /**
       
   112      * By default Symbian 2nd phase constructor is private.
       
   113      **/
       
   114     void ConstructL();
       
   115 
       
   116  protected:  // Functions from base classes
       
   117     /**
       
   118      * From CActive
       
   119      * Handles an active object’s request completion event
       
   120      **/
       
   121     void RunL();
       
   122 
       
   123     /**
       
   124      * From CActive,
       
   125      * Cancels and outstanding request
       
   126      **/
       
   127     void DoCancel();
       
   128 
       
   129  private:  // Data
       
   130  	// Value of a subscribed category property
       
   131  	TInt iValue;
       
   132 
       
   133     // handle to Publish And Subscribe component
       
   134     RProperty iProperty;
       
   135 
       
   136     // Observer to be notified when particular Property value has changed
       
   137     MDevEncStarterPropertyChangeObserver& iObserver;
       
   138 
       
   139     // UID of Publish And Subscribe category
       
   140     TUid iCategory;
       
   141 
       
   142     // subkey to be used with Publish And Subscribe
       
   143     TUint iKey;
       
   144 
       
   145 	};
       
   146 
       
   147 #endif  // CPROPERTYOBSERVER_H
       
   148 
       
   149 
       
   150 // End of File