srsf/nssvascontacthdlr/src/nssvasdatasyncwatcher.h
branchRCL_3
changeset 19 e36f3802f733
parent 0 bf1d17376201
equal deleted inserted replaced
18:cad71a31b7fc 19:e36f3802f733
       
     1 /*
       
     2 * Copyright (c) 2004-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:  Watcher for the PC-Suite data sync state
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef NSSVASDATASYNCWATCHER_H
       
    20 #define NSSVASDATASYNCWATCHER_H
       
    21 
       
    22 //  INCLUDES
       
    23 
       
    24 #include <e32base.h>
       
    25 
       
    26 // Publish & Subscribe of the contact handler activity
       
    27 #include <e32property.h>  
       
    28 
       
    29 #include <DataSyncInternalPSKeys.h>
       
    30 
       
    31 // CONSTANTS
       
    32 
       
    33 
       
    34 // MACROS
       
    35 
       
    36 // FORWARD DECLARATIONS
       
    37 
       
    38 // CLASS DECLARATION
       
    39 
       
    40 /**
       
    41 *  Interface for classes that want to be notified about the PC Suite data
       
    42 *  sync status: is it running or not
       
    43 */
       
    44 NONSHARABLE_CLASS( MNssDataSyncStateObserver ) 
       
    45     {
       
    46     public:
       
    47         /** 
       
    48         *  Is called when data sync status is changed and when data sync state
       
    49         *  observation was just started
       
    50         *  @param aRunning ETrue if from now on data sync process is running
       
    51         *                  EFalse otherwise
       
    52         */
       
    53         virtual void DataSyncStateChanged( TBool aRunning ) = 0;
       
    54     };
       
    55 
       
    56 
       
    57 /** 
       
    58 *  Watches for the changes of the data sync state (is it running) or not
       
    59 *  and notifies the host observer about it
       
    60 */
       
    61 NONSHARABLE_CLASS( MNssDataSyncWatcher )
       
    62     {
       
    63     public:
       
    64         virtual ~MNssDataSyncWatcher();
       
    65         /**
       
    66         * @return ETrue if data sync is in progress, EFalse otherwise
       
    67         */
       
    68         virtual TBool InProgress() = 0;
       
    69     };
       
    70     
       
    71 /** 
       
    72 *  Creates and returns 
       
    73 */
       
    74 NONSHARABLE_CLASS ( CNssDataSyncWatcherFactory ) : public CBase
       
    75     {
       
    76     public:
       
    77         /**
       
    78         *  Constructs and returns the data sync watcher according to what's
       
    79         *  available in the system. I.e RProperty based watcher or
       
    80         *  shared data client based watcher
       
    81         *  @param aHost Observer to be notified about data sync state changes
       
    82         *
       
    83         *  @return Constructed and already started watcher
       
    84         */
       
    85         static MNssDataSyncWatcher* ConstructDataSyncWatcherL( MNssDataSyncStateObserver& aHost );
       
    86     };
       
    87 
       
    88 /**
       
    89 * RProperty based data sync watcher implementation
       
    90 */
       
    91 NONSHARABLE_CLASS ( CNssDataSyncPropertyWatcher ) : public CActive, public MNssDataSyncWatcher
       
    92     {
       
    93     public:
       
    94         /** 
       
    95         *  Factory construction
       
    96         *  @param aHost Observer to be notified about data sync state changes
       
    97         *  @return Constructed and already started CNssDataSyncWatcher
       
    98         */
       
    99         static CNssDataSyncPropertyWatcher* NewL( MNssDataSyncStateObserver& aHost );
       
   100         
       
   101         /** 
       
   102         * Destructor 
       
   103         * Doesn't need to be declared as virtual. Is virtual since CBase 
       
   104         * implementation
       
   105         */
       
   106         ~CNssDataSyncPropertyWatcher();
       
   107         
       
   108         /**
       
   109         * @return ETrue if data sync is in progress, EFalse otherwise
       
   110         */
       
   111         virtual TBool InProgress();
       
   112     private:
       
   113         /** C++ constructor */
       
   114         CNssDataSyncPropertyWatcher( MNssDataSyncStateObserver& aHost );
       
   115         
       
   116         /** Symbian second phase constructor */
       
   117         void ConstructL();
       
   118         
       
   119         /** is called when data sync property changed */
       
   120         void RunL();
       
   121         
       
   122         /** Is called when system wants immediate cancelling of the watching */
       
   123         void DoCancel();
       
   124     private:
       
   125         // Publish & Sunscribe property about the data sync state
       
   126         RProperty   iProperty;
       
   127         
       
   128         // Host to be notified about the state changes
       
   129         MNssDataSyncStateObserver* iHost;
       
   130         
       
   131         // current data sync status
       
   132         TDataSyncStatus iDataSyncStatus;
       
   133     };
       
   134 
       
   135 #endif // NSSVASDATASYNCWATCHER_H
       
   136             
       
   137 // End of File