phoneengine/phonemodel/inc/cpepubsubmonitor.h
changeset 37 ba76fc04e6c2
child 51 f39ed5e045e0
equal deleted inserted replaced
36:2eacb6118286 37:ba76fc04e6c2
       
     1 /*
       
     2 * Copyright (c) 2005 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:  This file contains the header of the phone engine base 
       
    15 *                central repository monitor classes 
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef CPEPUBSUBMONITOR_H
       
    21 #define CPEPUBSUBMONITOR_H
       
    22 
       
    23 // INCLUDE FILES
       
    24 #include <e32base.h>
       
    25 #include <e32property.h>
       
    26 #include <talogger.h>
       
    27 
       
    28 // Forward declarations
       
    29 class CRepository;
       
    30 class MPEPhoneModelInternal;
       
    31 class RProperty;
       
    32 
       
    33 // BASE CLASS
       
    34 
       
    35 // CLASS DECLARATION
       
    36 
       
    37 /**
       
    38 *   CPEPubSubMonitor
       
    39 *   Active object base class for publish&subscribe monitor code - not instantiable
       
    40 *   Exported methods are used by variant phone engine or other PE components
       
    41 *   This class should not be used by components external to the TelephonyEngine
       
    42 *
       
    43 *  @lib PhoneEngineBase.lib
       
    44 *  @since Series60_4.0
       
    45 */
       
    46 NONSHARABLE_CLASS( CPEPubSubMonitor ) : public CActive
       
    47     {
       
    48     protected:
       
    49 
       
    50         ~CPEPubSubMonitor();
       
    51         
       
    52         CPEPubSubMonitor( MPEPhoneModelInternal& aModel );
       
    53 
       
    54         /**
       
    55         * Creates a new property object and submits a notification request
       
    56         */
       
    57         void BaseConstructL( TUid aCategory, TUint aKey, TUint aType );
       
    58 
       
    59     protected:
       
    60 
       
    61         /**
       
    62         * Submits a notification request
       
    63         */
       
    64         void SubmitNotifyRequestL();
       
    65 
       
    66         /**
       
    67         * Defines the actions that take place when a change indication
       
    68         * is received. Each deriving monitor has to define the implementation for
       
    69         * this method. Most common approach would be to save the data to internal
       
    70         * data store and send a message via phone model if neccessary.
       
    71         */
       
    72         virtual void UpdateL() = 0;
       
    73 
       
    74     public:
       
    75 
       
    76         /**
       
    77         * Gets the current integer value of the monitored key
       
    78         * @param TInt& aValue the current value of the monitored setting
       
    79         * @return TInt Symbian OS error code from central repository
       
    80         */
       
    81         virtual TInt Get( TInt& aValue );
       
    82 
       
    83         /**
       
    84         * Gets the current binary value of the monitored key
       
    85         * @param TDes8& aValue the current value of the monitored setting
       
    86         * @return TInt Symbian OS error code from central repository
       
    87         */
       
    88         virtual TInt Get( TDes8& aValue );
       
    89 
       
    90         /**
       
    91         * Gets the current text value of the monitored key
       
    92         * @param TDes16& aValue the current value of the monitored setting
       
    93         * @return TInt Symbian OS error code from central repository
       
    94         */
       
    95         virtual TInt Get( TDes16& aValue );
       
    96         
       
    97     protected: // From CActive
       
    98 
       
    99         virtual void DoCancel();
       
   100         virtual TInt RunError( TInt aError );
       
   101         virtual void RunL();
       
   102 
       
   103     protected:         
       
   104 
       
   105         // Not owned by this object: reference to phone model object    
       
   106         MPEPhoneModelInternal& iModel;   
       
   107         
       
   108     private:        
       
   109         // Owns handle to property object
       
   110         RProperty iProperty;
       
   111 
       
   112     #ifdef TEF_LOGGING_ENABLED            
       
   113         // Category of property
       
   114         TUid iCategory;
       
   115         
       
   116         // Key of property
       
   117         TUint iKey;
       
   118     #endif
       
   119 };
       
   120 
       
   121 #endif // CPEPUBSUBMONITOR_H