|
1 /* |
|
2 * Copyright (c) 2010 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 //#include <downloadcontroller.h> |
|
27 |
|
28 #include "loadgen_loadbase.h" |
|
29 #include "loadgen_loadattributes.h" |
|
30 |
|
31 |
|
32 // FORWARD DECLARATIONS |
|
33 class CNetConnManager; |
|
34 |
|
35 |
|
36 // CLASS DECLARATIONS |
|
37 |
|
38 class CNetConn : public CLoadBase |
|
39 { |
|
40 public: |
|
41 static CNetConn* NewL(TNetConnAttributes& aAttributes, TInt aReferenceNumber); |
|
42 virtual ~CNetConn(); |
|
43 |
|
44 private: // Constructors |
|
45 CNetConn(TNetConnAttributes& aAttributes, TInt aReferenceNumber); |
|
46 void ConstructL(); |
|
47 |
|
48 public: // New methods |
|
49 virtual void Resume(); |
|
50 virtual void Suspend(); |
|
51 virtual void SetPriority(); |
|
52 virtual void Close(); |
|
53 virtual TPtrC Description(); |
|
54 inline TNetConnAttributes& Attributes() { return iAttributes; } |
|
55 inline void SetAttributes(TNetConnAttributes aAttributes) { iAttributes = aAttributes; } |
|
56 |
|
57 public: // New static methods |
|
58 static TInt ThreadFunction(TAny* aThreadArg); |
|
59 |
|
60 private: // New static methods |
|
61 static void GenerateLoad(TNetConnAttributes& aAttributes); |
|
62 |
|
63 private: // Data |
|
64 TNetConnAttributes iAttributes; |
|
65 RThread iThread; |
|
66 }; |
|
67 |
|
68 |
|
69 class CNetConnManager : public CActive, public MHttpDownloadMgrObserver |
|
70 { |
|
71 public: |
|
72 static CNetConnManager* NewL(TNetConnAttributes& aAttributes); |
|
73 ~CNetConnManager(); |
|
74 |
|
75 private: |
|
76 CNetConnManager(TNetConnAttributes& aAttributes); |
|
77 void ConstructL(); |
|
78 |
|
79 private: |
|
80 void RunL(); |
|
81 void DoCancel(); |
|
82 |
|
83 private: |
|
84 static TInt PeriodicTimerCallBack(TAny* aAny); |
|
85 void StartDownloadL(); |
|
86 |
|
87 private: // MHttpDownloadMgrObserver |
|
88 void HandleDMgrEventL(RHttpDownload& aDownload, THttpDownloadEvent aEvent); |
|
89 public: |
|
90 inline CPeriodic* PeriodicTimer() { return iPeriodicTimer; } |
|
91 |
|
92 private: |
|
93 TNetConnAttributes& iAttributes; |
|
94 CPeriodic* iPeriodicTimer; |
|
95 RHttpDownloadMgr iDownloadMgr; |
|
96 }; |
|
97 |
|
98 #endif |