os/persistentdata/featuremgmt/featuremgr/test/helper/test_plugins/src/baseplugin.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 
    17 
    18 #include "baseplugin.h"
    19 #include <featmgr/featureinfoplugin.h>
    20 #include "featmgrdebug.h"
    21 #include "efm_test_consts.h"     
    22 #include "plugintimer.h"     
    23 
    24 
    25 CFeatMgrBasePlugin::CFeatMgrBasePlugin()
    26     {
    27     }
    28 
    29 CFeatMgrBasePlugin::~CFeatMgrBasePlugin()
    30     {
    31     if ( iTimer )
    32         {
    33         delete iTimer;
    34         iTimer = NULL;
    35         }
    36     }
    37 
    38 void CFeatMgrBasePlugin::ConstructL()
    39     {
    40     }
    41     
    42 void CFeatMgrBasePlugin::ProcessCommandL( const FeatureInfoCommand::TFeatureInfoCmd aCommandId,
    43                                       const TUint8 aTransId,
    44                                       TDesC8& /*aData*/ )
    45     {
    46     INFO_LOG2( "FeatMgrPlugin: Processing command: 0x%x, TransId: 0x%x", 
    47                          aCommandId, aTransId );
    48            
    49     switch ( aCommandId )
    50         {
    51         case FeatureInfoCommand::ELoadFeatureInfoCmdId:
    52             {
    53             INFO_LOG( "FeatMgrPlugin: Processed ELoadFeatureInfoCmdId" );
    54             // Load feature info
    55             }
    56             break;
    57         case FeatureInfoCommand::ELoadEnhancedFeatureInfoCmdId:
    58             {
    59             }
    60         default :
    61             {
    62             INFO_LOG1( "FeatMgrPlugin: Unknown Command: 0x%x", aCommandId );
    63             User::Leave(KErrNotSupported);
    64             }
    65             break;
    66         }
    67         
    68     TInt retval(KErrNone);
    69     TInt timeout( 50 ); // microseconds
    70 
    71     // create new timer
    72 
    73 
    74     if ( iTimer && !iTimer->IsActive() )
    75         {
    76         delete iTimer;
    77         iTimer = NULL;
    78         }
    79         
    80     iTimer = CPluginTimer::NewL(timeout, *iResponseCallback, aCommandId, aTransId, retval,this);
    81     }
    82 
    83     
    84 void CFeatMgrBasePlugin::GenericTimerFiredL(
    85     MFeatureInfoPluginCallback& /*aService*/,
    86     FeatureInfoCommand::TFeatureInfoCmd /*aCommandId*/,
    87     TUint8 /*aTransId*/,
    88     TInt /*aRetVal*/ )
    89     {
    90     if ( iTimer && !iTimer->IsActive() )
    91         {
    92         delete iTimer;
    93         iTimer = NULL;            
    94         INFO_LOG( "FeatMgr Plugin: GenericTimerFiredL - Removed obsolete timer" );
    95         }
    96     }