os/persistentdata/featuremgmt/featuremgr/test/helper/test_plugins/src/hangingplugin.cpp
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
18 #include "hangingplugin.h"
19 #include <featmgr/featureinfoplugin.h>
20 #include "featmgrdebug.h"
21 #include "efm_test_consts.h"
22 #include <ecom/implementationproxy.h>
23 #include "featmgrconfiguration.h"
26 // Map the interface implementation UIDs to implementation factory functions
27 const TImplementationProxy ImplementationTable[] =
29 IMPLEMENTATION_PROXY_ENTRY(0x102836FA, CFeatMgrHangingPlugin::NewL),
32 // Exported proxy for instantiation method resolution.
33 EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
35 aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
36 return ImplementationTable;
39 CFeatMgrHangingPlugin* CFeatMgrHangingPlugin::NewL()
41 CFeatMgrHangingPlugin* self = new(ELeave) CFeatMgrHangingPlugin();
42 CleanupStack::PushL(self);
44 CleanupStack::Pop(self);
48 CFeatMgrHangingPlugin::~CFeatMgrHangingPlugin()
52 CFeatMgrHangingPlugin::CFeatMgrHangingPlugin()
56 void CFeatMgrHangingPlugin::ConstructL()
60 void CFeatMgrHangingPlugin::ProcessCommandL( const FeatureInfoCommand::TFeatureInfoCmd aCommandId,
61 const TUint8 aTransId,
64 INFO_LOG2( "FeatMgr Hanging Plugin: Processing command: 0x%x, TransId: 0x%x",
65 aCommandId, aTransId );
69 case FeatureInfoCommand::ELoadFeatureInfoCmdId:
71 INFO_LOG( "FeatMgr Hanging Plugin: Processed ELoadFeatureInfoCmdId" );
75 case FeatureInfoCommand::ELoadEnhancedFeatureInfoCmdId:
77 INFO_LOG( "FeatMgr Hanging Plugin: extended command interface not supported");
78 User::Leave(KErrNotSupported);
82 INFO_LOG1( "FeatMgr Hanging Plugin: Unknown Command: 0x%x", aCommandId );
83 User::Leave(KErrNotSupported);
88 TInt retval(KErrNone);
89 TInt timeout( 1.5*KDefaultFeatMgrTimer ); // microseconds
94 if ( iTimer && !iTimer->IsActive() )
100 iTimer = CPluginTimer::NewL(timeout, *iResponseCallback, aCommandId, aTransId, retval,this);
104 void CFeatMgrHangingPlugin::GenericTimerFiredL(
105 MFeatureInfoPluginCallback& aService,
106 FeatureInfoCommand::TFeatureInfoCmd aCommandId,
110 CFeatMgrBasePlugin::GenericTimerFiredL(aService,aCommandId,aTransId,aRetVal);
111 INFO_LOG2( "FeatMgr Hanging Plugin: GenericTimerFiredL (0x%x, 0x%x)",
112 aCommandId, aTransId );
114 TInt err( KErrNone );
116 switch ( aCommandId )
118 case FeatureInfoCommand::ELoadFeatureInfoCmdId:
120 // Return some features and KErrNone.
121 FeatureInfoCommand::TFeatureInfo featureList;
122 TInt err( KErrNone );
123 RArray<FeatureInfoCommand::TFeature> list;
124 CleanupClosePushL( list );
125 FeatureInfoCommand::TFeature feature1;
127 feature1.iFeatureID = KHangingPluginUid.iUid;
128 feature1.iValue = ETrue;
129 list.AppendL(feature1);
131 featureList.iErrorCode = KErrNone;
132 featureList.iList = list;
134 FeatureInfoCommand::TFeatureInfoRespPckg resPackage(featureList);
136 TRAP(err, aService.ProcessResponseL(aCommandId, aTransId, resPackage));
138 CleanupStack::PopAndDestroy( &list );
148 if ( err != KErrNone )
150 ERROR_LOG1( "FeatMgr Plugin: Error in ProcessResponseL: %d", err );