|
1 /* |
|
2 * Copyright (c) 2002 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 * Adapts data from Shared data GPRS counters to listbox |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef __Logs_App_GprsCtAdapter_H__ |
|
21 #define __Logs_App_GprsCtAdapter_H__ |
|
22 |
|
23 // INCLUDES |
|
24 #include <bamdesca.h> // MDesCArray |
|
25 #include <e32base.h> |
|
26 |
|
27 #include "LogsConstants.hrh" |
|
28 // CONSTANTS |
|
29 |
|
30 // MACROS |
|
31 |
|
32 // DATA TYPES |
|
33 |
|
34 // FUNCTION PROTOTYPES |
|
35 |
|
36 // FORWARD DECLARATIONS |
|
37 class MLogsSharedData; |
|
38 |
|
39 // CLASS DECLARATION |
|
40 |
|
41 /** |
|
42 * Adapts data from Shared data GPRS counters to listbox |
|
43 */ |
|
44 class CLogsGprsCtAdapter : public CBase, public MDesCArray |
|
45 { |
|
46 enum TGprsDirectionType |
|
47 { |
|
48 EGprsDirectionSent = 0, |
|
49 EGprsDirectionReceived |
|
50 }; |
|
51 |
|
52 public: // Constructors and destructor |
|
53 |
|
54 /** |
|
55 * Two-phased constructor. |
|
56 * |
|
57 * @param aSharedData shared data |
|
58 */ |
|
59 static CLogsGprsCtAdapter* NewL( MLogsSharedData* aSharedData ); |
|
60 |
|
61 /** |
|
62 * Destructor. |
|
63 */ |
|
64 virtual ~CLogsGprsCtAdapter(); |
|
65 |
|
66 private: |
|
67 /** |
|
68 * C++ default constructor. |
|
69 * |
|
70 * @param aSharedData shared data |
|
71 */ |
|
72 CLogsGprsCtAdapter( MLogsSharedData* aSharedData ); |
|
73 |
|
74 /** |
|
75 * Symbian OS constructor. |
|
76 */ |
|
77 void ConstructL(); |
|
78 |
|
79 private: // from MDesCArray |
|
80 |
|
81 /** |
|
82 * Returns number of entries |
|
83 * |
|
84 * @return TInt |
|
85 */ |
|
86 TInt MdcaCount() const; |
|
87 |
|
88 /** |
|
89 * Returns a TPtrC related with the position given by aIndex |
|
90 * |
|
91 * @param TInt aIndex |
|
92 * @return TPtrC16 |
|
93 */ |
|
94 TPtrC16 MdcaPoint( TInt aIndex ) const; |
|
95 |
|
96 private: |
|
97 |
|
98 /** |
|
99 * Construct GPRS connection amount descriptor |
|
100 * |
|
101 * @param aDirection in / out direction |
|
102 */ |
|
103 void ConstructAmountDescriptor( TGprsDirectionType aDirection ) const; |
|
104 |
|
105 /** |
|
106 * Construct GPRS connection amount second phase |
|
107 * |
|
108 * @param aDes descriptor to put result into |
|
109 * @param aDividend dividend |
|
110 * @param aDivisor divisor |
|
111 */ |
|
112 void CalcPercentage( TInt64 aDividend, |
|
113 TInt64 aDivisor ) const; |
|
114 |
|
115 private: //data |
|
116 |
|
117 /// Ref: shared data |
|
118 MLogsSharedData* iSharedData; |
|
119 |
|
120 /// Own: Conversion buffer |
|
121 TBuf<KLogsBuff128> iBuffer; |
|
122 |
|
123 /// Own: Sent title |
|
124 HBufC* iSentTitle; |
|
125 |
|
126 /// Own: Received title |
|
127 HBufC* iReceivedTitle; |
|
128 |
|
129 /// Own: bytes text |
|
130 HBufC* iBytes; |
|
131 |
|
132 /// Own: kilobytes text |
|
133 HBufC* iKBytes; |
|
134 |
|
135 /// Own: megabytes text |
|
136 HBufC* iMBytes; |
|
137 |
|
138 /// Own: gigabytes text |
|
139 HBufC* iGBytes; |
|
140 |
|
141 }; |
|
142 |
|
143 #endif // __Logs_App_GprsCtAdapter_H__ |
|
144 |
|
145 // End of File |