|         |      1 /* | 
|         |      2 * Copyright (c) 2002 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:  | 
|         |     15 *      Declaration of class CCodEngBase.    | 
|         |     16 *       | 
|         |     17 * | 
|         |     18 */ | 
|         |     19  | 
|         |     20  | 
|         |     21 #ifndef COD_ENG_BASE_H | 
|         |     22 #define COD_ENG_BASE_H | 
|         |     23  | 
|         |     24 // INCLUDES | 
|         |     25  | 
|         |     26 #include <e32base.h> | 
|         |     27 #include <f32file.h> | 
|         |     28 #include <apmrec.h> | 
|         |     29 #include <apparc.h> | 
|         |     30 #include "CodSaver.h" | 
|         |     31 #include <CodDownload.h> | 
|         |     32  | 
|         |     33 // FORWARD DECLARATION | 
|         |     34  | 
|         |     35 class CCodData; | 
|         |     36 class CDocumentHandler; | 
|         |     37 class CEikProcess; | 
|         |     38 class MCodLoadObserver; | 
|         |     39 class CConnection; | 
|         |     40 class CHttpLoader; | 
|         |     41 class CRoapData; | 
|         |     42 class TCodProgress; | 
|         |     43 class CBodyPart; | 
|         |     44 class CAiwGenericParamList; | 
|         |     45  | 
|         |     46 class CHeaderField; | 
|         |     47 class CDownloadDataClient; | 
|         |     48 class CMediaDataClient; | 
|         |     49  | 
|         |     50 // CONSTANTS | 
|         |     51 #ifdef RD_MULTIPLE_DRIVE | 
|         |     52 const TInt KMaxDriveListStrLen = KMaxDrives << 1; | 
|         |     53 #endif | 
|         |     54  | 
|         |     55 /// Estimated data transfer for notify. Needed for progress. | 
|         |     56 LOCAL_D const TInt KCodNotifyTraffic = 1024; | 
|         |     57  | 
|         |     58 _LIT( KDownloadFolderFormat, "%S%x\\%S\\" ); // <DRIVE> <KCodDefaultTempDir> \\ <uid> \\ <KTempFilesCodDirName> | 
|         |     59  | 
|         |     60 _LIT( KCodDefaultTempDir, "\\system\\dmgr\\" ); | 
|         |     61 _LIT( KDmDefaultDir, "c:\\system\\dmgr\\" ); | 
|         |     62 _LIT( KInfoFilesCodDirName, "codinfo" ); | 
|         |     63 _LIT( KTempFilesCodDirName, "contents" ); | 
|         |     64  | 
|         |     65  | 
|         |     66 // CLASS DECLARATION | 
|         |     67  | 
|         |     68 /** | 
|         |     69 * COD Handler Engine Base (processing COD, fetching content, posting status). | 
|         |     70 */ | 
|         |     71 NONSHARABLE_CLASS( CCodEngBase ): public CActive, public MCodSaverFactory | 
|         |     72     { | 
|         |     73  | 
|         |     74     public:     // Constructors and destructor | 
|         |     75  | 
|         |     76         /** | 
|         |     77         * Destructor. | 
|         |     78         */       | 
|         |     79         IMPORT_C virtual ~CCodEngBase(); | 
|         |     80  | 
|         |     81  | 
|         |     82     public:     // new methods | 
|         |     83  | 
|         |     84         /** | 
|         |     85         * Process non-Unicode buffer and set data. Character set conversion is | 
|         |     86         * applied first. Character set is auto-detected if not supplied. | 
|         |     87         * Do this first before attempting anything else. | 
|         |     88         * @param aBuf Raw COD content buffer. | 
|         |     89         * @param aStatus Completes when done. | 
|         |     90         * @param aParams Parameters or NULL. | 
|         |     91         * @param aParts If descriptor is part of a multipart/related, body | 
|         |     92         * parts of the multipart/related content. NULL if not multipart. | 
|         |     93         */ | 
|         |     94         IMPORT_C void SetL | 
|         |     95             ( | 
|         |     96             const TDesC8& aBuf, | 
|         |     97             TRequestStatus* aStatus, | 
|         |     98             const CAiwGenericParamList* aParams, | 
|         |     99             const RPointerArray<CBodyPart>* aParts | 
|         |    100             ); | 
|         |    101  | 
|         |    102         /** | 
|         |    103         * Return current COD. | 
|         |    104         * @return Current COD data. | 
|         |    105         */ | 
|         |    106         IMPORT_C const CCodData& Data() const; | 
|         |    107  | 
|         |    108         /** | 
|         |    109         * Set or unset observer (pass NULL to unset). | 
|         |    110         * Panics if already set; unsetting more is allowed. | 
|         |    111         * @param aObserver Observer to set or NULL to unset. | 
|         |    112         */ | 
|         |    113         IMPORT_C void SetObserver( MCodLoadObserver* aObserver ); | 
|         |    114          | 
|         |    115         /** | 
|         |    116         * Copy data from CCodData to CDownloadDataClient. | 
|         |    117         */  | 
|         |    118     	void ConvertCodDataToDownloadDataL( CDownloadDataClient*& aDlData ); | 
|         |    119     	 | 
|         |    120     	/** | 
|         |    121         * Copy data from CCodData to CDownloadDataClient. | 
|         |    122         */  | 
|         |    123     	void ConvertMOToMediaDataL( CMediaDataClient*& aMOData, TInt aMOIndex ); | 
|         |    124     	 | 
|         |    125     	/** | 
|         |    126         * Inform DownloadMgrClntSrv about updated CodData. | 
|         |    127         */  | 
|         |    128     	void UpdateMediaInfoL(); | 
|         |    129     	 | 
|         |    130     	/** | 
|         |    131         * Inform DownloadMgrClntSrv about updated Media Object (Track). | 
|         |    132         */  | 
|         |    133     	void UpdateTrackInfoL();  | 
|         |    134     	 | 
|         |    135     	/** | 
|         |    136         * Inform DownloadMgrClntSrv about change in Type of a content.  | 
|         |    137         */  | 
|         |    138     	void ContentTypeChanged();         | 
|         |    139          | 
|         |    140     public:     // command handling | 
|         |    141  | 
|         |    142         /** | 
|         |    143         * Accept COD (download content, post status); | 
|         |    144         * @param aStatus Completes when done. | 
|         |    145         */ | 
|         |    146         IMPORT_C void Accept( TRequestStatus* aStatus ); | 
|         |    147  | 
|         |    148         /** | 
|         |    149         * Reject COD (don't download content, post status); | 
|         |    150         * @param aStatus Completes when done. | 
|         |    151         */ | 
|         |    152         IMPORT_C void Reject( TRequestStatus* aStatus ); | 
|         |    153  | 
|         |    154         /** | 
|         |    155         * Similar to Cancel, but further processing may be invoked (e.g. | 
|         |    156         * install-notify), so the request may not complete immediately. | 
|         |    157         * Please use this method (instead of Cancel) for user cancellation of | 
|         |    158         * downloads. Keep Cancel for error situations (final cleanup etc.) | 
|         |    159         */ | 
|         |    160         IMPORT_C void Stop(); | 
|         |    161  | 
|         |    162     public:     // checking results | 
|         |    163  | 
|         |    164         /** | 
|         |    165         * Check if downloading to removable media. | 
|         |    166         * @return ETrue if downloading to removable media. | 
|         |    167         */ | 
|         |    168         IMPORT_C TBool RemovableMedia() const; | 
|         |    169  | 
|         |    170         /** | 
|         |    171         * Get path of saved content (or empty string). | 
|         |    172         * @return Path of saved content. Fits to KMaxFileName. | 
|         |    173         */ | 
|         |    174         IMPORT_C TPtrC GetPath() const; | 
|         |    175  | 
|         |    176         /** | 
|         |    177         * Get type of saved content. | 
|         |    178         * @return Type of saved content. | 
|         |    179         */ | 
|         |    180         IMPORT_C const TDataType& GetType() const; | 
|         |    181  | 
|         |    182         /** | 
|         |    183         * Get UID of handler for the saved content. | 
|         |    184         * @return Handler UID. | 
|         |    185         */ | 
|         |    186         IMPORT_C TUid GetHandler() const; | 
|         |    187  | 
|         |    188         /** | 
|         |    189         * TODO can this be removed form API? | 
|         |    190         * Get HTTP status code of last operation. Default value 900. | 
|         |    191         * @return HTTP status code. | 
|         |    192         */ | 
|         |    193         IMPORT_C TInt GetStatusCode() const; | 
|         |    194  | 
|         |    195         /** | 
|         |    196         * Get ROAP data (or NULL if no ROAP was involved). | 
|         |    197         * @return ROAP data. This is NULL if no ROAP was involved. | 
|         |    198         */ | 
|         |    199         IMPORT_C const CRoapData* GetRoapData() const; | 
|         |    200  | 
|         |    201         /** | 
|         |    202         * Set attach to download for the COD (set from the DlMgr client) | 
|         |    203         * If aValue equals to ETrue it means that file is playing progressively | 
|         |    204         */ | 
|         |    205         IMPORT_C void SetCodDlAttached(const TBool aValue); | 
|         |    206  | 
|         |    207         /** | 
|         |    208         * for Paused Download the info files are read | 
|         |    209         * Do this first before attempting anything else. | 
|         |    210         * @param aDownloadId the unique download ID | 
|         |    211         * @param aDlUid the application Uid | 
|         |    212         * @param aParams Parameters or NULL. | 
|         |    213         * @param aParts If descriptor is part of a multipart/related, body | 
|         |    214         */ | 
|         |    215         IMPORT_C void SetL | 
|         |    216             ( | 
|         |    217             const TInt aDownloadId, | 
|         |    218             const TUid aDlUid,                   | 
|         |    219             const RPointerArray<CBodyPart>* aParts | 
|         |    220             ); | 
|         |    221  | 
|         |    222         /** | 
|         |    223         * Start the paused download | 
|         |    224         * @param aParams, parameters from Download Manager server | 
|         |    225         * @param aStatus , active object status | 
|         |    226         */ | 
|         |    227         IMPORT_C void Start( const CAiwGenericParamList* aParams, TRequestStatus* aStatus ); | 
|         |    228          | 
|         |    229         /** | 
|         |    230         * Return current COD. | 
|         |    231         * @return Current COD data. | 
|         |    232         */ | 
|         |    233         IMPORT_C HBufC8* UpdatedDownloadDataL(); | 
|         |    234          | 
|         |    235         /** | 
|         |    236         * Return stream descriptor for single media object (track). | 
|         |    237         * @return Current COD data. | 
|         |    238         */ | 
|         |    239         IMPORT_C HBufC8* UpdatedTrackDataL(TInt& aValue); | 
|         |    240  | 
|         |    241         /** | 
|         |    242         * Get Destination file name  | 
|         |    243         * @param aMOIndex media object index between 1 to 'n' | 
|         |    244         * @return NULL if index out of range | 
|         |    245         */ | 
|         |    246         IMPORT_C TPtrC GetDestFilePath (TInt aMOIndex ) const; | 
|         |    247  | 
|         |    248         /** | 
|         |    249         * Perform Pause for COD download. | 
|         |    250         */      	 | 
|         |    251         IMPORT_C void Pause(); | 
|         |    252     	 | 
|         |    253         /** | 
|         |    254         * Returns a flag saying whether or not download is pausable | 
|         |    255         * @return void | 
|         |    256         * @Added in OMA pause-resume feature | 
|         |    257         */		 | 
|         |    258         IMPORT_C TBool Pausable();   | 
|         |    259          | 
|         |    260         /** | 
|         |    261         *Returns the currently Active download | 
|         |    262         * @return Index of the currently active download | 
|         |    263         */	         | 
|         |    264         IMPORT_C TInt ActiveDownload( ); | 
|         |    265          | 
|         |    266         /** | 
|         |    267         * TODO can this be removed form API? | 
|         |    268         * Get HTTP status code of last operation. Default value EFailedPermanent. | 
|         |    269         * @return HTTP status code. | 
|         |    270         */         | 
|         |    271         IMPORT_C TCodDownloadProgress::TState GetProductStatusCode() const; | 
|         |    272         /** | 
|         |    273         * Check if download has Preview-only rights | 
|         |    274         * @return ETrue if download is Preview-only | 
|         |    275         */ | 
|         |    276         TBool IsDrmPreviewOnly() { return iDrmPreviewOnly; } | 
|         |    277  | 
|         |    278         /** | 
|         |    279         * Set Download descriptor for OMA 2 | 
|         |    280         */ | 
|         |    281         void SetDd2Type(TBool aIsDd2){iIsDd2 = aIsDd2;} | 
|         |    282          | 
|         |    283         /** | 
|         |    284         * Creates download info folder | 
|         |    285         * @return void | 
|         |    286         * @Added in OMA pause-resume feature | 
|         |    287         */ | 
|         |    288 		void CODDownloadInfoFolder( TDes& aFolder ) const; | 
|         |    289 		 | 
|         |    290         /** | 
|         |    291         * Returns the download ID | 
|         |    292         * @return DownloadID | 
|         |    293         * @Added in OMA pause-resume feature | 
|         |    294         */ | 
|         |    295 		TUint32 DownloadID(); | 
|         |    296 		 | 
|         |    297         /** | 
|         |    298         * Updates the download file path | 
|         |    299         * @return void | 
|         |    300         * @Added in OMA pause-resume feature | 
|         |    301         */ | 
|         |    302         void StoreFilePathsL(TPtr8& aBuf); | 
|         |    303 		 | 
|         |    304         /** | 
|         |    305         * Reads the download file path from info file | 
|         |    306         * @return void | 
|         |    307         * @Added in OMA pause-resume feature | 
|         |    308         */		 | 
|         |    309         void LoadFilePathsL(RFile& aInFile); | 
|         |    310 		 | 
|         |    311 		 | 
|         |    312         /** | 
|         |    313         * Updates the pausability of the download | 
|         |    314         * @return void | 
|         |    315         * @Added in OMA pause-resume feature | 
|         |    316         */		 | 
|         |    317         void SetPausable(TBool aPausable); | 
|         |    318  | 
|         |    319         /** | 
|         |    320         * | 
|         |    321         * To indicate the download is resumed and ready for PD | 
|         |    322         * @return void | 
|         |    323         * @Added in OMA pause-resume feature | 
|         |    324         */ | 
|         |    325         void SetResumePDAvailable(); | 
|         |    326          | 
|         |    327         /** | 
|         |    328         * Returns download info file path | 
|         |    329         * @return file path | 
|         |    330         * @Added in OMA pause-resume feature | 
|         |    331         */         | 
|         |    332         TFileName& CodDlInfoFile()  | 
|         |    333     	    { | 
|         |    334     	    return   iCodDlInfoPath;  | 
|         |    335     	    } | 
|         |    336     	 | 
|         |    337     	/** | 
|         |    338     	* Set iUrl in CCodData | 
|         |    339     	*/ | 
|         |    340     	void SetUrlL(const TDesC& aUrl); | 
|         |    341     	 | 
|         |    342         /** | 
|         |    343         * Creates the info files when Cod Engine is started | 
|         |    344         */ | 
|         |    345         void StoreInfoFilesL(); | 
|         |    346          | 
|         |    347         /** | 
|         |    348         * Creates info file for product (CCodData class) | 
|         |    349         */ | 
|         |    350         void StoreMainInfoFileL();         | 
|         |    351          | 
|         |    352         /** | 
|         |    353         * Creates info file for specified media object | 
|         |    354         */ | 
|         |    355         void StoreSubInfoFileL( const CArrayPtrFlat<CHeaderField>* aHeaders, TInt aMediaIndex ); | 
|         |    356  | 
|         |    357 		/** | 
|         |    358 		* Loads the CodData and MediaObjectData from info files | 
|         |    359 		*/ | 
|         |    360         void LoadMainInfoFileL();	 | 
|         |    361          | 
|         |    362 		/** | 
|         |    363 		* Loads the CodData from info files | 
|         |    364 		*/ | 
|         |    365         void LoadInfoFilesL(); | 
|         |    366 		 | 
|         |    367 		/** | 
|         |    368 		* Updates the downloaded size in media object | 
|         |    369 		*/         | 
|         |    370         void UpdateDownloadedSize( TInt aSize ); | 
|         |    371         /** | 
|         |    372 		* Loads the MediaObjectData from info files | 
|         |    373 		*/ | 
|         |    374         void LoadSubInfoFileL( TInt aMediaIndex, CArrayPtrFlat<CHeaderField>* aHeaders ); | 
|         |    375  | 
|         |    376     protected:  // Constructors and destructor | 
|         |    377  | 
|         |    378         /** | 
|         |    379         * Constructor. | 
|         |    380         * @param aObserver Observer. | 
|         |    381         */       | 
|         |    382         CCodEngBase( MCodLoadObserver* aObserver ); | 
|         |    383          | 
|         |    384         /** | 
|         |    385         * Second phase constructor. Leaves on failure. | 
|         |    386         * @param aProcess Host process. | 
|         |    387         */       | 
|         |    388         void ConstructL( CEikProcess* aProcess ); | 
|         |    389  | 
|         |    390     protected:  // from CActive | 
|         |    391  | 
|         |    392         /** | 
|         |    393         * Cancel protocol implementation. | 
|         |    394         */ | 
|         |    395         virtual void DoCancel(); | 
|         |    396  | 
|         |    397         /** | 
|         |    398         * Outstanding request completed. | 
|         |    399         */ | 
|         |    400         virtual void RunL(); | 
|         |    401  | 
|         |    402         /** | 
|         |    403         * Handle error. | 
|         |    404         * @param aError Error code. | 
|         |    405         * @return KErrNone. | 
|         |    406         */ | 
|         |    407         virtual TInt RunError( TInt aError ); | 
|         |    408  | 
|         |    409     protected:  // NOT from MApaEmbeddedDocObserver | 
|         |    410  | 
|         |    411         /** | 
|         |    412         * Embedded document viewing has ended. | 
|         |    413         * @param aMode Exit mode (actually unused). | 
|         |    414         */ | 
|         |    415         void NotifyExit( MApaEmbeddedDocObserver::TExitMode aMode ); | 
|         |    416  | 
|         |    417     protected:    // types | 
|         |    418  | 
|         |    419         enum TState                 ///< State. | 
|         |    420             { | 
|         |    421             EInit,                  ///< Initial state (no valid data set). | 
|         |    422             ESet,                   ///< Setting data is requested. | 
|         |    423             EReady,                 ///< Initial state (valid data set). | 
|         |    424             EStartInstallRoap,      ///< Installing Roap trigger from DD2 | 
|         |    425             EInstallRoap,           ///< RO recieved | 
|         |    426             EStartConnect,          ///< Initiate connecting to network. | 
|         |    427             EConnect,               ///< Connecting to network. | 
|         |    428             EStartFetch,            ///< Fetching requested. | 
|         |    429             EFetch,                 ///< Fetching content (GET). | 
|         |    430             EStartInstall,          ///< Installing content requested. | 
|         |    431             EInstall,               ///< Installing content. | 
|         |    432             EStartNotify,           ///< Notify requested. | 
|         |    433             ENotify,                 ///< Reporting status (POST). | 
|         |    434             EPause,					///< Pause state. | 
|         |    435             EMediaChange,           ///<Media object change (Track Change)      | 
|         |    436             EStartProductNotify,    ///<Product Notify Requested | 
|         |    437             EProductNotify          ///<Reporting Status (POST) | 
|         |    438             }; | 
|         |    439  | 
|         |    440         enum TNotificationStatus    ///< Notification status. | 
|         |    441             { | 
|         |    442             ENull,                  ///< No notification. | 
|         |    443             ELoad,                  ///< Notified about loading. | 
|         |    444             ECancel,                 ///< Notified about cancelling. | 
|         |    445             EPaused                 ///< Notified about pause. | 
|         |    446             }; | 
|         |    447  | 
|         |    448     protected:    // state machine parts | 
|         |    449  | 
|         |    450         /** | 
|         |    451         * Process buffer and set data. | 
|         |    452         */ | 
|         |    453         void SetL(); | 
|         |    454  | 
|         |    455         /** | 
|         |    456         * Initiate Roap installation. | 
|         |    457         */ | 
|         |    458         void StartInstallRoapL(); | 
|         |    459  | 
|         |    460         /** | 
|         |    461         * Roap installation ended. | 
|         |    462         */ | 
|         |    463         void EndInstallRoapL(); | 
|         |    464  | 
|         |    465         /** | 
|         |    466         * Initiate connecting to network. | 
|         |    467         */ | 
|         |    468         void StartConnectL(); | 
|         |    469  | 
|         |    470         /** | 
|         |    471         * Connecting to network ended. | 
|         |    472         */ | 
|         |    473         void EndConnectL(); | 
|         |    474  | 
|         |    475         /** | 
|         |    476         * Initiate fetching content. | 
|         |    477         */ | 
|         |    478         void StartFetchL(); | 
|         |    479  | 
|         |    480         /** | 
|         |    481         * Fetch ended. | 
|         |    482         */ | 
|         |    483         void EndFetchL(); | 
|         |    484  | 
|         |    485         /** | 
|         |    486         * Initiate installing received content (if any). | 
|         |    487         */ | 
|         |    488         void StartInstallL(); | 
|         |    489  | 
|         |    490         /** | 
|         |    491         * Installing ended. | 
|         |    492         */ | 
|         |    493         void EndInstallL(); | 
|         |    494  | 
|         |    495         /** | 
|         |    496         * Initiate notification. | 
|         |    497         */ | 
|         |    498         void StartNotifyL(); | 
|         |    499  | 
|         |    500         /** | 
|         |    501         * Notification ended. | 
|         |    502         */ | 
|         |    503         void EndNotifyL(); | 
|         |    504 		 | 
|         |    505 		/** | 
|         |    506 		*Change Media Object | 
|         |    507 		*/ | 
|         |    508 		void ChangeMediaObjectL(); | 
|         |    509          | 
|         |    510         /** | 
|         |    511         * Clean up and notify parent. | 
|         |    512         */ | 
|         |    513         void Done(); | 
|         |    514  | 
|         |    515         /** | 
|         |    516         * Clean up and notify parent for case of dd2 with license tag. | 
|         |    517         */ | 
|         |    518         void DoneDD2(); | 
|         |    519  | 
|         |    520         /** | 
|         |    521         * Invoke next state asynchronously (via RunL()). | 
|         |    522         * @param aNextState Next state. | 
|         |    523         */ | 
|         |    524         void Continue( TState aNextState ); | 
|         |    525  | 
|         |    526         /** | 
|         |    527         * Complete own request status (if not already completed). | 
|         |    528         * @param aError Error code to complete with. | 
|         |    529         */ | 
|         |    530         void SelfComplete( TInt aError ); | 
|         |    531          | 
|         |    532         /** | 
|         |    533         *Initiate Notification for Product | 
|         |    534         */ | 
|         |    535         void StartProductNotifyL(); | 
|         |    536          | 
|         |    537         /** | 
|         |    538         *End Notification | 
|         |    539         */ | 
|         |    540         void EndProductNotifyL(); | 
|         |    541  | 
|         |    542     protected:  // validity checks | 
|         |    543  | 
|         |    544         /** | 
|         |    545         * Check data (storage space, MIME type, mandatory attributes etc.) | 
|         |    546         * Leave on any errors. | 
|         |    547         */ | 
|         |    548         virtual void CheckDataL() = 0; | 
|         |    549  | 
|         |    550         /** | 
|         |    551         * Check device capabilities (MIME types, disk space) before download. | 
|         |    552         * Leaves with KMimeNotSupported, KErrCodInsufficientSpace | 
|         |    553         * (or system error codes). | 
|         |    554         */ | 
|         |    555         void CapabilityCheckL(); | 
|         |    556  | 
|         |    557     protected:  // error code / status code conversion. | 
|         |    558  | 
|         |    559         /** | 
|         |    560         * Parse data buffer. | 
|         |    561         */ | 
|         |    562         virtual void ParseDataL() = 0; | 
|         |    563  | 
|         |    564         /** | 
|         |    565         * Get http status code from error code and state. This method contains | 
|         |    566         * the  semantic interpretation of errors; e.g. failure to notify due | 
|         |    567         * to loss of service is regarded as success, etc. | 
|         |    568         * @param aError Error code. | 
|         |    569         * @param aState State. | 
|         |    570         * @return HTTP status code (to post). | 
|         |    571         */ | 
|         |    572         virtual TInt StatusCode( TInt aError, TState aState ) const = 0; | 
|         |    573  | 
|         |    574         /** | 
|         |    575         * Get textual representation of COD notify HTTP code. This text is | 
|         |    576         * sent back as notification. | 
|         |    577         * @param aCode HTTP code, values should only be the ones returned by | 
|         |    578         * StatusCode(). Other values panic. | 
|         |    579         * @return Textual form of HTTP code. | 
|         |    580         */ | 
|         |    581         virtual const TDesC8& StatusText( TInt aCode ) const = 0; | 
|         |    582  | 
|         |    583     protected:  // from MCodSaverFactory | 
|         |    584  | 
|         |    585         /** | 
|         |    586         * Create saver object. | 
|         |    587         * @param aType Data type. | 
|         |    588         * @return Saver object for this data type. Ownership not passed. | 
|         |    589         */ | 
|         |    590         CCodSaver* CreateSaverL( const TDesC8& aType ); | 
|         |    591  | 
|         |    592     private:    // implementation | 
|         |    593      | 
|         |    594         /** | 
|         |    595         * Set root and temp paths. | 
|         |    596         */ | 
|         |    597         void SetPathsL(); | 
|         |    598          | 
|         |    599         /** | 
|         |    600         * Reset paths. | 
|         |    601         */ | 
|         |    602         void ResetPaths(); | 
|         |    603  | 
|         |    604         /** | 
|         |    605         * Set file name based on the temp path file name from the url (for dd2)  | 
|         |    606         */ | 
|         |    607         void SetFileNameL(); | 
|         |    608          | 
|         |    609         /** | 
|         |    610         * Append index to file name to avoid overwriting existing file | 
|         |    611         */ | 
|         |    612         void SetUniqueFileNameL(); | 
|         |    613  | 
|         |    614 #ifdef RD_MULTIPLE_DRIVE | 
|         |    615  | 
|         |    616         /** | 
|         |    617         * Query the dynamic drive list. | 
|         |    618         */ | 
|         |    619         HBufC8* QueryDynDriveListLC(); | 
|         |    620  | 
|         |    621         /** | 
|         |    622         * Query the drive list from the CentRep. | 
|         |    623         */ | 
|         |    624         void QueryDriveListL(); | 
|         |    625 #endif | 
|         |    626          | 
|         |    627     protected:  // data | 
|         |    628  | 
|         |    629         /// COD Data. Owned. | 
|         |    630         CCodData* iData; | 
|         |    631         /// COD buffer. Owned. | 
|         |    632         HBufC* iCodBuf; | 
|         |    633         /// Connection. Owned. | 
|         |    634         CConnection* iConn; | 
|         |    635         /// Http loader. Owned. | 
|         |    636         CHttpLoader* iLoader; | 
|         |    637         /// Current state. | 
|         |    638         TState iState; | 
|         |    639         /// Document handler. Owned. | 
|         |    640         CDocumentHandler* iDocHandler; | 
|         |    641         /// Observer or NULL. Not owned. | 
|         |    642         MCodLoadObserver* iObserver; | 
|         |    643         /// Saver object. Owned. | 
|         |    644         CCodSaver* iSaver; | 
|         |    645         /// Parent status. | 
|         |    646         TRequestStatus* iParentStatus; | 
|         |    647         /// ETrue when Stop is in progress. | 
|         |    648         TBool iStopInProgress; | 
|         |    649         /// Preferred IAP. | 
|         |    650         TUint32 iPreferredIap; | 
|         |    651         /// File Server session. | 
|         |    652         RFs iFs; | 
|         |    653         /// Keeping track of observer notifications. | 
|         |    654         TNotificationStatus iNotificationStatus; | 
|         |    655         /// Data type of saved content. | 
|         |    656         TDataType iType; | 
|         |    657         /// Handler app UID. | 
|         |    658         TUid iHandler; | 
|         |    659         /// Saving to FS. | 
|         |    660         TBool iFsUsed; | 
|         |    661         /// Download id | 
|         |    662 		TUint32 iDownloadId; | 
|         |    663         /// App UId | 
|         |    664         TUid iAppUId; | 
|         |    665         /// COD info file path | 
|         |    666         TFileName iCodDlInfoPath; | 
|         |    667          | 
|         |    668 #ifdef RD_MULTIPLE_DRIVE  | 
|         |    669         /// Available memory has enough space to save the content | 
|         |    670         TBool iSpaceAvailOk; | 
|         |    671         /// Drive number that has enough space to save the content | 
|         |    672         TInt iAvailDriveSpace; | 
|         |    673         /// storage precedence from Cenrep | 
|         |    674         TBuf<KMaxDriveListStrLen> iDriveLettersCenRep; | 
|         |    675 #else | 
|         |    676         /// Saving to phone memory is OK. | 
|         |    677         TBool iPhoneMemoryOk; | 
|         |    678         /// Saving to MMC is OK. | 
|         |    679         TBool iMmcOk; | 
|         |    680 #endif | 
|         |    681         /// Paths on removable media? | 
|         |    682         TBool iRemovableMedia; | 
|         |    683         /// ROAP Data. Owned. | 
|         |    684         CRoapData* iRoapData; | 
|         |    685         /// Progress or NULL. Owned. | 
|         |    686         TCodProgress* iProgress; | 
|         |    687         /// Multipart body parts or NULL. Not owned. | 
|         |    688         const RPointerArray<CBodyPart>* iParts; | 
|         |    689         /// Parameters or NULL. Not owned. | 
|         |    690         const CAiwGenericParamList* iParams; | 
|         |    691         /// download rights are Preview-only | 
|         |    692         TBool iDrmPreviewOnly;      | 
|         |    693         /// ETrue if download descriptor is DD2 (OMA v2 download descriptor)  | 
|         |    694         TBool iIsDd2; | 
|         |    695         /// ETrue if DD2 has license element | 
|         |    696         TBool iIsLicense; | 
|         |    697         /// ETrue if download is attached (playing progressively) | 
|         |    698         TBool iAttached; | 
|         |    699         /// HTTP code sent in install-notify. | 
|         |    700       	TInt iStatusCode;	         | 
|         |    701       	/// Resulting error code (overall result). | 
|         |    702         TInt iResult; | 
|         |    703         /// Confirms whether content type check is done | 
|         |    704         TBool iContentTypeCheck; | 
|         |    705         //True if the download is resumed after pause | 
|         |    706         TBool iResumedDownload; | 
|         |    707  | 
|         |    708     }; | 
|         |    709  | 
|         |    710 #endif /* def COD_ENG_BASE_H */ |