os/persistentdata/featuremgmt/featuremgr/test/helper/test_plugins/src/baseplugin.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/featuremgmt/featuremgr/test/helper/test_plugins/src/baseplugin.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,96 @@
     1.4 +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +
    1.20 +
    1.21 +#include "baseplugin.h"
    1.22 +#include <featmgr/featureinfoplugin.h>
    1.23 +#include "featmgrdebug.h"
    1.24 +#include "efm_test_consts.h"     
    1.25 +#include "plugintimer.h"     
    1.26 +
    1.27 +
    1.28 +CFeatMgrBasePlugin::CFeatMgrBasePlugin()
    1.29 +    {
    1.30 +    }
    1.31 +
    1.32 +CFeatMgrBasePlugin::~CFeatMgrBasePlugin()
    1.33 +    {
    1.34 +    if ( iTimer )
    1.35 +        {
    1.36 +        delete iTimer;
    1.37 +        iTimer = NULL;
    1.38 +        }
    1.39 +    }
    1.40 +
    1.41 +void CFeatMgrBasePlugin::ConstructL()
    1.42 +    {
    1.43 +    }
    1.44 +    
    1.45 +void CFeatMgrBasePlugin::ProcessCommandL( const FeatureInfoCommand::TFeatureInfoCmd aCommandId,
    1.46 +                                      const TUint8 aTransId,
    1.47 +                                      TDesC8& /*aData*/ )
    1.48 +    {
    1.49 +    INFO_LOG2( "FeatMgrPlugin: Processing command: 0x%x, TransId: 0x%x", 
    1.50 +                         aCommandId, aTransId );
    1.51 +           
    1.52 +    switch ( aCommandId )
    1.53 +        {
    1.54 +        case FeatureInfoCommand::ELoadFeatureInfoCmdId:
    1.55 +            {
    1.56 +            INFO_LOG( "FeatMgrPlugin: Processed ELoadFeatureInfoCmdId" );
    1.57 +            // Load feature info
    1.58 +            }
    1.59 +            break;
    1.60 +        case FeatureInfoCommand::ELoadEnhancedFeatureInfoCmdId:
    1.61 +            {
    1.62 +            }
    1.63 +        default :
    1.64 +            {
    1.65 +            INFO_LOG1( "FeatMgrPlugin: Unknown Command: 0x%x", aCommandId );
    1.66 +            User::Leave(KErrNotSupported);
    1.67 +            }
    1.68 +            break;
    1.69 +        }
    1.70 +        
    1.71 +    TInt retval(KErrNone);
    1.72 +    TInt timeout( 50 ); // microseconds
    1.73 +
    1.74 +    // create new timer
    1.75 +
    1.76 +
    1.77 +    if ( iTimer && !iTimer->IsActive() )
    1.78 +        {
    1.79 +        delete iTimer;
    1.80 +        iTimer = NULL;
    1.81 +        }
    1.82 +        
    1.83 +    iTimer = CPluginTimer::NewL(timeout, *iResponseCallback, aCommandId, aTransId, retval,this);
    1.84 +    }
    1.85 +
    1.86 +    
    1.87 +void CFeatMgrBasePlugin::GenericTimerFiredL(
    1.88 +    MFeatureInfoPluginCallback& /*aService*/,
    1.89 +    FeatureInfoCommand::TFeatureInfoCmd /*aCommandId*/,
    1.90 +    TUint8 /*aTransId*/,
    1.91 +    TInt /*aRetVal*/ )
    1.92 +    {
    1.93 +    if ( iTimer && !iTimer->IsActive() )
    1.94 +        {
    1.95 +        delete iTimer;
    1.96 +        iTimer = NULL;            
    1.97 +        INFO_LOG( "FeatMgr Plugin: GenericTimerFiredL - Removed obsolete timer" );
    1.98 +        }
    1.99 +    }