mmserv/tms/tmsserver/inc/cspcenreplistener.h
changeset 0 71ca22bcf22a
child 3 4f62049db6ac
equal deleted inserted replaced
-1:000000000000 0:71ca22bcf22a
       
     1 /*
       
     2  * Copyright (c) 2009 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 CenRep Listener class.
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef CSPCENREPLISTENER_H
       
    19 #define CSPCENREPLISTENER_H
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include <e32base.h>
       
    23 #include <centralrepository.h>
       
    24 
       
    25 namespace TMS {
       
    26 
       
    27 // Forward declarations
       
    28 //class CRepository;
       
    29 class MCSPCenRepObserver;    
       
    30    
       
    31     // BASE CLASS
       
    32 
       
    33     // CLASS DECLARATION
       
    34 
       
    35     /**
       
    36      *   CSPCenRepListener manages getting notification on CenRep key changes.
       
    37      */
       
    38 class CSPCenRepListener : public CActive
       
    39         {
       
    40     public:
       
    41 
       
    42         /**
       
    43          * Two-phased construction.
       
    44          *
       
    45          * @param aUid cenrep Uid
       
    46          * @param aKey key to be listened
       
    47          * @param aObserver observer for key change.
       
    48          * @return instance of the class
       
    49          */
       
    50         static CSPCenRepListener* NewL(TUid aUid, TUint32 aKey,
       
    51                 MCSPCenRepObserver* aObserver);
       
    52 
       
    53         /**
       
    54          * Destructor.
       
    55          */
       
    56         virtual ~CSPCenRepListener();
       
    57 
       
    58     public:
       
    59 
       
    60         /**
       
    61          * Gets the current value of the monitored setting
       
    62          * @param aValue the current value of the monitored setting
       
    63          * @return TInt Symbian OS error code from central repository
       
    64          */
       
    65         TInt Get(TInt& aValue);
       
    66         
       
    67         TInt Set( TInt aValue );
       
    68 
       
    69     protected:
       
    70         // From CActive
       
    71 
       
    72         void DoCancel();
       
    73         TInt RunError(TInt aError);
       
    74         void RunL();
       
    75 
       
    76     private:
       
    77 
       
    78         /**
       
    79          * Constructor
       
    80          * @param aUid cenrep Uid
       
    81          * @param aKey key to be listened
       
    82          * @param aObserver observer for key change.
       
    83          */
       
    84         CSPCenRepListener(TUid aUid, TUint32 aKey,
       
    85                 MCSPCenRepObserver* aObserver);
       
    86 
       
    87         /**
       
    88          * Private constructing.
       
    89          */
       
    90         void ConstructL();
       
    91 
       
    92         /**
       
    93          * Submits a notification request
       
    94          */
       
    95         void SubmitNotifyRequestL();
       
    96 
       
    97     private:
       
    98         // Owned by this object
       
    99 
       
   100         /**
       
   101          * UID of CR key.
       
   102          */
       
   103         TUid iUid;
       
   104 
       
   105         /**
       
   106          * Repository access.
       
   107          * Own.
       
   108          */
       
   109         CRepository* iRepository;
       
   110 
       
   111         /**
       
   112          * Identification number of the monitored setting.
       
   113          */
       
   114         TUint32 iMonitorSetting;
       
   115 
       
   116         MCSPCenRepObserver* iObserver;
       
   117         };
       
   118 
       
   119 } //namespace TMS
       
   120 #endif // CSPCENREPLISTENER_H