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