|
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 "irsessionloggerutility.h" |
|
24 |
|
25 const TInt KMaxUrlLength = 256; |
|
26 const TInt KMaxTimeStampLength = 64; |
|
27 |
|
28 // ============================== Function declaration ======================= |
|
29 |
|
30 // --------------------------------------------------------------------------- |
|
31 // Function: NewL |
|
32 // Two phase constructor returns the instance of CIRSessionLogger |
|
33 // --------------------------------------------------------------------------- |
|
34 // |
|
35 CIRSessionLogger* CIRSessionLogger::NewL() |
|
36 { |
|
37 IRLOG_DEBUG( "CIRSessionLogger::NewL" ); |
|
38 CIRSessionLogger* self = CIRSessionLogger::NewLC(); |
|
39 CleanupStack::Pop(self); |
|
40 IRLOG_DEBUG( "CIRSessionLogger::NewL - Exiting." ); |
|
41 return self; |
|
42 } |
|
43 |
|
44 |
|
45 // --------------------------------------------------------------------------- |
|
46 // Function: NewLC |
|
47 // Two phase constructor creates the instance of CIRSessionLogger |
|
48 // --------------------------------------------------------------------------- |
|
49 // |
|
50 CIRSessionLogger* CIRSessionLogger::NewLC() |
|
51 { |
|
52 IRLOG_DEBUG( "CIRSessionLogger::NewLC" ); |
|
53 CIRSessionLogger* self = new (ELeave) CIRSessionLogger; |
|
54 CleanupStack::PushL(self); |
|
55 self->ConstructL(); |
|
56 IRLOG_DEBUG( "CIRSessionLogger::NewLC - Exiting." ); |
|
57 return self; |
|
58 } |
|
59 |
|
60 // --------------------------------------------------------------------------- |
|
61 // Function: ~CIRSessionLogger |
|
62 // default destructor |
|
63 // --------------------------------------------------------------------------- |
|
64 // |
|
65 CIRSessionLogger::~CIRSessionLogger() |
|
66 { |
|
67 iRServer.Reset(); |
|
68 iRServer.Close(); |
|
69 iRSongRecogLog.Reset(); |
|
70 iRSongRecogLog.Close(); |
|
71 } |
|
72 |
|
73 // --------------------------------------------------------------------------- |
|
74 // Function: ConstructL |
|
75 // Two phase constructor |
|
76 // --------------------------------------------------------------------------- |
|
77 // |
|
78 void CIRSessionLogger::ConstructL() |
|
79 { |
|
80 //No implementation |
|
81 } |
|
82 |
|
83 // --------------------------------------------------------------------------- |
|
84 // Function: CIRSessionLogger |
|
85 // default constructor |
|
86 // --------------------------------------------------------------------------- |
|
87 // |
|
88 CIRSessionLogger::CIRSessionLogger() |
|
89 { |
|
90 //No implementation |
|
91 } |
|
92 |
|
93 // --------------------------------------------------------------------------- |
|
94 // Function: EndLogging |
|
95 // logs the termination condition |
|
96 // --------------------------------------------------------------------------- |
|
97 // |
|
98 void CIRSessionLogger::EndLogging() |
|
99 { |
|
100 IRLOG_DEBUG( "CIRSessionLogger::EndLogging" ); |
|
101 if( iSessionMarked ) |
|
102 { |
|
103 HandleStopEvents(); |
|
104 } |
|
105 else |
|
106 { |
|
107 iDuration = 0; |
|
108 } |
|
109 switch(iTerminateBy) |
|
110 { |
|
111 case EUserTerminated: |
|
112 { |
|
113 //error condition for termination is disconnected by the user |
|
114 iTerminatedBy.Copy(KUSER); |
|
115 break; |
|
116 } |
|
117 case ENoConnectionToServer: |
|
118 { |
|
119 //error condition for termination is no connection to server |
|
120 iTerminatedBy.Copy(KNOCONNECTIONTOSERVER); |
|
121 break; |
|
122 } |
|
123 case ENoConnectionToNetwork: |
|
124 { |
|
125 //error condition for termination is no connection to network |
|
126 iTerminatedBy.Copy(KNOCONNECTIONTONETWORK); |
|
127 break; |
|
128 } |
|
129 default: |
|
130 { |
|
131 break; |
|
132 } |
|
133 } |
|
134 IRLOG_DEBUG( "CIRSessionLogger::EndLogging - Exiting." ); |
|
135 } |
|
136 |
|
137 |
|
138 // --------------------------------------------------------------------------- |
|
139 // Function: HandleStopEvents |
|
140 // logs the termination condition |
|
141 // --------------------------------------------------------------------------- |
|
142 // |
|
143 void CIRSessionLogger::HandleStartEvents() |
|
144 { |
|
145 if( !iIsSessionProgressing ) |
|
146 { |
|
147 iActiveSessionTime.UniversalTime(); |
|
148 iIsSessionProgressing = ETrue; |
|
149 } |
|
150 } |
|
151 |
|
152 // --------------------------------------------------------------------------- |
|
153 // Function: HandleStartEvents |
|
154 // logs the termination condition |
|
155 // --------------------------------------------------------------------------- |
|
156 // |
|
157 void CIRSessionLogger::HandleStopEvents() |
|
158 { |
|
159 if( iIsSessionProgressing ) |
|
160 { |
|
161 TTime endtime; |
|
162 //endtime has session end time in GMT format |
|
163 endtime.UniversalTime(); |
|
164 //session duration compensation value is calculated |
|
165 //as difference between Compensation Time [time when it stopped] and |
|
166 //end time |
|
167 TTimeIntervalSeconds timeelaspsed; |
|
168 endtime.SecondsFrom(iActiveSessionTime,timeelaspsed); |
|
169 //compensation value session duration is converted to integer |
|
170 iDuration += timeelaspsed.Int(); |
|
171 iIsSessionProgressing = EFalse; |
|
172 } |
|
173 } |
|
174 |
|
175 // --------------------------------------------------------------------------- |
|
176 // Function: MarkSession |
|
177 // Marks the start of a session |
|
178 // --------------------------------------------------------------------------- |
|
179 // |
|
180 void CIRSessionLogger::MarkSession() |
|
181 { |
|
182 iSessionMarked = ETrue; |
|
183 iDuration = 0; |
|
184 HandleStartEvents(); |
|
185 } |
|
186 |
|
187 // --------------------------------------------------------------------------- |
|
188 // Function: UnMarkSession |
|
189 // UnMarks the start of a sessiom |
|
190 // --------------------------------------------------------------------------- |
|
191 // |
|
192 void CIRSessionLogger::UnMarkSession() |
|
193 { |
|
194 iSessionMarked = EFalse; |
|
195 } |
|
196 |
|
197 // --------------------------------------------------------------------------- |
|
198 // Function: SessionMarked |
|
199 // Returns the session mark flag |
|
200 // --------------------------------------------------------------------------- |
|
201 // |
|
202 TBool CIRSessionLogger::SessionMarked() |
|
203 { |
|
204 return iSessionMarked; |
|
205 } |
|
206 // --------------------------------------------------------------------------- |
|
207 // Function: ResetResource |
|
208 // reset data from channel server |
|
209 // --------------------------------------------------------------------------- |
|
210 // |
|
211 void CIRSessionLogger::ResetResource() |
|
212 { |
|
213 IRLOG_DEBUG( "CIRSessionLogger::ResetResource" ); |
|
214 //reseting of resource |
|
215 iRServer.Reset(); |
|
216 iRSongRecogLog.Reset(); |
|
217 } |
|
218 // --------------------------------------------------------------------------- |
|
219 // Function: IsSessionProgressing |
|
220 // checks whether session is progressing or not |
|
221 // --------------------------------------------------------------------------- |
|
222 // |
|
223 TBool CIRSessionLogger::IsSessionProgressing() |
|
224 { |
|
225 return iIsSessionProgressing; |
|
226 } |
|
227 |
|
228 // --------------------------------------------------------------------------- |
|
229 // Function: CompensationTime |
|
230 // Returns the session mark flag |
|
231 // --------------------------------------------------------------------------- |
|
232 // |
|
233 TTime CIRSessionLogger::CompensationTime() |
|
234 { |
|
235 return iActiveSessionTime; |
|
236 } |
|
237 |
|
238 // --------------------------------------------------------------------------- |
|
239 // Function: LogServerResult |
|
240 // logs server connection result |
|
241 // --------------------------------------------------------------------------- |
|
242 // |
|
243 void CIRSessionLogger::LogServerResult(const TDesC& aUrl,TResponse aResponse) |
|
244 { |
|
245 IRLOG_INFO3( "CIRSessionLogger::LogServerResult - %S (%d)", &aUrl, aResponse ); |
|
246 TIRServer tempServer; |
|
247 if( aUrl.Length() <= KMaxUrlLength ) |
|
248 { |
|
249 //channel server url is copied |
|
250 tempServer.iServerUrl.Copy(aUrl); |
|
251 } |
|
252 switch(aResponse) |
|
253 { |
|
254 //connected to the channel server |
|
255 case EIRConnected: |
|
256 { |
|
257 tempServer.iServerResult.Copy(KConnected); |
|
258 } |
|
259 break; |
|
260 //not connected to channel server |
|
261 //since server is not responding |
|
262 case EIRFull: |
|
263 { |
|
264 tempServer.iServerResult.Copy(KFull); |
|
265 } |
|
266 break; |
|
267 //not connected to channel server |
|
268 //since connection time out |
|
269 case EIRConnTimeOut: |
|
270 { |
|
271 tempServer.iServerResult.Copy(KConnTimeOut); |
|
272 } |
|
273 break; |
|
274 //not connected to channel server (may be invalid urls) |
|
275 case EIRConnFailed: |
|
276 { |
|
277 tempServer.iServerResult.Copy(KConnectionFailed); |
|
278 } |
|
279 break; |
|
280 default: |
|
281 { |
|
282 break; |
|
283 } |
|
284 } |
|
285 UpdateSessionLog(tempServer); |
|
286 IRLOG_DEBUG( "CIRSessionLogger::LogServerResult - Exiting." ); |
|
287 } |
|
288 |
|
289 // --------------------------------------------------------------------------- |
|
290 // Function: LogSongRecog |
|
291 // logs song recog |
|
292 // --------------------------------------------------------------------------- |
|
293 // |
|
294 void CIRSessionLogger::LogSongRecog(const TDesC& aTimeStamp) |
|
295 { |
|
296 if( aTimeStamp.Length() <= KMaxTimeStampLength ) |
|
297 { |
|
298 TIRSongRecogLog tempSongRecogLog; |
|
299 tempSongRecogLog.iTimeStamp.Copy(aTimeStamp); |
|
300 TRAP_IGNORE(iRSongRecogLog.AppendL(tempSongRecogLog)); |
|
301 } |
|
302 |
|
303 } |
|
304 |
|
305 // --------------------------------------------------------------------------- |
|
306 // Function: GetConnectedFrom |
|
307 // connected information is stored |
|
308 // --------------------------------------------------------------------------- |
|
309 // |
|
310 void CIRSessionLogger::GetConnectedFrom(TConnectedFrom aConnectedFrom) |
|
311 { |
|
312 IRLOG_DEBUG( "CIRSessionLogger::GetConnectedFrom" ); |
|
313 switch(aConnectedFrom) |
|
314 { |
|
315 case EIRIsds: |
|
316 { |
|
317 iConnectedFrom.Copy(KISDS); |
|
318 break; |
|
319 } |
|
320 case EIRPresetAdhoc: |
|
321 { |
|
322 iConnectedFrom.Copy(KPRESETADHOC); |
|
323 break; |
|
324 } |
|
325 case EIRPresetIsds: |
|
326 { |
|
327 iConnectedFrom.Copy(KPRESETISDS); |
|
328 break; |
|
329 } |
|
330 case EIRHistoryAdhoc: |
|
331 { |
|
332 iConnectedFrom.Copy(KHISTORYADHOC); |
|
333 break; |
|
334 } |
|
335 case EIRHistoryIsds: |
|
336 { |
|
337 iConnectedFrom.Copy(KHISTORYISDS); |
|
338 break; |
|
339 } |
|
340 case EIRAdhocManual: |
|
341 { |
|
342 iConnectedFrom.Copy(KADHOCMANUAL); |
|
343 break; |
|
344 } |
|
345 case EIRAdhocExternal: |
|
346 { |
|
347 iConnectedFrom.Copy(KADHOCEXTERNAL); |
|
348 break; |
|
349 } |
|
350 default: |
|
351 { |
|
352 break; |
|
353 } |
|
354 } |
|
355 IRLOG_DEBUG( "CIRSessionLogger::GetConnectedFrom - Exiting." ); |
|
356 } |
|
357 |
|
358 // --------------------------------------------------------------------------- |
|
359 // Function: UpdateSessionLog |
|
360 // update the session logs |
|
361 // --------------------------------------------------------------------------- |
|
362 // |
|
363 void CIRSessionLogger::UpdateSessionLog(TIRServer& aServer) |
|
364 { |
|
365 IRLOG_DEBUG( "CIRSessionLogger::UpdateSessionLog" ); |
|
366 |
|
367 TBool found = EFalse; |
|
368 |
|
369 // Only one entry per URL may be in the session log. |
|
370 for ( TInt i = 0; i < iRServer.Count() && !found; i++ ) |
|
371 { |
|
372 TIRServer& server = iRServer[i]; |
|
373 if ( server.iServerUrl == aServer.iServerUrl ) |
|
374 { |
|
375 // If an entry for this URL already exists, it is replaced |
|
376 // by the newer status code. |
|
377 server = aServer; |
|
378 found = ETrue; |
|
379 } |
|
380 } |
|
381 |
|
382 if ( !found ) |
|
383 { |
|
384 // Creates a new entry into the session log for this URL. |
|
385 TRAP_IGNORE(iRServer.AppendL(aServer)) |
|
386 } |
|
387 } |
|
388 |
|
389 |
|
390 // --------------------------------------------------------------------------- |
|
391 // Function: UpdateSessionId |
|
392 // updates the session id |
|
393 // --------------------------------------------------------------------------- |
|
394 // |
|
395 void CIRSessionLogger::UpdateSessionId(TInt aSessionId) |
|
396 { |
|
397 IRLOG_DEBUG( "CIRSessionLogger::UpdateSessionId" ); |
|
398 iSessionId = aSessionId; |
|
399 } |
|
400 |
|
401 |
|
402 // --------------------------------------------------------------------------- |
|
403 // Function: UpdateTerminationStatus |
|
404 // updates the termination status |
|
405 // --------------------------------------------------------------------------- |
|
406 // |
|
407 void CIRSessionLogger::UpdateTerminationStatus(TTerminationStatus aTerminatedBy) |
|
408 { |
|
409 IRLOG_DEBUG( "CIRSessionLogger::UpdateTerminationStatus" ); |
|
410 iTerminateBy = aTerminatedBy; |
|
411 } |
|
412 |
|
413 // --------------------------------------------------------------------------- |
|
414 // Function: UpdateChannelID |
|
415 // updates the channel id |
|
416 // --------------------------------------------------------------------------- |
|
417 // |
|
418 void CIRSessionLogger::UpdateChannelID(TInt aChanneldID) |
|
419 { |
|
420 IRLOG_DEBUG( "CIRSessionLogger::UpdateChannelID" ); |
|
421 iChannelId = aChanneldID; |
|
422 } |
|
423 |
|
424 // --------------------------------------------------------------------------- |
|
425 // Function: UpdateCurrentNetwork |
|
426 // updates the current network |
|
427 // --------------------------------------------------------------------------- |
|
428 // |
|
429 void CIRSessionLogger::UpdateCurrentNetwork(TInt aCurrentNetwork) |
|
430 { |
|
431 IRLOG_DEBUG( "CIRSessionLogger::UpdateCurrentNetwork" ); |
|
432 iSessionCurrentNetwork = aCurrentNetwork; |
|
433 } |
|
434 |
|
435 // --------------------------------------------------------------------------- |
|
436 // Function: UpdateHomeOperator |
|
437 // updates the home network |
|
438 // --------------------------------------------------------------------------- |
|
439 // |
|
440 void CIRSessionLogger::UpdateHomeOperator(TInt aHomeOperator) |
|
441 { |
|
442 IRLOG_DEBUG( "CIRSessionLogger::UpdateHomeOperator" ); |
|
443 iHomeOperator = aHomeOperator; |
|
444 } |
|
445 |
|
446 // --------------------------------------------------------------------------- |
|
447 // Function: UpdateConnectionType |
|
448 // updates the connection type |
|
449 // --------------------------------------------------------------------------- |
|
450 // |
|
451 void CIRSessionLogger::UpdateConnectionType(const TDesC& aConnectionType) |
|
452 { |
|
453 IRLOG_DEBUG( "CIRSessionLogger::UpdateConnectionType" ); |
|
454 iSessionConnectionType.Copy(aConnectionType); |
|
455 } |
|
456 |
|
457 // --------------------------------------------------------------------------- |
|
458 // Function : UpdateSessionStartGMTTime |
|
459 // function updates session start time with current GMT time |
|
460 // --------------------------------------------------------------------------- |
|
461 // |
|
462 void CIRSessionLogger::UpdateSessionStartGMTTime() |
|
463 { |
|
464 iStartSessionTime.UniversalTime(); |
|
465 } |
|
466 |
|
467 // --------------------------------------------------------------------------- |
|
468 // Function: TerminationStatus |
|
469 // returns termination status |
|
470 // --------------------------------------------------------------------------- |
|
471 // |
|
472 TDesC& CIRSessionLogger::TerminationStatus() |
|
473 { |
|
474 IRLOG_DEBUG( "CIRSessionLogger::TerminationStatus" ); |
|
475 return iTerminatedBy; |
|
476 } |
|
477 |
|
478 // --------------------------------------------------------------------------- |
|
479 // Function: ChannelID |
|
480 // returns the channel id |
|
481 // --------------------------------------------------------------------------- |
|
482 // |
|
483 TInt CIRSessionLogger::ChannelID() const |
|
484 { |
|
485 IRLOG_DEBUG( "CIRSessionLogger::ChannelID" ); |
|
486 return iChannelId; |
|
487 } |
|
488 |
|
489 // --------------------------------------------------------------------------- |
|
490 // Function: CurrentNetwork |
|
491 // returns the Current Network |
|
492 // --------------------------------------------------------------------------- |
|
493 // |
|
494 TInt CIRSessionLogger::CurrentNetwork() const |
|
495 { |
|
496 IRLOG_DEBUG( "CIRSessionLogger::CurrentNetwork" ); |
|
497 return iSessionCurrentNetwork; |
|
498 } |
|
499 |
|
500 // --------------------------------------------------------------------------- |
|
501 // Function: HomeOperator |
|
502 // returns the home network |
|
503 // --------------------------------------------------------------------------- |
|
504 // |
|
505 TInt CIRSessionLogger::HomeOperator() const |
|
506 { |
|
507 IRLOG_DEBUG( "CIRSessionLogger::HomeOperator" ); |
|
508 return iHomeOperator; |
|
509 } |
|
510 |
|
511 // --------------------------------------------------------------------------- |
|
512 // Function: ConnectionType |
|
513 // returns the connection type |
|
514 // --------------------------------------------------------------------------- |
|
515 // |
|
516 TDesC& CIRSessionLogger::ConnectionType() |
|
517 { |
|
518 IRLOG_DEBUG( "CIRSessionLogger::ConnectionType" ); |
|
519 return iSessionConnectionType; |
|
520 } |
|
521 |
|
522 // --------------------------------------------------------------------------- |
|
523 // Function: StartTime |
|
524 // returns the start time |
|
525 // --------------------------------------------------------------------------- |
|
526 // |
|
527 TDes& CIRSessionLogger::StartTime() |
|
528 { |
|
529 IRLOG_DEBUG( "CIRSessionLogger::StartTime" ); |
|
530 return iStartTime; |
|
531 } |
|
532 |
|
533 // --------------------------------------------------------------------------- |
|
534 // Function: ConnectionType |
|
535 // returns the connection type |
|
536 // --------------------------------------------------------------------------- |
|
537 // |
|
538 TDesC& CIRSessionLogger::ConnectedFrom() |
|
539 { |
|
540 IRLOG_DEBUG( "CIRSessionLogger::ConnectedFrom" ); |
|
541 return iConnectedFrom; |
|
542 } |
|
543 |
|
544 // --------------------------------------------------------------------------- |
|
545 // Function: SessionId |
|
546 // returns the session id |
|
547 // --------------------------------------------------------------------------- |
|
548 // |
|
549 TInt CIRSessionLogger::SessionId() const |
|
550 { |
|
551 IRLOG_DEBUG( "CIRSessionLogger::SessionId" ); |
|
552 return iSessionId; |
|
553 } |
|
554 |
|
555 // --------------------------------------------------------------------------- |
|
556 // Function: SessionDuration |
|
557 // returns the duration of the session |
|
558 // --------------------------------------------------------------------------- |
|
559 // |
|
560 TInt CIRSessionLogger::SessionDuration() const |
|
561 { |
|
562 IRLOG_DEBUG( "CIRSessionLogger::SessionDuration" ); |
|
563 return iDuration; |
|
564 } |
|
565 |
|
566 // --------------------------------------------------------------------------- |
|
567 // Function: FileName |
|
568 // returns file name |
|
569 // --------------------------------------------------------------------------- |
|
570 // |
|
571 TFileName CIRSessionLogger::FileName() |
|
572 { |
|
573 IRLOG_DEBUG( "CIRSessionLogger::FileName" ); |
|
574 return iFilePath; |
|
575 } |
|
576 |
|
577 // --------------------------------------------------------------------------- |
|
578 // Function: DateTime |
|
579 // returns session start time |
|
580 // --------------------------------------------------------------------------- |
|
581 // |
|
582 TTime CIRSessionLogger::DateTime() |
|
583 { |
|
584 return iStartSessionTime; |
|
585 } |
|
586 |
|
587 |
|
588 // --------------------------------------------------------------------------- |
|
589 // Function: SessionData |
|
590 // function returns instance session log array |
|
591 // --------------------------------------------------------------------------- |
|
592 // |
|
593 const RArray<TIRServer>& CIRSessionLogger::SessionData()const |
|
594 { |
|
595 IRLOG_DEBUG( "CIRSessionLogger::SessionData" ); |
|
596 return iRServer; |
|
597 } |
|
598 |
|
599 // --------------------------------------------------------------------------- |
|
600 // Function: SongRecogLog |
|
601 // function returns instance song recog log array |
|
602 // --------------------------------------------------------------------------- |
|
603 // |
|
604 const RArray<TIRSongRecogLog>& CIRSessionLogger::SongRecogLog()const |
|
605 { |
|
606 IRLOG_DEBUG( "CIRSessionLogger::SongRecogLog" ); |
|
607 return iRSongRecogLog; |
|
608 } |
|
609 |
|
610 // --------------------------------------------------------------------------- |
|
611 // Function: DurationValue |
|
612 // function returns duration value |
|
613 // --------------------------------------------------------------------------- |
|
614 // |
|
615 TTimeIntervalSeconds CIRSessionLogger::DurationValue() |
|
616 { |
|
617 return iDurationValue; |
|
618 } |
|
619 |
|
620 // --------------------------------------------------------------------------- |
|
621 // Function: GetBackedUp |
|
622 // Back up the session log of a session |
|
623 // --------------------------------------------------------------------------- |
|
624 // |
|
625 void CIRSessionLogger::GetBackedUp( CIRSessionLogger& aSession ) |
|
626 { |
|
627 //copies the file path |
|
628 iFilePath = aSession.FileName(); |
|
629 //session start time |
|
630 iStartSessionTime = aSession.DateTime(); |
|
631 //duration |
|
632 iDurationValue = aSession.DurationValue(); |
|
633 //start time |
|
634 iStartTime.Copy( aSession.StartTime() ); |
|
635 //termination status |
|
636 iTerminatedBy.Copy( aSession.TerminationStatus() ); |
|
637 //connected from information |
|
638 iConnectedFrom.Copy( aSession.ConnectedFrom() ); |
|
639 //connection type |
|
640 iSessionConnectionType.Copy( aSession.ConnectionType() ); |
|
641 //session duration |
|
642 iDuration = aSession.SessionDuration(); |
|
643 //state of the player |
|
644 iIsSessionProgressing = aSession.IsSessionProgressing(); |
|
645 //Compensation time |
|
646 iActiveSessionTime = aSession.CompensationTime(); |
|
647 //session id |
|
648 iSessionId = aSession.SessionId(); |
|
649 //channel id |
|
650 iChannelId = aSession.ChannelID(); |
|
651 //home operator |
|
652 iHomeOperator = aSession.HomeOperator(); |
|
653 //current network |
|
654 iSessionCurrentNetwork = aSession.CurrentNetwork(); |
|
655 //session mark checking flag |
|
656 iSessionMarked = aSession.SessionMarked(); |
|
657 |
|
658 ResetResource(); |
|
659 //getting session data |
|
660 for(TInt iter = 0 ;iter < aSession.SessionData().Count(); iter++) |
|
661 { |
|
662 //session data |
|
663 iRServer.Append(aSession.SessionData().operator[](iter)); |
|
664 } |
|
665 //getting song recog log data |
|
666 for(TInt iter = 0 ;iter < aSession.SongRecogLog().Count(); iter++) |
|
667 { |
|
668 //song recog log data |
|
669 iRSongRecogLog.Append(aSession.SongRecogLog().operator[](iter)); |
|
670 } |
|
671 } |
|
672 |
|
673 // --------------------------------------------------------------------------- |
|
674 // Function: ExternalizeL |
|
675 // externialize the stream to the given stream |
|
676 // --------------------------------------------------------------------------- |
|
677 // |
|
678 void CIRSessionLogger::ExternalizeL(RWriteStream& aWriteStream) |
|
679 { |
|
680 IRLOG_DEBUG( "CIRSessionLogger::ExternalizeL" ); |
|
681 TInt length; |
|
682 //start time |
|
683 length = iStartTime.Length(); |
|
684 aWriteStream.WriteInt32L(length); |
|
685 aWriteStream.WriteL(iStartTime,length); |
|
686 |
|
687 //connected from |
|
688 length = iConnectedFrom.Length(); |
|
689 aWriteStream.WriteInt32L(length); |
|
690 aWriteStream.WriteL(iConnectedFrom,length); |
|
691 |
|
692 //session id |
|
693 aWriteStream.WriteInt32L(iSessionId); |
|
694 |
|
695 //connection type |
|
696 length = iSessionConnectionType.Length(); |
|
697 aWriteStream.WriteInt32L(length); |
|
698 aWriteStream.WriteL(iSessionConnectionType,length); |
|
699 |
|
700 //channel id |
|
701 aWriteStream.WriteInt32L(iChannelId); |
|
702 |
|
703 //current network |
|
704 aWriteStream.WriteInt32L(iSessionCurrentNetwork); |
|
705 |
|
706 //home operator |
|
707 aWriteStream.WriteInt32L(iHomeOperator); |
|
708 |
|
709 //duration |
|
710 aWriteStream.WriteInt32L(iDuration); |
|
711 |
|
712 //terminated by |
|
713 length = iTerminatedBy.Length(); |
|
714 aWriteStream.WriteInt32L(length); |
|
715 aWriteStream.WriteL(iTerminatedBy,length); |
|
716 |
|
717 //count |
|
718 aWriteStream.WriteInt32L(iRServer.Count()); |
|
719 |
|
720 //session duration |
|
721 //Session Data |
|
722 for(TInt iter=0;iter<iRServer.Count();iter++) |
|
723 { |
|
724 //channel Server Url; |
|
725 length = iRServer[iter].iServerUrl.Length(); |
|
726 aWriteStream.WriteInt32L(length); |
|
727 aWriteStream.WriteL(iRServer[iter].iServerUrl,length); |
|
728 //channel server result |
|
729 length = iRServer[iter].iServerResult.Length(); |
|
730 aWriteStream.WriteInt32L(length); |
|
731 aWriteStream.WriteL(iRServer[iter].iServerResult,length); |
|
732 //count |
|
733 aWriteStream.WriteInt32L(iRServer[iter].iCount); |
|
734 } |
|
735 |
|
736 //count |
|
737 aWriteStream.WriteInt32L(iRSongRecogLog.Count()); |
|
738 |
|
739 //session duration |
|
740 //Session Data |
|
741 for(TInt iter=0;iter<iRSongRecogLog.Count();iter++) |
|
742 { |
|
743 //channel Server Url; |
|
744 length = iRSongRecogLog[iter].iTimeStamp.Length(); |
|
745 aWriteStream.WriteInt32L(length); |
|
746 aWriteStream.WriteL(iRSongRecogLog[iter].iTimeStamp,length); |
|
747 } |
|
748 IRLOG_DEBUG( "CIRSessionLogger::ExternalizeL - Exiting." ); |
|
749 } |
|
750 |
|
751 // --------------------------------------------------------------------------- |
|
752 // Function: InternalizeL |
|
753 // gets the data from the stream |
|
754 // --------------------------------------------------------------------------- |
|
755 // |
|
756 void CIRSessionLogger::InternalizeL(RReadStream& aReadStream) |
|
757 { |
|
758 IRLOG_DEBUG( "CIRSessionLogger::InternalizeL" ); |
|
759 TInt length; |
|
760 |
|
761 //Start Time |
|
762 length = aReadStream.ReadInt32L(); |
|
763 aReadStream.ReadL(iStartTime,length); |
|
764 |
|
765 //Connected From |
|
766 length = aReadStream.ReadInt32L(); |
|
767 aReadStream.ReadL(iConnectedFrom,length); |
|
768 |
|
769 //Session Id |
|
770 iSessionId=aReadStream.ReadInt32L(); |
|
771 |
|
772 //Session Connection Type |
|
773 length = aReadStream.ReadInt32L(); |
|
774 aReadStream.ReadL(iSessionConnectionType,length); |
|
775 |
|
776 //Channel Id |
|
777 iChannelId = aReadStream.ReadInt32L(); |
|
778 |
|
779 //Session Current Network |
|
780 iSessionCurrentNetwork = aReadStream.ReadInt32L(); |
|
781 |
|
782 //Home Operator |
|
783 iHomeOperator = aReadStream.ReadInt32L(); |
|
784 |
|
785 //Duration |
|
786 iDuration = aReadStream.ReadInt32L(); |
|
787 |
|
788 //Terminated By |
|
789 length = aReadStream.ReadInt32L(); |
|
790 aReadStream.ReadL(iTerminatedBy,length); |
|
791 |
|
792 //count |
|
793 TInt count = aReadStream.ReadInt32L(); |
|
794 //Session Data |
|
795 iRServer.Reset(); |
|
796 for(TInt iter=0;iter<count;iter++) |
|
797 { |
|
798 TIRServer hold; |
|
799 |
|
800 //Server Url |
|
801 length = aReadStream.ReadInt32L(); |
|
802 hold.iServerUrl.Zero(); |
|
803 aReadStream.ReadL(hold.iServerUrl,length); |
|
804 |
|
805 //Server Result |
|
806 length = aReadStream.ReadInt32L(); |
|
807 hold.iServerResult.Zero(); |
|
808 aReadStream.ReadL(hold.iServerResult,length); |
|
809 |
|
810 //Count |
|
811 hold.iCount = aReadStream.ReadInt32L(); |
|
812 iRServer.Append(hold); |
|
813 } |
|
814 |
|
815 //count |
|
816 count = aReadStream.ReadInt32L(); |
|
817 //Song Recog Data |
|
818 iRSongRecogLog.Reset(); |
|
819 for(TInt iter=0;iter<count;iter++) |
|
820 { |
|
821 TIRSongRecogLog hold; |
|
822 |
|
823 //Server Url |
|
824 length = aReadStream.ReadInt32L(); |
|
825 hold.iTimeStamp.Zero(); |
|
826 aReadStream.ReadL(hold.iTimeStamp,length); |
|
827 |
|
828 iRSongRecogLog.Append(hold); |
|
829 } |
|
830 |
|
831 IRLOG_DEBUG( "CIRSessionLogger::InternalizeL - Exiting." ); |
|
832 } |