mmappfw_plat/mpx_common_api/inc/mpxpskeywatcher.h
changeset 0 a2952bb97e68
equal deleted inserted replaced
-1:000000000000 0:a2952bb97e68
       
     1 /*
       
     2 * Copyright (c) 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:  Publish and Subscribe key watcher
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_MPXPSKEYWATCHER_H
       
    20 #define C_MPXPSKEYWATCHER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 
       
    24 #include <e32property.h>
       
    25 
       
    26 class MMPXPSKeyObserver;
       
    27 
       
    28 /**
       
    29  *  Publish and subscribe key watcher.
       
    30  *
       
    31  *  @lib MPXCommon.lib
       
    32  */
       
    33 class CMPXPSKeyWatcher : public CActive
       
    34     {
       
    35 public:
       
    36 
       
    37     /*
       
    38     * Two Phased Constructor.
       
    39     *
       
    40     * @since S60 3.2.3
       
    41     * @param aUid PubSub UID to watch
       
    42     * @param aKey specific key to watch
       
    43     * @return Construced object
       
    44     */
       
    45     IMPORT_C static CMPXPSKeyWatcher* NewL( TUid aUid, TInt aKey,
       
    46                                             MMPXPSKeyObserver* aObserver );
       
    47 
       
    48     /*
       
    49     * virtual destructor.
       
    50     *
       
    51     * @since S60 3.2.3
       
    52     */
       
    53     IMPORT_C virtual ~CMPXPSKeyWatcher();
       
    54 
       
    55 public:     // New Functions
       
    56 
       
    57     /*
       
    58     * Return the value of the key.
       
    59     *
       
    60     * @since S60 3.2.3
       
    61     * @param aValue
       
    62     * @return KErrNone, if successful otherwise system error
       
    63     */
       
    64     IMPORT_C TInt GetValue( TInt& aValue );
       
    65     
       
    66     /*
       
    67     * Return the value of the key.
       
    68     *
       
    69     * @since S60 3.2.3
       
    70     * @param aValue
       
    71     * @return KErrNone, if successful otherwise system error
       
    72     */
       
    73     IMPORT_C TInt GetValue( TDes8& aValue );
       
    74     
       
    75     /*
       
    76     * Return the value of the key.
       
    77     *
       
    78     * @since S60 3.2.3
       
    79     * @param aValue
       
    80     * @return KErrNone, if successful otherwise system error
       
    81     */
       
    82     IMPORT_C TInt GetValue( TDes16& aValue );
       
    83     
       
    84     /*
       
    85     * Sets the value of the key.
       
    86     *
       
    87     * @since S60 3.2.3
       
    88     * @params aValue
       
    89     * @return KErrNone, if successful otherwise system error     
       
    90     */
       
    91     IMPORT_C TInt SetValue(TInt aValue );
       
    92     
       
    93     /*
       
    94     * Sets the value of the key.
       
    95     *
       
    96     * @since S60 3.2.3
       
    97     * @params aValue
       
    98     * @return KErrNone, if successful otherwise system error     
       
    99     */
       
   100     IMPORT_C TInt SetValue( const TDesC8& aValue );
       
   101     
       
   102     /*
       
   103     * Sets the value of the key.
       
   104     *
       
   105     * @since S60 3.2.3
       
   106     * @params aValue
       
   107     * @return KErrNone, if successful otherwise system error     
       
   108     */
       
   109     IMPORT_C TInt SetValue( const TDesC16& aValue );
       
   110     
       
   111 protected:  // From Base class
       
   112 
       
   113     /*
       
   114     * From CActive.
       
   115     *
       
   116     * @since S60 3.2.3
       
   117     */
       
   118     void RunL();
       
   119     
       
   120     /*
       
   121     * From CActive.
       
   122     *
       
   123     * @since S60 3.2.3
       
   124     */
       
   125     void DoCancel();
       
   126     
       
   127 private:
       
   128 
       
   129     /*
       
   130     * Default Constructor.
       
   131     *
       
   132     * @since S60 3.2.3
       
   133     * @param aUid PubSub key to watch
       
   134     * @param aKey specific key to watch
       
   135     */
       
   136     CMPXPSKeyWatcher( TUid aUid,
       
   137                       TInt aKey,
       
   138                       MMPXPSKeyObserver* aObserver );
       
   139 
       
   140     /*
       
   141     * Second phased constructor.
       
   142     *
       
   143     * @since S60 3.2.3
       
   144     */
       
   145     void ConstructL();
       
   146 
       
   147 private: // data
       
   148     
       
   149     RProperty             iProperty;
       
   150     MMPXPSKeyObserver*    iObserver;  // not owned
       
   151     TUid                  iUid;       // Uid that we are watching
       
   152     TInt                  iKey;       // Key that we are watching
       
   153     };
       
   154 
       
   155 #endif // C_MPXPSKEYWATCHER_H