omadm/omadmappui/inc/NSmlDMSyncAppEngine.h
changeset 0 3ce708148e4d
child 8 0a8136f75056
equal deleted inserted replaced
-1:000000000000 0:3ce708148e4d
       
     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:  Application engine for the sync events
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CNSMLDMSYNCAPPENGINE_H
       
    21 #define CNSMLDMSYNCAPPENGINE_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <SyncMLClient.h>
       
    26 #include "NSmlDMdef.h"
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class CNSmlDMSyncHandler;
       
    30 class CNSmlDMSyncProfile;
       
    31 class CNSmlDMSyncDocument;
       
    32 
       
    33 // CLASS DECLARATION
       
    34 
       
    35 /**
       
    36 * MNSmlDMSyncObserver
       
    37 *
       
    38 * MNSmlDMSyncObserver is for observing Sync.
       
    39 */
       
    40 class MNSmlDMSyncObserver
       
    41     {
       
    42     public:
       
    43 	    virtual void SyncComplete( TNSmlStatus aStatus ) = 0;
       
    44     };
       
    45    
       
    46 /**
       
    47 * CNSmlDMSyncAppEngine
       
    48 * Sync engine for handling synchronization and profiles.
       
    49 */
       
    50 NONSHARABLE_CLASS (CNSmlDMSyncAppEngine) : public CBase
       
    51     {
       
    52     public:  // Constructors and destructor
       
    53         
       
    54         /**
       
    55         * Two-phased constructor.
       
    56         */
       
    57         static CNSmlDMSyncAppEngine* NewL( CNSmlDMSyncDocument* aSyncDocument );
       
    58         
       
    59         /**
       
    60         * Destructor.
       
    61         */
       
    62         virtual ~CNSmlDMSyncAppEngine();
       
    63 
       
    64     public: // New functions
       
    65         
       
    66         /**
       
    67         * Delete profile
       
    68         * @param aProfileId Profile to be deleted.
       
    69         * @return None
       
    70         */
       
    71         void DeleteProfileL( TInt aProfileId );
       
    72 
       
    73         /**
       
    74         * Create profile
       
    75         * @param None.
       
    76         * @return None
       
    77         */
       
    78         TInt CreateProfileL();
       
    79 
       
    80         /**
       
    81         * Create copy profile
       
    82         * @param aProfileId Profile that is used for copying
       
    83         * @return None
       
    84         */
       
    85         CNSmlDMSyncProfile* CreateCopyProfileL( TInt aProfileId );
       
    86 
       
    87         /**
       
    88         * Return current profile
       
    89         * @param None.
       
    90         * @return CNSmlDMSyncProfile*
       
    91         */
       
    92         CNSmlDMSyncProfile* Profile( );
       
    93 
       
    94         /**
       
    95         * Cancel synchronization
       
    96         * @param None.
       
    97         * @return None
       
    98         */
       
    99         void CancelSyncL();
       
   100         
       
   101         /**
       
   102         * Return RSyncMLSession
       
   103         * @param None.
       
   104         * @return RSyncMLSession*
       
   105         */
       
   106         RSyncMLSession* Session();
       
   107         
       
   108         /**
       
   109         * Open profile
       
   110         * @param aProfileId Profile id to open
       
   111         * @param aOpenMode opening mode
       
   112         * @return None
       
   113         */
       
   114         CNSmlDMSyncProfile* OpenProfileL( TInt aProfileId,
       
   115                                           TInt aOpenMode = ESmlOpenReadWrite );
       
   116 
       
   117         /**
       
   118         * Close profile
       
   119         * @param None.
       
   120         * @return None
       
   121         */        
       
   122         void CloseProfile();
       
   123         
       
   124         /**
       
   125         * Start synchronization
       
   126         * @param aProfileId Profile id to sync
       
   127         * @return None
       
   128         */               
       
   129         void SynchronizeL( TDesC& aServerName,
       
   130                            const TInt aProfileId,
       
   131                            const TInt aConnectionBearer,
       
   132                            const TBool aUseFotaProgressNote );
       
   133         
       
   134         /**
       
   135         * Start synchronization
       
   136         * @param aProfileId Profile id to sync
       
   137         * @param aJobId Jod id to sync
       
   138         * @return None
       
   139         */         
       
   140         void SynchronizeL( TDesC& aServerName,
       
   141                            const TInt aProfileId,
       
   142                            const TInt aJobId,
       
   143                            const TInt aConnectionBearer,
       
   144                            const TBool aUseFotaProgressNote );
       
   145         
       
   146         /**
       
   147         * Check if duplicate server id is found
       
   148         * @param  aServerId Server id
       
   149         * @param  aProfileId current profile id
       
   150         * @return ETrue if server id found
       
   151         */                 
       
   152         TBool ServerIdFoundL( const TDesC& aServerId, const TInt aProfileId );
       
   153         
       
   154 		/**
       
   155 		* Compare two descriptors
       
   156         * @param aLeft  
       
   157 		* @param aRight  
       
   158 		* @return - Positive, if this descriptor is 
       
   159         *                     greater than the specified descriptor.
       
   160 		*           Negative, if this descriptor is
       
   161 		*                     less than the specified descriptor.
       
   162 		*           Zero, if the content of both descriptors match
       
   163         */
       
   164         TInt Compare( const TDesC& aLeft, const TDesC& aRight );
       
   165         
       
   166         /**
       
   167         * Sync state
       
   168         * @param None
       
   169         * @return ETrue if sync is running
       
   170         */          
       
   171         TBool SyncRunning();
       
   172         
       
   173         /**
       
   174         * Utility function.
       
   175         * @param aSyncObserver
       
   176         * @return None
       
   177         */
       
   178 		void RequestSyncStatus( MNSmlDMSyncObserver* aSyncObserver );
       
   179 		
       
   180 		void SyncCompleted( TNSmlStatus aStatus );
       
   181 
       
   182         /**
       
   183         * Hides or shows the device management progress dialog.
       
   184         * @since Series 60 3.1
       
   185         * @param aShow ETrue -> The progress dialog is shown; EFalse -> The dialog is hidden.
       
   186         * @return None
       
   187         */
       
   188         void ShowProgressDialogL( TBool aShow );
       
   189         
       
   190     private:
       
   191 
       
   192         /**
       
   193         * C++ default constructor.
       
   194         */
       
   195         CNSmlDMSyncAppEngine();
       
   196 
       
   197         /**
       
   198         * By default Symbian 2nd phase constructor is private.
       
   199         */
       
   200         void ConstructL( CNSmlDMSyncDocument* aSyncDocument );
       
   201 
       
   202 
       
   203     private:    // Data
       
   204         // SyncML Session
       
   205         RSyncMLSession          iSyncMLSession;
       
   206         // Sync profile
       
   207         CNSmlDMSyncProfile*     iProfile;
       
   208         // Sync handler
       
   209         CNSmlDMSyncHandler*     iSyncHandler;
       
   210         TBool               iProgressShown;
       
   211         // Sync Observer
       
   212         MNSmlDMSyncObserver*    iSyncObserver;
       
   213     };
       
   214 
       
   215 #endif      // CNSMLDMSYNCAPPENGINE_H
       
   216 
       
   217 // End of File