callcontinuity/vcc/inc/vccengpspropertylistener.h
branchRCL_3
changeset 22 d38647835c2e
parent 0 a4daefaec16c
equal deleted inserted replaced
21:f742655b05bf 22:d38647835c2e
       
     1 /*
       
     2 * Copyright (c) 2005-2008 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:   Active object that tracks changes on a PS property.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef C_VCCENGPSPROPERTYLISTENER_H
       
    21 #define C_VCCENGPSPROPERTYLISTENER_H
       
    22 
       
    23 #include <e32base.h>
       
    24 #include <e32property.h>
       
    25 
       
    26 #include "mvccengpspropertylistenerobserver.h"
       
    27 
       
    28 /*
       
    29  *  CVccEngPsPropertyListener subsribes to the given property. It is used to 
       
    30  *  notify its observers about the changed the value of the property.
       
    31  *  
       
    32  *   
       
    33  *  @code
       
    34  *  void CExampleClass::ConstructL()
       
    35  * 	{
       
    36  *   CVccEngPsPropertyListener* iPropListener = 
       
    37  *				CVccEngPsPropertyListener::NewL( KPSVccPropertyCategory, 
       
    38                                                  KVccPropKeyHoRequest );
       
    39  * 	 iPropListener.AddObserver( this );
       
    40  * 	 iPropListener.Start();
       
    41  * 	}	
       
    42  * 
       
    43  * 	void CExampleClass::PropertyChangedL( 
       
    44             const TUid aCategoryId,
       
    45             const TUint aKeyId,
       
    46             const TInt aValue )
       
    47  * 	{
       
    48         
       
    49  *  	if( aKeyId )
       
    50  * 			{
       
    51  * 			switch( aValue )
       
    52  * 				{				
       
    53  * 				case EVccManualStartCsToPsHoRequest:
       
    54  * 					// start CS->PS handover 
       
    55  * 					break;
       
    56  * 				default:
       
    57  * 					break;
       
    58  * 				}			
       
    59  * 			}
       
    60  *  }
       
    61  *   
       
    62  *  @endcode
       
    63  
       
    64  * 
       
    65  *  @lib hoengine.lib
       
    66  *  @since S60 v3.2
       
    67  */
       
    68 class CVccEngPsPropertyListener : public CActive
       
    69     {
       
    70 public:
       
    71 
       
    72 	/**
       
    73 	 * Symbian two-phased constructor.
       
    74      *
       
    75      * @param aCategoryId	category uid 
       
    76      * @param aKeyId Id of a key of the property.
       
    77      */
       
    78     static CVccEngPsPropertyListener* NewL( const TUid aCategoryId, 
       
    79     										const TUint aKeyId );
       
    80 
       
    81     /**
       
    82      * Destructor.
       
    83      */
       
    84     virtual ~CVccEngPsPropertyListener();
       
    85 
       
    86     /**
       
    87      * Adds an observer
       
    88      * @param aObserver Reference to observer to be added
       
    89      */
       
    90     void AddObserverL( MVccEngPsPropertyListenerObserver& aObserver );
       
    91 
       
    92     /**
       
    93      * Removes an observer
       
    94      * @param aObserver  Reference to observer to be removed
       
    95      */
       
    96     void RemoveObserver( MVccEngPsPropertyListenerObserver& aObserver );
       
    97 
       
    98     /**
       
    99      * Get the current value of the property.
       
   100      * @return Current key value
       
   101      */
       
   102     TInt CurrentValue();
       
   103 
       
   104     /**
       
   105      * Starts the listener.
       
   106      */
       
   107     void Start();
       
   108 
       
   109 private: 
       
   110 	/**
       
   111 	 * Constructor.
       
   112 	 * 
       
   113 	 * @param aPropertyUid	category uid 
       
   114 	 * @param aKeyId Id of a key of the property.
       
   115 	 */
       
   116 	CVccEngPsPropertyListener( const TUid aCategoryId, const TUint aKeyId );
       
   117     
       
   118 	/**
       
   119 	 * 2nd phase constructor
       
   120 	 */
       
   121  	void ConstructL();
       
   122  	
       
   123     /**
       
   124      * Notifies the observers about the property value change.
       
   125      * @leave Symbian error code in error case
       
   126      */
       
   127     void NotifyObserversL();
       
   128 
       
   129 // from base class CActive.
       
   130 
       
   131     /**
       
   132      * @see CActive::RunL()
       
   133      */
       
   134     void RunL();
       
   135      
       
   136     /**
       
   137      * See CActive::DoCancel()
       
   138      */
       
   139     void DoCancel();
       
   140  
       
   141 private: //data
       
   142 
       
   143 	/**
       
   144 	 * Uid of the property category to be watched.
       
   145 	 */
       
   146  	TUid iCategoryId;
       
   147  
       
   148  	/**
       
   149  	 * The property key uid to be watched.
       
   150  	 */
       
   151  	TUint iKeyId;
       
   152 
       
   153  	/**
       
   154  	 * the property category.
       
   155  	 * Own
       
   156  	 */
       
   157  	RProperty iProperty;
       
   158    
       
   159  	/**
       
   160  	 * Obsevers for callback from this.
       
   161  	 * Own
       
   162  	 */
       
   163  	RPointerArray<MVccEngPsPropertyListenerObserver> iObservers;
       
   164 
       
   165     };
       
   166 
       
   167 #endif // C_VCCENGPSPROPERTYLISTENER_H
       
   168