author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:59:48 +0300 | |
branch | RCL_3 |
changeset 69 | cf1b3ddbe9a1 |
parent 58 | 83ca720e2b9a |
permissions | -rw-r--r-- |
58 | 1 |
/* |
2 |
* Copyright (c) 2004 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: Represents a connection |
|
15 |
* |
|
16 |
* |
|
17 |
*/ |
|
18 |
||
19 |
||
20 |
// INCLUDE FILES |
|
21 |
//#include <nifvar.h> |
|
22 |
#include <StringLoader.h> |
|
23 |
#include <ConnectionMonitorUi.rsg> |
|
24 |
#include <ConnectionMonitorUi.mbg> |
|
25 |
#include <AknUtils.h> |
|
26 |
||
27 |
#include "ConnectionMonitorUiLogger.h" |
|
28 |
#include "CsdConnectionInfo.h" |
|
29 |
#include "ActiveWrapper.h" |
|
30 |
||
31 |
// CONSTANTS |
|
32 |
||
33 |
LOCAL_D const TUint KDetailsArrayGranularityInternal = 9; |
|
34 |
LOCAL_D const TUint KDetailsArrayGranularityExternal = 4; |
|
35 |
||
36 |
// ================= MEMBER FUNCTIONS ======================= |
|
37 |
// --------------------------------------------------------- |
|
38 |
// CCsdConnectionInfo::NewL |
|
39 |
// --------------------------------------------------------- |
|
40 |
// |
|
41 |
CCsdConnectionInfo* CCsdConnectionInfo::NewL( TInt aConnectionId, |
|
42 |
RConnectionMonitor* const aConnectionMonitor, |
|
43 |
TConnMonBearerType aConnectionBearerType, |
|
44 |
CActiveWrapper* aActiveWrapper ) |
|
45 |
{ |
|
46 |
CMUILOGGER_WRITE( "NewL, CCsdsConnectionInfo - start " ); |
|
47 |
||
48 |
CCsdConnectionInfo* self = new ( ELeave ) CCsdConnectionInfo( |
|
49 |
aConnectionId, |
|
50 |
aConnectionMonitor, |
|
51 |
aConnectionBearerType, |
|
52 |
aActiveWrapper ); |
|
53 |
CMUILOGGER_WRITE( "NewL, CCsdsConnectionInfo - created " ); |
|
54 |
CleanupStack::PushL( self ); |
|
55 |
self->ConstructL(); |
|
56 |
CleanupStack::Pop( self ); |
|
57 |
CMUILOGGER_WRITE( "NewL, CCsdsConnectionInfo - end " ); |
|
58 |
return self; |
|
59 |
} |
|
60 |
||
61 |
||
62 |
// --------------------------------------------------------- |
|
63 |
// CCsdConnectionInfo::~CCsdConnectionInfo |
|
64 |
// --------------------------------------------------------- |
|
65 |
// |
|
66 |
CCsdConnectionInfo::~CCsdConnectionInfo() |
|
67 |
{ |
|
68 |
} |
|
69 |
||
70 |
||
71 |
// --------------------------------------------------------- |
|
72 |
// CCsdConnectionInfo::CCsdConnectionInfo |
|
73 |
// --------------------------------------------------------- |
|
74 |
// |
|
75 |
CCsdConnectionInfo::CCsdConnectionInfo( TInt aConnectionId, |
|
76 |
RConnectionMonitor* const aConnectionMonitor, |
|
77 |
TConnMonBearerType aConnectionBearerType, |
|
78 |
CActiveWrapper* aActiveWrapper ) : |
|
79 |
CConnectionInfoBase( aConnectionId, |
|
80 |
aConnectionMonitor, |
|
81 |
aConnectionBearerType, |
|
82 |
aActiveWrapper ) |
|
83 |
{ |
|
84 |
CMUILOGGER_WRITE( "CCsdConnectionInfo constuctor" ); |
|
85 |
} |
|
86 |
||
87 |
||
88 |
// --------------------------------------------------------- |
|
89 |
// CCsdConnectionInfo::ConstructL |
|
90 |
// --------------------------------------------------------- |
|
91 |
// |
|
92 |
void CCsdConnectionInfo::ConstructL() |
|
93 |
{ |
|
94 |
CMUILOGGER_WRITE( "CCsdConnectionInfo::ConstructL() start" ); |
|
95 |
||
96 |
iActiveWrapper->StartGetStringAttribute( iConnectionId, |
|
97 |
iConnectionMonitor, |
|
98 |
KTelNumber, |
|
99 |
iDialupNumber ); |
|
100 |
TInt err( iActiveWrapper->iStatus.Int() ); |
|
101 |
CMUILOGGER_WRITE_F( "CCsdConnectionInfo::ConstructL() status: %d", |
|
102 |
err ); |
|
103 |
if ( err != KErrNone ) |
|
104 |
{ |
|
105 |
User::Leave( err ); |
|
106 |
} |
|
107 |
||
108 |
CConnectionInfoBase::ConstructL(); |
|
109 |
CMUILOGGER_WRITE( "CCsdConnectionInfo::ConstructL() end" ); |
|
110 |
} |
|
111 |
||
112 |
||
113 |
// --------------------------------------------------------- |
|
114 |
// CCsdConnectionInfo::DeepCopyL |
|
115 |
// --------------------------------------------------------- |
|
116 |
// |
|
117 |
CConnectionInfoBase* CCsdConnectionInfo::DeepCopyL() |
|
118 |
{ |
|
119 |
CCsdConnectionInfo* temp = new ( ELeave ) CCsdConnectionInfo( |
|
120 |
iConnectionId, |
|
121 |
iConnectionMonitor, |
|
122 |
iConnectionBearerType, |
|
123 |
iActiveWrapper ); |
|
124 |
||
125 |
temp->iConnectionName = iConnectionName; |
|
126 |
temp->iConnectionStatus = iConnectionStatus; |
|
127 |
temp->iUploaded = iUploaded; |
|
128 |
temp->iDownloaded = iDownloaded; |
|
129 |
temp->iStartTime = iStartTime; |
|
130 |
temp->iDuration = iDuration; |
|
131 |
temp->iLastSpeedUpdate = iLastSpeedUpdate; |
|
132 |
temp->iUpSpeed = iUpSpeed; |
|
133 |
temp->iDownSpeed = iDownSpeed; |
|
134 |
temp->iListBoxItemText = iListBoxItemText; |
|
135 |
||
136 |
temp->iDialupNumber = iDialupNumber; |
|
137 |
||
138 |
if ( iDetailsArray ) |
|
139 |
{ |
|
140 |
CleanupStack::PushL( temp ); |
|
141 |
temp->ToArrayDetailsL(); |
|
142 |
CleanupStack::Pop( temp ); |
|
143 |
} |
|
144 |
||
145 |
return temp; |
|
146 |
} |
|
147 |
||
148 |
||
149 |
// --------------------------------------------------------- |
|
150 |
// CCsdConnectionInfo::GetIconId |
|
151 |
// --------------------------------------------------------- |
|
152 |
// |
|
153 |
TUint CCsdConnectionInfo::GetIconId() const |
|
154 |
{ |
|
155 |
TUint iconId = ECsd; |
|
156 |
if ( ( iConnectionBearerType == EBearerHSCSD ) || |
|
157 |
( iConnectionBearerType == EBearerExternalHSCSD ) ) |
|
158 |
{ |
|
159 |
iconId = EHscsd; |
|
160 |
} |
|
161 |
return iconId; |
|
162 |
} |
|
163 |
||
164 |
// --------------------------------------------------------- |
|
165 |
// CCsdConnectionInfo::RefreshDetailsL |
|
166 |
// --------------------------------------------------------- |
|
167 |
// |
|
168 |
void CCsdConnectionInfo::RefreshDetailsL() |
|
169 |
{ |
|
170 |
CMUILOGGER_WRITE( "CCsdConnectionInfo::RefreshDetailsL start" ); |
|
171 |
||
172 |
CMUILOGGER_WRITE_F( "before iConnectionBearerType: %d", |
|
173 |
( TInt )iConnectionBearerType ); |
|
174 |
||
175 |
TConnMonBearerType bearerType; |
|
176 |
||
177 |
iActiveWrapper->StartGetIntAttribute( iConnectionId, |
|
178 |
iConnectionMonitor, |
|
179 |
KBearer, |
|
180 |
( TInt& )bearerType ); |
|
181 |
||
182 |
if ( !iActiveWrapper->iStatus.Int() ) |
|
183 |
{ |
|
184 |
iConnectionBearerType = bearerType; |
|
185 |
} |
|
186 |
||
187 |
CMUILOGGER_WRITE_F( "status.Int(): %d", iActiveWrapper->iStatus.Int() ); |
|
188 |
CMUILOGGER_WRITE_F( "bearerType: %d", ( TInt )bearerType ); |
|
189 |
CMUILOGGER_WRITE_F( "after iConnectionBearerType: %d", ( TInt )iConnectionBearerType ); |
|
190 |
||
191 |
if ( iConnectionBearerType < EBearerExternalCSD ) |
|
192 |
{ |
|
193 |
RefreshTransferSpeedsL(); |
|
194 |
} |
|
195 |
RefreshDuration(); |
|
196 |
CMUILOGGER_WRITE( "CCsdConnectionInfo::RefreshDetailsL end" ); |
|
197 |
} |
|
198 |
||
199 |
// --------------------------------------------------------- |
|
200 |
// CCsdConnectionInfo::ToStringDialupNumberLC |
|
201 |
// --------------------------------------------------------- |
|
202 |
// |
|
203 |
HBufC* CCsdConnectionInfo::ToStringDialupNumberLC() const |
|
204 |
{ |
|
205 |
HBufC* dialupNumber = iDialupNumber.AllocLC(); |
|
206 |
TPtr temp( dialupNumber->Des() ); |
|
207 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion( temp ); |
|
208 |
||
209 |
return dialupNumber; |
|
210 |
} |
|
211 |
||
212 |
||
213 |
// --------------------------------------------------------- |
|
214 |
// CCsdConnectionInfo::RefreshConnectionListBoxItemTextL |
|
215 |
// --------------------------------------------------------- |
|
216 |
// |
|
217 |
void CCsdConnectionInfo::RefreshConnectionListBoxItemTextL() |
|
218 |
{ |
|
219 |
CMUILOGGER_WRITE( |
|
220 |
"CCsdConnectionInfo::RefreshConnectionListBoxItemTextL start" ); |
|
221 |
||
222 |
TUint iconId; |
|
223 |
HBufC* secondRow = NULL; |
|
224 |
||
225 |
iconId = GetIconId(); |
|
226 |
||
227 |
if ( iConnectionStatus == EConnectionCreated ) |
|
228 |
{ |
|
229 |
secondRow = ToStringDurationLC(); |
|
230 |
} |
|
231 |
else // if connection has not created yet gives back the status of its. |
|
232 |
{ |
|
233 |
secondRow = ToStringStatusLC( EFalse ); |
|
234 |
} |
|
235 |
||
236 |
iListBoxItemText.Format( KConnectonListItemTextFormat, iconId, |
|
237 |
&iConnectionName, secondRow ); |
|
238 |
CleanupStack::PopAndDestroy( secondRow ); |
|
239 |
CMUILOGGER_WRITE( |
|
240 |
"CCsdConnectionInfo::RefreshConnectionListBoxItemTextL end" ); |
|
241 |
} |
|
242 |
||
243 |
||
244 |
// --------------------------------------------------------- |
|
245 |
// CCsdConnectionInfo::RefreshDetailsArrayL |
|
246 |
// --------------------------------------------------------- |
|
247 |
// |
|
248 |
void CCsdConnectionInfo::RefreshDetailsArrayL() |
|
249 |
{ |
|
250 |
CMUILOGGER_WRITE( "CCsdConnectionInfo::RefreshDetailsArrayL start" ); |
|
251 |
if ( iDetailsArray ) |
|
252 |
{ |
|
253 |
TBool internal = iConnectionBearerType < EBearerExternalCSD ; |
|
254 |
HBufC* temp = NULL; |
|
255 |
||
256 |
if ( internal ) |
|
257 |
{ |
|
258 |
temp = ToStringStatusLC(); |
|
259 |
ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_STATUS, |
|
260 |
temp, 2 ); |
|
261 |
||
262 |
ToDetailsListBoxItemTextWithReplaceL |
|
263 |
( |
|
264 |
R_QTN_CMON_HEADING_DATA_TOTAL, |
|
265 |
ToStringTotalTransmittedDataLC(), |
|
266 |
3 |
|
267 |
); |
|
268 |
||
269 |
ToDetailsListBoxItemTextWithReplaceL |
|
270 |
( |
|
271 |
R_QTN_CMON_HEADING_DATA_RECEIVED, |
|
272 |
ToStringReceivedDataLC(), |
|
273 |
4 |
|
274 |
); |
|
275 |
||
276 |
ToDetailsListBoxItemTextWithReplaceL |
|
277 |
( |
|
278 |
R_QTN_CMON_HEADING_DATA_SENT, |
|
279 |
ToStringSentDataLC(), |
|
280 |
5 |
|
281 |
); |
|
282 |
||
283 |
ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_DURATION, |
|
284 |
ToStringDurationLC(), 6 ); |
|
285 |
||
286 |
ToDetailsListBoxItemTextWithReplaceL |
|
287 |
( |
|
288 |
R_QTN_CMON_HEADING_SPEED, |
|
289 |
ToStringTransferSpeedDownLC(), |
|
290 |
7 |
|
291 |
); |
|
292 |
||
293 |
ToDetailsListBoxItemTextWithReplaceL |
|
294 |
( |
|
295 |
0, |
|
296 |
ToStringTransferSpeedUpLC(), |
|
297 |
8 |
|
298 |
); |
|
299 |
||
300 |
CleanupStack::PopAndDestroy( 7, temp ); // ToString...LC() |
|
301 |
||
302 |
TInt sharing = RefreshAppNamesL(); |
|
303 |
||
69
cf1b3ddbe9a1
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
58
diff
changeset
|
304 |
if ( sharing > 1 ) |
58 | 305 |
{ |
306 |
if ( iDetailsArray->Count() > 10 ) |
|
307 |
{ |
|
308 |
iDetailsArray->Delete( 10, |
|
309 |
iDetailsArray->Count() - 10 ); |
|
310 |
iDetailsArray->Compress(); |
|
311 |
} |
|
312 |
||
313 |
for ( TInt i = 0; i < sharing; i++ ) |
|
314 |
{ |
|
315 |
if ( i == 0 ) |
|
316 |
{ |
|
317 |
ToDetailsListBoxItemTextWithAppendL( |
|
318 |
R_QTN_CMON_HEADING_SHARING_INFO, |
|
319 |
ToStringAppNameLC( i ) ); |
|
320 |
} |
|
321 |
else |
|
322 |
{ |
|
323 |
ToDetailsListBoxItemTextWithAppendL( 0, |
|
324 |
ToStringAppNameLC( i ) ); |
|
325 |
} |
|
326 |
} |
|
327 |
CleanupStack::PopAndDestroy( sharing ); |
|
328 |
// ToStringAppNameLC() |
|
329 |
} |
|
330 |
else |
|
331 |
{ |
|
332 |
if ( iDetailsArray->Count() > 10 ) |
|
333 |
{ |
|
334 |
iDetailsArray->Delete( 10, iDetailsArray->Count() - 10 ); |
|
335 |
iDetailsArray->Compress(); |
|
336 |
} |
|
337 |
} |
|
338 |
} |
|
339 |
else |
|
340 |
{ |
|
341 |
ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_DURATION, |
|
342 |
ToStringDurationLC(), 2 ); |
|
343 |
CleanupStack::PopAndDestroy( 1 ); // ToStringDurationLC() |
|
344 |
} |
|
345 |
} |
|
346 |
CMUILOGGER_WRITE( "CCsdConnectionInfo::RefreshDetailsArrayL end" ); |
|
347 |
} |
|
348 |
||
349 |
||
350 |
// --------------------------------------------------------- |
|
351 |
// CCsdConnectionInfo::ToArrayDetailsL |
|
352 |
// --------------------------------------------------------- |
|
353 |
// |
|
354 |
void CCsdConnectionInfo::ToArrayDetailsL() |
|
355 |
{ |
|
356 |
CMUILOGGER_ENTERFN("CCsdConnectionInfo::ToArrayDetailsL"); |
|
357 |
TBool internal = iConnectionBearerType < EBearerExternalCSD ; |
|
358 |
TUint granularity = KDetailsArrayGranularityExternal; |
|
359 |
HBufC* temp = NULL; |
|
360 |
||
361 |
if ( internal ) |
|
362 |
{ |
|
363 |
granularity = KDetailsArrayGranularityInternal; |
|
364 |
} |
|
365 |
delete iDetailsArray; |
|
366 |
iDetailsArray = NULL; |
|
367 |
iDetailsArray = new ( ELeave ) CDesCArrayFlat( granularity ); |
|
368 |
||
369 |
temp = iConnectionName.AllocLC(); |
|
370 |
ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_CONN_NAME, |
|
371 |
temp ); |
|
372 |
||
373 |
ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_BEARER, |
|
374 |
ToStringBearerLC() ); |
|
375 |
CleanupStack::PopAndDestroy( 2, temp ); // ToString...LC() |
|
376 |
||
377 |
||
378 |
if ( internal ) |
|
379 |
{ |
|
380 |
temp = ToStringStatusLC(); |
|
381 |
ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_STATUS, |
|
382 |
temp ); |
|
383 |
||
384 |
ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_DATA_TOTAL, |
|
385 |
ToStringTotalTransmittedDataLC() ); |
|
386 |
||
387 |
ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_DATA_RECEIVED, |
|
388 |
ToStringReceivedDataLC() ); |
|
389 |
||
390 |
ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_DATA_SENT, |
|
391 |
ToStringSentDataLC() ); |
|
392 |
CleanupStack::PopAndDestroy( 4, temp ); // ToString...LC() |
|
393 |
} |
|
394 |
||
395 |
ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_DURATION, |
|
396 |
ToStringDurationLC() ); |
|
397 |
CleanupStack::PopAndDestroy( 1 ); // ToStringDurationLC() |
|
398 |
||
399 |
if ( internal ) |
|
400 |
{ |
|
401 |
temp = ToStringTransferSpeedDownLC(); |
|
402 |
||
403 |
ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_SPEED, |
|
404 |
temp ); |
|
405 |
||
406 |
ToDetailsListBoxItemTextWithAppendL( 0, |
|
407 |
ToStringTransferSpeedUpLC() ); |
|
408 |
CleanupStack::PopAndDestroy( 2, temp ); // ToString...LC() |
|
409 |
} |
|
410 |
||
411 |
ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_CSD_NUMBER, |
|
412 |
ToStringDialupNumberLC() ); |
|
413 |
CleanupStack::PopAndDestroy( 1 ); // ToStringDialupNumberLC() |
|
414 |
||
415 |
if ( internal ) |
|
416 |
{ |
|
417 |
TInt sharing = RefreshAppNamesL(); |
|
418 |
||
69
cf1b3ddbe9a1
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
58
diff
changeset
|
419 |
if ( sharing > 1 ) |
58 | 420 |
{ |
421 |
for ( TInt i = 0; i < sharing; i++ ) |
|
422 |
{ |
|
423 |
if ( i == 0 ) |
|
424 |
{ |
|
425 |
ToDetailsListBoxItemTextWithAppendL( |
|
426 |
R_QTN_CMON_HEADING_SHARING_INFO, |
|
427 |
ToStringAppNameLC( i ) ); |
|
428 |
} |
|
429 |
else |
|
430 |
{ |
|
431 |
ToDetailsListBoxItemTextWithAppendL( 0, |
|
432 |
ToStringAppNameLC( i ) ); |
|
433 |
} |
|
434 |
} |
|
435 |
CleanupStack::PopAndDestroy( sharing ); |
|
436 |
// ToStringAppNameLC() |
|
437 |
} |
|
438 |
} |
|
439 |
CMUILOGGER_LEAVEFN("CCsdConnectionInfo::ToArrayDetailsL"); |
|
440 |
} |
|
441 |
||
442 |
||
443 |
||
444 |
// End of File |