securitydialogs/lockapp/inc/lockappcenrepobserver.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:  Central Repository key observer
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __LOCKAPPCENREPOBSERVER_H__
       
    20 #define __LOCKAPPCENREPOBSERVER_H__
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32std.h>
       
    24 #include <cenrepnotifyhandler.h>
       
    25 #include "lockappobserverinterface.h"
       
    26 
       
    27 /**
       
    28  *  CLockAppCenRepObserver class is a Central Repository key observer
       
    29  *  which can be used to monitor and set a CenRep value.
       
    30  *
       
    31  *  @lib    lockapp
       
    32  *  @since  5.0
       
    33  *  @author Tamas Koteles
       
    34  */
       
    35 class CLockAppCenRepObserver : public CBase, public MCenRepNotifyHandlerCallback
       
    36 	{
       
    37 	public:
       
    38 
       
    39 		/**
       
    40 		 * Two-phased constructor.
       
    41 		 *
       
    42 		 * @param aObserver   pointer to observer
       
    43 		 * @param aCenRepUid  repository Uid
       
    44 		 * @param aKeyId      repository key Id
       
    45 		 * @return            the instance just created
       
    46 		 */
       
    47 		static CLockAppCenRepObserver* NewL( MLockAppObserverInterface* aObserver, TUid aCenRepUid,
       
    48 				TUint32 aKeyId );
       
    49 
       
    50 		/**
       
    51 		 * Destructor.
       
    52 		 */
       
    53 		~CLockAppCenRepObserver( );
       
    54 
       
    55 		/**
       
    56 		 * Get key value from CenRep.
       
    57 		 */
       
    58 		TInt GetValue( TInt& aValue );
       
    59 
       
    60 		/**
       
    61 		 * Get the value from a different CenRep key.
       
    62 		 */
       
    63 		TInt GetKeyValue( TUint32 aKey, TInt& aValue );
       
    64 
       
    65 		/**
       
    66 		 * Set key value to CenRep.
       
    67 		 */
       
    68 		TInt SetValue( TInt aValue );
       
    69 
       
    70 		/**
       
    71 		 * Set the value of a different CenRep key.
       
    72 		 */
       
    73 		TInt SetKeyValue( TUint32 aKey, TInt aValue );
       
    74 
       
    75 	public:
       
    76 
       
    77 		/**
       
    78 		 * From MCenRepNotifyHandlerCallback. Handles change event. Called by CenRep.
       
    79 		 *
       
    80 		 * @param aId the id of the changed setting
       
    81 		 * @param aNewValue the new value of the changed setting
       
    82 		 */
       
    83 		void HandleNotifyInt( TUint32 aId, TInt aNewValue );
       
    84 
       
    85 		void HandleNotifyError( TUint32 aId, TInt error, CCenRepNotifyHandler* aHandler );
       
    86 
       
    87 		void HandleNotifyGeneric( TUint32 aId );
       
    88 
       
    89 	protected:
       
    90 
       
    91 		/**
       
    92 		 * C++ default constructor.
       
    93 		 *
       
    94 		 * @param aObserver  pointer to observer
       
    95 		 * @param aCenRepUid central repository Uid
       
    96 		 * @param aKeyId     key Id
       
    97 		 */
       
    98 		CLockAppCenRepObserver( MLockAppObserverInterface* aObserver, TUid aCenRepUid,
       
    99 				TUint32 aKeyId );
       
   100 
       
   101 		/**
       
   102 		 * Symbian OS constructor.
       
   103 		 */
       
   104 		void ConstructL( );
       
   105 
       
   106 	protected:
       
   107 
       
   108 		/**
       
   109 		 * Observer's callback interface. Not owned.
       
   110 		 */
       
   111 		MLockAppObserverInterface* iObserver;
       
   112 
       
   113 		/**
       
   114 		 * CenRep value notifier.
       
   115 		 */
       
   116 		CCenRepNotifyHandler* iNotifyHandler;
       
   117 
       
   118 		/**
       
   119 		 * Access to central repository.
       
   120 		 */
       
   121 		CRepository* iRepository;
       
   122 
       
   123 		/**
       
   124 		 * Repository Uid.
       
   125 		 */
       
   126 		TUid iCenRepUid;
       
   127 
       
   128 		/**
       
   129 		 * Repository key Id.
       
   130 		 */
       
   131 		TUint32 iKeyId;
       
   132 
       
   133 	};
       
   134 
       
   135 #endif // __LOCKAPPCENREPOBSERVER_H__
       
   136 // END OF FILE