epoc32/include/mw/downloadmgrclient.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@2
     5
* under the terms of the License "Eclipse Public License v1.0"
williamr@2
     6
* which accompanies this distribution, and is available
williamr@2
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:  This file contains the definition of the Client interface of Download Mgr Server.
williamr@2
    15
*
williamr@2
    16
*/
williamr@2
    17
williamr@2
    18
williamr@2
    19
#ifndef __DOWNLOADMGR_CLIENT_H__
williamr@2
    20
#define __DOWNLOADMGR_CLIENT_H__
williamr@2
    21
williamr@2
    22
//  INCLUDES
williamr@2
    23
#include <e32base.h>
williamr@2
    24
#include <f32file.h>
williamr@4
    25
#include <httpdownloadmgrcommon.h>
williamr@2
    26
#include <http.h>
williamr@2
    27
williamr@2
    28
// FORWARD DECLARATIONS
williamr@2
    29
class CDownloadMgrHandler;
williamr@2
    30
class RHttpDownload;
williamr@2
    31
class MHttpDownloadMgrObserver;
williamr@2
    32
class CDefaultAttrib;
williamr@2
    33
class CRHttpDownloadExtension;
williamr@2
    34
class CRHttpDownloadMgrExtension;
williamr@2
    35
class CRHttpDlExtension;
williamr@2
    36
class CEikonEnv;
williamr@2
    37
class CTransactionObserver;
williamr@2
    38
class THttpTransactionCallback;
williamr@2
    39
class CCodDownload;
williamr@2
    40
class CCodObserver;
williamr@2
    41
williamr@2
    42
/**
williamr@2
    43
* Calculate a hash and in the form of a 32 character hex result.
williamr@2
    44
* @param aMessage Source.
williamr@2
    45
* @param aHash Hash value.
williamr@2
    46
* @return None.        
williamr@2
    47
*/
williamr@2
    48
void HashL( const TDesC8& aMessage, TDes8& aHash );
williamr@2
    49
williamr@2
    50
// TYPEDEFS
williamr@2
    51
typedef CArrayPtrFlat< RHttpDownload > CDownloadArray;
williamr@2
    52
typedef CArrayPtrFlat< MHttpDownloadMgrObserver >  CDownloadMgrObserver;
williamr@2
    53
williamr@2
    54
// CLASS DECLARATION
williamr@2
    55
williamr@2
    56
/**
williamr@2
    57
*  Contains download states
williamr@2
    58
*
williamr@2
    59
*  @lib -
williamr@2
    60
*  @since Series 60 2.8
williamr@2
    61
*/
williamr@2
    62
NONSHARABLE_CLASS( THttpDownloadEvent )
williamr@2
    63
    {
williamr@2
    64
    public: // Data
williamr@2
    65
        // download state
williamr@2
    66
        THttpDownloadState iDownloadState;
williamr@2
    67
        // download progress state
williamr@2
    68
        THttpProgressState iProgressState;
williamr@2
    69
    };
williamr@2
    70
williamr@2
    71
/**
williamr@2
    72
*  Provides the interface for notification of events from a Download Manager 
williamr@2
    73
*  session and its subsessions.
williamr@2
    74
*
williamr@2
    75
*  @lib -
williamr@2
    76
*  @since Series 60 2.8
williamr@2
    77
*/
williamr@2
    78
class MHttpDownloadMgrObserver
williamr@2
    79
    {
williamr@2
    80
williamr@2
    81
    public:
williamr@2
    82
williamr@2
    83
        /**
williamr@2
    84
        * Indicates an event.
williamr@2
    85
        * @param aDownload The download with which the event occured.
williamr@2
    86
        * @param aEvent Event type.
williamr@2
    87
        * @return None.
williamr@2
    88
        */
williamr@2
    89
        virtual void HandleDMgrEventL( RHttpDownload& aDownload, THttpDownloadEvent aEvent ) = 0;
williamr@2
    90
    };
williamr@2
    91
williamr@2
    92
/**
williamr@2
    93
*  Provides the interface for sending next uri to 
williamr@2
    94
*  the client when downloading OMA or COD.
williamr@2
    95
*
williamr@2
    96
*  @lib -
williamr@2
    97
*  @since Series 60 3.0
williamr@2
    98
*/
williamr@2
    99
class MHttpDownloadMgrNextUriObserver
williamr@2
   100
    {
williamr@2
   101
williamr@2
   102
    public:
williamr@2
   103
williamr@2
   104
        /**
williamr@2
   105
        * Send next uri to the client. The client can then handle it.
williamr@2
   106
        * @param aDownload Reference to the download.
williamr@2
   107
        * @param aUri Next URI of the OMA or COD download.
williamr@2
   108
        * @return None.
williamr@2
   109
        */
williamr@2
   110
        virtual void NextUriL( RHttpDownload& aDownload, const TDesC8& aUri ) = 0;
williamr@2
   111
    };
williamr@2
   112
williamr@2
   113
/**
williamr@2
   114
*  Creates a download manager session and performs operations on it 
williamr@2
   115
*
williamr@2
   116
*  @lib -
williamr@2
   117
*  @since Series 60 2.8
williamr@2
   118
*/
williamr@4
   119
williamr@2
   120
NONSHARABLE_CLASS( RHttpDownloadMgr ) : public RSessionBase,
williamr@2
   121
                                        public MHttpDownloadMgrObserver
