deviceupdatesui/deviceupdates/inc/nsmldmsyncappengine.h
author hgs
Tue, 13 Jul 2010 03:42:03 +0530
changeset 43 88e14c3d4c4f
parent 36 9eefb50e711a
permissions -rw-r--r--
201019
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
33
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
     1
/*
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
     2
* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
     3
* All rights reserved.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
     8
*
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
     9
* Initial Contributors:
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    11
*
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    12
* Contributors:
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    13
*
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    14
* Description:  Application engine for the sync events
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    15
*
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    16
*/
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    17
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    18
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    19
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    20
#ifndef CNSMLDMSYNCAPPENGINE_H
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    21
#define CNSMLDMSYNCAPPENGINE_H
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    22
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    23
//  INCLUDES
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    24
#include <e32base.h>
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    25
#include <SyncMLClient.h>
36
hgs
parents: 33
diff changeset
    26
#include "nsmldmdef.h"
33
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    27
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    28
// FORWARD DECLARATIONS
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    29
class CNSmlDMSyncHandler;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    30
class CNSmlDMSyncProfile;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    31
class DmInfo;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    32
//class CNSmlDMSyncDocument;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    33
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    34
// CLASS DECLARATION
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    35
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    36
/**
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    37
* MNSmlDMSyncObserver
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    38
*
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    39
* MNSmlDMSyncObserver is for observing Sync.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    40
*/
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    41
class MNSmlDMSyncObserver
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    42
    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    43
    public:
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    44
	    virtual void SyncComplete( TNSmlStatus aStatus ) = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    45
    };
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    46
   
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    47
/**
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    48
* CNSmlDMSyncAppEngine
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    49
* Sync engine for handling synchronization and profiles.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    50
*/
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    51
NONSHARABLE_CLASS (CNSmlDMSyncAppEngine) : public CBase
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    52
    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    53
    public:  // Constructors and destructor
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    54
        
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    55
        /**
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    56
        * Two-phased constructor.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    57
        */
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    58
        static CNSmlDMSyncAppEngine* NewL(DmInfo* dmObj);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    59
        
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    60
        /**
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    61
        * Destructor.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    62
        */
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    63
        virtual ~CNSmlDMSyncAppEngine();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    64
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    65
    public: // New functions
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    66
        
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    67
        /**
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    68
        * Delete profile
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    69
        * @param aProfileId Profile to be deleted.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    70
        * @return None
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    71
        */
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    72
        void DeleteProfileL( TInt aProfileId );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    73
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    74
        /**
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    75
        * Create profile
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    76
        * @param None.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    77
        * @return None
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    78
        */
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    79
        TInt CreateProfileL();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    80
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    81
        /**
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    82
        * Create copy profile
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    83
        * @param aProfileId Profile that is used for copying
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    84
        * @return None
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    85
        */
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    86
        CNSmlDMSyncProfile* CreateCopyProfileL( TInt aProfileId );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    87
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    88
        /**
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    89
        * Return current profile
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    90
        * @param None.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    91
        * @return CNSmlDMSyncProfile*
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    92
        */
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    93
        CNSmlDMSyncProfile* Profile( );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    94
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    95
        /**
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    96
        * Cancel synchronization
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    97
        * @param None.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    98
        * @return None
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    99
        */
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   100
        void CancelSyncL();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   101
        
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   102
        /**
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   103
        * Return RSyncMLSession
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   104
        * @param None.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   105
        * @return RSyncMLSession*
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   106
        */
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   107
        RSyncMLSession* Session();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   108
        
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   109
        /**
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   110
        * Open profile
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   111
        * @param aProfileId Profile id to open
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   112
        * @param aOpenMode opening mode
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   113
        * @return None
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   114
        */
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   115
        CNSmlDMSyncProfile* OpenProfileL( TInt aProfileId,
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   116
                                          TInt aOpenMode = ESmlOpenReadWrite );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   117
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   118
        /**
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   119
        * Close profile
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   120
        * @param None.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   121
        * @return None
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   122
        */        
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   123
        void CloseProfile();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   124
        
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   125
        /**
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   126
        * Start synchronization
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   127
        * @param aProfileId Profile id to sync
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   128
        * @return None
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   129
        */               
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   130
        void SynchronizeL( TDesC& aServerName,
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   131
                           const TInt aProfileId,
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   132
                           const TInt aConnectionBearer,
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   133
                           const TBool aUseFotaProgressNote );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   134
        
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   135
        /**
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   136
        * Start synchronization
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   137
        * @param aProfileId Profile id to sync
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   138
        * @param aJobId Jod id to sync
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   139
        * @return None
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   140
        */         
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   141
        void SynchronizeL( TDesC& aServerName,
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   142
                           const TInt aProfileId,
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   143
                           const TInt aJobId,
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   144
                           const TInt aConnectionBearer,
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   145
                           const TBool aUseFotaProgressNote );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   146
        
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   147
        /**
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   148
        * Check if duplicate server id is found
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   149
        * @param  aServerId Server id
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   150
        * @param  aProfileId current profile id
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   151
        * @return ETrue if server id found
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   152
        */                 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   153
        TBool ServerIdFoundL( const TDesC& aServerId, const TInt aProfileId );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   154
        
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   155
		/**
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   156
		* Compare two descriptors
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   157
        * @param aLeft  
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   158
		* @param aRight  
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   159
		* @return - Positive, if this descriptor is 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   160
        *                     greater than the specified descriptor.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   161
		*           Negative, if this descriptor is
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   162
		*                     less than the specified descriptor.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   163
		*           Zero, if the content of both descriptors match
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   164
        */
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   165
        TInt Compare( const TDesC& aLeft, const TDesC& aRight );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   166
        
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   167
        /**
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   168
        * Sync state
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   169
        * @param None
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   170
        * @return ETrue if sync is running
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   171
        */          
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   172
        TBool SyncRunning();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   173
        
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   174
        /**
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   175
        * Utility function.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   176
        * @param aSyncObserver
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   177
        * @return None
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   178
        */
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   179
		void RequestSyncStatus( MNSmlDMSyncObserver* aSyncObserver );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   180
		
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   181
		void SyncCompleted( TNSmlStatus aStatus );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   182
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   183
        /**
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   184
        * Hides or shows the device management progress dialog.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   185
        * @since Series 60 3.1
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   186
        * @param aShow ETrue -> The progress dialog is shown; EFalse -> The dialog is hidden.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   187
        * @return None
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   188
        */
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   189
        void ShowProgressDialogL( TBool aShow );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   190
        
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   191
    private:
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   192
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   193
        /**
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   194
        * C++ default constructor.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   195
        */
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   196
        CNSmlDMSyncAppEngine();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   197
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   198
        /**
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   199
        * By default Symbian 2nd phase constructor is private.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   200
        */
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   201
        void ConstructL( DmInfo* dmcallback );
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   202
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   203
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   204
    private:    // Data
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   205
        // SyncML Session
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   206
        RSyncMLSession          iSyncMLSession;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   207
        // Sync profile
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   208
        CNSmlDMSyncProfile*     iProfile;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   209
        // Sync handler
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   210
        CNSmlDMSyncHandler*     iSyncHandler;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   211
        TBool               iProgressShown;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   212
        // Sync Observer
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   213
        MNSmlDMSyncObserver*    iSyncObserver;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   214
        DmInfo* iDmcallback;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   215
    };
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   216
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   217
#endif      // CNSMLDMSYNCAPPENGINE_H
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   218
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   219
// End of File