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