williamr@2
   122
	{
williamr@2
   123
    public:
williamr@2
   124
        /**
williamr@2
   125
        * C++ default constructor.
williamr@2
   126
        */
williamr@2
   127
        IMPORT_C RHttpDownloadMgr();
williamr@2
   128
williamr@2
   129
    public:  // New functions
williamr@2
   130
williamr@2
   131
        /**
williamr@2
   132
        * Creates a download manager session.
williamr@2
   133
        * @param aAppUid Client application's UID.
williamr@2
   134
        * @param aObserver Observer
williamr@2
   135
        * @param aMaster Indicates whether (if ETrue) this instance 
williamr@2
   136
        * inherints all downloads of other instances. (stand-alone app flag).
williamr@2
   137
        * @return None.
williamr@2
   138
        */
williamr@2
   139
        IMPORT_C void ConnectL( TUid aAppUid,
williamr@2
   140
                                MHttpDownloadMgrObserver& aObserver,
williamr@2
   141
                                TBool aMaster );
williamr@2
   142
williamr@2
   143
        /**
williamr@2
   144
        * Gives version information.
williamr@2
   145
        * @param -
williamr@2
   146
        * @return TVersion Contains version information.
williamr@2
   147
        */
williamr@2
   148
        IMPORT_C TVersion Version() const;
williamr@2
   149
williamr@2
   150
        /**
williamr@2
   151
        * Closes download manager session.
williamr@2
   152
        * @param -
williamr@2
   153
        * @return None.
williamr@2
   154
        */
williamr@2
   155
        IMPORT_C void Close();
williamr@2
   156
williamr@2
   157
        /**
williamr@2
   158
        * Returns a list of the current downloads.
williamr@2
   159
        * @param -
williamr@2
   160
        * @return CDownloadArray
williamr@2
   161
        */
williamr@2
   162
        IMPORT_C const CDownloadArray& CurrentDownloads() const;
williamr@2
   163
williamr@2
   164
        /**
williamr@2
   165
        * Creates a new download subsession.
williamr@2
   166
        * @param aUrl The url to be downloaded.
williamr@2
   167
        * @param aResult The result is true if the download is created.
williamr@2
   168
        * If the URL is already being downloaded the seult is false.
williamr@2
   169
        * @return RHttpDownload&
williamr@2
   170
        */
williamr@2
   171
        IMPORT_C RHttpDownload& CreateDownloadL( const TDesC8& aUrl, TBool& aResult );
williamr@2
   172
williamr@2
   173
        /**
williamr@2
   174
        * Creates a new download subsession. It creates a new one even
williamr@2
   175
        * if the URL is already beeing downloaded.
williamr@2
   176
        * @param aUrl The url to be downloaded.
williamr@2
   177
        * If the URL is already being downloaded the seult is false.
williamr@2
   178
        * @return RHttpDownload&
williamr@2
   179
        */
williamr@2
   180
        IMPORT_C RHttpDownload& CreateDownloadL( const TDesC8& aUrl );
williamr@2
   181
williamr@2
   182
        /**
williamr@2
   183
        * Creates a new download in client side.
williamr@2
   184
        * @param aHttpTransaction http transaction.
williamr@2
   185
        * @param aResult The result is true if the download is created.
williamr@2
   186
        * If the URL is already being downloaded the seult is false.        
williamr@2
   187
        */
williamr@2
   188
        IMPORT_C RHttpDownload& CreateClientSideDownloadL( TInt aHttpTransaction,TBool& aResult );
williamr@2
   189
williamr@2
   190
        /**
williamr@2
   191
        * Creates a new download subsession for COD.
williamr@2
   192
        * @param aUrl The url from the COD is downloaded.
williamr@2
   193
        * @param aBuf The COD descriptor.
williamr@2
   194
        * @param aMimeType The mimetype.
williamr@2
   195
        * @param aEikEnv Eikon environment or NULL. Can be NULL if download
williamr@2
   196
        * does not require UI functionality.        
williamr@2
   197
        * @param aResult The result is true if the download is created.       
williamr@2
   198
        * If the URL is already being downloaded the seult is false.
williamr@2
   199
        * @return RHttpDownload&
williamr@2
   200
        */
williamr@2
   201
        IMPORT_C RHttpDownload& CreateCodDownloadL( const TDesC8& aUrl,
williamr@2
   202
                                                    const TDesC8& aBuf,
williamr@2
   203
                                                    const TDesC8& aMimeType,
williamr@2
   204
                                                    CEikonEnv* aEikEnv,
williamr@2
   205
                                                    TBool& aResult );
williamr@2
   206
williamr@2
   207
        /**
williamr@2
   208
        * Finds if the download is already created
williamr@2
   209
        * @since 2.8
williamr@2
   210
        * @param aUrl given URL
williamr@2
   211
        * @param aMsgBody Message body from post operation
williamr@2
   212
        * @return Returns a pointer to the found download or null.
williamr@2
   213
        *         This pointer is NOT owned by the client!
williamr@2
   214
        */        
williamr@2
   215
        IMPORT_C RHttpDownload* FindDownload( const TDesC8& aUrl, const TDesC8& aMsgBody );
williamr@2
   216
williamr@2
   217
        /**
williamr@2
   218
        * Pauses all downloads.
williamr@2
   219
        * @param -
williamr@2
   220
        * @return None.
williamr@2
   221
        */
williamr@2
   222
        IMPORT_C TInt PauseAll();
williamr@2
   223
williamr@2
   224
        /**
williamr@2
   225
        * Resumes all downloads.
williamr@2
   226
        * @param -
williamr@2
   227
        * @return None.
williamr@2
   228
        */
williamr@2
   229
        IMPORT_C TInt StartAll();
williamr@2
   230
williamr@2
   231
        /**
williamr@2
   232
        * Resets all downloads.
williamr@2
   233
        * @param -
williamr@2
   234
        * @return None.
williamr@2
   235
        */
williamr@2
   236
        IMPORT_C TInt ResetAll();
williamr@2
   237
williamr@2
   238
        /**
williamr@2
   239
        * Deletes all downloads.
williamr@2
   240
        * @param -
williamr@2
   241
        * @return None.
williamr@2
   242
        */
williamr@2
   243
        IMPORT_C TInt DeleteAll();
williamr@2
   244
williamr@2
   245
        /**
williamr@2
   246
        * Disconnect the http connection and pauses all downloads.
williamr@2
   247
        * @param -
williamr@2
   248
        * @return None.
williamr@2
   249
        */
williamr@2
   250
        IMPORT_C TInt Disconnect();
williamr@2
   251
williamr@2
   252
		/**
williamr@2
   253
		* Gets the value for a TInt attribute.
williamr@2
   254
		* @param aAttribute Identifies the attribute to be retrived.
williamr@2
   255
		* @param aValue On completion, contains the requested TInt attribute.
williamr@2
   256
        * @return None.
williamr@2
   257
		*/
williamr@2
   258
		IMPORT_C TInt GetIntAttribute( const TUint aAttribute, TInt32& aValue );
williamr@2
   259
williamr@2
   260
		/**
williamr@2
   261
		* Gets the value for a TBool attribute.
williamr@2
   262
		* @param aAttribute Identifies the attribute to be retrived.
williamr@2
   263
		* @param aValue On completion, contains the requested TBool attribute.
williamr@2
   264
        * @return None.
williamr@2
   265
		*/
williamr@2
   266
		IMPORT_C TInt GetBoolAttribute( const TUint aAttribute, TBool& aValue );
williamr@2
   267
williamr@2
   268
		/**
williamr@2
   269
		* Gets the value for a TDes16 attribute.
williamr@2
   270
		* @param aAttribute Identifies the attribute to be retrived.
williamr@2
   271
		* @param aValue On completion, contains the requested TDes16 attribute.
williamr@2
   272
        * @return None.
williamr@2
   273
		*/
williamr@2
   274
		IMPORT_C TInt GetStringAttribute( const TUint aAttribute, TDes16& aValue  );
williamr@2
   275
williamr@2
   276
		/**
williamr@2
   277
		* Gets the value for a TDes8 attribute.
williamr@2
   278
		* @param aAttribute Identifies the attribute to be retrived.
williamr@2
   279
		* @param aValue On completion, contains the requested TDes8 attribute.
williamr@2
   280
        * @return None.
williamr@2
   281
		*/
williamr@2
   282
        IMPORT_C TInt GetStringAttribute( const TUint aAttribute, TDes8& aValue  );
williamr@2
   283
williamr@2
   284
		/**
williamr@2
   285
		* Sets the value for a TInt attribute.
williamr@2
   286
		* @param aAttribute Identifies the attribute to be set.
williamr@2
   287
		* @param aValue The value to be set.
williamr@2
   288
        * @return None.
williamr@2
   289
		*/
williamr@2
   290
		IMPORT_C TInt SetIntAttribute( const TUint aAttribute, TInt32 aValue );
williamr@2
   291
williamr@2
   292
		/**
williamr@2
   293
		* Sets the value for a TBool attribute.
williamr@2
   294
		* @param aAttribute Identifies the attribute to be set.
williamr@2
   295
		* @param aValue The value to be set.
williamr@2
   296
        * @return None.
williamr@2
   297
		*/
williamr@2
   298
		IMPORT_C TInt SetBoolAttribute( const TUint aAttribute, TBool aValue );
williamr@2
   299
williamr@2
   300
		/**
williamr@2
   301
		* Sets the value for a TDesC attribute.
williamr@2
   302
		* @param aAttribute Identifies the attribute to be set.
williamr@2
   303
		* @param aValue The value to be set.
williamr@2
   304
        * @return None.
williamr@2
   305
		*/
williamr@2
   306
		IMPORT_C TInt SetStringAttribute( const TUint aAttribute, const TDesC16& aValue );
williamr@2
   307
williamr@2
   308
		/**
williamr@2
   309
		* Sets the value for a TDesC8 attribute.
williamr@2
   310
		* @param aAttribute Identifies the attribute to be set.
williamr@2
   311
		* @param aValue The value to be set.
williamr@2
   312
        * @return None.
williamr@2
   313
		*/
williamr@2
   314
        IMPORT_C TInt SetStringAttribute( const TUint aAttribute, const TDesC8& aValue );
williamr@2
   315
williamr@2
   316
		/**
williamr@2
   317
		* Sets the value for the default TInt attribute.
williamr@2
   318
		* @param aAttribute Identifies the attribute to be set.
williamr@2
   319
		* @param aValue The value to be set.
williamr@2
   320
        * @return None.
williamr@2
   321
		*/
williamr@2
   322
		IMPORT_C TInt SetDefaultIntAttribute( const TUint aAttribute, TInt32 aValue );
williamr@2
   323
williamr@2
   324
		/**
williamr@2
   325
		* Sets the value for the default TBool attribute.
williamr@2
   326
		* @param aAttribute Identifies the attribute to be set.
williamr@2
   327
		* @param aValue The value to be set.
williamr@2
   328
        * @return None.
williamr@2
   329
		*/
williamr@2
   330
		IMPORT_C TInt SetDefaultBoolAttribute( const TUint aAttribute, TBool aValue );
williamr@2
   331
williamr@2
   332
		/**
williamr@2
   333
		* Sets the value for the default TDesC attribute.
williamr@2
   334
		* @param aAttribute Identifies the attribute to be set.
williamr@2
   335
		* @param aValue The value to be set.
williamr@2
   336
        * @return None.
williamr@2
   337
		*/
williamr@2
   338
		IMPORT_C TInt SetDefaultStringAttribute( const TUint aAttribute, const TDesC16& aValue );
williamr@2
   339
williamr@2
   340
		/**
williamr@2
   341
		* Sets the value for the default TDesC8 attribute.
williamr@2
   342
		* @param aAttribute Identifies the attribute to be set.
williamr@2
   343
		* @param aValue The value to be set.
williamr@2
   344
        * @return None.
williamr@2
   345
		*/
williamr@2
   346
        IMPORT_C TInt SetDefaultStringAttribute( const TUint aAttribute, const TDesC8& aValue );
williamr@2
   347
williamr@2
   348
		/**
williamr@2
   349
		* Adds client to the observer list.
williamr@2
   350
		* @param aObserver Observer.
williamr@2
   351
        * @return None.
williamr@2
   352
		*/
williamr@2
   353
        IMPORT_C void AddObserverL( MHttpDownloadMgrObserver& aObserver );
williamr@2
   354
williamr@2
   355
		/**
williamr@2
   356
		* Removes client from the observer list.
williamr@2
   357
		* @param aObserver Observer.
williamr@2
   358
        * @return None.
williamr@2
   359
		*/
williamr@2
   360
        IMPORT_C void RemoveObserver( MHttpDownloadMgrObserver& aObserver );
williamr@2
   361
        
williamr@2
   362
		/**
williamr@2
   363
		* Set next uri observer.
williamr@2
   364
		* @param aObserver Observer.
williamr@2
   365
        * @return None.
williamr@2
   366
		*/        
williamr@2
   367
        IMPORT_C void SetNextUriObserver( MHttpDownloadMgrNextUriObserver* aObserver );
williamr@4
   368
        
williamr@4
   369
    /**
williamr@4
   370
		* Checks for possibility of a new donload 
williamr@4
   371
		* @param None
williamr@4
   372
        * @return TBool,possibility of a new download.
williamr@4
   373
		*/
williamr@4
   374
        TBool IsNewDownloadPossible();
williamr@2
   375
williamr@2
   376
    protected: // from MHttpDownloadMgrObserver
williamr@2
   377
williamr@2
   378
        /**
williamr@2
   379
        * Indicates an event.
williamr@2
   380
        * @param aDownload The download with which the event occured.
williamr@2
   381
        * @param aEvent Event type.
williamr@2
   382
        * @return None.
williamr@2
   383
        */
williamr@2
   384
        void HandleDMgrEventL( RHttpDownload& aDownload, THttpDownloadEvent aEvent );
williamr@2
   385
williamr@2
   386
    private:
williamr@2
   387
williamr@2
   388
        /**
williamr@2
   389
        * Indicates the session's event.
williamr@2
   390
        * @param aHandle Unique identifier of server side subsession.
williamr@2
   391
        * @param aEvent Event type.
williamr@2
   392
        * @return None.
williamr@2
   393
        */
williamr@2
   394
        void HandleSessionEventL( TInt aHandle, THttpDownloadEvent aEvent );
williamr@2
   395
williamr@2
   396
    private:  // New functions
williamr@2
   397
williamr@2
   398
        /**
williamr@2
   399
        * Creates a download manager session.
williamr@2
   400
        * @param aAppUid Client application's UID.
williamr@2
   401
        * @param aObserver Observer
williamr@2
   402
        * @param aMaster Indicates whether (if ETrue) this instance 
williamr@2
   403
        * inherints all downloads of other instances. (stand-alone app flag).
williamr@2
   404
        * @return None.
williamr@2
   405
        */
williamr@2
   406
        void DoConnectL( TUid aAppUid,
williamr@2
   407
                         MHttpDownloadMgrObserver& aObserver,
williamr@2
   408
                         TBool aMaster );
williamr@2
   409
williamr@2
   410
        /**
williamr@2
   411
        * Initializes the download manager session.
williamr@2
   412
        * @param aAppUid Client app's UID.
williamr@2
   413
        * @param aObserver Observer to add to the observer list.
williamr@2
   414
        * @param aMaster Indicates whether (if ETrue) this instance 
williamr@2
   415
        * inherints all downloads of other instances. (stand-alone app flag).
williamr@2
   416
        * @return None.
williamr@2
   417
        */
williamr@2
   418
        void InitializeL( TUid aAppUid,
williamr@2
   419
                          MHttpDownloadMgrObserver& aObserver,
williamr@2
   420
                          TBool aMaster );
williamr@2
   421
williamr@2
   422
    protected: // New functions
williamr@2
   423
williamr@2
   424
        /**
williamr@2
   425
        * Adds the created download to the list. If it is already added, 
williamr@2
   426
        * then it will do nothing.
williamr@2
   427
        * @param aElement Download subsession.
williamr@2
   428
        * @return RHttpDownload& reference to the added item in the list.
williamr@2
   429
        */
williamr@2
   430
        RHttpDownload& AddToArrayL( RHttpDownload* aElement );
williamr@2
   431
williamr@2
   432
    private:  // New functions
williamr@2
   433
williamr@2
   434
        /**
williamr@2
   435
        * Removes the download from the list.
williamr@2
   436
        * @param aElement Download subsession.
williamr@2
   437
        * @return None.
williamr@2
   438
        */
williamr@2
   439
        void RemoveFromArray( RHttpDownload* aElement );
williamr@2
   440
williamr@2
   441
        /**
williamr@2
   442
        * Finds the download in the list.
williamr@2
   443
        * @param aElement Download subsession.
williamr@2
   444
        * @param aIndex Index of the element found.
williamr@2
   445
        * @return KErrNone if found, KErrNotFound otherwise..
williamr@2
   446
        */
williamr@2
   447
        TInt FindInArray( RHttpDownload* aElement, TInt& aIndex ) const;
williamr@2
   448
williamr@2
   449
        /**
williamr@2
   450
        * Returns a reference to the download identified by a handle.
williamr@2
   451
        * @param aHandle Handle identifier.
williamr@2
   452
        * @return RHttpDownload&
williamr@2
   453
        */
williamr@2
   454
        RHttpDownload& DownloadFromHandleL( TUint aHandle );
williamr@2
   455
williamr@2
   456
        /**
williamr@2
   457
        * Finds observer based on index.
williamr@2
   458
        * @param aObserver Observer found.
williamr@2
   459
        * @param aIndex Index.
williamr@2
   460
        * @return TInt
williamr@2
   461
        */
williamr@2
   462
        TInt FindObserver( MHttpDownloadMgrObserver& aObserver, TInt& aIndex ) const;
williamr@2
   463
williamr@2
   464
        /**
williamr@2
   465
        * Attach client to the session.
williamr@2
   466
        * @param aBuf Buffer to the subsession IDs.
williamr@2
   467
        * @return None.
williamr@2
   468
        */
williamr@2
   469
        void AttachL( TDes8& aBuf );
williamr@2
   470
williamr@2
   471
        /**
williamr@2
   472
        * Close a download subsession.
williamr@2
   473
        * @param aElement Download subsession.
williamr@2
   474
        * @return None.
williamr@2
   475
        */
williamr@2
   476
        void CloseDownload( RHttpDownload* aElement );
williamr@2
   477
williamr@2
   478
		/**
williamr@2
   479
		* Packes the default values of the attributes.
williamr@2
   480
		* @param -
williamr@2
   481
        * @return bbuffer of the packed attribs.
williamr@2
   482
		*/
williamr@2
   483
        HBufC8* PackedDefaultAttributesLC();
williamr@2
   484
williamr@2
   485
		/**
williamr@2
   486
		* Sets the default value for the TInt32 attribute.
williamr@2
   487
		* @param aAttribute Identifies the attribute to be set.
williamr@2
   488
		* @param aValue The value to be set.
williamr@2
   489
        * @return None.
williamr@2
   490
		*/
williamr@2
   491
        void DoSetDefaultAttributeL( const TUint aAttribute, TInt32 aValue );
williamr@2
   492
williamr@2
   493
		/**
williamr@2
   494
		* Sets the default value for the TBool attribute.
williamr@2
   495
		* @param aAttribute Identifies the attribute to be set.
williamr@2
   496
		* @param aValue The value to be set.
williamr@2
   497
        * @return None.
williamr@2
   498
		*/
williamr@2
   499
        void DoSetDefaultAttributeL( const TUint aAttribute, TBool aValue );
williamr@2
   500
williamr@2
   501
		/**
williamr@2
   502
		* Sets the default value for the TDesC8 attribute.
williamr@2
   503
		* @param aAttribute Identifies the attribute to be set.
williamr@2
   504
		* @param aValue The value to be set.
williamr@2
   505
        * @return None.
williamr@2
   506
		*/
williamr@2
   507
        void DoSetDefaultAttributeL( const TUint aAttribute, const TDesC8& aValue );
williamr@2
   508
williamr@2
   509
		/**
williamr@2
   510
		* Sets the default value for the TDesC16 attribute.
williamr@2
   511
		* @param aAttribute Identifies the attribute to be set.
williamr@2
   512
		* @param aValue The value to be set.
williamr@2
   513
        * @return None.
williamr@2
   514
		*/
williamr@2
   515
        void DoSetDefaultAttributeL( const TUint aAttribute, const TDesC16& aValue );
williamr@2
   516
williamr@2
   517
        /**
williamr@2
   518
        * Start session's event notification.
williamr@2
   519
        * @param aStatus Handler's request status.
williamr@2
   520
        * @return None.
williamr@2
   521
        */
williamr@2
   522
        void StartSessionEventNotification( const TDesC8& aDownloadState,
williamr@2
   523
                                            const TDesC8& aProgressState,
williamr@2
   524
                                            const TDesC8& aHandle,
williamr@2
   525
                                            TRequestStatus& aStatus );
williamr@2
   526
williamr@2
   527
        /**
williamr@2
   528
        * Cancels session's event notification.
williamr@2
   529
        * @param -
williamr@2
   530
        * @return None.
williamr@2
   531
        */
williamr@2
   532
        void CancelSessionEventNotification();
williamr@2
   533
        
williamr@2
   534
        /**
williamr@2
   535
        * Leave version of FindDownload
williamr@2
   536
        */
williamr@2
   537
        RHttpDownload* DoFindDownloadL( const TDesC8& aUrl, const TDesC8& aMsgBody );
williamr@2
   538
        
williamr@2
   539
        /**
williamr@2
   540
        * Gets the number of client side download.
williamr@2
   541
        * @param aValue Num of client side download
williamr@2
   542
        * @return Error code.
williamr@2
   543
        */        
williamr@2
   544
        TInt NumberOfClientSideDownload( TInt32& aValue );
williamr@2
   545
        
williamr@2
   546
        /**
williamr@2
   547
        * Tells that event is being broadcasted.
williamr@2
   548
        * @param None
williamr@2
   549
        * @return TBool.
williamr@2
   550
        */         
williamr@2
   551
        TBool IsEventBroadcasting();
williamr@2
   552
        
williamr@2
   553
        /**
williamr@2
   554
        * Do-Indicates the session's event.
williamr@2
   555
        * @param aHandle Unique identifier of server side subsession.
williamr@2
   556
        * @param aEvent Event type.
williamr@2
   557
        * @return None.
williamr@2
   558
        */
williamr@2
   559
        void DoHandleSessionEventL( TInt aHandle, THttpDownloadEvent aEvent );
williamr@2
   560
williamr@2
   561
        /**
williamr@2
   562
        * Broadcasts an event.
williamr@2
   563
        * @param aDownload The download with which the event occured.
williamr@2
   564
        * @param aEvent Event type.
williamr@2
   565
        * @return None.
williamr@2
   566
        */
williamr@2
   567
        void BroadcastEvent( RHttpDownload& aDownload, 
williamr@2
   568
                             THttpDownloadEvent aEvent );
williamr@2
   569
williamr@2
   570
        /**
williamr@2
   571
        * Returns the next uri observer from the extension calss.
williamr@2
   572
        * @return Next uri observer.
williamr@2
   573
        */                             
williamr@2
   574
        MHttpDownloadMgrNextUriObserver* NextUriObserver() const;
williamr@2
   575
        
williamr@2
   576
        /**
williamr@2
   577
        * Returns the session id
williamr@2
   578
        * @return session id
williamr@2
   579
        */
williamr@2
   580
        TInt SessionId() const;
williamr@2
   581
williamr@2
   582
        /**
williamr@2
   583
        * Broadcast deleting event.
williamr@2
   584
        * @param aDownload download is beenig deleted.
williamr@2
   585
        * @return None.
williamr@2
   586
        */        
williamr@2
   587
//        void BroadcastDeleting( RHttpDownload& aDownload );
williamr@2
   588
        
williamr@2
   589
        /**
williamr@2
   590
        * Returns the the event priority flag
williamr@2
   591
        * @return TInt
williamr@2
   592
        */        
williamr@2
   593
        TInt EventPriorityFlag() const;
williamr@2
   594
        
williamr@2
   595
        /**
williamr@2
   596
        * Increments the event priority flas
williamr@2
   597
        * @return void
williamr@2
   598
        */        
williamr@2
   599
        void IncrementEventPriorityFlag();
williamr@2
   600
        
williamr@2
   601
        /**
williamr@2
   602
        * Decrements the event priority flag
williamr@2
   603
        * @return void
williamr@2
   604
        */        
williamr@2
   605
        void DecrementEventPriorityFlag();        
williamr@2
   606
                             
williamr@2
   607
    private:     // Data
williamr@2
   608
        // The client application UID.
williamr@2
   609
        TUid                             iAppUid;
williamr@2
   610
        // List of downloads.
williamr@2
   611
        CDownloadArray*                  iDownloadArray;  ///< Owned.
williamr@2
   612
        // List of observers.
williamr@2
   613
        CDownloadMgrObserver*            iObservers;      ///< Owned.
williamr@2
   614
        // Default attributes.
williamr@2
   615
        CArrayPtrFlat< CDefaultAttrib >* iDefaultAttribs; ///< Owned.
williamr@2
   616
        // Moved event handler
williamr@2
   617
        CDownloadMgrHandler*             iManagerHandler; ///< Owned.
williamr@2
   618
        // Extension class
williamr@2
   619
        CRHttpDownloadMgrExtension*      iExtension;      ///< Owned.
williamr@2
   620
williamr@2
   621
    public:     // Friend classes
williamr@2
   622
williamr@2
   623
        friend class RHttpDownload;
williamr@2
   624
        friend class CDownloadMgrHandler;
williamr@2
   625
        friend class CTransactionObserver;
williamr@2
   626
        friend class CCodObserver;        
williamr@2
   627
	};
