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 "slowstartplugin.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 |
#include "featmgrconfiguration.h"
|
sl@0
|
24 |
|
sl@0
|
25 |
|
sl@0
|
26 |
// Map the interface implementation UIDs to implementation factory functions
|
sl@0
|
27 |
const TImplementationProxy ImplementationTable[] =
|
sl@0
|
28 |
{
|
sl@0
|
29 |
IMPLEMENTATION_PROXY_ENTRY(0x102836FC, CFeatMgrSlowStartPlugin::NewL),
|
sl@0
|
30 |
};
|
sl@0
|
31 |
|
sl@0
|
32 |
// Exported proxy for instantiation method resolution.
|
sl@0
|
33 |
EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
|
sl@0
|
34 |
{
|
sl@0
|
35 |
aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
|
sl@0
|
36 |
return ImplementationTable;
|
sl@0
|
37 |
}
|
sl@0
|
38 |
|
sl@0
|
39 |
CFeatMgrSlowStartPlugin* CFeatMgrSlowStartPlugin::NewL()
|
sl@0
|
40 |
{
|
sl@0
|
41 |
CFeatMgrSlowStartPlugin* self = new(ELeave) CFeatMgrSlowStartPlugin();
|
sl@0
|
42 |
CleanupStack::PushL(self);
|
sl@0
|
43 |
self->ConstructL();
|
sl@0
|
44 |
CleanupStack::Pop(self);
|
sl@0
|
45 |
return self;
|
sl@0
|
46 |
}
|
sl@0
|
47 |
|
sl@0
|
48 |
CFeatMgrSlowStartPlugin::~CFeatMgrSlowStartPlugin()
|
sl@0
|
49 |
{
|
sl@0
|
50 |
}
|
sl@0
|
51 |
|
sl@0
|
52 |
CFeatMgrSlowStartPlugin::CFeatMgrSlowStartPlugin()
|
sl@0
|
53 |
{
|
sl@0
|
54 |
}
|
sl@0
|
55 |
|
sl@0
|
56 |
void CFeatMgrSlowStartPlugin::ConstructL()
|
sl@0
|
57 |
{
|
sl@0
|
58 |
}
|
sl@0
|
59 |
|
sl@0
|
60 |
void CFeatMgrSlowStartPlugin::ProcessCommandL( const FeatureInfoCommand::TFeatureInfoCmd aCommandId,
|
sl@0
|
61 |
const TUint8 aTransId,
|
sl@0
|
62 |
TDesC8& /*aData*/ )
|
sl@0
|
63 |
{
|
sl@0
|
64 |
INFO_LOG2( "FeatMgr SlowStart Plugin: Processing command: 0x%x, TransId: 0x%x",
|
sl@0
|
65 |
aCommandId, aTransId );
|
sl@0
|
66 |
|
sl@0
|
67 |
// Slow things down with a 1/2 second delay.
|
sl@0
|
68 |
User::After(200000);
|
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( "FeatMgr SlowStart Plugin: 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( "FeatMgr SlowStart Plugin: extended command interface not supported");
|
sl@0
|
81 |
User::Leave(KErrNotSupported);
|
sl@0
|
82 |
}
|
sl@0
|
83 |
default :
|
sl@0
|
84 |
{
|
sl@0
|
85 |
INFO_LOG1( "FeatMgr SlowStart Plugin: Unknown Command: 0x%x", aCommandId );
|
sl@0
|
86 |
User::Leave(KErrNotSupported);
|
sl@0
|
87 |
}
|
sl@0
|
88 |
break;
|
sl@0
|
89 |
}
|
sl@0
|
90 |
|
sl@0
|
91 |
TInt retval(KErrNone);
|
sl@0
|
92 |
TInt timeout( 0.5*KDefaultFeatMgrTimer ); // We don't actually want to timeout, but add an extra delay.
|
sl@0
|
93 |
|
sl@0
|
94 |
// create new timer
|
sl@0
|
95 |
if ( iTimer && !iTimer->IsActive() )
|
sl@0
|
96 |
{
|
sl@0
|
97 |
delete iTimer;
|
sl@0
|
98 |
iTimer = NULL;
|
sl@0
|
99 |
}
|
sl@0
|
100 |
|
sl@0
|
101 |
iTimer = CPluginTimer::NewL(timeout, *iResponseCallback, aCommandId, aTransId, retval,this);
|
sl@0
|
102 |
}
|
sl@0
|
103 |
|
sl@0
|
104 |
|
sl@0
|
105 |
void CFeatMgrSlowStartPlugin::GenericTimerFiredL(
|
sl@0
|
106 |
MFeatureInfoPluginCallback& aService,
|
sl@0
|
107 |
FeatureInfoCommand::TFeatureInfoCmd aCommandId,
|
sl@0
|
108 |
TUint8 aTransId,
|
sl@0
|
109 |
TInt aRetVal )
|
sl@0
|
110 |
{
|
sl@0
|
111 |
CFeatMgrBasePlugin::GenericTimerFiredL(aService,aCommandId,aTransId,aRetVal);
|
sl@0
|
112 |
INFO_LOG2( "FeatMgr SlowStart Plugin: GenericTimerFiredL (0x%x, 0x%x)",
|
sl@0
|
113 |
aCommandId, aTransId );
|
sl@0
|
114 |
|
sl@0
|
115 |
TInt err( KErrNone );
|
sl@0
|
116 |
|
sl@0
|
117 |
// Delay things a little.
|
sl@0
|
118 |
User::After(600000);
|
sl@0
|
119 |
|
sl@0
|
120 |
switch ( aCommandId )
|
sl@0
|
121 |
{
|
sl@0
|
122 |
case FeatureInfoCommand::ELoadFeatureInfoCmdId:
|
sl@0
|
123 |
{
|
sl@0
|
124 |
// Return some features and KErrNone.
|
sl@0
|
125 |
FeatureInfoCommand::TFeatureInfo featureList;
|
sl@0
|
126 |
TInt err( KErrNone );
|
sl@0
|
127 |
RArray<FeatureInfoCommand::TFeature> list;
|
sl@0
|
128 |
CleanupClosePushL( list );
|
sl@0
|
129 |
FeatureInfoCommand::TFeature feature1;
|
sl@0
|
130 |
|
sl@0
|
131 |
feature1.iFeatureID = KSlowStartPluginUid.iUid;
|
sl@0
|
132 |
feature1.iValue = ETrue;
|
sl@0
|
133 |
list.AppendL(feature1);
|
sl@0
|
134 |
|
sl@0
|
135 |
featureList.iErrorCode = KErrNone;
|
sl@0
|
136 |
featureList.iList = list;
|
sl@0
|
137 |
|
sl@0
|
138 |
FeatureInfoCommand::TFeatureInfoRespPckg resPackage(featureList);
|
sl@0
|
139 |
|
sl@0
|
140 |
TRAP(err, aService.ProcessResponseL(aCommandId, aTransId, resPackage));
|
sl@0
|
141 |
|
sl@0
|
142 |
CleanupStack::PopAndDestroy( &list );
|
sl@0
|
143 |
break;
|
sl@0
|
144 |
}
|
sl@0
|
145 |
|
sl@0
|
146 |
default :
|
sl@0
|
147 |
break;
|
sl@0
|
148 |
}
|
sl@0
|
149 |
|
sl@0
|
150 |
// TEST CASES END
|
sl@0
|
151 |
|
sl@0
|
152 |
if ( err != KErrNone )
|
sl@0
|
153 |
{
|
sl@0
|
154 |
ERROR_LOG1( "FeatMgr Plugin: Error in ProcessResponseL: %d", err );
|
sl@0
|
155 |
}
|
sl@0
|
156 |
}
|
sl@0
|
157 |
|