applicationmanagement/server/inc/AMDownloadManager.h
changeset 18 7d11f9a6646f
parent 4 75a71fdb4c92
child 21 c707676bf59f
equal deleted inserted replaced
4:75a71fdb4c92 18:7d11f9a6646f
     1 /*
       
     2  * Copyright (c) 2002-2004 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: Implementation of applicationmanagement components
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef __CAMDOWNLOADMANAGER_H__
       
    19 #define __CAMDOWNLOADMANAGER_H__
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <downloadmgrclient.h>
       
    23 
       
    24 #include "AMDeploymentComponent.h"
       
    25 #include "aminstalloptions.h"
       
    26 
       
    27 namespace NApplicationManagement
       
    28     {
       
    29 
       
    30     // FORWARD DECLARATIONS
       
    31     class CDeploymentComponent;
       
    32 
       
    33     // CLASS DECLARATION
       
    34 
       
    35     class MDownloadMngrObserver
       
    36         {
       
    37 public:
       
    38         virtual void ComponentDownloadComplete(
       
    39                 class CDeploymentComponent *aComponent, TInt iapid,
       
    40                 HBufC8* aServerId) = 0;
       
    41         virtual TBool HasUidL(const TUid &aUid,
       
    42                 CDeploymentComponent *& aCompo,
       
    43                 CDeploymentComponent *aIgnored) = 0;
       
    44         };
       
    45 
       
    46     /**
       
    47      *  CAMDownloadManager lets AM to download content.
       
    48      *
       
    49      *  @since Series 
       
    50      */
       
    51     class CAMDownloadManager : public CBase, public MHttpDownloadMgrObserver,
       
    52         public MDownloadCallback
       
    53         {
       
    54 private:
       
    55         /**
       
    56          * C++ default constructor.
       
    57          */
       
    58         CAMDownloadManager(MDownloadMngrObserver& aObserver);
       
    59 
       
    60         /**
       
    61          * By default Symbian 2nd phase constructor is private.
       
    62          */
       
    63         void ConstructL();
       
    64 
       
    65 public:
       
    66         // Constructors and destructor
       
    67 
       
    68         /**
       
    69          * Two-phased constructor.
       
    70          */
       
    71         static CAMDownloadManager* NewL(MDownloadMngrObserver& aObserver);
       
    72         /**
       
    73          * Destructor.
       
    74          */
       
    75         virtual ~CAMDownloadManager();
       
    76 
       
    77 public:
       
    78         // From MHttpDownloadMgrObserver 
       
    79 
       
    80         /**
       
    81          * Indicates an event.
       
    82          * @param aDownload The download with which the event occured.
       
    83          * @param aEvent Event type.
       
    84          * @return None.
       
    85          */
       
    86         void HandleDMgrEventL(RHttpDownload& aDownload,
       
    87                 THttpDownloadEvent aEvent);
       
    88 
       
    89 public:
       
    90         // from MDownloadCallback
       
    91 
       
    92         /**
       
    93          * 
       
    94          * @param aComponent 
       
    95          * @param aStatus 
       
    96          */
       
    97         void DownloadComplete(CDeploymentComponent *aComponent, TInt aStatus);
       
    98 
       
    99         /**
       
   100          * Looks all deployments components and sis & java registries
       
   101          * to find out whether given uid is already used...
       
   102          * @param aUid The uid to be looked for
       
   103          * @return ETrue if uid is found, EFalse otherwise
       
   104          */
       
   105         TBool UidExistsL(const TUid &aUid, CDeploymentComponent *& aCompo,
       
   106                 CDeploymentComponent *aIgnored);
       
   107                 
       
   108         TBool IsOMASCOMOEnabledL();
       
   109 
       
   110 public:
       
   111         // New functions
       
   112 
       
   113         /**
       
   114          *
       
   115          */
       
   116         void AddDownloadL(CDeploymentComponent *aComponent);
       
   117 
       
   118         /**
       
   119          *
       
   120          */
       
   121         TInt DownloadCount() const;
       
   122 
       
   123         /**
       
   124          *
       
   125          */
       
   126         //void CancelDownloads();		
       
   127 
       
   128 private:
       
   129         void ConnectHttpDownloadMgrL();
       
   130         RHttpDownload& CreateHttpDownloadL(CDeploymentComponent *aComponent);
       
   131         void SetIAPL(CDeploymentComponent *aComponent);
       
   132         void SetUserNamePassword(RHttpDownload& aDownload,
       
   133                 CDeploymentComponent *aComponent);
       
   134         void SyncMLCurrentProfileIdL(TSmlProfileId& aOwnerProfile);
       
   135 
       
   136         CAMDownload* FindDownload(const TDesC8& aURI);
       
   137         CAMDownload* FindDownload(RHttpDownload& aDownload);
       
   138         CAMDownload* FindDownload(CDeploymentComponent *aComponent);
       
   139         void DownloadURI(RHttpDownload& aDownload, TDes8& aURI);
       
   140 
       
   141         void HandlePausedEventL(CAMDownload& aDownload);
       
   142         void HandleNonProgEventL(CAMDownload& aDownload);
       
   143         void HandleContentTypeRecEventL(CAMDownload& aDownload);
       
   144         void HandleDlCompletedEventL(CAMDownload& aDownload);
       
   145         void HandleDlFailedEventL(CAMDownload& aDownload, THttpDownloadState aDownloadState);
       
   146         void HandleDlDeleteEventL(CAMDownload* aDownload);
       
   147 
       
   148         /**
       
   149          * Completed download for component.
       
   150          * @param aComponent The component which download is completed.
       
   151          */
       
   152         void DownloadCompleteL(CDeploymentComponent *aComponent);
       
   153 
       
   154         /**
       
   155          * Cancel downloading of content.
       
   156          * @param aDownload The download which is  cancelled.
       
   157          */
       
   158         void CancelDownloadL(CAMDownload& aDownload);
       
   159         void HandleAlreadyRunningL(TInt32 aDownloadedSize,
       
   160                 TInt32 aContentSize, CAMDownload& aDownload, THttpProgressState aState);
       
   161 
       
   162 public:
       
   163         // Functions from base classes
       
   164 
       
   165 private:
       
   166         // Data
       
   167         RHttpDownloadMgr iDownloadMgr;
       
   168         TBool iDownloadMgrConnected;
       
   169         
       
   170         RPointerArray<CAMDownload> iDownloads;
       
   171         
       
   172         RPointerArray<CAMDownload> iPrevDownloads;
       
   173         
       
   174         TInt iPrevDownldCount;
       
   175         
       
   176         MDownloadMngrObserver& iObserver;
       
   177 
       
   178         TInt iapid;
       
   179         HBufC8 *iServerId;
       
   180         TBool iOMASCOMOEnabled;
       
   181         TBool iNoteDisabled;
       
   182         
       
   183         };
       
   184 
       
   185     } // namespace NApplicationManagement
       
   186 
       
   187 
       
   188 
       
   189 #endif // __CAMDOWNLOADMANAGER_H__
       
   190 // End of File