iaupdate/IAD/engine/controller/inc/iaupdatecontrollerimpl.h
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 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:   ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef IAUPDATECONTROLLERIMPL_H
       
    21 #define IAUPDATECONTROLLERIMPL_H
       
    22 
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <e32cmn.h>
       
    26 #include <ncdproviderobserver.h>
       
    27 #include <ncdclientlocalizer.h>
       
    28 #include <ncdserverreportoperationobserver.h>
       
    29 #include <catalogsengineobserver.h>
       
    30 
       
    31 
       
    32 #include "iaupdatecontroller.h"
       
    33 #include "iaupdateloaderobserver.h"
       
    34 #include "iaupdateselfupdaterobserver.h"
       
    35 #include "iaupdatetimerobserver.h"
       
    36 
       
    37 
       
    38 class MCatalogsBase;
       
    39 class MNcdProvider;
       
    40 class MNcdNode;
       
    41 class MNcdNodeContainer;
       
    42 class MNcdServerReportManager;
       
    43 class MNcdServerReportOperation;
       
    44 class CCatalogsEngine;
       
    45 class MIAUpdateNode;
       
    46 class MIAUpdateAnyNode;
       
    47 class CIAUpdateNodeContainer;
       
    48 class CIAUpdateHistory;
       
    49 class CIAUpdateLoader;
       
    50 class CIAUpdateSelfUpdaterCtrl;
       
    51 class CIAUpdateContentOperationManager;
       
    52 class CIAUpdateCacheCleaner;
       
    53 class CIAUpdateControllerFile;
       
    54 class CIAUpdateTimer;
       
    55 
       
    56 
       
    57 /**
       
    58  *
       
    59  */
       
    60 class CIAUpdateController : public CActive, 
       
    61                             public MIAUpdateController, 
       
    62                             public MIAUpdateLoaderObserver,
       
    63                             public MIAUpdateSelfUpdaterObserver,
       
    64                             public MCatalogsEngineObserver,
       
    65                             public MNcdProviderObserver,
       
    66                             public MNcdClientLocalizer,
       
    67                             public MNcdServerReportOperationObserver,
       
    68                             public MIAUpdateTimerObserver
       
    69     {
       
    70     
       
    71 public:
       
    72 
       
    73     static CIAUpdateController* NewLC( const TUid& aFamilyUid, 
       
    74                                        MIAUpdateControllerObserver& aObserver );
       
    75     
       
    76     static CIAUpdateController* NewL( const TUid& aFamilyUid, 
       
    77                                       MIAUpdateControllerObserver& aObserver );
       
    78     
       
    79     
       
    80     virtual ~CIAUpdateController();
       
    81 
       
    82 
       
    83     const TUid& FamilyUid() const;
       
    84 
       
    85     MNcdProvider& ProviderL();
       
    86     
       
    87     CIAUpdateSelfUpdaterCtrl& SelfUpdaterCtrl();
       
    88     
       
    89     CIAUpdateContentOperationManager& ContentOperationManager();
       
    90      
       
    91     
       
    92 public: // MIAUpdateController   
       
    93     
       
    94     /**
       
    95      * @see MIAUpdateController::Startup
       
    96      **/
       
    97     virtual TInt Startup();
       
    98     
       
    99     /**
       
   100      * @see MIAUpdateController::StartRefreshL
       
   101      **/
       
   102     virtual void StartRefreshL( TBool aAllowNetConnection );
       
   103         
       
   104     /**
       
   105      * @see MIAUpdateController::CancelRefresh
       
   106      **/
       
   107     virtual void CancelRefresh();
       
   108 
       
   109     /**
       
   110      * @see MIAUpdateController::CancelReporting
       
   111      **/
       
   112     virtual void CancelReporting();
       
   113     
       
   114     /**
       
   115      * @see MIAUpdateController::HistoryL
       
   116      */
       
   117     virtual MIAUpdateHistory& HistoryL();
       
   118 
       
   119     /**
       
   120      * @see MIAUpdateController::SetDefaultConnectionMethodL
       
   121      */
       
   122     virtual void SetDefaultConnectionMethodL( const TIAUpdateConnectionMethod& aMethod );
       
   123 
       
   124     /**
       
   125      * @see MIAUpdateController::SelfUpdateDataExists
       
   126      */
       
   127     virtual TBool SelfUpdateDataExists() const;
       
   128 
       
   129     /**
       
   130      * @see MIAUpdateController::StartPossibleSelfUpdateL
       
   131      */ 
       
   132     virtual TBool StartPossibleSelfUpdateL( TInt aIndex, 
       
   133                                             TInt aTotalCount,
       
   134                                             const RPointerArray< MIAUpdateNode >& aPendingNodes,
       
   135                                             TBool aSilent );
       
   136 
       
   137     /**
       
   138      * @see MIAUpdateController::ResetSelfUpdate
       
   139      */
       
   140     virtual void ResetSelfUpdate();    
       
   141 
       
   142 
       
   143     /**
       
   144      * @see MIAUpdateController::SelfUpdateRestartInfoL
       
   145      */
       
   146     virtual CIAUpdateRestartInfo* SelfUpdateRestartInfo();
       
   147 
       
   148 
       
   149     /**
       
   150      * @see MIAUpdateController::NodeL
       
   151      */
       
   152     virtual MIAUpdateNode& NodeL( const CIAUpdaterIdentifier& aIdentifier );
       
   153 
       
   154 
       
   155     /**
       
   156      * @see MIAUpdateController::StartingUpdatesL
       
   157      */
       
   158     virtual void StartingUpdatesL();
       
   159 
       
   160 
       
   161     /**
       
   162      * @see MIAUpdateController::FinishedUpdatesL
       
   163      */
       
   164     virtual void FinishedUpdatesL( TBool aOperationsAllowed, TInt aMaxWaitTime );    
       
   165 
       
   166 
       
   167 public: // MIAUpdateLoaderObserver
       
   168     
       
   169     /**
       
   170      * @see MIAUpdateLoaderObserver::LoadComplete
       
   171      **/
       
   172     virtual void LoadComplete( TInt aError );
       
   173 
       
   174 
       
   175 public: // MIAupdateSelfUpdaterObserver
       
   176 
       
   177     /** 
       
   178      * @see MIAupdateSelfUpdaterObserver::SelfUpdaterComplete
       
   179      */
       
   180     virtual void SelfUpdaterComplete( TInt aErrorCode );
       
   181     
       
   182                                                      
       
   183 public: // MCatalogsEngineObserver
       
   184     
       
   185     /**
       
   186      * @see MCatalogsEngineObserver::CatalogsEngineShutdown
       
   187      */
       
   188     virtual void CatalogsEngineShutdown();
       
   189 
       
   190     /**
       
   191      * @see MCatalogsEngineObserver::CatalogsUpdateNotification
       
   192      */
       
   193     virtual void CatalogsUpdateNotification( const TDesC& aTarget,
       
   194                                              const TDesC& aId,
       
   195                                              const TDesC& aVersion,
       
   196                                              const TDesC& aUri,
       
   197                                              TBool aForce );
       
   198 
       
   199     /**
       
   200      * @see MCatalogsEngineObserver::CatalogsConnectionEvent
       
   201      */
       
   202     virtual void CatalogsConnectionEvent( TBool aConnectionActive );
       
   203     
       
   204 
       
   205 public: // MNcdProviderObserver
       
   206   
       
   207     /**
       
   208      * @see MNcdProvider::ForceExpirationInformationReceived
       
   209      */
       
   210     virtual void ForceExpirationInformationReceived( RCatalogsArray< MNcdNode >& aExpiredNodes );
       
   211     
       
   212     
       
   213 public: // MNcdClientLocalizer
       
   214     
       
   215     /**
       
   216      * @see MNcdClientLocalizer::LocalizeString
       
   217      *
       
   218      * At the moment, this implementation always returns NULL.
       
   219      */
       
   220     virtual HBufC* LocalizeString( const TDesC& aLocalizationKey );
       
   221 
       
   222 
       
   223 public: // MNcdServerReportOperationObserver
       
   224 
       
   225     /**
       
   226      * @see MNcdServerReportOperationObserver::ReportProgress
       
   227      */
       
   228     virtual void ReportProgress( MNcdServerReportOperation& aOperation,
       
   229                                  TNcdProgress aProgress );
       
   230         
       
   231     /**
       
   232      * @see MNcdServerReportOperationObserver::QueryReceived
       
   233      */
       
   234     virtual void QueryReceived( MNcdServerReportOperation& aOperation,
       
   235                                 MNcdQuery* aQuery );
       
   236 
       
   237     /**
       
   238      * @see MNcdServerReportOperationObserver::OperationComplete
       
   239      */
       
   240     virtual void OperationComplete( MNcdServerReportOperation& aOperation,
       
   241                                     TInt aError );
       
   242 
       
   243 
       
   244 public: // MIAUpdateTimerObserver
       
   245 
       
   246     /** 
       
   247      * @see MIAUpdateTimeObserver::TimerComplete
       
   248      */
       
   249     virtual void TimerComplete( TInt aError );
       
   250 
       
   251 
       
   252 protected: // CActive
       
   253     
       
   254     /**
       
   255      * @see CActive::DoCancel
       
   256      */
       
   257 	virtual void DoCancel();
       
   258 
       
   259     /**
       
   260      * @see CActive::RunL
       
   261      */
       
   262 	virtual void RunL();
       
   263 
       
   264     /**
       
   265      * @see CActive::RunError
       
   266      */
       
   267      virtual TInt RunError( TInt aError );
       
   268 		
       
   269 	
       
   270 private:
       
   271 
       
   272     // Prevent these if not implemented
       
   273     CIAUpdateController( const CIAUpdateController& aObject );
       
   274     CIAUpdateController& operator =( const CIAUpdateController& aObject );
       
   275 
       
   276     CIAUpdateController( const TUid& aFamilyUid, MIAUpdateControllerObserver &aObserver );
       
   277     
       
   278     void ConstructL();
       
   279 
       
   280     void LocalLoadL();
       
   281     
       
   282     void LocalContainerLoadL( MNcdNodeContainer& aContainer );
       
   283 
       
   284     void SetupConfigurationL();
       
   285 
       
   286     MNcdNode* NodeFromPurchaseHistoryL( const CIAUpdaterIdentifier& aIdentifier );
       
   287 
       
   288     void CancelPausedOperationsL();
       
   289 
       
   290 
       
   291 private: // data
       
   292 
       
   293     enum TControllerState
       
   294         {
       
   295         ENotRunning,
       
   296         EStarting,
       
   297         EIdle,
       
   298         EInClearCache,
       
   299         EInLoadOperation,
       
   300         EInLocalLoadOperation
       
   301         };
       
   302 
       
   303     TUid iFamilyUid;
       
   304     
       
   305     MIAUpdateControllerObserver& iObserver;
       
   306                 
       
   307     TControllerState iControllerState;
       
   308 
       
   309     CCatalogsEngine* iEngine;
       
   310     
       
   311     MCatalogsBase* iBaseProvider;
       
   312     MNcdProvider* iProvider;
       
   313     MNcdServerReportManager* iServerReportManager;
       
   314     
       
   315     CIAUpdateSelfUpdaterCtrl* iSelfUpdaterCtrl;
       
   316     
       
   317     CIAUpdateLoader* iLoader;
       
   318     
       
   319     CIAUpdateNodeContainer* iNodeContainer;
       
   320     
       
   321     CIAUpdateHistory* iHistory;
       
   322 
       
   323     CIAUpdateContentOperationManager* iContentOperationManager;
       
   324 
       
   325     CIAUpdateCacheCleaner* iCacheCleaner;
       
   326 
       
   327     CIAUpdateControllerFile* iCacheClearFile;
       
   328 
       
   329     // This class does not own the contents of this array.
       
   330     RPointerArray< MIAUpdateAnyNode > iNodes;
       
   331     
       
   332     MNcdServerReportOperation* iReportOperation;
       
   333     TBool iCancellingReportOperation;
       
   334 
       
   335     CIAUpdateTimer* iReportTimer;
       
   336     TBool iReportTimerCompleted;
       
   337     
       
   338     };
       
   339 
       
   340 
       
   341 #endif  //  IAUPDATECONTROLLERIMPL_H