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