loadgen/inc/loadgen_netconn.h
branchRCL_3
changeset 22 fad26422216a
equal deleted inserted replaced
21:b3cee849fa46 22:fad26422216a
       
     1 /*
       
     2 * Copyright (c) 2009 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 "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef LOADGEN_NETCONN_H
       
    20 #define LOADGEN_NETCONN_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32std.h>
       
    24 #include <e32base.h>
       
    25 #include <downloadmgrclient.h>
       
    26 
       
    27 #include "loadgen_loadbase.h"
       
    28 #include "loadgen_loadattributes.h"
       
    29 
       
    30 
       
    31 // FORWARD DECLARATIONS
       
    32 class CNetConnManager;
       
    33 
       
    34 
       
    35 // CLASS DECLARATIONS
       
    36 
       
    37 class CNetConn : public CLoadBase
       
    38     {
       
    39 public:
       
    40     static CNetConn* NewL(TNetConnAttributes& aAttributes, TInt aReferenceNumber);
       
    41     virtual ~CNetConn();
       
    42         
       
    43 private: // Constructors
       
    44     CNetConn(TNetConnAttributes& aAttributes, TInt aReferenceNumber);
       
    45     void ConstructL();  
       
    46 
       
    47 public:  // New methods
       
    48     virtual void Resume();
       
    49     virtual void Suspend();
       
    50     virtual void SetPriority();
       
    51     virtual void Close();
       
    52     virtual TPtrC Description();
       
    53     inline TNetConnAttributes& Attributes() { return iAttributes; }
       
    54 
       
    55 public:  // New static methods
       
    56     static TInt ThreadFunction(TAny* aThreadArg);
       
    57 
       
    58 private:  // New static methods
       
    59     static void GenerateLoad(TNetConnAttributes& aAttributes);
       
    60 
       
    61 private: // Data
       
    62     TNetConnAttributes          iAttributes;    
       
    63     RThread                     iThread;
       
    64     };
       
    65 
       
    66 
       
    67 class CNetConnManager : public CActive, public MHttpDownloadMgrObserver
       
    68     {
       
    69 public:
       
    70     static CNetConnManager* NewL(TNetConnAttributes& aAttributes);
       
    71     ~CNetConnManager();
       
    72 
       
    73 private:
       
    74     CNetConnManager(TNetConnAttributes& aAttributes);
       
    75     void ConstructL();
       
    76 
       
    77 private:
       
    78     void RunL();
       
    79     void DoCancel();
       
    80 
       
    81 private:
       
    82     static TInt PeriodicTimerCallBack(TAny* aAny);
       
    83     void StartDownloadL();
       
    84 
       
    85 private: // MHttpDownloadMgrObserver
       
    86     void HandleDMgrEventL(RHttpDownload& aDownload, THttpDownloadEvent aEvent); 
       
    87 public:
       
    88     inline CPeriodic* PeriodicTimer() { return iPeriodicTimer; }
       
    89 
       
    90 private:
       
    91     TNetConnAttributes&     iAttributes;    
       
    92     CPeriodic*              iPeriodicTimer;
       
    93     RHttpDownloadMgr        iDownloadMgr;
       
    94     }; 
       
    95 
       
    96 #endif