idlehomescreen/xmluicontroller/inc/cenrepobserver.h
branchRCL_3
changeset 9 f966699dea19
equal deleted inserted replaced
5:c743ef5928ba 9:f966699dea19
       
     1 /*
       
     2 * Copyright (c) 2010 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:  Listens for changes in a Central Repository key.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CENREPOBSERVER_H
       
    19 #define CENREPOBSERVER_H
       
    20 
       
    21 // FORWARD DECLARATIONS
       
    22 class CRepository;
       
    23 class MCenRepObserver;
       
    24 
       
    25 // Stop requesting new notifications after this many consecutive errors
       
    26 const TInt KCenRepErrorRetryCount = 80;
       
    27 
       
    28 namespace AiXmlUiController
       
    29 {
       
    30 
       
    31 /**
       
    32 * MCenRepObserver
       
    33 *
       
    34 * Client application must implement the CenRepObserver interface in
       
    35 * order to receive a notification when Central Repository key 
       
    36 * KCRUidCmManager/ KCurrentCellularDataUsage changes.
       
    37 *
       
    38 */
       
    39 class MCenRepObserver
       
    40     {
       
    41 public:
       
    42     /**
       
    43     * This method is called every time when Central Repository key 
       
    44     * KCRUidCmManager/ KCurrentCellularDataUsage changes.
       
    45     *
       
    46     * @param aValue The new value for KCurrentCellularDataUsage.
       
    47     * 
       
    48     */
       
    49     virtual void CurrentCellularDataUsageChangedL( const TInt aValue ) = 0;
       
    50     };
       
    51 
       
    52 /**
       
    53 * CCenRepObserver
       
    54 *
       
    55 */
       
    56 NONSHARABLE_CLASS( CCenRepObserver ) : public CActive
       
    57     {
       
    58 public: // Constructors and destructor
       
    59     static CCenRepObserver* NewL( MCenRepObserver* aObserver );
       
    60 
       
    61     static CCenRepObserver* NewLC( MCenRepObserver* aObserver );
       
    62 
       
    63     virtual ~CCenRepObserver();
       
    64 
       
    65 private:
       
    66     CCenRepObserver( MCenRepObserver* aObserver );
       
    67 
       
    68     void ConstructL();
       
    69     
       
    70     /**
       
    71     * Request notification for network setting change
       
    72     */
       
    73     void RequestNotifications();
       
    74  
       
    75 private: // Methods from base class
       
    76     void DoCancel();
       
    77     void RunL();
       
    78 
       
    79 private:
       
    80     /**
       
    81     * Cenrep Observer. Not own
       
    82     */
       
    83     MCenRepObserver*   iObserver;
       
    84     
       
    85     /**
       
    86     * Cenrep repository. Own
       
    87     */
       
    88     CRepository*       iRepository;
       
    89     
       
    90     /**
       
    91     * Cenrep read error count.
       
    92     */
       
    93     TInt               iErrorCounter;
       
    94     };
       
    95 }// namespace AiXmlUiController
       
    96 #endif // AOCENREPOBSERVER_H
       
    97 
       
    98 // End-of-file