codhandler/codeng/inc/RoapSaver.h
changeset 0 dd21522fd290
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     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 the License "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:  Declaration of class CRoapSaver.   
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef ROAP_SAVER_H
       
    20 #define ROAP_SAVER_H
       
    21 
       
    22 // INCLUDES
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <RoapEng.h>
       
    26 #include <RoapObserver.h>
       
    27 #include "CodSaver.h"
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 
       
    31 class CRoapData;
       
    32 class CAiwGenericParamList;
       
    33 class TCodProgress;
       
    34 
       
    35 // CLASS DECLARATION
       
    36 
       
    37 /**
       
    38 * ROAP saver. ROAP is downloaded to memory buffer; installation is executing
       
    39 * the ROAP.
       
    40 */
       
    41 NONSHARABLE_CLASS( CRoapSaver ): public CCodSaver, public Roap::MRoapObserver
       
    42     {
       
    43     public:     // Constructors and destructor.
       
    44 
       
    45         /**
       
    46         * Two phased constructor. Leaves on failure.
       
    47         * @param aType Data type.
       
    48         * @param aData ROAP data created here. Ownership not taken.
       
    49         * @param aProgress Progress.
       
    50         * @param aProgressBytes Estimated number of bytes (progress scale).
       
    51         * @param aTempPath Temp path (used for multipart ROAP response).
       
    52         * @param aRootPath Root path (used for multipart ROAP response).
       
    53         * @param aFname File name (used for progressive downloads).
       
    54         * @return The created object.
       
    55         */      
       
    56         static CRoapSaver* NewL
       
    57             (
       
    58             const TDesC8& aType,
       
    59             CRoapData*& aData,
       
    60             TCodProgress* aProgress,
       
    61             TInt aProgressBytes,
       
    62             const TFileName& aTempPath,
       
    63             const TFileName& aRootPath,
       
    64             const TFileName& aFname
       
    65             );
       
    66 
       
    67         /**
       
    68         * Destructor.
       
    69         */
       
    70         virtual ~CRoapSaver();
       
    71 
       
    72     public:     // from CCodSaver
       
    73 
       
    74         /**
       
    75         * Open temporary store for download.
       
    76         */
       
    77         virtual void OpenStoreL();
       
    78         
       
    79         /**
       
    80         * Append data to store.
       
    81         * @param aData Data to append.
       
    82         * @return Error code.
       
    83         */
       
    84         virtual TInt AppendData( const TDesC8& aData );
       
    85         
       
    86         /**
       
    87         * Download finished, close temporary store.
       
    88         */
       
    89         virtual void CloseStore();
       
    90 
       
    91         /**
       
    92         * Check if attributes of received content match descriptor data.
       
    93         * Leaves with KErrCodAttributeMismatch in case of mismatch.
       
    94         * @param aData Data to match.
       
    95         */
       
    96         virtual void CheckResponseAttributesL( const CCodData& aData );
       
    97 
       
    98         /**
       
    99         * Install downloaded content. Executes the ROAP.
       
   100         * @param aStatus Completes when done.
       
   101         * @param aName Preferred name (ignored).
       
   102         * @param aAttached. ETrue if the download is attached and playing progressively (ignored).
       
   103         */
       
   104         virtual void InstallL( TRequestStatus* aStatus, const TDesC& aName, const TBool aAttached );
       
   105         
       
   106 
       
   107         /**
       
   108         * BulkInstallL - No support for ROAP
       
   109         */        
       
   110         virtual void BulkInstallL( TRequestStatus* /*aStatus*/, const CCodData &/*aData*/, const TBool /*aAttached*/ ){}
       
   111         
       
   112         /**
       
   113         * Cancel installation.
       
   114         */
       
   115         virtual void CancelInstall();
       
   116 
       
   117         /**
       
   118         * Release content (take ownership of content from saver).
       
   119         * @param aFname Empty string returned here.
       
   120         * @param aHandler Handler UID returned here.
       
   121         */
       
   122         virtual void ReleaseContent( TFileName& aFname, TUid& aHandler );
       
   123            
       
   124         /**
       
   125         * Get the downloaded file size.
       
   126         */
       
   127         virtual TInt DownloadedFileSize()
       
   128             {
       
   129             return 0;
       
   130             };
       
   131         
       
   132         /**
       
   133         * Discard the old contents
       
   134         */        
       
   135         virtual void ResetL()
       
   136             {
       
   137 
       
   138             };
       
   139 
       
   140         /**
       
   141         * Clean up.
       
   142         */
       
   143         virtual void Cleanup( TBool aDeleteFile  );
       
   144 
       
   145         /**
       
   146         * Release file name (take ownership of content from saver).
       
   147         * @param aFname File name of content returned here.
       
   148         */
       
   149         virtual void ReleaseFileName( TFileName& aFname );
       
   150 
       
   151     private:    // Constructors and destructor.
       
   152 
       
   153         /**
       
   154         * Constructor.
       
   155         * @param aType Data type.
       
   156         * @param aData ROAP data created here. Ownership not taken.
       
   157         * @param aProgress Progress.
       
   158         * @param aProgressBytes Estimated number of bytes (progress scale).
       
   159         * @param aTempPath Temp path (used for multipart ROAP response).
       
   160         * @param aRootPath Root path (used for multipart ROAP response).
       
   161         * @param aFname File name of content.
       
   162         */
       
   163         CRoapSaver
       
   164             (
       
   165             const TDesC8& aType,
       
   166             CRoapData*& aData,
       
   167             TCodProgress* aProgress,
       
   168             TInt aProgressBytes,
       
   169             const TFileName& aTempPath,
       
   170             const TFileName& aRootPath,
       
   171             const TFileName& aFname
       
   172             );
       
   173 
       
   174     private:    // from Roap::MRoapObserver
       
   175     
       
   176         /**
       
   177         * Confirm creating network connection.
       
   178         * @return ETrue if network connection confirmed.
       
   179         */
       
   180         virtual TBool ConnectionConfL();
       
   181 
       
   182         /**
       
   183         * Confirm contacting Rights Issuer.
       
   184         * @return ETrue if confirmed.
       
   185         */
       
   186         virtual TBool ContactRiConfL();
       
   187 		
       
   188         /**
       
   189         * Confirm transaction ID tracking.
       
   190         * @return ETrue if transaction ID tracking confirmed.
       
   191         */
       
   192         virtual TBool TransIdConfL();
       
   193 
       
   194        /**
       
   195         * Handle right objects after a successful RoAcq.
       
   196         * @param aRightsList Received right objects.
       
   197         */
       
   198 		virtual void RightsObjectDetailsL
       
   199 	        ( const RPointerArray<CDRMRights>& aRightsList );
       
   200 
       
   201         /**
       
   202         * ROAP response returned multipart response, return parameters
       
   203         * needed saving.
       
   204         * @param aTempFolder Folder for temp file returned here.
       
   205         * @param aContentName Name for content file returned here.
       
   206         * @param aMaxSize Safety size limit returned here.
       
   207         */
       
   208         virtual void ContentDownloadInfoL
       
   209             ( TPath& aTempFolder, TFileName& aContentName, TInt& aMaxSize );
       
   210 
       
   211         /**
       
   212         * Details of DCF file received in ROAP (saved by ROAP Engine).
       
   213         * @param aPath: The path and the filename of the saved DCF file.
       
   214         * @param aType: The plain MIME type of the saved DCF file.
       
   215         * @param aAppUid: The handler app UID of the saved DCF file.
       
   216         */
       
   217 		virtual void ContentDetailsL
       
   218 		    ( const TDesC& aPath, const TDesC8& aType, const TUid& aAppUid );
       
   219                                       
       
   220         /**
       
   221         * Handle DCF file (received in multipart RO response).
       
   222         * @aFilename File name.
       
   223         */
       
   224         virtual void HandleDCFPartL( const TDesC8& aFilename );
       
   225 
       
   226         /**
       
   227         * Progress callback.
       
   228         * @param aProgressInfo Percentage completed.
       
   229         */
       
   230 		virtual void RoapProgressInfoL( const TInt aProgressInfo );
       
   231 
       
   232        /**
       
   233         * ErrorUrl
       
   234         * @param aErrorUrl: The error URL
       
   235         * @return void
       
   236         */
       
   237         virtual void ErrorUrlL( const TDesC8& aErrorUrl );
       
   238 
       
   239         /**
       
   240         * To handle PostResponseUrlL as part of metering response
       
   241         * @param aPrUrl: The PostResponseURL
       
   242         * @return void
       
   243         */
       
   244         virtual void PostResponseUrlL( const TDesC8& aPrUrl );
       
   245         		
       
   246     private:    // data
       
   247 
       
   248         HBufC8* iBuf;                   ///< Trigger buffer. Owned.
       
   249         Roap::CRoapEng* iEng;           ///< Engine. Owned.
       
   250         CRoapData*& iData;              ///< Data. Created but not owned.
       
   251         TCodProgress* iProgress;        ///< Progress. Not owned.
       
   252         TInt iProgressBytes;            ///< Progress scale.
       
   253         const TFileName& iTempPath;     ///< Temp file path.
       
   254         const TFileName& iRootPath;     ///< Root path.
       
   255         TFileName iFname;               ///< File name (DCF response).
       
   256         TPtrC iContentName;             ///< Content name.
       
   257 
       
   258     };
       
   259 
       
   260 #endif /* def ROAP_SAVER_H */