1 /* |
|
2 * Copyright (c) 2006-2007 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: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <s32strm.h> |
|
20 |
|
21 #include "irdebug.h" |
|
22 #include "irreportsettings.h" |
|
23 #include "irnmslogger.h" |
|
24 |
|
25 //const TInt KMaxUrlLength = 256 |
|
26 |
|
27 // ============================== Function declaration ======================= |
|
28 |
|
29 // --------------------------------------------------------------------------- |
|
30 // Function: NewL |
|
31 // Two phase constructor returns the instance of CIRNmsLogger |
|
32 // --------------------------------------------------------------------------- |
|
33 // |
|
34 CIRNmsLogger* CIRNmsLogger::NewL() |
|
35 { |
|
36 IRLOG_DEBUG( "CIRNmsLogger::NewL" ); |
|
37 CIRNmsLogger* self = CIRNmsLogger::NewLC(); |
|
38 CleanupStack::Pop(self); |
|
39 IRLOG_DEBUG( "CIRNmsLogger::NewL - Exiting." ); |
|
40 return self; |
|
41 } |
|
42 |
|
43 |
|
44 // --------------------------------------------------------------------------- |
|
45 // Function: NewLC |
|
46 // Two phase constructor creates the instance of CIRNmsLogger |
|
47 // --------------------------------------------------------------------------- |
|
48 // |
|
49 CIRNmsLogger* CIRNmsLogger::NewLC() |
|
50 { |
|
51 IRLOG_DEBUG( "CIRNmsLogger::NewLC" ); |
|
52 CIRNmsLogger* self = new (ELeave) CIRNmsLogger; |
|
53 CleanupStack::PushL(self); |
|
54 self->ConstructL(); |
|
55 IRLOG_DEBUG( "CIRNmsLogger::NewLC - Exiting." ); |
|
56 return self; |
|
57 } |
|
58 |
|
59 // --------------------------------------------------------------------------- |
|
60 // Function: ~CIRNmsLogger |
|
61 // default destructor |
|
62 // --------------------------------------------------------------------------- |
|
63 // |
|
64 CIRNmsLogger::~CIRNmsLogger() |
|
65 { |
|
66 } |
|
67 |
|
68 // --------------------------------------------------------------------------- |
|
69 // Function: ConstructL |
|
70 // Two phase constructor |
|
71 // --------------------------------------------------------------------------- |
|
72 // |
|
73 void CIRNmsLogger::ConstructL() |
|
74 { |
|
75 //No implementation |
|
76 //return; |
|
77 } |
|
78 |
|
79 // --------------------------------------------------------------------------- |
|
80 // Function: CIRNmsLogger |
|
81 // default constructor |
|
82 // --------------------------------------------------------------------------- |
|
83 // |
|
84 CIRNmsLogger::CIRNmsLogger() |
|
85 { |
|
86 //No implementation |
|
87 } |
|
88 |
|
89 |
|
90 // --------------------------------------------------------------------------- |
|
91 // Function: ResetResource |
|
92 // reset data from channel server |
|
93 // --------------------------------------------------------------------------- |
|
94 // |
|
95 void CIRNmsLogger::ResetResource() |
|
96 { |
|
97 IRLOG_DEBUG( "CIRNmsLogger::ResetResource" ); |
|
98 //reseting of resource |
|
99 } |
|
100 |
|
101 |
|
102 |
|
103 // --------------------------------------------------------------------------- |
|
104 // Function: UpdateChannelID |
|
105 // updates the channel id |
|
106 // --------------------------------------------------------------------------- |
|
107 // |
|
108 void CIRNmsLogger::UpdateChannelID(TInt aChanneldID) |
|
109 { |
|
110 IRLOG_DEBUG( "CIRNmsLogger::UpdateChannelID" ); |
|
111 iChannelId = aChanneldID; |
|
112 } |
|
113 |
|
114 // --------------------------------------------------------------------------- |
|
115 // Function: UpdateCurrentNetwork |
|
116 // updates the current network |
|
117 // --------------------------------------------------------------------------- |
|
118 // |
|
119 void CIRNmsLogger::UpdateCurrentNetwork(TInt aCurrentNetwork) |
|
120 { |
|
121 IRLOG_DEBUG( "CIRNmsLogger::UpdateCurrentNetwork" ); |
|
122 iNmsCurrentNetwork = aCurrentNetwork; |
|
123 } |
|
124 |
|
125 // --------------------------------------------------------------------------- |
|
126 // Function: UpdateHomeOperator |
|
127 // updates the home network |
|
128 // --------------------------------------------------------------------------- |
|
129 // |
|
130 void CIRNmsLogger::UpdateHomeOperator(TInt aHomeOperator) |
|
131 { |
|
132 IRLOG_DEBUG( "CIRNmsLogger::UpdateHomeOperator" ); |
|
133 iHomeOperator = aHomeOperator; |
|
134 } |
|
135 |
|
136 // --------------------------------------------------------------------------- |
|
137 // Function : UpdateNmsStartGMTTime |
|
138 // function updates Nms start time with current GMT time |
|
139 // --------------------------------------------------------------------------- |
|
140 // |
|
141 void CIRNmsLogger::UpdateNmsStartGMTTime() |
|
142 { |
|
143 iStartNmsTime.UniversalTime(); |
|
144 } |
|
145 // --------------------------------------------------------------------------- |
|
146 // CIRNmsLogger: UpdateNmsType |
|
147 // updates the Nms type |
|
148 // --------------------------------------------------------------------------- |
|
149 // |
|
150 void CIRNmsLogger::UpdateNmsType(const TDesC& aNmsType) |
|
151 { |
|
152 IRLOG_DEBUG( "CIRNmsLogger::UpdateNmsType" ); |
|
153 iNmsType.Copy(aNmsType); |
|
154 } |
|
155 |
|
156 // --------------------------------------------------------------------------- |
|
157 // Function: ChannelID |
|
158 // returns the channel id |
|
159 // --------------------------------------------------------------------------- |
|
160 // |
|
161 TInt CIRNmsLogger::ChannelID() const |
|
162 { |
|
163 IRLOG_DEBUG( "CIRNmsLogger::ChannelID" ); |
|
164 return iChannelId; |
|
165 } |
|
166 |
|
167 // --------------------------------------------------------------------------- |
|
168 // Function: CurrentNetwork |
|
169 // returns the Current Network |
|
170 // --------------------------------------------------------------------------- |
|
171 // |
|
172 TInt CIRNmsLogger::CurrentNetwork() const |
|
173 { |
|
174 IRLOG_DEBUG( "CIRNmsLogger::CurrentNetwork" ); |
|
175 return iNmsCurrentNetwork; |
|
176 } |
|
177 |
|
178 // --------------------------------------------------------------------------- |
|
179 // Function: HomeOperator |
|
180 // returns the home network |
|
181 // --------------------------------------------------------------------------- |
|
182 // |
|
183 TInt CIRNmsLogger::HomeOperator() const |
|
184 { |
|
185 IRLOG_DEBUG( "CIRNmsLogger::HomeOperator" ); |
|
186 return iHomeOperator; |
|
187 } |
|
188 |
|
189 |
|
190 // --------------------------------------------------------------------------- |
|
191 // Function: StartTime |
|
192 // returns the start time |
|
193 // --------------------------------------------------------------------------- |
|
194 // |
|
195 TDes& CIRNmsLogger::StartTime() |
|
196 { |
|
197 IRLOG_DEBUG( "CIRNmsLogger::StartTime" ); |
|
198 return iStartTime; |
|
199 } |
|
200 // --------------------------------------------------------------------------- |
|
201 // Function: NmsLogId |
|
202 // returns the NmsLog id |
|
203 // --------------------------------------------------------------------------- |
|
204 // |
|
205 TInt CIRNmsLogger::NmsLogId() const |
|
206 { |
|
207 IRLOG_DEBUG( "CIRSessionLogger::NmsLogId" ); |
|
208 return iNmsLogId; |
|
209 } |
|
210 // --------------------------------------------------------------------------- |
|
211 // Function: NmsType |
|
212 // returns the Nms type |
|
213 // --------------------------------------------------------------------------- |
|
214 // |
|
215 TDesC& CIRNmsLogger::NmsType() |
|
216 { |
|
217 IRLOG_DEBUG( "CIRNmsLogger::ConnectionType" ); |
|
218 return iNmsType; |
|
219 } |
|
220 |
|
221 // --------------------------------------------------------------------------- |
|
222 // Function: FileName |
|
223 // returns file name |
|
224 // --------------------------------------------------------------------------- |
|
225 // |
|
226 TFileName CIRNmsLogger::FileName() |
|
227 { |
|
228 IRLOG_DEBUG( "CIRNmsLogger::FileName" ); |
|
229 return iFilePath; |
|
230 } |
|
231 |
|
232 // --------------------------------------------------------------------------- |
|
233 // Function: DateTime |
|
234 // returns Nms start time |
|
235 // --------------------------------------------------------------------------- |
|
236 // |
|
237 TTime CIRNmsLogger::DateTime() |
|
238 { |
|
239 return iStartNmsTime; |
|
240 } |
|
241 |
|
242 |
|
243 |
|
244 // --------------------------------------------------------------------------- |
|
245 // Function: GetBackedUp |
|
246 // Back up the Nms log of a Nms |
|
247 // --------------------------------------------------------------------------- |
|
248 // |
|
249 void CIRNmsLogger::GetBackedUp( CIRNmsLogger& aNms ) |
|
250 { |
|
251 //Nms start time |
|
252 iStartNmsTime = aNms.DateTime(); |
|
253 //start time |
|
254 iStartTime.Copy( aNms.StartTime() ); |
|
255 //channel id |
|
256 iChannelId = aNms.ChannelID(); |
|
257 //home operator |
|
258 iHomeOperator = aNms.HomeOperator(); |
|
259 //current network |
|
260 iNmsCurrentNetwork = aNms.CurrentNetwork(); |
|
261 // Newly added |
|
262 ResetResource(); |
|
263 } |
|
264 |
|
265 // --------------------------------------------------------------------------- |
|
266 // Function: ExternalizeL |
|
267 // externialize the stream to the given stream |
|
268 // --------------------------------------------------------------------------- |
|
269 // |
|
270 void CIRNmsLogger::ExternalizeL(RWriteStream& aWriteStream) |
|
271 { |
|
272 IRLOG_DEBUG( "CIRNmsLogger::ExternalizeL" ); |
|
273 TInt length; |
|
274 //start time |
|
275 length = iStartTime.Length(); |
|
276 aWriteStream.WriteInt32L(length); |
|
277 aWriteStream.WriteL(iStartTime,length); |
|
278 |
|
279 //channel id |
|
280 aWriteStream.WriteInt32L(iChannelId); |
|
281 |
|
282 //Type |
|
283 length = iNmsType.Length(); |
|
284 aWriteStream.WriteInt32L(length); |
|
285 aWriteStream.WriteL(iNmsType,length); |
|
286 |
|
287 //current network |
|
288 aWriteStream.WriteInt32L(iNmsCurrentNetwork); |
|
289 |
|
290 //home operator |
|
291 aWriteStream.WriteInt32L(iHomeOperator); |
|
292 |
|
293 IRLOG_DEBUG( "CIRNmsLogger::ExternalizeL - Exiting." ); |
|
294 } |
|
295 |
|
296 // --------------------------------------------------------------------------- |
|
297 // Function: InternalizeL |
|
298 // gets the data from the stream |
|
299 // --------------------------------------------------------------------------- |
|
300 // |
|
301 void CIRNmsLogger::InternalizeL(RReadStream& aReadStream) |
|
302 { |
|
303 IRLOG_DEBUG( "CIRNmsLogger::InternalizeL" ); |
|
304 TInt length; |
|
305 |
|
306 //Start Time |
|
307 length = aReadStream.ReadInt32L(); |
|
308 aReadStream.ReadL(iStartTime,length); |
|
309 |
|
310 |
|
311 //Channel Id |
|
312 iChannelId = aReadStream.ReadInt32L(); |
|
313 |
|
314 //Nms Type |
|
315 length = aReadStream.ReadInt32L(); |
|
316 aReadStream.ReadL(iNmsType,length); |
|
317 |
|
318 //Nms Current Network |
|
319 iNmsCurrentNetwork = aReadStream.ReadInt32L(); |
|
320 |
|
321 //Home Operator |
|
322 iHomeOperator = aReadStream.ReadInt32L(); |
|
323 |
|
324 IRLOG_DEBUG( "CIRNmsLogger::InternalizeL - Exiting." ); |
|
325 } |
|