sl@0
|
1 |
// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
|
sl@0
|
17 |
|
sl@0
|
18 |
#include "reconciliationplugin.h"
|
sl@0
|
19 |
#include <featmgr/featureinfoplugin.h>
|
sl@0
|
20 |
#include "featmgrdebug.h"
|
sl@0
|
21 |
#include "efm_test_consts.h"
|
sl@0
|
22 |
#include <ecom/implementationproxy.h>
|
sl@0
|
23 |
|
sl@0
|
24 |
// Map the interface implementation UIDs to implementation factory functions
|
sl@0
|
25 |
const TImplementationProxy ImplementationTable[] =
|
sl@0
|
26 |
{
|
sl@0
|
27 |
IMPLEMENTATION_PROXY_ENTRY(0x102836F4, CFeatMgrReconciliationPlugin::NewL),
|
sl@0
|
28 |
};
|
sl@0
|
29 |
|
sl@0
|
30 |
// Exported proxy for instantiation method resolution.
|
sl@0
|
31 |
EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
|
sl@0
|
32 |
{
|
sl@0
|
33 |
aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
|
sl@0
|
34 |
return ImplementationTable;
|
sl@0
|
35 |
}
|
sl@0
|
36 |
|
sl@0
|
37 |
CFeatMgrReconciliationPlugin* CFeatMgrReconciliationPlugin::NewL()
|
sl@0
|
38 |
{
|
sl@0
|
39 |
CFeatMgrReconciliationPlugin* self = new(ELeave) CFeatMgrReconciliationPlugin();
|
sl@0
|
40 |
CleanupStack::PushL(self);
|
sl@0
|
41 |
self->ConstructL();
|
sl@0
|
42 |
CleanupStack::Pop(self);
|
sl@0
|
43 |
return self;
|
sl@0
|
44 |
}
|
sl@0
|
45 |
|
sl@0
|
46 |
CFeatMgrReconciliationPlugin::~CFeatMgrReconciliationPlugin()
|
sl@0
|
47 |
{
|
sl@0
|
48 |
if ( iTimer )
|
sl@0
|
49 |
{
|
sl@0
|
50 |
delete iTimer;
|
sl@0
|
51 |
iTimer = NULL;
|
sl@0
|
52 |
}
|
sl@0
|
53 |
}
|
sl@0
|
54 |
|
sl@0
|
55 |
CFeatMgrReconciliationPlugin::CFeatMgrReconciliationPlugin()
|
sl@0
|
56 |
{
|
sl@0
|
57 |
}
|
sl@0
|
58 |
|
sl@0
|
59 |
void CFeatMgrReconciliationPlugin::ConstructL()
|
sl@0
|
60 |
{
|
sl@0
|
61 |
}
|
sl@0
|
62 |
|
sl@0
|
63 |
void CFeatMgrReconciliationPlugin::ProcessCommandL( const FeatureInfoCommand::TFeatureInfoCmd aCommandId,
|
sl@0
|
64 |
const TUint8 aTransId,
|
sl@0
|
65 |
TDesC8& /*aData*/ )
|
sl@0
|
66 |
{
|
sl@0
|
67 |
INFO_LOG2( "FeatMgrPlugin: Processing command: 0x%x, TransId: 0x%x",
|
sl@0
|
68 |
aCommandId, aTransId );
|
sl@0
|
69 |
|
sl@0
|
70 |
switch ( aCommandId )
|
sl@0
|
71 |
{
|
sl@0
|
72 |
case FeatureInfoCommand::ELoadFeatureInfoCmdId:
|
sl@0
|
73 |
{
|
sl@0
|
74 |
INFO_LOG( "FeatMgrPlugin: Processed ELoadFeatureInfoCmdId" );
|
sl@0
|
75 |
// Load feature info
|
sl@0
|
76 |
}
|
sl@0
|
77 |
break;
|
sl@0
|
78 |
case FeatureInfoCommand::ELoadEnhancedFeatureInfoCmdId:
|
sl@0
|
79 |
{
|
sl@0
|
80 |
INFO_LOG( "FeatMgrPlugin: Processed ELoadEnhancedFeatureInfoCmdId" );
|
sl@0
|
81 |
// Load feature info
|
sl@0
|
82 |
}
|
sl@0
|
83 |
break;
|
sl@0
|
84 |
default :
|
sl@0
|
85 |
{
|
sl@0
|
86 |
INFO_LOG1( "FeatMgrPlugin: Unknown Command: 0x%x", aCommandId );
|
sl@0
|
87 |
User::Leave(KErrNotSupported);
|
sl@0
|
88 |
}
|
sl@0
|
89 |
break;
|
sl@0
|
90 |
}
|
sl@0
|
91 |
|
sl@0
|
92 |
TInt retval(KErrNone);
|
sl@0
|
93 |
TInt timeout( 50 ); // microseconds
|
sl@0
|
94 |
|
sl@0
|
95 |
// create new timer
|
sl@0
|
96 |
|
sl@0
|
97 |
if ( iTimer && !iTimer->IsActive() )
|
sl@0
|
98 |
{
|
sl@0
|
99 |
delete iTimer;
|
sl@0
|
100 |
iTimer = NULL;
|
sl@0
|
101 |
}
|
sl@0
|
102 |
|
sl@0
|
103 |
iTimer = CPluginTimer::NewL(timeout, *iResponseCallback, aCommandId, aTransId, retval,this);
|
sl@0
|
104 |
}
|
sl@0
|
105 |
|
sl@0
|
106 |
void CFeatMgrReconciliationPlugin::GenericTimerFiredL(
|
sl@0
|
107 |
MFeatureInfoPluginCallback& aService,
|
sl@0
|
108 |
FeatureInfoCommand::TFeatureInfoCmd aCommandId,
|
sl@0
|
109 |
TUint8 aTransId,
|
sl@0
|
110 |
TInt /*aRetVal*/ )
|
sl@0
|
111 |
{
|
sl@0
|
112 |
INFO_LOG2( "FeatMgr Plugin: GenericTimerFiredL (0x%x, 0x%x)",
|
sl@0
|
113 |
aCommandId, aTransId );
|
sl@0
|
114 |
TInt err( KErrNone );
|
sl@0
|
115 |
|
sl@0
|
116 |
switch ( aCommandId )
|
sl@0
|
117 |
{
|
sl@0
|
118 |
case FeatureInfoCommand::ELoadFeatureInfoCmdId:
|
sl@0
|
119 |
{
|
sl@0
|
120 |
// Return some features and KErrNone.
|
sl@0
|
121 |
FeatureInfoCommand::TFeatureInfo featureList;
|
sl@0
|
122 |
TInt err( KErrNone );
|
sl@0
|
123 |
RArray<FeatureInfoCommand::TFeature> list;
|
sl@0
|
124 |
CleanupClosePushL( list );
|
sl@0
|
125 |
FeatureInfoCommand::TFeature feature1;
|
sl@0
|
126 |
|
sl@0
|
127 |
feature1.iFeatureID = KDefaultSupportedUid.iUid;
|
sl@0
|
128 |
feature1.iValue = ETrue;
|
sl@0
|
129 |
list.AppendL(feature1);
|
sl@0
|
130 |
feature1.iFeatureID = KBlacklistedUid.iUid;
|
sl@0
|
131 |
feature1.iValue = ETrue;
|
sl@0
|
132 |
list.AppendL(feature1);
|
sl@0
|
133 |
feature1.iFeatureID = KModifiableUid.iUid;
|
sl@0
|
134 |
feature1.iValue = ETrue;
|
sl@0
|
135 |
list.AppendL(feature1);
|
sl@0
|
136 |
|
sl@0
|
137 |
|
sl@0
|
138 |
feature1.iFeatureID = KSupportedUpgradeableUid.iUid;
|
sl@0
|
139 |
feature1.iValue = ETrue;
|
sl@0
|
140 |
list.AppendL(feature1);
|
sl@0
|
141 |
|
sl@0
|
142 |
feature1.iFeatureID = KSupportedUpgradeableBlacklistedUid.iUid;
|
sl@0
|
143 |
feature1.iValue = ETrue;
|
sl@0
|
144 |
list.AppendL(feature1);
|
sl@0
|
145 |
|
sl@0
|
146 |
feature1.iFeatureID = KSupportedUpgradeableModifiableUid.iUid;
|
sl@0
|
147 |
feature1.iValue = ETrue;
|
sl@0
|
148 |
list.AppendL(feature1);
|
sl@0
|
149 |
|
sl@0
|
150 |
feature1.iFeatureID = KSupportedUpgradeableModifiableUninitialisedUid.iUid;
|
sl@0
|
151 |
feature1.iValue = ETrue;
|
sl@0
|
152 |
list.AppendL(feature1);
|
sl@0
|
153 |
|
sl@0
|
154 |
feature1.iFeatureID = KSupportedUpgradeableModifiablePersistedUid.iUid;
|
sl@0
|
155 |
feature1.iValue = ETrue;
|
sl@0
|
156 |
list.AppendL(feature1);
|
sl@0
|
157 |
|
sl@0
|
158 |
featureList.iErrorCode = KErrNone;
|
sl@0
|
159 |
featureList.iList = list;
|
sl@0
|
160 |
|
sl@0
|
161 |
FeatureInfoCommand::TFeatureInfoRespPckg resPackage(featureList);
|
sl@0
|
162 |
|
sl@0
|
163 |
TRAP(err, aService.ProcessResponseL(aCommandId, aTransId, resPackage));
|
sl@0
|
164 |
|
sl@0
|
165 |
CleanupStack::PopAndDestroy( &list );
|
sl@0
|
166 |
break;
|
sl@0
|
167 |
}
|
sl@0
|
168 |
|
sl@0
|
169 |
case FeatureInfoCommand::ELoadEnhancedFeatureInfoCmdId:
|
sl@0
|
170 |
{
|
sl@0
|
171 |
// Return some features and KErrNone.
|
sl@0
|
172 |
FeatureInfoCommand::TEnhancedFeatureInfo featureList;
|
sl@0
|
173 |
RFeatureArray features;
|
sl@0
|
174 |
CleanupClosePushL( features );
|
sl@0
|
175 |
TBitFlags32 flags( 0 );
|
sl@0
|
176 |
flags.Set( EFeatureSupported );
|
sl@0
|
177 |
const TInt KDefaultData( 0x00ff00ff );
|
sl@0
|
178 |
TFeatureEntry entry( TUid::Uid(KNewUid.iUid), flags, KDefaultData );
|
sl@0
|
179 |
features.AppendL( entry );
|
sl@0
|
180 |
featureList.iErrorCode = KErrNone;
|
sl@0
|
181 |
featureList.iList = features;
|
sl@0
|
182 |
|
sl@0
|
183 |
FeatureInfoCommand::TEnhancedFeatureInfoRespPckg resPackage(featureList);
|
sl@0
|
184 |
|
sl@0
|
185 |
TRAP(err, aService.ProcessResponseL(aCommandId, aTransId, resPackage));
|
sl@0
|
186 |
|
sl@0
|
187 |
CleanupStack::PopAndDestroy( &features );
|
sl@0
|
188 |
break;
|
sl@0
|
189 |
}
|
sl@0
|
190 |
|
sl@0
|
191 |
default :
|
sl@0
|
192 |
break;
|
sl@0
|
193 |
}
|
sl@0
|
194 |
|
sl@0
|
195 |
// TEST CASES END
|
sl@0
|
196 |
|
sl@0
|
197 |
if ( err != KErrNone )
|
sl@0
|
198 |
{
|
sl@0
|
199 |
ERROR_LOG1( "FeatMgr Plugin: Error in ProcessResponseL: %d", err );
|
sl@0
|
200 |
}
|
sl@0
|
201 |
|
sl@0
|
202 |
if ( iTimer && !iTimer->IsActive() )
|
sl@0
|
203 |
{
|
sl@0
|
204 |
delete iTimer;
|
sl@0
|
205 |
iTimer = NULL;
|
sl@0
|
206 |
INFO_LOG( "FeatMgr Plugin: GenericTimerFiredL - Removed obsolete timer" );
|
sl@0
|
207 |
}
|
sl@0
|
208 |
}
|
sl@0
|
209 |
|