phoneengine/loghandling/src/cpeloghandlingcommand.cpp
changeset 36 2eacb6118286
parent 30 ebdbd102c78a
child 37 ba76fc04e6c2
equal deleted inserted replaced
30:ebdbd102c78a 36:2eacb6118286
     1 /*
       
     2 * Copyright (c) 2002-2005 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 module contains the implementation of CPELogHandlingCommand class  
       
    15 
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include "cpeloghandlingcommand.h"
       
    22 #include "cpeloghandling.h"
       
    23 #include <pevirtualengine.h>
       
    24 #include <talogger.h>
       
    25 #include <logwrap.h>
       
    26 #include <logcli.h>
       
    27 
       
    28 // EXTERNAL DATA STRUCTURES
       
    29 // None.
       
    30 
       
    31 // EXTERNAL FUNCTION PROTOTYPES  
       
    32 // None.
       
    33 
       
    34 // CONSTANTS
       
    35 // None.
       
    36 
       
    37 // MACROS
       
    38 // None.
       
    39 
       
    40 // LOCAL CONSTANTS AND MACROS
       
    41 // None.
       
    42 
       
    43 // MODULE DATA STRUCTURES
       
    44 // None.
       
    45 
       
    46 // LOCAL FUNCTION PROTOTYPES
       
    47 // None.
       
    48 
       
    49 // FORWARD DECLARATIONS
       
    50 // None. 
       
    51 
       
    52 // ==================== LOCAL FUNCTIONS ====================
       
    53 // None.
       
    54 
       
    55 // ================= MEMBER FUNCTIONS =======================
       
    56 
       
    57 // -----------------------------------------------------------------------------
       
    58 // CPELogHandlingCommand::CPELogHandlingCommand
       
    59 // C++ default constructor can NOT contain any code, that
       
    60 // might leave.
       
    61 // -----------------------------------------------------------------------------
       
    62 //
       
    63 /*****************************************************
       
    64 *    Series 60 Customer / LOGENG
       
    65 *    Series 60  LOGENG API
       
    66 *****************************************************/
       
    67 CPELogHandlingCommand::CPELogHandlingCommand
       
    68         ( 
       
    69         CPELogHandling& aOwner,                   //The owner of this object
       
    70         CLogClient& aLogClient                    //The log client
       
    71         ) : CActive( EPriorityStandard ),
       
    72             iOwner( aOwner),
       
    73             iLogClient( aLogClient )
       
    74     {
       
    75     TEFLOGSTRING( KTAOBJECT, "LOG CPELogHandlingCommand::CPELogHandlingCommand start.");
       
    76     CActiveScheduler::Add( this );    
       
    77     TEFLOGSTRING( KTAOBJECT, "LOG CPELogHandlingCommand::CPELogHandlingCommand complete.");
       
    78     }
       
    79 
       
    80 // Destructor
       
    81 CPELogHandlingCommand::~CPELogHandlingCommand
       
    82     (
       
    83     // None.
       
    84     )
       
    85     {
       
    86     Cancel( );
       
    87     TEFLOGSTRING( KTAOBJECT, "LOG CPELogHandlingCommand::~CPELogHandlingCommand: complete." );
       
    88     }
       
    89 
       
    90 // -----------------------------------------------------------------------------
       
    91 // CPELogHandlingCommand::AddEvent
       
    92 // Adds an event to the log
       
    93 // (other items were commented in a header).
       
    94 // -----------------------------------------------------------------------------
       
    95 //
       
    96 /*****************************************************
       
    97 *    Series 60 Customer / LOGENG
       
    98 *    Series 60  LOGENG API
       
    99 *****************************************************/
       
   100 TInt CPELogHandlingCommand::AddEvent
       
   101         (
       
   102         CLogEvent& aLogEvent
       
   103         )
       
   104     {
       
   105     TInt errorCode ( KErrNone );
       
   106     
       
   107     iLogId = aLogEvent.Id( );        
       
   108     
       
   109     TEFLOGSTRING( KTAINT, "==========================================" );
       
   110     TEFLOGSTRING2( KTAINT, "LOG CPELogHandlingCommand::AddEvent() > CLogClient::AddEvent(), Log ID: %d",iLogId );
       
   111     TEFLOGSTRING2( KTAINT, "LOG CPELogHandlingCommand::AddEvent() > CLogClient::AddEvent(), Calling Name: %S",&(aLogEvent.RemoteParty()) );
       
   112     TEFLOGSTRING2( KTAINT, "LOG CPELogHandlingCommand::AddEvent() > CLogClient::AddEvent(), Call Number: %S",&(aLogEvent.Number()) );
       
   113     TEFLOGSTRING2( KTAINT, "LOG CPELogHandlingCommand::AddEvent() > CLogClient::AddEvent(), Direction: %S",&(aLogEvent.Direction()) );
       
   114     TEFLOGSTRING2( KTAINT, "LOG CPELogHandlingCommand::AddEvent() > CLogClient::AddEvent(), Duration: %d",aLogEvent.Duration() );
       
   115     TEFLOGSTRING2( KTAINT, "LOG CPELogHandlingCommand::AddEvent() > CLogClient::AddEvent(), Subject: %S", &(aLogEvent.Subject()) );
       
   116     TEFLOGSTRING( KTAINT, "==========================================" );
       
   117     
       
   118     if ( !IsActive( ) )
       
   119         {
       
   120         TEFLOGSTRING( KTAREQOUT, 
       
   121             "LOG CPELogHandlingCommand::AddEvent() > CLogClient::AddEvent()" );
       
   122         iLogClient.AddEvent( aLogEvent, iStatus );
       
   123         errorCode = KErrNone;
       
   124         SetActive( );        
       
   125         }
       
   126     else
       
   127         {
       
   128         TEFLOGSTRING( KTAINT, "LOG CPELogHandlingCommand::AddEvent(), Event NOT added" );
       
   129         errorCode = KErrInUse;
       
   130         }
       
   131         
       
   132     return errorCode;
       
   133     }
       
   134 
       
   135 // -----------------------------------------------------------------------------
       
   136 // CPELogHandlingCommand::ChangeEvent
       
   137 // Updates an event in the log
       
   138 // (other items were commented in a header).
       
   139 // -----------------------------------------------------------------------------
       
   140 //
       
   141 /*****************************************************
       
   142 *    Series 60 Customer / LOGENG
       
   143 *    Series 60  LOGENG API
       
   144 *****************************************************/
       
   145 TInt CPELogHandlingCommand::ChangeEvent
       
   146         (
       
   147         const CLogEvent& aLogEvent
       
   148         )
       
   149     {
       
   150     TInt errorCode( KErrNone );
       
   151 
       
   152     iLogId = aLogEvent.Id( );        
       
   153 
       
   154     TEFLOGSTRING( KTAINT, "==========================================" );
       
   155     TEFLOGSTRING2( KTAINT, "LOG CPELogHandlingCommand::ChangeEvent() > CLogClient::ChangeEvent(), Log ID: %d",aLogEvent.Id() );
       
   156     TEFLOGSTRING2( KTAINT, "LOG CPELogHandlingCommand::ChangeEvent() > CLogClient::ChangeEvent(), Call Number: %S",&(aLogEvent.Number()) );
       
   157     TEFLOGSTRING2( KTAINT, "LOG CPELogHandlingCommand::ChangeEvent() > CLogClient::ChangeEvent(), Direction: %S",&(aLogEvent.Direction()) );
       
   158     TEFLOGSTRING2( KTAINT, "LOG CPELogHandlingCommand::ChangeEvent() > CLogClient::ChangeEvent(), Duration: %d",aLogEvent.Duration() );
       
   159     TEFLOGSTRING( KTAINT, "==========================================" );
       
   160     
       
   161     if ( !IsActive( ) )
       
   162         {
       
   163         TEFLOGSTRING( KTAREQOUT, 
       
   164             "LOG CPELogHandlingCommand::ChangeEvent() > CLogClient::ChangeEvent()" );
       
   165         
       
   166         iLogClient.ChangeEvent( aLogEvent, iStatus );
       
   167         SetActive( );
       
   168         }
       
   169     else
       
   170         {
       
   171         TEFLOGSTRING( KTAINT, "LOG CPELogHandlingCommand::ChangeEvent(), Event NOT changed" );
       
   172         errorCode = KErrInUse;        
       
   173         } 
       
   174         
       
   175     return errorCode;       
       
   176     }
       
   177 
       
   178 // -----------------------------------------------------------------------------
       
   179 // CPELogHandlingCommand::RunL
       
   180 // Description: Method gets notification from etel that asyncronous request is completed.
       
   181 // (other items were commented in a header).
       
   182 // -----------------------------------------------------------------------------
       
   183 //
       
   184 void CPELogHandlingCommand::RunL
       
   185         (
       
   186         // None.
       
   187         )
       
   188     {
       
   189     TEFLOGSTRING2( KTAREQEND, "LOG CPELogHandlingCommand::RunL: < CLogClient LogId = %d. ", iLogId );   
       
   190     if ( iStatus.Int( ) != KErrNone && iStatus.Int( ) != KErrCancel )
       
   191         {
       
   192         TEFLOGSTRING2( KTAERROR, "LOG CPELogHandlingCommand::RunL: error = %d.", iStatus.Int() );   
       
   193         }
       
   194     iOwner.SendMessage( MEngineMonitor::EPEMessageLogEventSaved, iStatus.Int() );  
       
   195     }
       
   196 
       
   197 // -----------------------------------------------------------------------------
       
   198 // CPELogHandlingCommand::DoCancel
       
   199 // Cancels request to the log client
       
   200 // (other items were commented in a header).
       
   201 // -----------------------------------------------------------------------------
       
   202 //
       
   203 /*****************************************************
       
   204 *    Series 60 Customer / LOGENG
       
   205 *    Series 60  LOGENG API
       
   206 *****************************************************/
       
   207 void CPELogHandlingCommand::DoCancel
       
   208         (
       
   209         // None.
       
   210         )
       
   211     {
       
   212     TEFLOGSTRING( KTAINT, "LOG CPELogHandlingCommand::DoCancel" );
       
   213     
       
   214     iLogClient.Cancel( );  
       
   215     }
       
   216 
       
   217 
       
   218 
       
   219 //  End of File