phoneengine/loghandling/src/cpeloghandlingproxy.cpp
changeset 36 2eacb6118286
parent 30 ebdbd102c78a
child 37 ba76fc04e6c2
equal deleted inserted replaced
30:ebdbd102c78a 36:2eacb6118286
     1 /*
       
     2 * Copyright (c) 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 CPELogHandlingProxy
       
    15 *              : class member functions.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 //  INCLUDE FILES
       
    22 #include "cpeloghandling.h"
       
    23 #include "cpeloghandlingdummy.h"
       
    24 #include "cpeloghandlingproxy.h"
       
    25 #include <talogger.h>
       
    26 #include <pepanic.pan>
       
    27 #include "mpeloghandling.h"
       
    28 #include <mpephonemodelinternal.h>
       
    29 #include <mpedatastore.h>
       
    30 
       
    31 // EXTERNAL DATA STRUCTURES
       
    32 // None
       
    33 
       
    34 // EXTERNAL FUNCTION PROTOTYPES  
       
    35 /// None
       
    36 
       
    37 // CONSTANTS
       
    38 // None
       
    39 
       
    40 // MACROS
       
    41 // None
       
    42 
       
    43 // LOCAL CONSTANTS AND MACROS
       
    44 // None
       
    45 
       
    46 // MODULE DATA STRUCTURES
       
    47 // None
       
    48 
       
    49 // LOCAL FUNCTION PROTOTYPES
       
    50 // None
       
    51 
       
    52 // ================= MEMBER FUNCTIONS =======================
       
    53 // -----------------------------------------------------------------------------
       
    54 // CPELogHandlingProxy::CreateFirstPhaseL
       
    55 // This method creates the log handling proxy and dummy implementation
       
    56 // -----------------------------------------------------------------------------
       
    57 //
       
    58 EXPORT_C MPELogHandling* CPELogHandlingProxy::CreateFirstPhaseL()
       
    59     {
       
    60     TEFLOGSTRING( KTAOBJECT, "LOG CPELogHandlingProxy::CreateFirstPhaseL start." );
       
    61     CPELogHandlingProxy* self = new ( ELeave ) CPELogHandlingProxy();
       
    62     CleanupStack::PushL( self );
       
    63     self->ConstructL();
       
    64     CleanupStack::Pop( self );
       
    65     TEFLOGSTRING( KTAOBJECT, "LOG CPELogHandlingProxy::CreateFirstPhaseL complete" );
       
    66     return self;
       
    67     }
       
    68 
       
    69 // -----------------------------------------------------------------------------
       
    70 // PELogHandling::CreateSecondPhaseL
       
    71 // This method creates the actual log handling implementation
       
    72 // -----------------------------------------------------------------------------
       
    73 //
       
    74 EXPORT_C void CPELogHandlingProxy::CreateSecondPhaseL(
       
    75         MPEPhoneModelInternal& aModel,        // Owner of the object
       
    76         RFs& aFsSession                       // Handle to a file server session
       
    77         )
       
    78     {
       
    79     TEFLOGSTRING( KTAOBJECT, "LOG CPELogHandlingProxy::CreateSecondPhaseL start." );
       
    80     iLogHandling = CPELogHandling::NewL( aModel, aFsSession );
       
    81     TEFLOGSTRING( KTAOBJECT, "LOG CPELogHandlingProxy::CreateSecondPhaseL complete." );
       
    82     }
       
    83 
       
    84 // -----------------------------------------------------------------------------
       
    85 // CPELogHandlingProxy::~CPELogHandlingProxy
       
    86 // Destructor.
       
    87 // -----------------------------------------------------------------------------
       
    88 //
       
    89 EXPORT_C CPELogHandlingProxy::~CPELogHandlingProxy()
       
    90     {
       
    91     TEFLOGSTRING( KTAOBJECT, "LOG CPELogHandlingProxy::~CPELogHandlingProxy" );
       
    92     delete iLogHandling;
       
    93     delete iLogHandlingDummy;
       
    94     }
       
    95 
       
    96 // -----------------------------------------------------------------------------
       
    97 // CPELogHandlingProxy::CPELogHandlingProxy
       
    98 // C++ default constructor can NOT contain any code, that
       
    99 // might leave.
       
   100 // -----------------------------------------------------------------------------
       
   101 //
       
   102 CPELogHandlingProxy::CPELogHandlingProxy()
       
   103     {
       
   104     }
       
   105 
       
   106 // -----------------------------------------------------------------------------
       
   107 // CPELogHandlingProxy::ConstructL
       
   108 // Symbian 2nd phase constructor can leave.
       
   109 // -----------------------------------------------------------------------------
       
   110 //
       
   111 void CPELogHandlingProxy::ConstructL()
       
   112     {
       
   113     TEFLOGSTRING( KTAOBJECT, "LOG CPELogHandlingProxy::ConstructL" );
       
   114     // Create an instance of the log handling dummy implementation
       
   115     iLogHandlingDummy = CPELogHandlingDummy::NewL();
       
   116     }
       
   117 
       
   118 // -----------------------------------------------------------------------------
       
   119 // CPELogHandlingProxy::SaveCallEntry
       
   120 // Redirects the function call to either log handling implementation or
       
   121 // log handling dummy implementation.
       
   122 // -----------------------------------------------------------------------------
       
   123 //
       
   124 EXPORT_C TInt CPELogHandlingProxy::SaveCallEntry
       
   125         ( 
       
   126         const TInt aCallId
       
   127         )
       
   128     {
       
   129     if ( iLogHandling )
       
   130         {
       
   131         TEFLOGSTRING( KTAINT, "LOG CPELogHandlingProxy::SaveCallEntry > CPELogHandling::SaveCallEntry" );
       
   132         return iLogHandling->SaveCallEntry( aCallId );
       
   133         }
       
   134     else if ( iLogHandlingDummy )
       
   135         {
       
   136         TEFLOGSTRING( KTAINT, "LOG CPELogHandlingProxy::SaveCallEntry > CPELogHandlingDummy::SaveCallEntry" );
       
   137         return iLogHandlingDummy->SaveCallEntry( aCallId );
       
   138         }
       
   139     else
       
   140         {
       
   141         TEFLOGSTRING( KTAERROR, "LOG CPELOGHANDLINGPROXY::SAVECALLENTRY ! NEITHER LOG HANDLING NOR LOG HANDLING DUMMY EXISTS" );
       
   142         User::Invariant();
       
   143         }
       
   144     return KErrBadHandle;
       
   145     }
       
   146 
       
   147 // End of File