wvuing/IMPSServiceSettingsUI/SharedDataSrc/CIMPSPubSubHandler.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2004 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:  Publish and subscribe handler for IMPSCommonUI
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __CIMPSPUBSUBHANDLER_H
       
    19 #define __CIMPSPUBSUBHANDLER_H
       
    20 
       
    21 //  INCLUDES
       
    22 #include <e32base.h>
       
    23 
       
    24 #include "MIMPSSharedData.h"
       
    25 #include "MIMPSPropertyNotificationObserver.h"
       
    26 #include "IMPSSharedDataDefs.h"
       
    27 
       
    28 //#include <e32property.h>    // RProperty
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class MIMPSSharedDataObserver;
       
    32 class CIMPSPropertyObserver;
       
    33 
       
    34 // CLASS DECLARATION
       
    35 
       
    36 /**
       
    37 *  Shared data handler
       
    38 *
       
    39 *  @lib WVServiceSettingsUi.dll
       
    40 *  @since 2.6
       
    41 */
       
    42 NONSHARABLE_CLASS( CIMPSPubSubHandler ) : public CBase,
       
    43         public MIMPSSharedData,
       
    44         public MIMPSPropertyNotificationObserver
       
    45     {
       
    46 public: // New functions
       
    47     /**
       
    48     * Two-phased constructor.
       
    49     * @param aResourceId the resource of the setting page
       
    50     * @param aSelectionItemList the selection item list of the setting page
       
    51     */
       
    52     static CIMPSPubSubHandler* NewL( MIMPSSharedDataObserver* aObserver, const TUid aUid );
       
    53 
       
    54 private: // constructor and destructor
       
    55 
       
    56     /**
       
    57     * C++ default constructor.
       
    58     */
       
    59     CIMPSPubSubHandler( MIMPSSharedDataObserver* aObserver );
       
    60 
       
    61     /**
       
    62      * Symbian OS constructor.
       
    63      */
       
    64     void ConstructL( const TUid aUid );
       
    65 
       
    66     /**
       
    67     * Destructor.
       
    68     */
       
    69     virtual ~CIMPSPubSubHandler();
       
    70 
       
    71 
       
    72 private: //Functions from base classes
       
    73 
       
    74     /**
       
    75     * From MIMPSSharedData
       
    76     * @see MIMPSSharedData
       
    77     */
       
    78     TInt SubscribeChange( const TUid aUid, const TIMPSSharedKeys aKey );
       
    79 
       
    80     /**
       
    81     * From MIMPSSharedData
       
    82     * @see MIMPSSharedData
       
    83     */
       
    84     TInt SubscribeSet( const TUid aUid, const TIMPSSharedKeys aKey );
       
    85 
       
    86     /**
       
    87     * From MIMPSSharedData
       
    88     * @see MIMPSSharedData
       
    89     */
       
    90     void UnSubscribe( const TUid aUid, const TIMPSSharedKeys aKey );
       
    91 
       
    92     /**
       
    93     * From MIMPSSharedData
       
    94     * @see MIMPSSharedData
       
    95     */
       
    96     TInt GetStringKey( const TIMPSSharedKeys aKey, TDes& aValue );
       
    97 
       
    98     /**
       
    99     * From MIMPSSharedData
       
   100     * @see MIMPSSharedData
       
   101     */
       
   102     TInt GetIntKey( const TIMPSSharedKeys aKey, TInt& aValue );
       
   103 
       
   104     /**
       
   105     * From MIMPSSharedData
       
   106     * @see MIMPSSharedData
       
   107     */
       
   108     TInt SetStringKey( const TIMPSSharedKeys aKey, const TDesC& aValue );
       
   109 
       
   110     /**
       
   111     * From MIMPSSharedData
       
   112     * @see MIMPSSharedData
       
   113     */
       
   114     TInt SetIntKey( const TIMPSSharedKeys aKey, TInt aValue );
       
   115 
       
   116     /**
       
   117     * From MIMPSSharedData
       
   118     * @see MIMPSSharedData
       
   119     */
       
   120     TInt Signal( const TIMPSSharedKeys aKey );
       
   121 
       
   122     /**
       
   123     * From MIMPSSharedData
       
   124     * @see MIMPSSharedData
       
   125     */
       
   126     TInt CancelSignal( const TIMPSSharedKeys aKey );
       
   127 
       
   128     /**
       
   129     * From MIMPSPropertyNotificationObserver
       
   130     * @see MIMPSPropertyNotificationObserver
       
   131     */
       
   132     void HandlePropertyNotificationEventL( TUid aCategory, TUint aKey );
       
   133 
       
   134     /**
       
   135     * From MSharedDataNotifyHandler
       
   136     * Converts shared data keys to TIMPSSharedKeys
       
   137     * @param aKey keyword
       
   138     * @return error code
       
   139     */
       
   140     TInt ConvertSharedDataKey( const TDesC& aSrc, TIMPSSharedKeys& aDest );
       
   141 
       
   142 private: // new functions
       
   143 
       
   144     /**
       
   145     * Does the actual subscribing
       
   146     * @param aUid the uid of the property
       
   147     * @param aKey the key of the property
       
   148     */
       
   149     void DoSubscribeChangeL( const TUid aUid, const TIMPSSharedKeys aKey );
       
   150 
       
   151     /**
       
   152     * Does the actual subscribing
       
   153     * @param aUid the uid of the property
       
   154     * @param aKey the key of the property
       
   155     */
       
   156     void DoSubscribeSetL( const TUid aUid, const TIMPSSharedKeys aKey );
       
   157 
       
   158     /**
       
   159     * Does the actual signalling
       
   160     * @param aKey the key to signal
       
   161     */
       
   162     void DoSignalL( const TIMPSSharedKeys aKey );
       
   163 
       
   164     /**
       
   165     * Does the actual cancelling
       
   166     * @param aKey the key to cancel the signal from
       
   167     */
       
   168     void DoCancelSignalL( const TIMPSSharedKeys aKey );
       
   169 
       
   170     /**
       
   171     * Converts the shared data keys to TIMPSSharedKeys
       
   172     * @param aKey the key from the enumeration that clients use
       
   173     * @param aSharedDataKey the shared data key
       
   174     * @return KErrNone if found, KErrNotFound if not found
       
   175     */
       
   176     TInt MapKeysToClient( TIMPSSharedKeys& aKey, const TDesC& aSharedDataKey );
       
   177 
       
   178     /**
       
   179     * Creates the array of key mappings
       
   180     */
       
   181     void AppendKeyPairsL( );
       
   182 
       
   183     /**
       
   184     * Appends a key pair into the array of keys
       
   185     * @param aKey the key from the enumeration that clients use
       
   186     * @param aSharedDataKey the shared data key
       
   187     */
       
   188     void DoAppendKeyPairL( TIMPSSharedKeys aKey, const TDesC& aSharedDataKey );
       
   189 
       
   190 
       
   191 
       
   192 private:    // Data
       
   193     // Doesn't own: observer for the shared data.
       
   194     MIMPSSharedDataObserver* iObserver;
       
   195 
       
   196     // identifier of the ini file we are interested in
       
   197     TUid iUid;
       
   198 
       
   199     // Owns: array of property observers
       
   200     RPointerArray<CIMPSPropertyObserver> iPropertyObservers;
       
   201 
       
   202     //Array of key pairs
       
   203     RArray<TIMPSSharedKeyPairs> iKeys;
       
   204     };
       
   205 
       
   206 #endif      // __CIMPSPUBSUBHANDLER_H
       
   207 
       
   208 // End of File