bearermanagement/mpm/inc/mpmofflinewatcher.h
branchRCL_3
changeset 17 c14618f9de99
equal deleted inserted replaced
15:4dc3bb0099b0 17:c14618f9de99
       
     1 /*
       
     2 * Copyright (c) 2008-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: Listens for offline mode changes in central repository.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef MPMOFFLINEWATCHER_H
       
    19 #define MPMOFFLINEWATCHER_H
       
    20 
       
    21 //  INCLUDES
       
    22 #include <e32base.h>
       
    23 
       
    24 class CRepository;
       
    25 class CMPMServer;
       
    26 
       
    27 // Stop after this many consecutive central repository errors.
       
    28 const TInt KMpmOfflineWatcherCenRepErrorThreshold = 80;
       
    29 
       
    30 /**
       
    31  *  Class for accessing central repository.
       
    32  *  Follows KCoreAppUIsNetworkConnectionAllowed key in central repository.
       
    33  *  @since 5.2
       
    34  */
       
    35 class CMpmOfflineWatcher : public CActive
       
    36     {
       
    37 
       
    38 public:
       
    39 
       
    40     /**
       
    41     * New for calling the two-phased constructor.
       
    42     */
       
    43     static CMpmOfflineWatcher* NewL( CMPMServer* aServer );
       
    44 
       
    45     /**
       
    46     * Destructor.
       
    47     */
       
    48     virtual ~CMpmOfflineWatcher();
       
    49 
       
    50     /**
       
    51      * Start to listen for events.
       
    52      */
       
    53     void StartL();
       
    54     
       
    55     /**
       
    56     * Active object's RunL.
       
    57     */
       
    58     void RunL();
       
    59 
       
    60     /**
       
    61     * Active object's DoCancel.
       
    62     */
       
    63     void DoCancel();
       
    64 
       
    65 private:
       
    66 
       
    67     /**
       
    68     * C++ default constructor.
       
    69     */
       
    70     CMpmOfflineWatcher( CMPMServer* aServer );
       
    71 
       
    72     /**
       
    73     * Symbian 2nd phase constructor.
       
    74     */
       
    75     void ConstructL();
       
    76     
       
    77     /**
       
    78     * Request for notifications.
       
    79     */
       
    80     TInt RequestNotifications();
       
    81     
       
    82     /**
       
    83     * Get current offline mode value.
       
    84     */
       
    85     TInt GetCurrentOfflineValue();
       
    86 
       
    87 
       
    88 private: // data
       
    89 
       
    90     /**
       
    91      * Is offline feature supported.
       
    92      */
       
    93     TBool iOfflineFeatureSupported;
       
    94 
       
    95     /**
       
    96      * Central repository handle.
       
    97      * Own.
       
    98      */
       
    99     CRepository* iRepository;
       
   100 
       
   101     /**
       
   102      * Offline mode activity value.
       
   103      */
       
   104     TInt iOfflineMode;     // type: TCoreAppUIsNetworkConnectionAllowed
       
   105 
       
   106     /**
       
   107      * Pointer to the MPM Server object.
       
   108      * Not own.
       
   109      */
       
   110     CMPMServer* iServer;
       
   111 
       
   112     /**
       
   113      * Error counter.
       
   114      */
       
   115     TUint iErrorCounter;
       
   116 
       
   117     };
       
   118 
       
   119 #endif // MPMOFFLINEWATCHER_H