sl@0
|
1 |
// Copyright (c) 2007-2010 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 FILES
|
sl@0
|
19 |
#include <featmgr/featurecontrol.h>
|
sl@0
|
20 |
#include "featmgrtlsdata.h"
|
sl@0
|
21 |
#include "featmgrdebug.h"
|
sl@0
|
22 |
#include <e32std.h>
|
sl@0
|
23 |
|
sl@0
|
24 |
// LOCAL CONSTANTS AND MACROS
|
sl@0
|
25 |
_LIT( KPanicCategory, "RFeatureControl" );
|
sl@0
|
26 |
|
sl@0
|
27 |
// ============================= LOCAL FUNCTIONS ===============================
|
sl@0
|
28 |
|
sl@0
|
29 |
CFeatMgrTlsData* TlsData( )
|
sl@0
|
30 |
{
|
sl@0
|
31 |
CFeatMgrTlsData* tlsData = STATIC_CAST( CFeatMgrTlsData*, Dll::Tls() );
|
sl@0
|
32 |
|
sl@0
|
33 |
__ASSERT_ALWAYS( tlsData, User::Panic( KPanicCategory, EPanicBadHandle ) );
|
sl@0
|
34 |
|
sl@0
|
35 |
return tlsData;
|
sl@0
|
36 |
}
|
sl@0
|
37 |
|
sl@0
|
38 |
|
sl@0
|
39 |
// ============================ MEMBER FUNCTIONS ===============================
|
sl@0
|
40 |
|
sl@0
|
41 |
// -----------------------------------------------------------------------------
|
sl@0
|
42 |
// RFeatureControl::RFeatureControl
|
sl@0
|
43 |
// -----------------------------------------------------------------------------
|
sl@0
|
44 |
//
|
sl@0
|
45 |
EXPORT_C RFeatureControl::RFeatureControl() :
|
sl@0
|
46 |
iInitialized( EFalse ), iReserved1( 0 ), iReserved2 ( 0 )
|
sl@0
|
47 |
{
|
sl@0
|
48 |
FUNC_LOG
|
sl@0
|
49 |
}
|
sl@0
|
50 |
|
sl@0
|
51 |
// -----------------------------------------------------------------------------
|
sl@0
|
52 |
// RFeatureControl::Connect()
|
sl@0
|
53 |
// -----------------------------------------------------------------------------
|
sl@0
|
54 |
//
|
sl@0
|
55 |
EXPORT_C TInt RFeatureControl::Connect()
|
sl@0
|
56 |
{
|
sl@0
|
57 |
FUNC_LOG
|
sl@0
|
58 |
|
sl@0
|
59 |
return Open();
|
sl@0
|
60 |
}
|
sl@0
|
61 |
|
sl@0
|
62 |
// -----------------------------------------------------------------------------
|
sl@0
|
63 |
// RFeatureControl::Open()
|
sl@0
|
64 |
// -----------------------------------------------------------------------------
|
sl@0
|
65 |
//
|
sl@0
|
66 |
EXPORT_C TInt RFeatureControl::Open()
|
sl@0
|
67 |
{
|
sl@0
|
68 |
FUNC_LOG
|
sl@0
|
69 |
|
sl@0
|
70 |
if ( !Dll::Tls() )
|
sl@0
|
71 |
{
|
sl@0
|
72 |
CFeatMgrTlsData* tlsData = NULL;
|
sl@0
|
73 |
|
sl@0
|
74 |
TRAPD( err, tlsData = CFeatMgrTlsData::NewL() );
|
sl@0
|
75 |
|
sl@0
|
76 |
if ( err == KErrNone )
|
sl@0
|
77 |
{
|
sl@0
|
78 |
err = Dll::SetTls( tlsData );
|
sl@0
|
79 |
if (err != KErrNone)
|
sl@0
|
80 |
{
|
sl@0
|
81 |
delete tlsData;
|
sl@0
|
82 |
ERROR_LOG1( "RFeatureControl::Open SetTls error %d ", err );
|
sl@0
|
83 |
return err;
|
sl@0
|
84 |
}
|
sl@0
|
85 |
}
|
sl@0
|
86 |
else
|
sl@0
|
87 |
{
|
sl@0
|
88 |
ERROR_LOG1( "RFeatureControl::Open error %d ", err );
|
sl@0
|
89 |
return err;
|
sl@0
|
90 |
}
|
sl@0
|
91 |
}
|
sl@0
|
92 |
|
sl@0
|
93 |
// Increase the client count (self)
|
sl@0
|
94 |
iInitialized = ETrue;
|
sl@0
|
95 |
TlsData()->IncreaseClientCount();
|
sl@0
|
96 |
return KErrNone;
|
sl@0
|
97 |
}
|
sl@0
|
98 |
|
sl@0
|
99 |
// -----------------------------------------------------------------------------
|
sl@0
|
100 |
// RFeatureControl::Close()
|
sl@0
|
101 |
// -----------------------------------------------------------------------------
|
sl@0
|
102 |
//
|
sl@0
|
103 |
EXPORT_C void RFeatureControl::Close()
|
sl@0
|
104 |
{
|
sl@0
|
105 |
FUNC_LOG
|
sl@0
|
106 |
|
sl@0
|
107 |
if ( Dll::Tls() && iInitialized )
|
sl@0
|
108 |
{
|
sl@0
|
109 |
CFeatMgrTlsData::DeleteClient();
|
sl@0
|
110 |
}
|
sl@0
|
111 |
}
|
sl@0
|
112 |
|
sl@0
|
113 |
// -----------------------------------------------------------------------------
|
sl@0
|
114 |
// RFeatureControl::FeatureSupported(TUid)
|
sl@0
|
115 |
// -----------------------------------------------------------------------------
|
sl@0
|
116 |
//
|
sl@0
|
117 |
EXPORT_C TInt RFeatureControl::FeatureSupported( TUid aFeature )
|
sl@0
|
118 |
{
|
sl@0
|
119 |
TFeatureEntry feature( aFeature );
|
sl@0
|
120 |
TInt retVal = TlsData()->FeatureSupported( feature );
|
sl@0
|
121 |
|
sl@0
|
122 |
return retVal;
|
sl@0
|
123 |
}
|
sl@0
|
124 |
|
sl@0
|
125 |
// -----------------------------------------------------------------------------
|
sl@0
|
126 |
// RFeatureControl::FeatureSupported(TFeatureEntry&)
|
sl@0
|
127 |
// -----------------------------------------------------------------------------
|
sl@0
|
128 |
//
|
sl@0
|
129 |
EXPORT_C TInt RFeatureControl::FeatureSupported( TFeatureEntry& aFeature )
|
sl@0
|
130 |
{
|
sl@0
|
131 |
return TlsData()->FeatureSupported( aFeature );
|
sl@0
|
132 |
}
|
sl@0
|
133 |
|
sl@0
|
134 |
// -----------------------------------------------------------------------------
|
sl@0
|
135 |
// RFeatureControl::FeaturesSupported(RFeatureArray&)
|
sl@0
|
136 |
// -----------------------------------------------------------------------------
|
sl@0
|
137 |
//
|
sl@0
|
138 |
EXPORT_C TInt RFeatureControl::FeaturesSupported( RFeatureArray& aFeatures )
|
sl@0
|
139 |
{
|
sl@0
|
140 |
TInt err( KErrNone );
|
sl@0
|
141 |
|
sl@0
|
142 |
if( !aFeatures.Count() )
|
sl@0
|
143 |
{
|
sl@0
|
144 |
err = KErrArgument;
|
sl@0
|
145 |
}
|
sl@0
|
146 |
else
|
sl@0
|
147 |
{
|
sl@0
|
148 |
err = TlsData()->FeaturesSupported( aFeatures );
|
sl@0
|
149 |
}
|
sl@0
|
150 |
|
sl@0
|
151 |
return err;
|
sl@0
|
152 |
}
|
sl@0
|
153 |
|
sl@0
|
154 |
// -----------------------------------------------------------------------------
|
sl@0
|
155 |
// RFeatureControl::EnableFeature(TUid)
|
sl@0
|
156 |
// -----------------------------------------------------------------------------
|
sl@0
|
157 |
//
|
sl@0
|
158 |
EXPORT_C TInt RFeatureControl::EnableFeature( TUid aFeature )
|
sl@0
|
159 |
{
|
sl@0
|
160 |
return TlsData()->EnableFeature( aFeature );
|
sl@0
|
161 |
}
|
sl@0
|
162 |
|
sl@0
|
163 |
// -----------------------------------------------------------------------------
|
sl@0
|
164 |
// RFeatureControl::DisableFeature(TUid)
|
sl@0
|
165 |
// -----------------------------------------------------------------------------
|
sl@0
|
166 |
//
|
sl@0
|
167 |
EXPORT_C TInt RFeatureControl::DisableFeature( TUid aFeature )
|
sl@0
|
168 |
{
|
sl@0
|
169 |
return TlsData()->DisableFeature( aFeature );
|
sl@0
|
170 |
}
|
sl@0
|
171 |
|
sl@0
|
172 |
// -----------------------------------------------------------------------------
|
sl@0
|
173 |
// RFeatureControl::SetFeature(TUid, TBool, TInt)
|
sl@0
|
174 |
// -----------------------------------------------------------------------------
|
sl@0
|
175 |
//
|
sl@0
|
176 |
EXPORT_C TInt RFeatureControl::SetFeature( TUid aFeature, TBool aEnabled, TUint32 aData )
|
sl@0
|
177 |
{
|
sl@0
|
178 |
return TlsData()->SetFeature( aFeature, aEnabled, aData );
|
sl@0
|
179 |
}
|
sl@0
|
180 |
|
sl@0
|
181 |
// -----------------------------------------------------------------------------
|
sl@0
|
182 |
// RFeatureControl::SetFeature()
|
sl@0
|
183 |
// -----------------------------------------------------------------------------
|
sl@0
|
184 |
//
|
sl@0
|
185 |
EXPORT_C TInt RFeatureControl::SetFeature( TUid aFeature, TUint32 aData )
|
sl@0
|
186 |
{
|
sl@0
|
187 |
return TlsData()->SetFeature( aFeature, aData );
|
sl@0
|
188 |
}
|
sl@0
|
189 |
|
sl@0
|
190 |
// -----------------------------------------------------------------------------
|
sl@0
|
191 |
// RFeatureControl::AddFeature()
|
sl@0
|
192 |
// -----------------------------------------------------------------------------
|
sl@0
|
193 |
//
|
sl@0
|
194 |
EXPORT_C TInt RFeatureControl::AddFeature( TFeatureEntry& aFeature )
|
sl@0
|
195 |
{
|
sl@0
|
196 |
return TlsData()->AddFeature( aFeature );
|
sl@0
|
197 |
}
|
sl@0
|
198 |
|
sl@0
|
199 |
// -----------------------------------------------------------------------------
|
sl@0
|
200 |
// RFeatureControl::DeleteFeature()
|
sl@0
|
201 |
// -----------------------------------------------------------------------------
|
sl@0
|
202 |
//
|
sl@0
|
203 |
EXPORT_C TInt RFeatureControl::DeleteFeature( TUid aFeature )
|
sl@0
|
204 |
{
|
sl@0
|
205 |
return TlsData()->DeleteFeature( aFeature );
|
sl@0
|
206 |
}
|
sl@0
|
207 |
|
sl@0
|
208 |
// -----------------------------------------------------------------------------
|
sl@0
|
209 |
// RFeatureControl::ListSupportedFeaturesL()
|
sl@0
|
210 |
// -----------------------------------------------------------------------------
|
sl@0
|
211 |
//
|
sl@0
|
212 |
EXPORT_C TInt RFeatureControl::ListSupportedFeatures( RFeatureUidArray& aSupportedFeatures )
|
sl@0
|
213 |
{
|
sl@0
|
214 |
TRAPD( err, TlsData()->ListSupportedFeaturesL( aSupportedFeatures ) );
|
sl@0
|
215 |
return err;
|
sl@0
|
216 |
}
|
sl@0
|
217 |
|
sl@0
|
218 |
// -----------------------------------------------------------------------------
|
sl@0
|
219 |
// RFeatureControl::SWIStart()
|
sl@0
|
220 |
// -----------------------------------------------------------------------------
|
sl@0
|
221 |
//
|
sl@0
|
222 |
EXPORT_C TInt RFeatureControl::SWIStart()
|
sl@0
|
223 |
{
|
sl@0
|
224 |
return TlsData()->SWIStart( );
|
sl@0
|
225 |
}
|
sl@0
|
226 |
|
sl@0
|
227 |
// -----------------------------------------------------------------------------
|
sl@0
|
228 |
// RFeatureControl::SWIEnd()
|
sl@0
|
229 |
// -----------------------------------------------------------------------------
|
sl@0
|
230 |
//
|
sl@0
|
231 |
EXPORT_C TInt RFeatureControl::SWIEnd()
|
sl@0
|
232 |
{
|
sl@0
|
233 |
return TlsData()->SWIEnd( );
|
sl@0
|
234 |
}
|
sl@0
|
235 |
|
sl@0
|
236 |
|
sl@0
|
237 |
// End of File
|