os/persistentdata/featuremgmt/featuremgr/test/helper/test_plugins/src/reconciliationplugin.cpp
First public contribution.
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 "reconciliationplugin.h"
19 #include <featmgr/featureinfoplugin.h>
20 #include "featmgrdebug.h"
21 #include "efm_test_consts.h"
22 #include <ecom/implementationproxy.h>
24 // Map the interface implementation UIDs to implementation factory functions
25 const TImplementationProxy ImplementationTable[] =
27 IMPLEMENTATION_PROXY_ENTRY(0x102836F4, CFeatMgrReconciliationPlugin::NewL),
30 // Exported proxy for instantiation method resolution.
31 EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
33 aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
34 return ImplementationTable;
37 CFeatMgrReconciliationPlugin* CFeatMgrReconciliationPlugin::NewL()
39 CFeatMgrReconciliationPlugin* self = new(ELeave) CFeatMgrReconciliationPlugin();
40 CleanupStack::PushL(self);
42 CleanupStack::Pop(self);
46 CFeatMgrReconciliationPlugin::~CFeatMgrReconciliationPlugin()
55 CFeatMgrReconciliationPlugin::CFeatMgrReconciliationPlugin()
59 void CFeatMgrReconciliationPlugin::ConstructL()
63 void CFeatMgrReconciliationPlugin::ProcessCommandL( const FeatureInfoCommand::TFeatureInfoCmd aCommandId,
64 const TUint8 aTransId,
67 INFO_LOG2( "FeatMgrPlugin: Processing command: 0x%x, TransId: 0x%x",
68 aCommandId, aTransId );
72 case FeatureInfoCommand::ELoadFeatureInfoCmdId:
74 INFO_LOG( "FeatMgrPlugin: Processed ELoadFeatureInfoCmdId" );
78 case FeatureInfoCommand::ELoadEnhancedFeatureInfoCmdId:
80 INFO_LOG( "FeatMgrPlugin: Processed ELoadEnhancedFeatureInfoCmdId" );
86 INFO_LOG1( "FeatMgrPlugin: Unknown Command: 0x%x", aCommandId );
87 User::Leave(KErrNotSupported);
92 TInt retval(KErrNone);
93 TInt timeout( 50 ); // microseconds
97 if ( iTimer && !iTimer->IsActive() )
103 iTimer = CPluginTimer::NewL(timeout, *iResponseCallback, aCommandId, aTransId, retval,this);
106 void CFeatMgrReconciliationPlugin::GenericTimerFiredL(
107 MFeatureInfoPluginCallback& aService,
108 FeatureInfoCommand::TFeatureInfoCmd aCommandId,
112 INFO_LOG2( "FeatMgr Plugin: GenericTimerFiredL (0x%x, 0x%x)",
113 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 = KDefaultSupportedUid.iUid;
128 feature1.iValue = ETrue;
129 list.AppendL(feature1);
130 feature1.iFeatureID = KBlacklistedUid.iUid;
131 feature1.iValue = ETrue;
132 list.AppendL(feature1);
133 feature1.iFeatureID = KModifiableUid.iUid;
134 feature1.iValue = ETrue;
135 list.AppendL(feature1);
138 feature1.iFeatureID = KSupportedUpgradeableUid.iUid;
139 feature1.iValue = ETrue;
140 list.AppendL(feature1);
142 feature1.iFeatureID = KSupportedUpgradeableBlacklistedUid.iUid;
143 feature1.iValue = ETrue;
144 list.AppendL(feature1);
146 feature1.iFeatureID = KSupportedUpgradeableModifiableUid.iUid;
147 feature1.iValue = ETrue;
148 list.AppendL(feature1);
150 feature1.iFeatureID = KSupportedUpgradeableModifiableUninitialisedUid.iUid;
151 feature1.iValue = ETrue;
152 list.AppendL(feature1);
154 feature1.iFeatureID = KSupportedUpgradeableModifiablePersistedUid.iUid;
155 feature1.iValue = ETrue;
156 list.AppendL(feature1);
158 featureList.iErrorCode = KErrNone;
159 featureList.iList = list;
161 FeatureInfoCommand::TFeatureInfoRespPckg resPackage(featureList);
163 TRAP(err, aService.ProcessResponseL(aCommandId, aTransId, resPackage));
165 CleanupStack::PopAndDestroy( &list );
169 case FeatureInfoCommand::ELoadEnhancedFeatureInfoCmdId:
171 // Return some features and KErrNone.
172 FeatureInfoCommand::TEnhancedFeatureInfo featureList;
173 RFeatureArray features;
174 CleanupClosePushL( features );
175 TBitFlags32 flags( 0 );
176 flags.Set( EFeatureSupported );
177 const TInt KDefaultData( 0x00ff00ff );
178 TFeatureEntry entry( TUid::Uid(KNewUid.iUid), flags, KDefaultData );
179 features.AppendL( entry );
180 featureList.iErrorCode = KErrNone;
181 featureList.iList = features;
183 FeatureInfoCommand::TEnhancedFeatureInfoRespPckg resPackage(featureList);
185 TRAP(err, aService.ProcessResponseL(aCommandId, aTransId, resPackage));
187 CleanupStack::PopAndDestroy( &features );
197 if ( err != KErrNone )
199 ERROR_LOG1( "FeatMgr Plugin: Error in ProcessResponseL: %d", err );
202 if ( iTimer && !iTimer->IsActive() )
206 INFO_LOG( "FeatMgr Plugin: GenericTimerFiredL - Removed obsolete timer" );