accessoryservices/pluggeddisplay/pluggeddisplayengine/inc/centralrepositorywatch.h
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     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: Class to watch key value changes in Central Repository.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef C_CENTRALREPOSITORYWATCH_H
       
    21 #define C_CENTRALREPOSITORYWATCH_H
       
    22 
       
    23 
       
    24 #include    <e32base.h>
       
    25 #include    <centralrepository.h>
       
    26 #include "centralrepositoryobserver.h"
       
    27 
       
    28 
       
    29 /**
       
    30  *  Class to watch key value changes in Central Repository.
       
    31  *
       
    32  *  @code
       
    33  *   ?good_class_usage_example(s)
       
    34  *  @endcode
       
    35  *
       
    36  *  @lib none.
       
    37  *  @since TB 9.2
       
    38  */
       
    39 NONSHARABLE_CLASS( CCentralRepositoryWatch ): public CActive
       
    40     {
       
    41 
       
    42 
       
    43 public:
       
    44 
       
    45 
       
    46     /**
       
    47     * Two-phased constructor.
       
    48     * @param aObserver Observer's callback interface.
       
    49     * @param aRepositoryUid Identifier of a repositor.
       
    50     * @param aKeyId Identifier of a key.
       
    51     */
       
    52     static CCentralRepositoryWatch* NewL(
       
    53             MCentralRepositoryObserver&   aObserver,
       
    54             TUid aRepositoryUid,
       
    55             TUint32 aKeyId
       
    56             );
       
    57     
       
    58     /**
       
    59     * Two-phased constructor.
       
    60     * @param aObserver Observer's callback interface.
       
    61     * @param aRepositoryUid Identifier of a repositor.
       
    62     * @param aKeyId Identifier of a key.
       
    63     */
       
    64     static CCentralRepositoryWatch* NewLC(
       
    65             MCentralRepositoryObserver&   aObserver,
       
    66             TUid aRepositoryUid,
       
    67             TUint32 aKeyId
       
    68             );
       
    69 
       
    70     /**
       
    71     * Destructor.
       
    72     */
       
    73     virtual ~CCentralRepositoryWatch();
       
    74 
       
    75     /**
       
    76     * Watch value changes of a specified key in a specified CenRep.
       
    77     * @param None
       
    78     * @return void
       
    79     */
       
    80     void Watch();
       
    81 
       
    82     /**
       
    83     * Get current value of a specified key in a specified CenRep.
       
    84     * @param aValue Reference to a variable to which current value is to be assigned.
       
    85     * @return TInt Error code. 
       
    86     *       KErrNone if successful, 
       
    87     *       KErrAbort if in a transaction that has previously failed 
       
    88     *       KErrPermissionDenied if caller fails capability check, 
       
    89     *       KErrNotFound if the setting does not exist, 
       
    90     *       KErrArgument if the setting exists but is not an integer, plus other system-wide error codes.
       
    91     */
       
    92     TInt GetCurrentValue( TInt& aValue );
       
    93 
       
    94 
       
    95 protected:
       
    96 
       
    97     /**
       
    98     * Active object cancellation
       
    99     * @param None
       
   100     * @return void
       
   101     */
       
   102     void DoCancel();
       
   103 
       
   104 private:
       
   105 
       
   106 
       
   107     /**
       
   108     * C++ default constructor.
       
   109     * @param aObserver Observer's callback interface.
       
   110     * @param aRepositoryId Identifier of a repositor.
       
   111     * @param aKeyId Identifier of a key.
       
   112     */
       
   113     CCentralRepositoryWatch(
       
   114             MCentralRepositoryObserver& aObserver,
       
   115             TUid aRepositoryId,
       
   116             TUint32 aKeyId );
       
   117 
       
   118     /**
       
   119     * By default Symbian OS constructor is private.
       
   120     * @return void
       
   121     */
       
   122     void ConstructL(  );
       
   123 
       
   124     /**
       
   125     * Completion
       
   126     * @param None
       
   127     * @return void
       
   128     */
       
   129     void RunL();
       
   130    
       
   131     /**
       
   132     * Error handling.
       
   133     * @param aError Error code.
       
   134     * @return void
       
   135     */
       
   136     TInt RunError( TInt aError );
       
   137    
       
   138     /**
       
   139     * By default, prohibit copy constructor
       
   140     */
       
   141    CCentralRepositoryWatch( const CCentralRepositoryWatch& );
       
   142 
       
   143    /**
       
   144    * By default, prohibit assignment operator
       
   145    */
       
   146     CCentralRepositoryWatch& operator= ( const CCentralRepositoryWatch& );
       
   147 
       
   148 
       
   149 private: // data
       
   150 
       
   151     /**
       
   152      * Observer objects callback interface.
       
   153      * Not own.
       
   154      */
       
   155     MCentralRepositoryObserver&   iObserver;
       
   156 
       
   157     /**
       
   158      * Repository pointer.
       
   159      * Own.
       
   160      */
       
   161     CRepository*               iRepository;
       
   162 
       
   163     /**
       
   164      * Identifier of the repositor.
       
   165      */
       
   166     TUid                       iRepositoryUid;
       
   167 
       
   168     /**
       
   169      * Identifier of a key.
       
   170      */
       
   171     TInt32                     iKey;
       
   172 
       
   173  
       
   174     };
       
   175 
       
   176 
       
   177 #endif // C_CENTRALREPOSITORYWATCH_H