dosservices/commondsy/src/CDSYExtensionDOSServerPlugin.cpp
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     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:  Implementation of CCDSYExtensionDOSServerPlugin class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES 
       
    22 #include "CDSYExtensionDOSServerPlugin.h"
       
    23 #include "commondsy_debug.h"
       
    24 #include "CDSYMessage.h"
       
    25 #include "CDSYMessageStructures.h"
       
    26 #include "CDSYMessageIDs.h"
       
    27 #include "CDSYDOSServerRequestManager.h"
       
    28 
       
    29 
       
    30 
       
    31 // EXTERNAL DATA STRUCTURES
       
    32 // EXTERNAL FUNCTION PROTOTYPES  
       
    33 // CONSTANTS
       
    34 // MACROS
       
    35 // LOCAL CONSTANTS AND MACROS
       
    36 // MODULE DATA STRUCTURES
       
    37 // LOCAL FUNCTION PROTOTYPES
       
    38 // FORWARD DECLARATIONS
       
    39 
       
    40 
       
    41 
       
    42 // ============================= LOCAL FUNCTIONS ===============================
       
    43 
       
    44 
       
    45 
       
    46 // ============================ MEMBER FUNCTIONS ===============================
       
    47 
       
    48 
       
    49 
       
    50 // -----------------------------------------------------------------------------
       
    51 // CCDSYExtensionDOSServerPlugin::CCDSYExtensionDOSServerPlugin
       
    52 // -----------------------------------------------------------------------------
       
    53 CCDSYExtensionDOSServerPlugin::CCDSYExtensionDOSServerPlugin( CCDSYDOSServerRequestManager& aCDSYDOSServerRequestManager )
       
    54 : iCDSYDOSServerRequestManager( aCDSYDOSServerRequestManager )
       
    55 , iDosExtensionBaseDSY( NULL )
       
    56     {
       
    57     COM_TRACE_1( "CDSY - CCDSYExtensionDOSServerPlugin::CCDSYExtensionDOSServerPlugin(0x%x)", &aCDSYDOSServerRequestManager );
       
    58 
       
    59     COM_TRACE_( "CDSY - CCDSYExtensionDOSServerPlugin::CCDSYExtensionDOSServerPlugin - return void" );
       
    60     }
       
    61 
       
    62 
       
    63 
       
    64 // -----------------------------------------------------------------------------
       
    65 // CCDSYExtensionDOSServerPlugin::~CCDSYExtensionDOSServerPlugin
       
    66 // -----------------------------------------------------------------------------
       
    67 CCDSYExtensionDOSServerPlugin::~CCDSYExtensionDOSServerPlugin()
       
    68     {
       
    69     COM_TRACE_( "CDSY - CCDSYExtensionDOSServerPlugin::~CCDSYExtensionDOSServerPlugin()" );
       
    70 
       
    71     iDosExtensionBaseDSY = NULL;
       
    72 
       
    73     COM_TRACE_( "CDSY - CCDSYExtensionDOSServerPlugin::~CCDSYExtensionDOSServerPlugin - return void" );
       
    74     }
       
    75 
       
    76 
       
    77 
       
    78 // -----------------------------------------------------------------------------
       
    79 // CCDSYFactory::ConstructL
       
    80 // -----------------------------------------------------------------------------
       
    81 void CCDSYExtensionDOSServerPlugin::ConstructL()
       
    82     {
       
    83     COM_TRACE_( "CDSY - CCDSYExtensionDOSServerPlugin::ConstructL()" );
       
    84     
       
    85     TCDSYMessage dsyMessage( KCDSYMsgGroup, KCDSYMsgInitializeExtensionCommand, NULL );
       
    86 
       
    87     iCDSYDOSServerRequestManager.SendMessageL( dsyMessage );
       
    88 
       
    89     TRACE_ASSERT( dsyMessage.ReturnData() != NULL );
       
    90     TRACE_ASSERT( dsyMessage.ReturnData()->Length() == sizeof ( TCDSYMsgDataExtensionInitialization ) );
       
    91 
       
    92     const TCDSYMsgDataExtensionInitialization* returnValue = REINTERPRET_CAST( const TCDSYMsgDataExtensionInitialization*, dsyMessage.ReturnData()->Ptr() );
       
    93 
       
    94     TRACE_ASSERT( returnValue->iDosExtensionBaseDSY != NULL );
       
    95 
       
    96     iDosExtensionBaseDSY = returnValue->iDosExtensionBaseDSY;
       
    97 
       
    98     COM_TRACE_( "CDSY - CCDSYExtensionDOSServerPlugin::ConstructL - return void" );
       
    99     }
       
   100 
       
   101 
       
   102 
       
   103 // -----------------------------------------------------------------------------
       
   104 // CCDSYExtensionDOSServerPlugin::NewL
       
   105 // -----------------------------------------------------------------------------
       
   106 CCDSYExtensionDOSServerPlugin* CCDSYExtensionDOSServerPlugin::NewL( CCDSYDOSServerRequestManager& aCDSYDOSServerRequestManager )
       
   107     {
       
   108     COM_TRACE_1( "CDSY - CCDSYExtensionDOSServerPlugin::NewL(0x%x)", &aCDSYDOSServerRequestManager );
       
   109     
       
   110     CCDSYExtensionDOSServerPlugin* extensionDOSServerPlugin = new ( ELeave ) CCDSYExtensionDOSServerPlugin( aCDSYDOSServerRequestManager );
       
   111     CleanupClosePushL( *extensionDOSServerPlugin );
       
   112     extensionDOSServerPlugin->ConstructL();
       
   113     CleanupStack::Pop( extensionDOSServerPlugin );
       
   114 
       
   115     COM_TRACE_1( "CDSY - CCDSYExtensionDOSServerPlugin::NewL - return 0x%x", extensionDOSServerPlugin );
       
   116     return extensionDOSServerPlugin;
       
   117     }
       
   118 
       
   119 
       
   120 
       
   121 // -----------------------------------------------------------------------------
       
   122 // CCDSYExtensionDOSServerPlugin::CallFunctionL
       
   123 // -----------------------------------------------------------------------------
       
   124 TInt CCDSYExtensionDOSServerPlugin::CallFunctionL( TInt aFunc, TAny* aParameter, TInt aParLength, TBool& aParameterModified )
       
   125     {
       
   126     API_TRACE_4( "CDSY - CCDSYExtensionDOSServerPlugin::CallFunctionL(0x%x, 0x%x, 0x%x, 0x%x)", aFunc, aParameter, aParLength, &aParameterModified );
       
   127     
       
   128     TRACE_ASSERT( iDosExtensionBaseDSY != NULL );
       
   129 
       
   130     if ( iDosExtensionBaseDSY == NULL )
       
   131         {
       
   132         User::Leave( KErrGeneral );
       
   133         }
       
   134     
       
   135     TInt err = iDosExtensionBaseDSY->CallFunctionL( aFunc, aParameter, aParLength, aParameterModified );
       
   136 
       
   137     API_TRACE_1( "CDSY - CCDSYExtensionDOSServerPlugin::CallFunctionL - return 0x%x", err );
       
   138     return err;
       
   139     }
       
   140 
       
   141 
       
   142 
       
   143 // -----------------------------------------------------------------------------
       
   144 // CCDSYExtensionDOSServerPlugin::CallFunctionAndCompleteL
       
   145 // -----------------------------------------------------------------------------
       
   146 void CCDSYExtensionDOSServerPlugin::CallFunctionAndCompleteL( TInt aFunc, TAny* aParameter, TInt aParLength, const RMessage2& aMessage )
       
   147     {
       
   148     API_TRACE_4( "CDSY - CCDSYExtensionDOSServerPlugin::CallFunctionAndCompleteL(0x%x, 0x%x, 0x%x, 0x%x)", aFunc, aParameter, aParLength, &aMessage );
       
   149 
       
   150     TRACE_ASSERT( iDosExtensionBaseDSY != NULL );
       
   151 
       
   152     if ( iDosExtensionBaseDSY == NULL )
       
   153         {
       
   154         User::Leave( KErrGeneral );
       
   155         }
       
   156 
       
   157     iDosExtensionBaseDSY->CallFunctionAndCompleteL( aFunc, aParameter, aParLength, aMessage );
       
   158 
       
   159     API_TRACE_( "CDSY - CCDSYExtensionDOSServerPlugin::CallFunctionAndCompleteL - return void" );
       
   160     }
       
   161