wlan_bearer/wlanengine/wlan_symbian/wlanengine_symbian_3.1/inc/wlmplatformsubscriber.h
changeset 0 c40eb8fe8501
equal deleted inserted replaced
-1:000000000000 0:c40eb8fe8501
       
     1 /*
       
     2 * Copyright (c) 2002-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 the License "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:  Class for requesting notifications to Publish & Subscribe
       
    15 *                properties.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef WLMPLATFORMSUBSCRIBER_H
       
    21 #define WLMPLATFORMSUBSCRIBER_H
       
    22 
       
    23 #include <e32base.h>
       
    24 #include <e32property.h>
       
    25 
       
    26 enum TWlmSubscribeType
       
    27     {
       
    28     EWlmSubscribeTypeCenRep,
       
    29     EWlmSubscribeTypePubSub,
       
    30     };
       
    31     
       
    32 class CRepository;
       
    33 
       
    34 /**
       
    35 * Callback interface to client
       
    36 */
       
    37 class MWlmPlatformResponder
       
    38     {
       
    39     public: // New functions
       
    40         
       
    41         /**
       
    42         * From The subscribed property has changed.
       
    43         * @since Series 60 3.0
       
    44         * @param aCategory Category of the changed property.
       
    45         * @param aKey Key of the changed property.
       
    46         */
       
    47         virtual void HandlePropertyChangedL( const TUid& aCategory, const TUint aKey ) = 0;
       
    48     };
       
    49 
       
    50 // CLASS DECLARATION
       
    51 /**
       
    52 * Class for requesting notifications about changed PubSub/CenRep properties/keys.
       
    53 * @lib wlmplatform.dll
       
    54 * @since Series 60 3.0
       
    55 */
       
    56 NONSHARABLE_CLASS( CWlmPlatformSubscriber ) : public CActive
       
    57     {
       
    58     public:  // Constructors and destructor
       
    59         
       
    60         /**
       
    61         * Two-phased constructor.
       
    62         * @since Series 60 3.0
       
    63         * @param aType specifies whether observed key is in CenRep or PubSub
       
    64         * @param aCallback specifies the callback object
       
    65         * @param aCategory specifies the key's category (PubSub)
       
    66         *        or repository file (CenRep)
       
    67         * @param aKey specifies the key to be watched
       
    68         */
       
    69         static CWlmPlatformSubscriber* NewL(
       
    70             TWlmSubscribeType aType,
       
    71             MWlmPlatformResponder& aCallback,
       
    72             const TUid& aCategory,
       
    73             const TUint aKey );
       
    74         
       
    75         /**
       
    76         * Destructor.
       
    77         */
       
    78         virtual ~CWlmPlatformSubscriber();
       
    79 
       
    80     public: // New functions
       
    81         
       
    82         /**
       
    83         * IssueRequest subscribes to changes of a property
       
    84         * @since Series 60 3.0
       
    85         */
       
    86         void IssueRequest();
       
    87 
       
    88         /**
       
    89         * Get requests the value of the property under subscription
       
    90         * (callback only tells the client that the value has changed)
       
    91         * @since Series 60 3.0
       
    92         */
       
    93         TInt Get( TInt& aValue );
       
    94 
       
    95     protected:  // Functions from base classes
       
    96         
       
    97         /**
       
    98         * From CActive
       
    99         */
       
   100         virtual void DoCancel();
       
   101 
       
   102         /**
       
   103         * From CActive
       
   104         */        
       
   105         virtual TInt RunError( TInt aError );
       
   106 
       
   107         /**
       
   108         * From CActive
       
   109         */
       
   110         virtual void RunL();
       
   111 
       
   112     private:
       
   113 
       
   114         /**
       
   115         * C++ default constructor.
       
   116         */
       
   117         CWlmPlatformSubscriber(
       
   118             TWlmSubscribeType aType,
       
   119             MWlmPlatformResponder& aCallback,
       
   120             const TUid& aCategory,
       
   121             const TUint aKey );
       
   122 
       
   123         /**
       
   124         * By default Symbian 2nd phase constructor is private.
       
   125         */
       
   126         void ConstructL();
       
   127 
       
   128     private:    // Data
       
   129     
       
   130         /** Type of the property to watch (PubSub or CenRep). */
       
   131         TWlmSubscribeType iType;
       
   132     
       
   133         /** Callback to call when the property changes. */
       
   134         MWlmPlatformResponder &iCallback;
       
   135         
       
   136         /** The category/repository to watch. */
       
   137         const TUid iCategory;
       
   138         
       
   139         /** The key to watch. */
       
   140         const TUint iKey;
       
   141 
       
   142         /** The property to watch in PubSub. */
       
   143         RProperty iProperty;
       
   144         
       
   145         /** The handle to CenRep. */
       
   146         CRepository* iCenRep;
       
   147     };
       
   148 
       
   149 #endif // WLMPLATFORMSUBSCRIBER_H