pushmtm/Plugins/PushContentHandler/PushMtmCacheSupply.h
branchRCL_3
changeset 64 6385c4c93049
parent 63 4baee4f15982
child 65 8e6fa1719340
equal deleted inserted replaced
63:4baee4f15982 64:6385c4c93049
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Definition of CPushMtmCacheSupply
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPUSHMTMCACHESUPPLY_H
       
    20 #define CPUSHMTMCACHESUPPLY_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <brctldefs.h>
       
    25 #include "httpcachemanager.h"
       
    26 
       
    27 // CONSTANTS
       
    28 
       
    29 // MACROS
       
    30 
       
    31 // DATA TYPES
       
    32 
       
    33 // FUNCTION PROTOTYPES
       
    34 
       
    35 // FORWARD DECLARATIONS
       
    36 class CHttpTransaction;
       
    37 class CPeriodic;
       
    38 class CPushMtmCacheDataSupplier;
       
    39 
       
    40 // CLASS DECLARATION
       
    41 
       
    42 
       
    43 
       
    44 class MCacheSupplyCallbacks
       
    45     {
       
    46     public:
       
    47         virtual RHTTPTransaction* Transaction() = 0;
       
    48         virtual void HandleEventL(THTTPEvent aEvent) = 0;
       
    49     };
       
    50 
       
    51 
       
    52 /**
       
    53 *  This class handles http transactions.
       
    54 *  @lib PushMtmContentHandler
       
    55 *  @since 3.1
       
    56 */
       
    57 class CPushMtmCacheSupply : public CBase
       
    58     {
       
    59     public:  // Constructors and destructor
       
    60 
       
    61         /**
       
    62         * Two-phased constructor.
       
    63         * @param
       
    64         * @param
       
    65         * @param
       
    66         * @return Http cache  object.
       
    67         */
       
    68         static CPushMtmCacheSupply* NewL( CHttpCacheManager* aCacheMgr, MCacheSupplyCallbacks* aCacheSupplyCallbacks );
       
    69 
       
    70         /**
       
    71         * Destructor.
       
    72         */
       
    73         virtual ~CPushMtmCacheSupply();
       
    74 
       
    75     public: // new functions
       
    76 
       
    77         /**
       
    78         *
       
    79         * @since 3.1
       
    80         * @param
       
    81         * @return
       
    82         */
       
    83         TInt StartRequestL(  );
       
    84 
       
    85         /**
       
    86         *
       
    87         * @since 3.1
       
    88         * @param
       
    89         * @return
       
    90         */
       
    91         void CloseRequest();
       
    92 
       
    93         /**
       
    94         *
       
    95         * @since 3.1
       
    96         * @param
       
    97         * @return
       
    98         */
       
    99         void HeadersReceivedL();
       
   100 
       
   101         /**
       
   102         *
       
   103         * @since 3.1
       
   104         * @param
       
   105         * @return
       
   106         */
       
   107         void BodyReceivedL();
       
   108 
       
   109         /**
       
   110         *
       
   111         * @since 3.1
       
   112         * @param
       
   113         * @return
       
   114         */
       
   115         void ResponseCompleteL();
       
   116 
       
   117         /**
       
   118         *
       
   119         * @since 3.1
       
   120         * @param
       
   121         * @return
       
   122         */
       
   123         TInt ResponseState() const { return iReponseState;}
       
   124 
       
   125         /**
       
   126         *
       
   127         * @since 3.1
       
   128         * @param
       
   129         * @return
       
   130         */
       
   131         TBool IsSupplying()             { return iResponseTimer!=0; }
       
   132 
       
   133         /**
       
   134         *
       
   135         * @since 3.1
       
   136         * @param
       
   137         * @return
       
   138         */
       
   139 		void PauseSupply();
       
   140 
       
   141         /**
       
   142         *
       
   143         * @since 3.1
       
   144         * @param
       
   145         * @return
       
   146         */
       
   147 		void ResumeSupply();
       
   148 
       
   149     private:
       
   150 
       
   151         /**
       
   152         * Construct.
       
   153         * @param
       
   154         * @param
       
   155         * @parem
       
   156         * @return
       
   157         */
       
   158         CPushMtmCacheSupply( MCacheSupplyCallbacks* aCacheSupplyCallbacks  );
       
   159 
       
   160         /**
       
   161         * By default Symbian 2nd phase constructor is private.
       
   162         */
       
   163         void ConstructL(CHttpCacheManager* aCacheMgr);
       
   164 
       
   165     private: //
       
   166 
       
   167         /**
       
   168         * Callback for async response
       
   169         * @since 3.1
       
   170         * @param  aAny this pinter
       
   171         * @return TInt KErrNone
       
   172         */
       
   173         static TInt ResponseCallbackL( TAny* aAny );
       
   174 
       
   175         /**
       
   176         *
       
   177         * @since 3.1
       
   178         * @param
       
   179         * @return
       
   180         */
       
   181         void SupplyResponseL();
       
   182 
       
   183         /**
       
   184         *
       
   185         * @since 3.1
       
   186         * @param
       
   187         * @return
       
   188         */
       
   189         void SendBodyL();
       
   190 
       
   191     private:    // Data
       
   192 
       
   193         //
       
   194         CHttpCacheManager*              iCacheManager;          // not owned
       
   195         //
       
   196         TInt                            iReponseState;
       
   197         //
       
   198         CPeriodic*                      iResponseTimer;         // owned
       
   199         //
       
   200         TBool                           iFailed;
       
   201         //
       
   202         TBool                           iNotModified;
       
   203         //
       
   204         THttpCacheEntry                 iCacheEntry;
       
   205         // ETrue if the cache object is closed
       
   206         TBool							iClosed;
       
   207 
       
   208         CPushMtmCacheDataSupplier*      iDataSupplier;
       
   209         MCacheSupplyCallbacks*          iCacheSupplyCallbacks;
       
   210   };
       
   211 
       
   212 #endif      // CPUSHMTMCACHESUPPLY_H
       
   213 
       
   214 // End of File