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