|
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 #ifndef IRSESSIONLOGGERUTILITY_H |
|
20 #define IRSESSIONLOGGERUTILITY_H |
|
21 |
|
22 #include <e32base.h> |
|
23 |
|
24 #include "irsessionparams.h" |
|
25 |
|
26 class RReadStream; |
|
27 class RWriteStream; |
|
28 |
|
29 /** |
|
30 * This class can hold data for session log |
|
31 */ |
|
32 |
|
33 NONSHARABLE_CLASS(CIRSessionLogger) : public CBase |
|
34 { |
|
35 public: |
|
36 /** |
|
37 * Function: NewL |
|
38 * Two phase constructor returns the instance of CIRSessionLogger |
|
39 * @returns instance of CIRSessionLogger |
|
40 */ |
|
41 static CIRSessionLogger* NewL(); |
|
42 |
|
43 /** |
|
44 * Function: NewLC |
|
45 * Two phase constructor creates the instance of CIRSessionLogger |
|
46 * @returns instance of CIRSessionLogger |
|
47 */ |
|
48 static CIRSessionLogger* NewLC(); |
|
49 |
|
50 /** |
|
51 * Function: ~CIRSessionLogger |
|
52 * default destructor |
|
53 */ |
|
54 ~CIRSessionLogger(); |
|
55 |
|
56 private: |
|
57 /** |
|
58 * Function: ConstructL |
|
59 * Two phase constructor |
|
60 */ |
|
61 void ConstructL(); |
|
62 |
|
63 /** |
|
64 * Function: CIRSessionLogger |
|
65 * default constructor |
|
66 */ |
|
67 CIRSessionLogger(); |
|
68 |
|
69 public: |
|
70 /** |
|
71 * Function: EndLogging |
|
72 * logs the termination condition |
|
73 */ |
|
74 void EndLogging(); |
|
75 |
|
76 /** |
|
77 * Function: HandleStartEvents |
|
78 * functtion handles start events |
|
79 */ |
|
80 void HandleStartEvents(); |
|
81 |
|
82 /** |
|
83 * Function: HandleStopEvents |
|
84 * functtion handles stop events |
|
85 */ |
|
86 void HandleStopEvents(); |
|
87 |
|
88 /** |
|
89 * Function: MarkSession |
|
90 * Marks the start of a session |
|
91 */ |
|
92 void MarkSession(); |
|
93 |
|
94 /** |
|
95 * Function: UnMarkSession |
|
96 * UnMarks the start of a sessiom |
|
97 */ |
|
98 void UnMarkSession(); |
|
99 |
|
100 /** |
|
101 * Function: SessionMarked |
|
102 * Returns whether session is marked or not |
|
103 * @return session marked flag |
|
104 */ |
|
105 TBool SessionMarked(); |
|
106 |
|
107 /** |
|
108 * Function: LogServerResult |
|
109 * logs server connection result |
|
110 * @param URL to which connection is attempted |
|
111 * @param response from server |
|
112 */ |
|
113 void LogServerResult(const TDesC& aUrl,TResponse aResult); |
|
114 |
|
115 /** |
|
116 * Function: LogSongRecog |
|
117 * logs song recog |
|
118 * @param aTimeStamp song recog timestamp. |
|
119 */ |
|
120 void LogSongRecog(const TDesC& aTimeStamp); |
|
121 |
|
122 /** |
|
123 * Function: GetConnectedFrom |
|
124 * connected information is stored |
|
125 * @param connected from information |
|
126 */ |
|
127 void GetConnectedFrom(TConnectedFrom aConnectedFrom); |
|
128 |
|
129 /** |
|
130 * Function: UpdateSessionLog |
|
131 * update the session logs |
|
132 * @param TIRServer structure which holds url response and cound |
|
133 */ |
|
134 void UpdateSessionLog(TIRServer& aServer); |
|
135 |
|
136 /** |
|
137 * Function: ResetResource |
|
138 * reset data from channel server |
|
139 */ |
|
140 void ResetResource(); |
|
141 |
|
142 /** |
|
143 * Function: IsSessionProgressing |
|
144 * checks whether session is active or not |
|
145 * @return EFalse if session is currently not progressing |
|
146 */ |
|
147 TBool IsSessionProgressing(); |
|
148 |
|
149 /** |
|
150 * Function: CompensationTime |
|
151 * returns time at which session become active |
|
152 * @return time at which session become active |
|
153 */ |
|
154 TTime CompensationTime(); |
|
155 |
|
156 /** |
|
157 * Function: UpdateSessionId |
|
158 * updates the session id |
|
159 * @param session id |
|
160 */ |
|
161 void UpdateSessionId(TInt aSessionId); |
|
162 |
|
163 /** |
|
164 * Function: UpdateTerminationStatus |
|
165 * updates the termination status |
|
166 * @param terminated by information |
|
167 */ |
|
168 void UpdateTerminationStatus(TTerminationStatus aTerminatedBy); |
|
169 |
|
170 /** |
|
171 * Function: UpdateChannelID |
|
172 * updates the channel id |
|
173 * @param channel id |
|
174 */ |
|
175 void UpdateChannelID(TInt aChanneldID); |
|
176 |
|
177 /** |
|
178 * Function: UpdateCurrentNetwork |
|
179 * updates the current network |
|
180 * @param current network |
|
181 */ |
|
182 void UpdateCurrentNetwork(TInt aCurrentNetwork); |
|
183 |
|
184 /** |
|
185 * Function: UpdateHomeOperator |
|
186 * updates the home network |
|
187 * @param home network |
|
188 */ |
|
189 void UpdateHomeOperator(TInt aHomeOperator); |
|
190 |
|
191 /** |
|
192 * Function: UpdateConnectionType |
|
193 * updates the connection type |
|
194 * @param connection type |
|
195 */ |
|
196 void UpdateConnectionType(const TDesC& aConnectionType); |
|
197 |
|
198 /** |
|
199 * Function : UpdateSessionStartGMTTime |
|
200 * function updates session start time with current GMT time |
|
201 */ |
|
202 void UpdateSessionStartGMTTime(); |
|
203 |
|
204 /** |
|
205 * Function: TerminationStatus |
|
206 * returns termination status |
|
207 * @return termination status |
|
208 */ |
|
209 TDesC& TerminationStatus(); |
|
210 |
|
211 /** |
|
212 * Function: ChannelID |
|
213 * return the channel id |
|
214 * @return channel id |
|
215 */ |
|
216 TInt ChannelID() const; |
|
217 |
|
218 /** |
|
219 * Function: CurrentNetwork |
|
220 * returns the Current Network |
|
221 * @return Current Network |
|
222 */ |
|
223 TInt CurrentNetwork() const; |
|
224 |
|
225 /** |
|
226 * Function: HomeOperator |
|
227 * returns the home network |
|
228 * @return home network |
|
229 */ |
|
230 TInt HomeOperator() const; |
|
231 |
|
232 /** |
|
233 * Function: ConnectionType |
|
234 * returns the connection type |
|
235 * @return connection type |
|
236 */ |
|
237 TDesC& ConnectionType(); |
|
238 |
|
239 /** |
|
240 * Function: StartTime |
|
241 * returns the start time |
|
242 * @return start time |
|
243 */ |
|
244 TDes& StartTime(); |
|
245 |
|
246 /** |
|
247 * Function: ConnectionType |
|
248 * returns the connection type |
|
249 * @return connection type |
|
250 */ |
|
251 TDesC& ConnectedFrom(); |
|
252 |
|
253 /** |
|
254 * Function: SessionId |
|
255 * returns the session id |
|
256 * @return session id |
|
257 */ |
|
258 TInt SessionId() const; |
|
259 |
|
260 |
|
261 /** |
|
262 * Function: SessionDuration |
|
263 * returns the duration of the session |
|
264 * @return duration of the session |
|
265 */ |
|
266 TInt SessionDuration() const; |
|
267 |
|
268 /** |
|
269 * Function: FileName |
|
270 * returns file name |
|
271 * @return file name |
|
272 */ |
|
273 TFileName FileName(); |
|
274 |
|
275 /** |
|
276 * Function: DateTime |
|
277 * returns session start time |
|
278 * @return session start time |
|
279 */ |
|
280 TTime DateTime(); |
|
281 |
|
282 /** |
|
283 * Function: SessionData |
|
284 * function returns instance session log array |
|
285 * @return session log RArray of session log |
|
286 */ |
|
287 const RArray<TIRServer>& SessionData()const; |
|
288 |
|
289 /** |
|
290 * Function: SongRecogLog |
|
291 * function returns instance song recog log array |
|
292 * @return song recog log RArray of song recog log |
|
293 */ |
|
294 const RArray<TIRSongRecogLog>& SongRecogLog()const; |
|
295 |
|
296 /** |
|
297 * Function: GetBackedUp |
|
298 * Back up the given session, copies the data of the session |
|
299 * @param session logs instance which to be copied |
|
300 */ |
|
301 void GetBackedUp( CIRSessionLogger& aSession ); |
|
302 |
|
303 /** |
|
304 * Function: ExternalizeL |
|
305 * externialize the stream to the given stream |
|
306 * @param write stream |
|
307 */ |
|
308 void ExternalizeL(RWriteStream& aWriteStream); |
|
309 |
|
310 /** |
|
311 * Function: InternalizeL |
|
312 * gets the data from the stream |
|
313 * @param read stream |
|
314 */ |
|
315 void InternalizeL(RReadStream& aReadStream); |
|
316 |
|
317 /** |
|
318 * Function: DurationValue |
|
319 * Duration value |
|
320 * @return duration |
|
321 */ |
|
322 TTimeIntervalSeconds DurationValue(); |
|
323 |
|
324 private: |
|
325 /** |
|
326 * file name |
|
327 */ |
|
328 TFileName iFilePath; |
|
329 |
|
330 /** |
|
331 * session start time |
|
332 */ |
|
333 TTime iStartSessionTime; |
|
334 |
|
335 /** |
|
336 * time current session become active started |
|
337 */ |
|
338 TTime iActiveSessionTime; |
|
339 |
|
340 /** |
|
341 * session duration |
|
342 */ |
|
343 TTimeIntervalSeconds iDurationValue; |
|
344 |
|
345 /** |
|
346 * start time is stored |
|
347 */ |
|
348 TBuf<64> iStartTime; |
|
349 |
|
350 /** |
|
351 * terminated by status is stored |
|
352 */ |
|
353 TBuf<32> iTerminatedBy; |
|
354 |
|
355 /** |
|
356 * connected from information |
|
357 */ |
|
358 TBuf<32> iConnectedFrom; |
|
359 |
|
360 /** |
|
361 * connection type information |
|
362 */ |
|
363 TBuf<32> iSessionConnectionType; |
|
364 |
|
365 /** |
|
366 * session duration |
|
367 */ |
|
368 TInt iDuration; |
|
369 |
|
370 /** |
|
371 * Termination status |
|
372 */ |
|
373 TTerminationStatus iTerminateBy; |
|
374 |
|
375 /** |
|
376 * Session id |
|
377 */ |
|
378 TInt iSessionId; |
|
379 |
|
380 |
|
381 /** |
|
382 * NmsLog id |
|
383 */ |
|
384 TInt iNmsLogId; |
|
385 |
|
386 /** |
|
387 * channel id |
|
388 */ |
|
389 TInt iChannelId; |
|
390 |
|
391 /** |
|
392 * home operator mcc+mnc |
|
393 */ |
|
394 TInt iHomeOperator; |
|
395 |
|
396 /** |
|
397 * current operator mcc+mnc |
|
398 */ |
|
399 TInt iSessionCurrentNetwork; |
|
400 |
|
401 /** |
|
402 * Checks whether session is actually started |
|
403 */ |
|
404 TBool iSessionMarked; |
|
405 |
|
406 /** |
|
407 * Checks whether application is playing or not |
|
408 */ |
|
409 TBool iIsSessionProgressing; |
|
410 |
|
411 /** |
|
412 * session log holder's array |
|
413 */ |
|
414 RArray<TIRServer> iRServer; |
|
415 |
|
416 /** |
|
417 * song recog log holder's array |
|
418 */ |
|
419 RArray<TIRSongRecogLog> iRSongRecogLog; |
|
420 }; |
|
421 |
|
422 |
|
423 #endif //IRSESSIONLOGGERUTILITY_H |
|
424 |
|
425 |
|
426 |