psln/Inc/PslnPropertySubscriber.h
changeset 37 89c890c70182
parent 34 6b5204869ed5
child 45 667edd0b8678
equal deleted inserted replaced
34:6b5204869ed5 37:89c890c70182
     1 /*
       
     2 * Copyright (c) 2005-2006 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:  Property subscriber.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef C_PSLNPROPERTYSUBSCRIBER_H
       
    21 #define C_PSLNPROPERTYSUBSCRIBER_H
       
    22 
       
    23 #include    <e32base.h>
       
    24 #include    <e32property.h>
       
    25 
       
    26 /**
       
    27 *  Property subscriber wrapper class.
       
    28 *  Implements callback when property's value changes.
       
    29 *
       
    30 *  @since S60 v3.1
       
    31 */
       
    32 class CPslnPropertySubscriber : public CActive
       
    33     {
       
    34     public:
       
    35 
       
    36         /**
       
    37         * C++ constructor.
       
    38         *
       
    39         * NOTE that callback method is NOT allowed to leave. If it leaves,
       
    40         * subscription is not activated after the leave.
       
    41         *
       
    42         * @param aCallBack callback method to handle notification of a change
       
    43         *        to client.
       
    44         * @param aProperty property to subscribe.
       
    45         */
       
    46         CPslnPropertySubscriber( TCallBack aCallBack, RProperty& aProperty );
       
    47         
       
    48         /**
       
    49         * Destructor.
       
    50         */
       
    51         virtual ~CPslnPropertySubscriber();   
       
    52         
       
    53         /**
       
    54         * Subscribe property. 
       
    55         * To stop subscription, just call Cancel.
       
    56         */
       
    57         void Subscribe();
       
    58 
       
    59         /**
       
    60         * From CActive. 
       
    61         * Called when Active Object is ready.
       
    62         */
       
    63         void RunL();
       
    64         
       
    65         /**
       
    66         * From CActive. 
       
    67         * Called when Active Object has been cancelled.
       
    68         */
       
    69         void DoCancel();
       
    70 
       
    71     private:    // Data
       
    72         /**
       
    73         * Callback harness.
       
    74         */
       
    75         TCallBack   iCallBack;
       
    76 
       
    77         /**
       
    78         * Publish & Subsribe property.
       
    79         */
       
    80         RProperty&  iProperty;
       
    81 
       
    82     };
       
    83 
       
    84 #endif      // C_PSLNPROPERTYSUBSCRIBER_H
       
    85             
       
    86 // End of File