|
1 /* |
|
2 * Copyright (c) 2002-2005 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: Issues RConnection::DataTransferredRequest() and sends the |
|
15 * data volumes to sessions. |
|
16 * |
|
17 */ |
|
18 |
|
19 #include <es_sock.h> |
|
20 |
|
21 #include "CDataVolume.h" |
|
22 #include "ConnMonServ.h" |
|
23 #include "ConnMonDef.h" |
|
24 #include "log.h" |
|
25 |
|
26 // ============================ MEMBER FUNCTIONS =============================== |
|
27 |
|
28 // ----------------------------------------------------------------------------- |
|
29 // CDataVolume::CDataVolume |
|
30 // ----------------------------------------------------------------------------- |
|
31 // |
|
32 CDataVolume::CDataVolume( |
|
33 CConnMonServer* aServer, |
|
34 RConnection* aConnection, |
|
35 const TUint& aConnectionId ) |
|
36 : |
|
37 CActive( EConnMonPriorityNormal ), |
|
38 iServer( aServer ), |
|
39 iConnection( aConnection ), |
|
40 iConnectionId( aConnectionId ), |
|
41 iDlData( 0 ), |
|
42 iPckgDlData( iDlData ), |
|
43 iUlData( 0 ), |
|
44 iPckgUlData( iUlData ) |
|
45 { |
|
46 } |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // CDataVolume::Construct |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 void CDataVolume::Construct() |
|
53 { |
|
54 CActiveScheduler::Add( this ); |
|
55 } |
|
56 |
|
57 // Destructor |
|
58 CDataVolume::~CDataVolume() |
|
59 { |
|
60 Cancel(); |
|
61 } |
|
62 |
|
63 // ----------------------------------------------------------------------------- |
|
64 // CDataVolume::Receive |
|
65 // Requests a new event (activity changed) from RConnection |
|
66 // ----------------------------------------------------------------------------- |
|
67 // |
|
68 void CDataVolume::Receive() |
|
69 { |
|
70 if ( IsActive() ) |
|
71 { |
|
72 Cancel(); |
|
73 } |
|
74 |
|
75 iUlData = 0; |
|
76 iDlData = 0; |
|
77 |
|
78 iConnection->DataTransferredRequest( iPckgUlData, iPckgDlData, iStatus ); |
|
79 SetActive(); |
|
80 } |
|
81 |
|
82 // ----------------------------------------------------------------------------- |
|
83 // CDataVolume::DoCancel |
|
84 // Cancels the request from RConnection. |
|
85 // ----------------------------------------------------------------------------- |
|
86 // |
|
87 void CDataVolume::DoCancel() |
|
88 { |
|
89 if ( IsActive() ) |
|
90 { |
|
91 // Complete all outstanding data volume requests on this connection |
|
92 // Use the latest data volumes got from the ESOCK. |
|
93 iServer->SendDataVolumesToSessions( |
|
94 iConnectionId, |
|
95 iPckgDlData(), |
|
96 iPckgUlData(), |
|
97 KErrCancel ); |
|
98 |
|
99 // Cancel the request from RConnection |
|
100 iConnection->DataTransferredCancel(); |
|
101 } |
|
102 } |
|
103 |
|
104 // ----------------------------------------------------------------------------- |
|
105 // CDataVolume::RunL |
|
106 // Handles the event that has arrived from RConnection |
|
107 // ----------------------------------------------------------------------------- |
|
108 // |
|
109 void CDataVolume::RunL() |
|
110 { |
|
111 //LOGENTRFN("CDataVolume::RunL()") |
|
112 |
|
113 // All RunL():s outside CServer-derived main class MUST NOT LEAVE. |
|
114 // Use TRAPD when needed. |
|
115 |
|
116 LOGIT(".") |
|
117 LOGIT1("RunL: CDataVolume, status %d", iStatus.Int()) |
|
118 |
|
119 if ( iStatus.Int() != KErrNone ) |
|
120 { |
|
121 LOGIT1("SERVER: Data volume request FAILED <%d>", iStatus.Int()) |
|
122 } |
|
123 else |
|
124 { |
|
125 LOGIT2("SERVER: Data volume request completed: d:%d, u:%d", iPckgDlData(), iPckgUlData()) |
|
126 } |
|
127 |
|
128 // Complete all outstanding data volume requests on this connection |
|
129 iServer->SendDataVolumesToSessions( |
|
130 iConnectionId, |
|
131 iPckgDlData(), |
|
132 iPckgUlData(), |
|
133 iStatus.Int() ); |
|
134 |
|
135 // This is a one-shot active object. The object is connection specific, |
|
136 // constructed when needed for the first time, and reused as necessary. |
|
137 // Delete happens only when the connection specific attribute tables are |
|
138 // cleaned up. |
|
139 |
|
140 //LOGEXITFN("CDataVolume::RunL()") |
|
141 } |
|
142 |
|
143 // End-of-file |