williamr@2
   628
williamr@2
   629
/**
williamr@2
   630
*  Creates a download manager subsession and performs operations on it 
williamr@2
   631
*
williamr@2
   632
*  @lib -
williamr@2
   633
*  @since Series 60 2.8
williamr@2
   634
*/
williamr@2
   635
NONSHARABLE_CLASS( RHttpDownload ): public RSubSessionBase
williamr@2
   636
	{
williamr@2
   637
    public:
williamr@2
   638
        /**
williamr@2
   639
        * Cod download progress states
williamr@2
   640
        */
williamr@2
   641
        enum TCodProgressState
williamr@2
   642
            {
williamr@2
   643
            ENotActive,
williamr@2
   644
            EPaused,
williamr@2
   645
            EInProgress
williamr@2
   646
            };
williamr@2
   647
    private:
williamr@2
   648
williamr@2
   649
        /**
williamr@2
   650
        * C++ default constructor.
williamr@2
   651
        */
williamr@2
   652
        RHttpDownload( RHttpDownloadMgr* aServer );
williamr@2
   653
williamr@2
   654
    public:  // New functions
williamr@2
   655
williamr@2
   656
        /**
williamr@2
   657
        * Starts downloading.
williamr@2
   658
        * @param -
williamr@2
   659
        * @return None.
williamr@2
   660
        */
williamr@2
   661
        IMPORT_C TInt Start();
williamr@2
   662
williamr@2
   663
        /**
williamr@2
   664
        * Pauses downloading.
williamr@2
   665
        * @param -
williamr@2
   666
        * @return None.
williamr@2
   667
        */
williamr@2
   668
        IMPORT_C TInt Pause();
williamr@2
   669
williamr@2
   670
        /**
williamr@2
   671
        * Resets downloading.
williamr@2
   672
        * @param -
williamr@2
   673
        * @return None.
williamr@2
   674
        */
williamr@2
   675
        IMPORT_C TInt Reset();
williamr@2
   676
williamr@2
   677
        /**
williamr@2
   678
        * Deletes downloading.
williamr@2
   679
        * @param -
williamr@2
   680
        * @return None.
williamr@2
   681
        */
williamr@2
   682
        IMPORT_C TInt Delete();
williamr@2
   683
williamr@2
   684
        /**
williamr@2
   685
        * Moves downloaded content to the previously specified location
williamr@2
   686
        * @param -
williamr@2
   687
        * @return None.
williamr@2
   688
        */
williamr@2
   689
        IMPORT_C TInt Move();
williamr@2
   690
williamr@2
   691
		/**
williamr@2
   692
		* Gets the value for a TInt attribute.
williamr@2
   693
		* @param aAttribute Identifies the attribute to be retrived.
williamr@2
   694
		* @param aValue On completion, contains the requested TInt attribute.
williamr@2
   695
        * @return None.
williamr@2
   696
		*/
williamr@2
   697
		IMPORT_C TInt GetIntAttribute( const TUint aAttribute, TInt32& aValue );
williamr@2
   698
williamr@2
   699
		/**
williamr@2
   700
		* Gets the value for a TBool attribute.
williamr@2
   701
		* @param aAttribute Identifies the attribute to be retrived.
williamr@2
   702
		* @param aValue On completion, contains the requested TBool attribute.
williamr@2
   703
        * @return None.
williamr@2
   704
		*/
williamr@2
   705
		IMPORT_C TInt GetBoolAttribute( const TUint aAttribute, TBool& aValue );
williamr@2
   706
williamr@2
   707
		/**
williamr@2
   708
		* Gets the value for a TDes16 attribute.
williamr@2
   709
		* @param aAttribute Identifies the attribute to be retrived.
williamr@2
   710
		* @param aValue On completion, contains the requested TDes16 attribute.
williamr@2
   711
        * @return None.
williamr@2
   712
		*/
williamr@2
   713
		IMPORT_C TInt GetStringAttribute( const TUint aAttribute, TDes16& aValue  );
williamr@2
   714
williamr@2
   715
		/**
williamr@2
   716
		* Gets the value for a TDes8 attribute.
williamr@2
   717
		* @param aAttribute Identifies the attribute to be retrived.
williamr@2
   718
		* @param aValue On completion, contains the requested TDes8 attribute.
williamr@2
   719
        * @return None.
williamr@2
   720
		*/
williamr@2
   721
        IMPORT_C TInt GetStringAttribute( const TUint aAttribute, TDes8& aValue  );
williamr@2
   722
williamr@2
   723
        /**
williamr@2
   724
        * Gets the download's destination file's handle.
williamr@2
   725
        * @param aFile RFile that adopts file handle from download.
williamr@2
   726
        */
williamr@2
   727
        IMPORT_C TInt GetFileHandleAttribute( RFile& aFile );
williamr@2
   728
        
williamr@2
   729
		/**
williamr@2
   730
		* Sets the value for a TInt attribute.
williamr@2
   731
		* @param aAttribute Identifies the attribute to be set.
williamr@2
   732
		* @param aValue The value to be set.
williamr@2
   733
        * @return None.
williamr@2
   734
		*/
williamr@2
   735
		IMPORT_C TInt SetIntAttribute( const TUint aAttribute, TInt32 aValue );
williamr@2
   736
williamr@2
   737
		/**
williamr@2
   738
		* Sets the value for a TDesC attribute.
williamr@2
   739
		* @param aAttribute Identifies the attribute to be set.
williamr@2
   740
		* @param aValue The value to be set.
williamr@2
   741
        * @return None.
williamr@2
   742
		*/
williamr@2
   743
		IMPORT_C TInt SetBoolAttribute( const TUint aAttribute, TBool aValue );
williamr@2
   744
williamr@2
   745
		/**
williamr@2
   746
		* Sets the value for a TDesC attribute.
williamr@2
   747
		* @param aAttribute Identifies the attribute to be set.
williamr@2
   748
		* @param aValue The value to be set.
williamr@2
   749
        * @return None.
williamr@2
   750
		*/
williamr@2
   751
		IMPORT_C TInt SetStringAttribute( const TUint aAttribute, const TDesC16& aValue );
williamr@2
   752
williamr@2
   753
		/**
williamr@2
   754
		* Sets the value for a TDesC8 attribute.
williamr@2
   755
		* @param aAttribute Identifies the attribute to be set.
williamr@2
   756
		* @param aValue The value to be set.
williamr@2
   757
        * @return None.
williamr@2
   758
		*/
williamr@2
   759
        IMPORT_C TInt SetStringAttribute( const TUint aAttribute, const TDesC8& aValue );
williamr@2
   760
williamr@2
   761
        /**
williamr@2
   762
        * Sets the download's destination file handle.
williamr@2
   763
        * @param aFile RFile to be transfered to server.
williamr@2
   764
        * @return KErrNotSupported on non-support platform.
williamr@2
   765
        * @return KErrBadHandle is file is not opened.
williamr@2
   766
        */
williamr@2
   767
        IMPORT_C TInt SetFileHandleAttribute( RFile& aFile );
williamr@2
   768
		/**
williamr@2
   769
		* Gets the value for a TInt attribute.
williamr@2
   770
		* @param aAttribute Identifies the attribute to be retrived.
williamr@2
   771
		* @param aMoIndex Identifies the media object index.
williamr@2
   772
		* @param aValue On completion, contains the requested TInt attribute.
williamr@2
   773
        * @return None.
williamr@2
   774
		*/
williamr@2
   775
		IMPORT_C TInt GetIntAttribute( const TUint aAttribute, const TInt32& aMoIndex, TInt32& aValue );
williamr@2
   776
		
williamr@2
   777
		/**
williamr@2
   778
		* Gets the value for a TBool attribute.
williamr@2
   779
		* @param aAttribute Identifies the attribute to be retrived.
williamr@2
   780
		* @param aMoIndex Identifies the media object index.
williamr@2
   781
		* @param aValue On completion, contains the requested TBool attribute.
williamr@2
   782
        * @return None.
williamr@2
   783
		*/
williamr@2
   784
		IMPORT_C TInt GetBoolAttribute( const TUint aAttribute, const TInt32& aMoIndex, TBool& aValue );
williamr@2
   785
		
williamr@2
   786
		/**
williamr@2
   787
		* Gets the value for a TDes16 attribute.
williamr@2
   788
		* @param aAttribute Identifies the attribute to be retrived.
williamr@2
   789
		* @param aMoIndex Identifies the media object index.
williamr@2
   790
		* @param aValue On completion, contains the requested TDes16 attribute.
williamr@2
   791
        * @return None.
williamr@2
   792
		*/
williamr@2
   793
		IMPORT_C TInt GetStringAttribute( const TUint aAttribute, const TInt32& aMoIndex, TDes16& aValue );
williamr@2
   794
        
williamr@2
   795
        /**
williamr@2
   796
		* Gets the value for a TDes8 attribute.
williamr@2
   797
		* @param aAttribute Identifies the attribute to be retrived.
williamr@2
   798
		* @param aMoIndex Identifies the media object index.
williamr@2
   799
		* @param aValue On completion, contains the requested TDes8 attribute.
williamr@2
   800
        * @return None.
williamr@2
   801
		*/
williamr@2
   802
        IMPORT_C TInt GetStringAttribute( const TUint aAttribute, const TInt32& aMoIndex, TDes8& aValue );
williamr@2
   803
		
williamr@2
   804
		/**
williamr@2
   805
		* Sets the value for a TDesC attribute.
williamr@2
   806
		* @param aAttribute Identifies the attribute to be set.
williamr@2
   807
		* @param aMoIndex Identifies the media object index.
williamr@2
   808
		* @param aValue The value to be set.
williamr@2
   809
        * @return None.
williamr@2
   810
		*/
williamr@2
   811
		IMPORT_C TInt SetStringAttribute(const TUint aAttribute, const TInt32& aMoIndex, const TDesC16& aValue );
williamr@2
   812
        
williamr@2
   813
        /**
williamr@2
   814
        * Sets the download data (media information).
williamr@2
   815
        * @param sizeBytes The length of descriptor (second parameter) in bytes.
williamr@2
   816
		* @param aValue The value to be set.
williamr@2
   817
        * @return None.
williamr@2
   818
        */
williamr@2
   819
        IMPORT_C TInt SetDownloadDataAttribute( const TDesC8& aValue );
williamr@2
   820
        
williamr@2
   821
        /**
williamr@2
   822
        * Sets the download data (media information).
williamr@2
   823
        * @param sizeBytes The length of descriptor (second parameter) in bytes.
williamr@2
   824
		* @param aValue The value to be set.
williamr@2
   825
        * @return None.
williamr@2
   826
        */
williamr@2
   827
        IMPORT_C TInt SetTrackDataAttribute( const TInt aIndex, const TDesC8& aValue );
williamr@2
   828
williamr@2
   829
    public: // New functions
williamr@2
   830
williamr@2
   831
        /**
williamr@2
   832
        * Closes download subsession.
williamr@2
   833
        * @param -
williamr@2
   834
        * @return None.
williamr@2
   835
        */
williamr@2
   836
        void Close();
williamr@2
   837
        
williamr@2
   838
williamr@2
   839
        /**
williamr@2
   840
        * Indicates whether the download is closed.
williamr@2
   841
        * @param - None
williamr@2
   842
        * @return TBool - ETrue if download is closed else EFalse.
williamr@2
   843
        */        
williamr@2
   844
        TBool IsClosed()
williamr@2
   845
        {
williamr@2
   846
            return iClosed;
williamr@2
   847
        }
williamr@2
   848
        
williamr@2
   849
        /**
williamr@2
   850
        * Resume COD download.
williamr@2
   851
        * @param -
williamr@2
   852
        * @return None.
williamr@2
   853
        */
williamr@2
   854
		void ResumeCodDownloadL()  ;
williamr@2
   855
		
williamr@2
   856
		/**
williamr@2
   857
        * Get Downloaded Size of product.
williamr@2
   858
        * @param -
williamr@2
   859
        * @return TInt.
williamr@2
   860
        */
williamr@2
   861
		TInt GetProductDownloadedSize();        
williamr@2
   862
        
williamr@2
   863
     private: // New functions
williamr@2
   864
     
williamr@2
   865
        /**
williamr@2
   866
        * Closes download subsession. This is called internally to close the sub session when the download
williamr@2
   867
        * is completed. Only the subsession will be closed but retains the RHttpDownload object.
williamr@2
   868
        * @return none.
williamr@2
   869
        */
williamr@2
   870
        void CloseSubSession();
williamr@2
   871
        
williamr@2
   872
        /**
williamr@2
   873
        * This is called internally to save the downloaded subsession before closing the subsession
williamr@2
   874
        * @param -
williamr@2
   875
        * @return None.
williamr@2
   876
        */
williamr@2
   877
        void SaveDownloadInfoL();
williamr@2
   878
williamr@2
   879
        /**
williamr@2
   880
        * Creates download subsession.
williamr@2
   881
        * @param aUrl The url to be downloaded.
williamr@2
   882
        * @return None.
williamr@2
   883
        */
williamr@2
   884
        void CreateL( const TDesC8& aUrl, const TPtr8 aPackedAttribs );
williamr@2
   885
williamr@2
   886
        /**
williamr@2
   887
        * Attaches subsession to the server subsession by handle.
williamr@2
   888
        * @param aHandle A handle which identifies the server subsession.
williamr@2
   889
        * @return None.
williamr@2
   890
        */
williamr@2
   891
        void AttachL( TInt aHandle );
williamr@2
   892
williamr@2
   893
        /**
williamr@2
   894
        * Start event notification.
williamr@2
   895
        * @param aDownloadState State.
williamr@2
   896
        * @param aProgressState Progress.
williamr@2
   897
        * @param aEventAttrib Packed attribs
williamr@2
   898
        * @param aStatus Handler's request status.
williamr@2
   899
        * @return None.
williamr@2
   900
        */
williamr@2
   901
        void StartEventNotification( TDes8& aDownloadState,
williamr@2
   902
                                     TDes8& aProgressState,
williamr@2
   903
                                     TDes8& aEventAttrib,                                     
williamr@2
   904
                                     TRequestStatus& aStatus );
williamr@2
   905
williamr@2
   906
        /**
williamr@2
   907
        * Cancels event notification.
williamr@2
   908
        * @param -
williamr@2
   909
        * @return None.
williamr@2
   910
        */
williamr@2
   911
        void CancelEventNotification();
williamr@2
   912
williamr@2
   913
        /**
williamr@2
   914
        * Returns true if the handle is equals with the stored one.
williamr@2
   915
        * @param aHandle Handle.
williamr@2
   916
        * @return TBool.
williamr@2
   917
        */
williamr@2
   918
        TBool IsDownload( TInt aHandle );
williamr@2
   919
        
williamr@2
   920
        /**
williamr@2
   921
        * Returns true if the params belongs to this download.
williamr@2
   922
        * @since 2.8
williamr@2
   923
        * @param aParsedReqUrl given URL
williamr@2
   924
        * @param aMsgBody Message body from post operation
williamr@2
   925
        * @return TBool
williamr@2
   926
        */           
williamr@2
   927
        TBool IsDownloadL( const TUriParser8& aParsedReqUrl, 
williamr@2
   928
                           const TDesC8& aMsgBody );
williamr@2
   929
williamr@2
   930
		/**
williamr@2
   931
		* Sets the default value for the attributes.
williamr@2
   932
		* @param aDownload The download which default attributes to be set.
williamr@2
   933
        * @return None.
williamr@2
   934
		*/
williamr@2
   935
        void SetDefaultAttributesL( const TDesC8& aPackedAttribs );
williamr@2
   936
williamr@2
   937
		/**
williamr@2
   938
		* Buffers attributes which need when a client deletes download.
williamr@2
   939
		* @param None.
williamr@2
   940
        * @return None.
williamr@2
   941
		*/
williamr@2
   942
        void BufferAttributesL();
williamr@2
   943
williamr@2
   944
		/**
williamr@2
   945
		* Sets event type.
williamr@2
   946
		* @param aEventType.
williamr@2
   947
        * @return None.
williamr@2
   948
		*/
williamr@2
   949
        void SetEventType( THttpDownloadState aEventType );
williamr@2
   950
williamr@2
   951
		/**
williamr@2
   952
		* Sets http transaction.
williamr@2
   953
		* @param aHttpTransaction.
williamr@2
   954
        * @return None.
williamr@2
   955
		*/
williamr@2
   956
        void SetHttpTransactionL( TInt aHttpTransaction );
williamr@2
   957
williamr@2
   958
		/**
williamr@2
   959
		* Delete http transaction.
williamr@2
   960
		* @param .
williamr@2
   961
        * @return None.
williamr@2
   962
		*/
williamr@2
   963
        void DeleteTransaction();
williamr@2
   964
        
williamr@2
   965
		/**
williamr@2
   966
		* Initialize OMA DD download.
williamr@2
   967
        * @param aBuf The descriptor.
williamr@2
   968
        * @param aType Descriptor data type.
williamr@2
   969
        * @param aEikEnv Eikon environment or NULL. Can be NULL if download
williamr@2
   970
        * does not require UI functionality. If download needs UI but NULL is
williamr@2
   971
        * passed here, the download fails with EFailedPermanent KErrCancel.
williamr@2
   972
        * @return None.
williamr@2
   973
		*/        
williamr@2
   974
        void InitCodDownloadL( const TDesC8& aBuf, 
williamr@2
   975
                               const TDesC8& aMimeType,
williamr@2
   976
                               CEikonEnv* aEikEnv );
williamr@2
   977
williamr@2
   978
		/**
williamr@2
   979
		* Initialize paused OMA DD download.
williamr@2
   980
        * @param aAppUid App UID of the client.
williamr@2
   981
        * @return None.
williamr@2
   982
		*/ 
williamr@2
   983
       void InitPausedCodDownloadL( const TUid aAppUid );
williamr@2
   984
       
williamr@2
   985
		/**
williamr@2
   986
		* Starts COD download.
williamr@2
   987
        * @return None.
williamr@2
   988
		*/                               
williamr@2
   989
        void DoStartCodL();
williamr@2
   990
        
williamr@2
   991
		/**
williamr@2
   992
		* Checks the mime type of a completed content.
williamr@2
   993
		* Creates a cod download if it is considered as OMA DD.
williamr@2
   994
		* The return value is the result of the checking.
williamr@2
   995
		* Leaves in case of failure.
williamr@2
   996
        * @return TBool.
williamr@2
   997
		*/         
williamr@2
   998
        TBool CheckContentTypeAndCreateCodDownloadL();
williamr@2
   999
williamr@2
  1000
		/**
williamr@2
  1001
		* Sets the error value.
williamr@2
  1002
		* @param aAttribute Identifies the attribute to be set.
williamr@2
  1003
		* @param aValue The value to be set.
williamr@2
  1004
        * @return None.
williamr@2
  1005
		*/        
williamr@2
  1006
        TInt SetOnError( TInt aError,
williamr@2
  1007
                         THttpDownloadMgrError aDlError = EGeneral ); 
williamr@2
  1008
williamr@2
  1009
#ifdef DEAD_CODE
williamr@2
  1010
		/**
williamr@2
  1011
		* Allocate buffer for event attribute. Part of IPC optimalization.
williamr@2
  1012
        * @return HBufC8.
williamr@2
  1013
		*/      
williamr@2
  1014
        HBufC8* AllocEventAttribBufL();
williamr@2
  1015
#endif
williamr@2
  1016
        
williamr@2
  1017
		/**
williamr@2
  1018
		* Unpack event attribute package.
williamr@2
  1019
		* @param aPack Packed attributes.
williamr@2
  1020
        * @return None.
williamr@2
  1021
		*/          
williamr@2
  1022
        void UnpackEventAttribL( const TDesC8& aPack );
williamr@2
  1023
williamr@2
  1024
        /**
williamr@2
  1025
        * True if it is a client side download
williamr@2
  1026
        * @param -
williamr@2
  1027
        * @return TBool.
williamr@2
  1028
        */                                        
williamr@2
  1029
        TBool IsClientSideDownload() const;
williamr@2
  1030
        
williamr@2
  1031
        /**
williamr@2
  1032
        * Tells that download should be deleted.
williamr@2
  1033
        * @param None
williamr@2
  1034
        * @return TBool.
williamr@2
  1035
        */         
williamr@2
  1036
        TBool IsToBeDeleted();
williamr@2
  1037
        
williamr@2
  1038
        /**
williamr@2
  1039
        * Starts downloading.
williamr@2
  1040
        * @param None
williamr@2
  1041
        * @return None.
williamr@2
  1042
        */         
williamr@2
  1043
        void DoStartL(); 
williamr@2
  1044
        
williamr@2
  1045
        /**
williamr@2
  1046
        * Returns the the event priority flag from session
williamr@2
  1047
        * @return TInt
williamr@2
  1048
        */        
williamr@2
  1049
        TInt EventPriorityFlag() const;
williamr@2
  1050
        
williamr@2
  1051
        /**
williamr@2
  1052
        * ETrue if download should be deleted on COD completion.
williamr@2
  1053
        * @return TBool
williamr@2
  1054
        */         
williamr@2
  1055
        TBool IsDeleteCodWhenDone() const;
williamr@2
  1056
        
williamr@2
  1057
        /**
williamr@2
  1058
        * Sets COD in progress flag.
williamr@2
  1059
        * @return None
williamr@2
  1060
        */        
williamr@2
  1061
        void SetCodInProgress( TCodProgressState aVal ); 
williamr@2
  1062
williamr@2
  1063
        /**
williamr@2
  1064
        * Attach to an existing download.
williamr@2
  1065
        * @param aDlId Download ID.
williamr@2
  1066
        * @return None.
williamr@2
  1067
        */
williamr@2
  1068
        void AttachToDownloadL( const TInt32 aDlId );
williamr@2
  1069
        
williamr@2
  1070
        /**
williamr@2
  1071
        * Sets COD in progress flag.
williamr@2
  1072
        * @return iExtension
williamr@2
  1073
        */
williamr@2
  1074
        TInt32 ActiveMoIndex() const;
williamr@2
  1075
        
williamr@2
  1076
        /**
williamr@2
  1077
        * To stop waiting loop of AS
williamr@2
  1078
        * @return None.
williamr@2
  1079
        */
williamr@2
  1080
        void StopWaitingAS();
williamr@2
  1081
williamr@2
  1082
    private:    // Data
williamr@2
  1083
        // Event notification handler.
williamr@2
  1084
        CDownloadMgrHandler*     iDownloadHandler;  ///< Owned.
williamr@2
  1085
        // Download manager session.
williamr@2
  1086
        RHttpDownloadMgr*        iDownloadMgr;      ///< NOT Owned.
williamr@2
  1087
        // Unique identifier of server side subsession.
williamr@2
  1088
        TInt                     iHandle;
williamr@2
  1089
        // Extension class
williamr@2
  1090
        CRHttpDownloadExtension* iExtension;        ///< Owned.
williamr@2
  1091
williamr@2
  1092
        CTransactionObserver*    iTransactionObserver;
williamr@2
  1093
        RHTTPTransaction*        iHttpTransaction;
williamr@2
  1094
        // Descriptor Based download COD/DD
williamr@2
  1095
        CCodDownload*            iCodDownload;      ///< Owned.        
williamr@2
  1096
        // Cod observer
williamr@2
  1097
        CCodObserver*            iCodObserver;    ///< Owned.
williamr@2
  1098
        // Client Side Download
williamr@2
  1099
        TBool                    iClientSideDownload;
williamr@2
  1100
        // Boolean flag which indicates download closure
williamr@2
  1101
        TBool                    iClosed;
williamr@2
  1102
        // Boolean flag which indicates download subsession closure
williamr@2
  1103
        TBool                    iClosedSubSession;
williamr@2
  1104
        // Extension class to cache the cloased subsession
williamr@2
  1105
        CRHttpDlExtension* 		 iDlExtension;        ///< Owned.
williamr@2
  1106
        
williamr@2
  1107
        CActiveSchedulerWait*    iWait;
williamr@2
  1108
        
williamr@2
  1109
        // Boolean flag which indicates Active Scheduler is Ready
williamr@2
  1110
        TBool                    iASReady;
williamr@2
  1111
        
williamr@2
  1112
    public:     // Friend classes
williamr@2
  1113
 
williamr@2
  1114
        friend class CDownloadMgrHandler;
williamr@2
  1115
        friend class RHttpDownloadMgr;
williamr@2
  1116
        friend class RHttpDownloadMgrApiExt;
williamr@2
  1117
        friend class CTransactionObserver;
williamr@2
  1118
        friend class CCodObserver;
williamr@2
  1119
        friend class CDownloadMgrHandler;
williamr@2
  1120
williamr@2
  1121
	};
williamr@2
  1122
williamr@2
  1123
#endif /* __DOWNLOADMGR_CLIENT_H__ */
williamr@2
  1124