securitydialogs/lockapp/inc/lockapppubsubobserver.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:  Publish & Subscribe key observer
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __LOCKAPPPUBSUBOBSERVER_H__
       
    20 #define __LOCKAPPPUBSUBOBSERVER_H__
       
    21 
       
    22 // INCLUDES
       
    23 #include <w32std.h>
       
    24 #include <e32svr.h>
       
    25 #include <e32property.h>
       
    26 #include "lockappobserverinterface.h"
       
    27 
       
    28 /**
       
    29  *  CLockAppPubSubObserver class implements a Publish & Subscribe key observer.
       
    30  *  It can be used to monitor and also to set a PubSub key.
       
    31  *
       
    32  *  @lib    lockapp
       
    33  *  @since  5.0
       
    34  *  @author Tamas Koteles
       
    35  */
       
    36 class CLockAppPubSubObserver : public CActive
       
    37 	{
       
    38 	public:
       
    39 
       
    40 		/**
       
    41 		 * Two-phased constructor.
       
    42 		 *
       
    43 		 * @param aObserver   pointer to observer
       
    44 		 * @param aPubSubUid  publish & subscribe Uid
       
    45 		 * @param aKeyId      publish & subscribe key id
       
    46 		 * @return            the instance just created.
       
    47 		 */
       
    48 		static CLockAppPubSubObserver* NewL( MLockAppObserverInterface* aObserver, TUid aPubSubUid,
       
    49 				TUint32 aKeyId );
       
    50 
       
    51 		/**
       
    52 		 * Destructor.
       
    53 		 */
       
    54 		~CLockAppPubSubObserver( );
       
    55 
       
    56 		/**
       
    57 		 * Start obsering PubSub key
       
    58 		 */
       
    59 		TInt Start( );
       
    60 
       
    61 		/**
       
    62 		 * Stop observing PubSub key
       
    63 		 */
       
    64 		void Stop( );
       
    65 
       
    66 		/**
       
    67 		 * Get key value from P&S.
       
    68 		 */
       
    69 		TInt GetKeyValue( TInt& aValue );
       
    70 
       
    71 		/**
       
    72 		 * Set key value to P&S.
       
    73 		 */
       
    74 		TInt SetKeyValue( TInt aValue );
       
    75 
       
    76 	protected:
       
    77 
       
    78 		/**
       
    79 		 * C++ default constructor.
       
    80 		 *
       
    81 		 * @param aObserver observer
       
    82 		 * @param aPubSubUid publish & subscribe Uid
       
    83 		 * @param aKeyId key id
       
    84 		 */
       
    85 		CLockAppPubSubObserver( MLockAppObserverInterface* aObserver, TUid aPubSubUid,
       
    86 				TUint32 aKeyId );
       
    87 
       
    88 		/**
       
    89 		 * Symbian OS constructor.
       
    90 		 */
       
    91 		void ConstructL( );
       
    92 
       
    93 	private:
       
    94 
       
    95 		void RunL( );
       
    96 
       
    97 		void DoCancel( );
       
    98 
       
    99 	protected:
       
   100 
       
   101 		/**
       
   102 		 * Observer's callback interface. Not owned.
       
   103 		 */
       
   104 		MLockAppObserverInterface* iObserver;
       
   105 
       
   106 		/**
       
   107 		 * Access to Publish & Subscribe.
       
   108 		 */
       
   109 		RProperty iProperty;
       
   110 
       
   111 		/**
       
   112 		 * Publish & Subscribe Uid.
       
   113 		 */
       
   114 		TUid iPubSubUid;
       
   115 
       
   116 		/**
       
   117 		 * Publish & Subscribe key Id.
       
   118 		 */
       
   119 		TUint32 iKeyId;
       
   120 
       
   121 		/**
       
   122 		 * Publish & Subscribe key's value.
       
   123 		 */
       
   124 		TInt iValue;
       
   125 
       
   126 	};
       
   127 
       
   128 #endif // __LOCKAPPPUBSUBOBSERVER_H__
       
   129 // END OF FILE