camerauis/cameraapp/generic/inc/CamPropertyWatcher.h
branchRCL_3
changeset 24 bac7acad7cb3
parent 0 1ddebce53859
child 25 2c87b2808fd7
equal deleted inserted replaced
23:61bc0f252b2b 24:bac7acad7cb3
       
     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:  Callback wrapper for Publish and Subscribe
       
    15 *
       
    16 *  Copyright © 2007 Nokia.  All rights reserved.
       
    17 *  This material, including documentation and any related computer
       
    18 *  programs, is protected by copyright controlled by Nokia.  All
       
    19 *  rights are reserved.  Copying, including reproducing, storing,
       
    20 *  adapting or translating, any or all of this material requires the
       
    21 *  prior written consent of Nokia.  This material also contains
       
    22 *  confidential information which may not be disclosed to others
       
    23 *  without the prior written consent of Nokia.
       
    24 
       
    25 *
       
    26 *
       
    27 */
       
    28 
       
    29 
       
    30 #ifndef CAMPROPERTYWATCHER_H
       
    31 #define CAMPROPERTYWATCHER_H
       
    32 
       
    33 //  INCLUDES
       
    34 #include <e32base.h>
       
    35 #include <e32property.h>
       
    36 
       
    37 // FORWARD DECLARATIONS
       
    38 class MPropertyObserver;
       
    39 
       
    40 // CLASS DECLARATION
       
    41 
       
    42 /**
       
    43 *  Class to watch for value changes on a property
       
    44 *
       
    45 *  @since 2.8
       
    46 */
       
    47 class CCamPropertyWatcher : public CActive
       
    48 	{
       
    49 public: // Constructors and destructor
       
    50     /**
       
    51     * Symbian OS two-phased constructor
       
    52     * @since 2.8
       
    53     * @param aPropertyObserver The observer, notified when the value changes
       
    54     * @param aCategory the category of the property
       
    55     * @param aKey the identifier of the property
       
    56     */      
       
    57     static CCamPropertyWatcher* NewL( MPropertyObserver& aPropertyObserver, 
       
    58                                       const TUid& aCategory, 
       
    59                                       const TUint aKey );
       
    60 
       
    61     /**
       
    62     * Destructor.
       
    63     * @since 2.8
       
    64     */
       
    65     ~CCamPropertyWatcher();
       
    66 
       
    67 public: // New methods
       
    68 
       
    69     /**
       
    70     * Register a need for notification of value changes
       
    71     * @since 2.8
       
    72     */
       
    73     void Subscribe();
       
    74 
       
    75     /**
       
    76     * Return the current value of the property
       
    77     * @since 2.8
       
    78     * @param aValue Reference to an integer that will receive the current 
       
    79     *                 value of the property
       
    80     * @return KErrNone if successful otherwise another of the system-wide error 
       
    81     *                 codes 
       
    82     */
       
    83 	TInt Get( TInt& aValue );
       
    84 
       
    85 private: // new methods
       
    86 
       
    87     /**
       
    88     * C++ default constructor.
       
    89     * @since 2.8
       
    90     * @param aPropertyObserver Reference to observer of change events
       
    91     * @param aCategory category of the property
       
    92     * @param aKey identifier of the property
       
    93     */
       
    94     CCamPropertyWatcher( MPropertyObserver& aPropertyObserver, 
       
    95                          const TUid& aCategory, 
       
    96                          const TUint aKey );
       
    97     /**
       
    98     * Symbian 2nd phase constructor.
       
    99     * @since 2.8
       
   100     */
       
   101     void ConstructL();
       
   102 
       
   103 public: // methods from base classes
       
   104 
       
   105 	/**
       
   106     * From CActive
       
   107     * @since 2.8
       
   108     */
       
   109     void RunL();
       
   110 
       
   111 private:
       
   112 
       
   113     /**
       
   114     * From CActive
       
   115     * @since 2.8
       
   116     */
       
   117     void DoCancel();
       
   118 	
       
   119 private:
       
   120 
       
   121     MPropertyObserver& iPropertyObserver;   // observer informed of change events
       
   122     RProperty iProperty;                    // handle to the property
       
   123     TUid iCategory;                         // category of the property
       
   124     TUint iKey;                             // identifier of the property
       
   125 	};
       
   126 
       
   127 #endif // CAMPROPERTYWATCHER_H
       
   128 
       
   129 // End of File