phoneengine/loghandling/src/cpeloginfo.cpp
changeset 37 ba76fc04e6c2
child 51 f39ed5e045e0
equal deleted inserted replaced
36:2eacb6118286 37:ba76fc04e6c2
       
     1 /*
       
     2 * Copyright (c) 2003-2006 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:  This file contains the implementation of CPELogInfo class 
       
    15 *                member functions.
       
    16 *
       
    17 */
       
    18 
       
    19 //  INCLUDE FILES
       
    20 #include "cpeloginfo.h"
       
    21 #include "talogger.h"
       
    22 
       
    23 
       
    24 // ---------------------------------------------------------------------------
       
    25 // 
       
    26 // ---------------------------------------------------------------------------
       
    27 //
       
    28 CPELogInfo* CPELogInfo::NewL()
       
    29     {
       
    30     return new( ELeave ) CPELogInfo();
       
    31     }
       
    32 
       
    33 
       
    34 // ---------------------------------------------------------------------------
       
    35 // 
       
    36 // ---------------------------------------------------------------------------
       
    37 //
       
    38 CPELogInfo::~CPELogInfo()
       
    39     {
       
    40     delete iContactLink;
       
    41     }
       
    42 
       
    43 
       
    44 // ---------------------------------------------------------------------------
       
    45 // 
       
    46 // ---------------------------------------------------------------------------
       
    47 //
       
    48 CPELogInfo::CPELogInfo() : iEventType( CPELogInfo::EPEUnknownEvent ),
       
    49     iCallDirection( RMobileCall::EDirectionUnknown ),
       
    50     iCallId( KPECallIdNotUsed ),
       
    51     iCallState( EPEStateUnknown ),
       
    52     iCurrentLine( CCCECallParameters::ECCELineTypePrimary ), 
       
    53     iPhoneNumberId( EPEUnknownNumber )
       
    54     {
       
    55     }
       
    56 
       
    57 
       
    58 // ---------------------------------------------------------------------------
       
    59 // Set basic event data, guarantees data existence
       
    60 // ---------------------------------------------------------------------------
       
    61 //
       
    62 void CPELogInfo::SetEventData( 
       
    63     TInt aCallId, 
       
    64     const MPEDataStore& aDataStore )
       
    65     {
       
    66     //CallId
       
    67     iCallId = aCallId;
       
    68 
       
    69     // Line
       
    70     iCurrentLine = aDataStore.CallALSLine( aCallId );
       
    71 
       
    72     // EventType
       
    73     switch ( aDataStore.CallType( aCallId ) )
       
    74         {
       
    75         case EPECallTypeCSVoice:
       
    76 
       
    77             iEventType = EPEVoiceEvent;
       
    78             break;
       
    79 
       
    80         case EPECallTypeVoIP:
       
    81 
       
    82             iEventType = EPEVoIPEvent;
       
    83 
       
    84             break;
       
    85         case EPECallTypeVideo:
       
    86             iEventType = EPEVideoCallEvent;
       
    87             break;
       
    88         case EPECallTypeUninitialized:
       
    89         default:
       
    90             iEventType = EPEUnknownEvent;
       
    91             break;
       
    92         }
       
    93 
       
    94     // CallDirection
       
    95     iCallDirection = aDataStore.CallDirection( aCallId );
       
    96    
       
    97     // Name
       
    98     if ( aDataStore.RemoteName( aCallId ).Length() > 0 )
       
    99         {
       
   100         iName = aDataStore.RemoteName( aCallId );
       
   101         }
       
   102     else if ( aDataStore.RemoteCompanyName( aCallId ).Length() > 0 ) 
       
   103         {
       
   104         iName = aDataStore.RemoteCompanyName( aCallId );
       
   105         }
       
   106     else
       
   107         {
       
   108         iName = KNullDesC;
       
   109         }
       
   110       
       
   111     if ( iCallDirection == RMobileCall::EMobileTerminated )
       
   112         {
       
   113         // adjust log info name in case of suppressed and unknown remote identity for MT calls only
       
   114         RMobileCall::TMobileCallRemoteIdentityStatus remoteIdentity;
       
   115         remoteIdentity = aDataStore.RemoteIdentity( aCallId );
       
   116 
       
   117         switch ( remoteIdentity )
       
   118             {
       
   119             case RMobileCall::ERemoteIdentityUnknown:
       
   120                 iName = KPELogUnknownText;
       
   121                 break;
       
   122             case RMobileCall::ERemoteIdentityAvailableNoCliCoinOrPayphone:
       
   123             case RMobileCall::ERemoteIdentityUnavailableNoCliCoinOrPayphone:
       
   124                 iName = KLogsPayphoneText;
       
   125                 break;
       
   126             case RMobileCall::ERemoteIdentitySuppressed:
       
   127                 if ( aDataStore.RemotePhoneNumber( aCallId ).Length() == 0 )
       
   128                     {
       
   129                     iName = KLogsPrivateText;
       
   130                     }
       
   131                 break;
       
   132             default:
       
   133                 break;
       
   134             }
       
   135         }
       
   136 
       
   137     // CallState
       
   138     iCallState = aDataStore.CallState( aCallId );
       
   139     
       
   140     // CallDuration
       
   141     iDuration = aDataStore.CallDuration( aCallId );
       
   142    
       
   143     // PhoneNumberType
       
   144     TPEPhoneNumberIdType numberType = aDataStore.RemotePhoneNumberType( aCallId );
       
   145     iPhoneNumberId = numberType;
       
   146 
       
   147     //Start time
       
   148     iCallStartTime = aDataStore.CallStartTime( aCallId );
       
   149     
       
   150     //Missed call
       
   151     iMissedCall = aDataStore.MissedCall( aCallId );
       
   152 
       
   153     //LoggingEnabled
       
   154     iLoggingEnabled = aDataStore.LoggingIndicator( aCallId );
       
   155     
       
   156     // Get log forced completion indicator
       
   157     iForcedCompletion = aDataStore.LogForcedCompletion( aCallId );
       
   158      
       
   159     // Set log event type in case of emergency call
       
   160     if ( numberType == EPEEmergencyNumber )
       
   161         {
       
   162         TEFLOGSTRING( KTAINT, "LOG CPELogHandling::CreateLogInfo() Emergecy call" );
       
   163         iEventType = EPEEmergecyEvent;
       
   164         }
       
   165 
       
   166     iServiceId = aDataStore.ServiceId( aCallId );
       
   167  
       
   168     iMyAddress = KNullDesC();
       
   169     
       
   170     }
       
   171 
       
   172 
       
   173 // ---------------------------------------------------------------------------
       
   174 // 
       
   175 // ---------------------------------------------------------------------------
       
   176 //
       
   177 void CPELogInfo::CopyL( const CPELogInfo& aLogInfo )
       
   178     {
       
   179     iEventType = aLogInfo.iEventType;
       
   180     iCallDirection = aLogInfo.iCallDirection;
       
   181     iCallId = aLogInfo.iCallId;
       
   182     iPhoneNumber = aLogInfo.iPhoneNumber;
       
   183     iName = aLogInfo.iName;
       
   184     iCallState = aLogInfo.iCallState;
       
   185     iDuration = aLogInfo.iDuration;
       
   186     iCurrentLine = aLogInfo.iCurrentLine;
       
   187     iPhoneNumberId = aLogInfo.iPhoneNumberId;
       
   188     iLoggingEnabled = aLogInfo.iLoggingEnabled;
       
   189     iCallStartTime = aLogInfo.iCallStartTime;
       
   190     iMissedCall = aLogInfo.iMissedCall;
       
   191     iForcedCompletion = aLogInfo.iForcedCompletion;
       
   192     iServiceId = aLogInfo.iServiceId;
       
   193     iVoipAddress = aLogInfo.iVoipAddress;
       
   194     iMyAddress = aLogInfo.iMyAddress;
       
   195     if ( iContactLink )
       
   196         {
       
   197         delete iContactLink;
       
   198         iContactLink = NULL;
       
   199         }
       
   200     if ( aLogInfo.iContactLink )
       
   201         {
       
   202         iContactLink = aLogInfo.iContactLink->AllocL();
       
   203         }
       
   204     }
       
   205 
       
   206 
       
   207 // ---------------------------------------------------------------------------
       
   208 // 
       
   209 // ---------------------------------------------------------------------------
       
   210 //
       
   211 void CPELogInfo::Reset()
       
   212     {
       
   213     iEventType = CPELogInfo::EPEUnknownEvent;
       
   214     iCallDirection = RMobileCall::EDirectionUnknown;
       
   215     iCallId = KPECallIdNotUsed;
       
   216     iPhoneNumber = KNullDesC;
       
   217     iName = KNullDesC;       
       
   218     iCallState = EPEStateUnknown;
       
   219     iDuration = 0; 
       
   220     iCurrentLine = CCCECallParameters::ECCELineTypePrimary; 
       
   221     iPhoneNumberId = EPEUnknownNumber;
       
   222     iLoggingEnabled = EFalse;
       
   223     iCallStartTime = 0;
       
   224     iMissedCall = EFalse;   
       
   225     iForcedCompletion = EFalse;
       
   226     iVoipAddress = KNullDesC;
       
   227     iMyAddress = KNullDesC;
       
   228     delete iContactLink;
       
   229     iContactLink = NULL;
       
   230     }
       
   231 
       
   232 
       
   233 // ---------------------------------------------------------------------------
       
   234 // 
       
   235 // ---------------------------------------------------------------------------
       
   236 //
       
   237 void CPELogInfo::SetEventType( TPELogEventType aEventType )
       
   238     {
       
   239     iEventType = aEventType;
       
   240     }
       
   241 
       
   242 
       
   243 // ---------------------------------------------------------------------------
       
   244 // 
       
   245 // ---------------------------------------------------------------------------
       
   246 //
       
   247 CPELogInfo::TPELogEventType CPELogInfo::EventType() const
       
   248     {
       
   249     return iEventType;
       
   250     }
       
   251 
       
   252 
       
   253 // ---------------------------------------------------------------------------
       
   254 // 
       
   255 // ---------------------------------------------------------------------------
       
   256 //
       
   257 void CPELogInfo::SetCallDirection( RMobileCall::TMobileCallDirection aCallDirection )
       
   258     {
       
   259     iCallDirection = aCallDirection;
       
   260     }
       
   261 
       
   262 
       
   263 // ---------------------------------------------------------------------------
       
   264 // 
       
   265 // ---------------------------------------------------------------------------
       
   266 //
       
   267 RMobileCall::TMobileCallDirection CPELogInfo::CallDirection() const
       
   268     {
       
   269     return iCallDirection;
       
   270     }
       
   271 
       
   272 
       
   273 // ---------------------------------------------------------------------------
       
   274 // 
       
   275 // ---------------------------------------------------------------------------
       
   276 //
       
   277 void CPELogInfo::SetCallId( TInt aCallId )
       
   278     {
       
   279     iCallId = aCallId;
       
   280     }
       
   281 
       
   282 
       
   283 // ---------------------------------------------------------------------------
       
   284 // 
       
   285 // ---------------------------------------------------------------------------
       
   286 //
       
   287 TInt CPELogInfo::CallId() const
       
   288     {
       
   289     return iCallId;
       
   290     }
       
   291 
       
   292 
       
   293 // ---------------------------------------------------------------------------
       
   294 // 
       
   295 // ---------------------------------------------------------------------------
       
   296 //
       
   297 void CPELogInfo::SetPhoneNumber( const TPEPhoneNumber& aPhoneNumber )
       
   298     {
       
   299     iPhoneNumber = aPhoneNumber;
       
   300     }
       
   301 
       
   302 
       
   303 // ---------------------------------------------------------------------------
       
   304 // 
       
   305 // ---------------------------------------------------------------------------
       
   306 //
       
   307 const TPEPhoneNumber& CPELogInfo::PhoneNumber() const
       
   308     {
       
   309     return iPhoneNumber;
       
   310     }
       
   311 
       
   312 
       
   313 // ---------------------------------------------------------------------------
       
   314 // 
       
   315 // ---------------------------------------------------------------------------
       
   316 //
       
   317 void CPELogInfo::SetName( const TPEContactName& aName )
       
   318     {
       
   319     iName = aName;
       
   320     }
       
   321 
       
   322 
       
   323 // ---------------------------------------------------------------------------
       
   324 // 
       
   325 // ---------------------------------------------------------------------------
       
   326 //
       
   327 const TPEContactName& CPELogInfo::Name() const
       
   328     {
       
   329     return iName;
       
   330     }
       
   331 
       
   332 
       
   333 // ---------------------------------------------------------------------------
       
   334 // 
       
   335 // ---------------------------------------------------------------------------
       
   336 //
       
   337 void CPELogInfo::SetCallState( TPEState aCallState )
       
   338     {
       
   339     iCallState = aCallState;
       
   340     }
       
   341 
       
   342 
       
   343 // ---------------------------------------------------------------------------
       
   344 // 
       
   345 // ---------------------------------------------------------------------------
       
   346 //
       
   347 TPEState CPELogInfo::CallState() const
       
   348     {
       
   349     return iCallState;
       
   350     }
       
   351 
       
   352 
       
   353 // ---------------------------------------------------------------------------
       
   354 // 
       
   355 // ---------------------------------------------------------------------------
       
   356 //
       
   357 void CPELogInfo::SetDuration( TTimeIntervalSeconds aDuration )
       
   358     {
       
   359     iDuration = aDuration;
       
   360     }
       
   361 
       
   362 
       
   363 // ---------------------------------------------------------------------------
       
   364 // 
       
   365 // ---------------------------------------------------------------------------
       
   366 //
       
   367 TTimeIntervalSeconds CPELogInfo::Duration() const
       
   368     {
       
   369     return iDuration;
       
   370     }
       
   371 
       
   372 
       
   373 // ---------------------------------------------------------------------------
       
   374 // 
       
   375 // ---------------------------------------------------------------------------
       
   376 //
       
   377 void CPELogInfo::SetCurrentLine( CCCECallParameters::TCCELineType aCurrentLine )
       
   378     {
       
   379     iCurrentLine = aCurrentLine;
       
   380     }
       
   381 
       
   382 
       
   383 // ---------------------------------------------------------------------------
       
   384 // 
       
   385 // ---------------------------------------------------------------------------
       
   386 //
       
   387 CCCECallParameters::TCCELineType CPELogInfo::CurrentLine() const
       
   388     {
       
   389     return iCurrentLine;
       
   390     }
       
   391 
       
   392 
       
   393 // ---------------------------------------------------------------------------
       
   394 // 
       
   395 // ---------------------------------------------------------------------------
       
   396 //
       
   397 void CPELogInfo::SetPhoneNumberId( TPEPhoneNumberIdType aPhoneNumberId )
       
   398     {
       
   399     iPhoneNumberId = aPhoneNumberId;
       
   400     }
       
   401 
       
   402 
       
   403 // ---------------------------------------------------------------------------
       
   404 // 
       
   405 // ---------------------------------------------------------------------------
       
   406 //
       
   407 TPEPhoneNumberIdType CPELogInfo::PhoneNumberId() const
       
   408     {
       
   409     return iPhoneNumberId;
       
   410     }
       
   411 
       
   412 
       
   413 // ---------------------------------------------------------------------------
       
   414 // 
       
   415 // ---------------------------------------------------------------------------
       
   416 //
       
   417 void CPELogInfo::SetLoggingEnabled( TBool aLoggingEnabled )
       
   418     {
       
   419     iLoggingEnabled = aLoggingEnabled;
       
   420     }
       
   421 
       
   422 
       
   423 // ---------------------------------------------------------------------------
       
   424 // 
       
   425 // ---------------------------------------------------------------------------
       
   426 //
       
   427 TBool CPELogInfo::LoggingEnabled() const
       
   428     {
       
   429     return iLoggingEnabled;
       
   430     }
       
   431 
       
   432 
       
   433 // ---------------------------------------------------------------------------
       
   434 // 
       
   435 // ---------------------------------------------------------------------------
       
   436 //
       
   437 void CPELogInfo::SetCallStartTime( TTime aCallStartTime )
       
   438     {
       
   439     iCallStartTime = aCallStartTime;
       
   440     }
       
   441 
       
   442 
       
   443 // ---------------------------------------------------------------------------
       
   444 // 
       
   445 // ---------------------------------------------------------------------------
       
   446 //
       
   447 TTime CPELogInfo::CallStartTime() const
       
   448     {
       
   449     return iCallStartTime;
       
   450     }
       
   451 
       
   452 
       
   453 // ---------------------------------------------------------------------------
       
   454 // 
       
   455 // ---------------------------------------------------------------------------
       
   456 //
       
   457 void CPELogInfo::SetMissedCall( TBool aMissedCall )
       
   458     {
       
   459     iMissedCall = aMissedCall;
       
   460     }
       
   461 
       
   462 
       
   463 // ---------------------------------------------------------------------------
       
   464 // 
       
   465 // ---------------------------------------------------------------------------
       
   466 //
       
   467 TBool CPELogInfo::MissedCall() const
       
   468     {
       
   469     return iMissedCall;
       
   470     }
       
   471 
       
   472 
       
   473 // ---------------------------------------------------------------------------
       
   474 // 
       
   475 // ---------------------------------------------------------------------------
       
   476 //
       
   477 void CPELogInfo::SetForcedCompletion( TBool aForcedCompletion )
       
   478     {
       
   479     iForcedCompletion = aForcedCompletion;
       
   480     }
       
   481 
       
   482 
       
   483 // ---------------------------------------------------------------------------
       
   484 // 
       
   485 // ---------------------------------------------------------------------------
       
   486 //
       
   487 TBool CPELogInfo::ForcedCompletion() const
       
   488     {
       
   489     return iForcedCompletion;
       
   490     }
       
   491 
       
   492 
       
   493 // ---------------------------------------------------------------------------
       
   494 // 
       
   495 // ---------------------------------------------------------------------------
       
   496 //
       
   497 void CPELogInfo::SetServiceId( TUint32 aServiceId )
       
   498     {
       
   499     iServiceId = aServiceId;
       
   500     }
       
   501 
       
   502 
       
   503 // ---------------------------------------------------------------------------
       
   504 // 
       
   505 // ---------------------------------------------------------------------------
       
   506 //
       
   507 TUint32 CPELogInfo::ServiceId() const
       
   508     {
       
   509     return iServiceId;
       
   510     }
       
   511 
       
   512 
       
   513 // ---------------------------------------------------------------------------
       
   514 // 
       
   515 // ---------------------------------------------------------------------------
       
   516 //
       
   517 void CPELogInfo::SetVoipAddress( const TPEPhoneNumber& aVoipAddress )
       
   518     {
       
   519     iVoipAddress = aVoipAddress;
       
   520     }
       
   521 
       
   522 
       
   523 // ---------------------------------------------------------------------------
       
   524 // 
       
   525 // ---------------------------------------------------------------------------
       
   526 //
       
   527 const TPEPhoneNumber& CPELogInfo::VoipAddress() const
       
   528     {
       
   529     return iVoipAddress;
       
   530     }
       
   531 
       
   532 
       
   533 // ---------------------------------------------------------------------------
       
   534 // 
       
   535 // ---------------------------------------------------------------------------
       
   536 //
       
   537 void CPELogInfo::SetMyAddress( const TPEPhoneNumber& aMyAddress )
       
   538     {
       
   539     iMyAddress = aMyAddress;
       
   540     }
       
   541 
       
   542 
       
   543 // ---------------------------------------------------------------------------
       
   544 // 
       
   545 // ---------------------------------------------------------------------------
       
   546 //
       
   547 const TPEPhoneNumber& CPELogInfo::MyAddress() const
       
   548     {
       
   549     return iMyAddress;
       
   550     }
       
   551 
       
   552 
       
   553 // ---------------------------------------------------------------------------
       
   554 // Save contact link. Ownership is transferred.
       
   555 // ---------------------------------------------------------------------------
       
   556 //
       
   557 void CPELogInfo::SetContactLink( const HBufC8* aContactLink )
       
   558     {
       
   559     delete iContactLink;
       
   560     iContactLink = aContactLink;
       
   561     }
       
   562 
       
   563 
       
   564 // ---------------------------------------------------------------------------
       
   565 // 
       
   566 // ---------------------------------------------------------------------------
       
   567 //
       
   568 const HBufC8& CPELogInfo::ContactLink() const
       
   569     {
       
   570     return *iContactLink;
       
   571     }