emailservices/emailserver/cmailhandlerplugin/inc/PSSubscriber.h
branchRCL_3
changeset 25 3533d4323edc
equal deleted inserted replaced
24:d189ee25cf9d 25:3533d4323edc
       
     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: Subscriber class for Publish & Subsribe events
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef PSSUBSCRIBER_H
       
    19 #define PSSUBSCRIBER_H
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <e32property.h>
       
    23 
       
    24 class MPSSubscribeHandler;
       
    25 
       
    26 /**
       
    27 *  CPSSubscriber is an acitve object that subscribes to a single
       
    28 *  Publish and Subscribe Property and notifies about the Property changes.
       
    29 */
       
    30 class CPSSubscriber : public CActive
       
    31 {
       
    32 public:
       
    33     /**
       
    34     * Two-phased constructor.
       
    35 	*
       
    36 	* @param aPropertyResponder The object to be notified about Property changes
       
    37 	* @param aCategory The category of the Property to be observed
       
    38 	* @param aKey The subkey of the Property to be observed
       
    39     */
       
    40     static CPSSubscriber* NewL( MPSSubscribeHandler& aPropertyResponder, const TUid& aCategory, TUint aKey );
       
    41 
       
    42     /**
       
    43     * Destructor.
       
    44     */
       
    45      ~CPSSubscriber();
       
    46 
       
    47 	 /**
       
    48 	  * Subscribes to the Property given in constructor
       
    49 	  */
       
    50      void Subscribe();
       
    51 
       
    52 private:
       
    53 	/**
       
    54      * C++ default constructor.
       
    55 	 *
       
    56   	 * @param aPropertyResponder The object to be notified about Property changes
       
    57 	 * @param aCategory The category of the Property to be observed
       
    58 	 * @param aKey The subkey of the Property to be observed
       
    59      */
       
    60     CPSSubscriber( MPSSubscribeHandler& aPropertyResponder, const TUid& aCategory, TUint aKey );
       
    61 
       
    62     /**
       
    63      * By default Symbian 2nd phase constructor is private.
       
    64      */
       
    65 	 void ConstructL();
       
    66 
       
    67 public: // from CActive
       
    68     /**
       
    69 	*   RunL
       
    70     */
       
    71     void RunL();
       
    72 
       
    73     /**
       
    74 	*   RunError
       
    75     *	@param aError the error returned
       
    76 	*
       
    77     *	@return error
       
    78     */
       
    79     TInt RunError( TInt aError );
       
    80 
       
    81     /**
       
    82     *	DoCancel
       
    83     */
       
    84     void DoCancel();
       
    85 
       
    86 private: // Methods not implemented
       
    87     CPSSubscriber( const CPSSubscriber& );           // Copy constructor
       
    88     CPSSubscriber& operator=( const CPSSubscriber& );// Assigment operator
       
    89 
       
    90 private: // data
       
    91 
       
    92 	// The object to be notified about Property changes
       
    93     MPSSubscribeHandler&      iPropertyResponder;
       
    94 
       
    95 	// The property object that subscribes to the Property to be observed
       
    96     RProperty                 iProperty;
       
    97 
       
    98 	// The category of the Property to be observed
       
    99     TUid                      iCategory;
       
   100 
       
   101 	// The subkey of the Property to be observed
       
   102 	TUint                     iKey;
       
   103 };
       
   104 
       
   105 #endif // PSSUBSCRIBER_H