sl@0
|
1 |
// Copyright (c) 2008-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 the License "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 |
// Hardware Configuration Respoitory Platform Independent Layer (PIL)
|
sl@0
|
15 |
//
|
sl@0
|
16 |
|
sl@0
|
17 |
// -- INCLUDES ----------------------------------------------------------------
|
sl@0
|
18 |
|
sl@0
|
19 |
|
sl@0
|
20 |
#include <nkern/nkern.h>
|
sl@0
|
21 |
#include <kernel/kernel.h>
|
sl@0
|
22 |
|
sl@0
|
23 |
#ifdef HCRTEST_NO_EXPORT
|
sl@0
|
24 |
#undef EXPORT_C
|
sl@0
|
25 |
#undef IMPORT_C
|
sl@0
|
26 |
#define EXPORT_C
|
sl@0
|
27 |
#define IMPORT_C
|
sl@0
|
28 |
#endif // HCRTEST_NO_EXPORT
|
sl@0
|
29 |
|
sl@0
|
30 |
#include <drivers/hcr.h>
|
sl@0
|
31 |
#include "hcr_debug.h"
|
sl@0
|
32 |
#include "hcr_pil.h"
|
sl@0
|
33 |
|
sl@0
|
34 |
|
sl@0
|
35 |
// -- FUNCTIONS ---------------------------------------------------------------
|
sl@0
|
36 |
|
sl@0
|
37 |
#ifndef MAKE_DEF_FILE
|
sl@0
|
38 |
namespace HCR
|
sl@0
|
39 |
{
|
sl@0
|
40 |
|
sl@0
|
41 |
LOCAL_C TInt GetUValueWordSetting (const TSettingId& aId,
|
sl@0
|
42 |
TSettingType aType, UValueWord& aValue)
|
sl@0
|
43 |
{
|
sl@0
|
44 |
HCR_FUNC("GetUValueWordSetting");
|
sl@0
|
45 |
|
sl@0
|
46 |
if (HCRNotReady)
|
sl@0
|
47 |
HCR_TRACE_RETURN(KErrNotReady);
|
sl@0
|
48 |
|
sl@0
|
49 |
__NK_ASSERT_DEBUG((aType & KMaskWordTypes) != 0);
|
sl@0
|
50 |
|
sl@0
|
51 |
TSettingRef sref(0,0);
|
sl@0
|
52 |
TInt err = 0;
|
sl@0
|
53 |
err = HCRSingleton->FindSetting(aId, aType, sref);
|
sl@0
|
54 |
if (err != KErrNone)
|
sl@0
|
55 |
HCR_TRACE_RETURN(err);
|
sl@0
|
56 |
|
sl@0
|
57 |
err = sref.iRep->GetValue(sref, aValue);
|
sl@0
|
58 |
__NK_ASSERT_DEBUG(err == KErrNone);
|
sl@0
|
59 |
|
sl@0
|
60 |
return KErrNone;
|
sl@0
|
61 |
}
|
sl@0
|
62 |
|
sl@0
|
63 |
LOCAL_C TInt GetUValueLargeSetting64 (const TSettingId& aId,
|
sl@0
|
64 |
TSettingType aType, UValueLarge& aValue)
|
sl@0
|
65 |
{
|
sl@0
|
66 |
HCR_FUNC("GetUValueLargeSetting64");
|
sl@0
|
67 |
|
sl@0
|
68 |
if (HCRNotReady)
|
sl@0
|
69 |
HCR_TRACE_RETURN(KErrNotReady);
|
sl@0
|
70 |
|
sl@0
|
71 |
__NK_ASSERT_DEBUG(aType == ETypeInt64 || aType == ETypeUInt64);
|
sl@0
|
72 |
|
sl@0
|
73 |
TSettingRef sref(0,0);
|
sl@0
|
74 |
TInt err = 0;
|
sl@0
|
75 |
err = HCRSingleton->FindSetting(aId, aType, sref);
|
sl@0
|
76 |
if (err != KErrNone)
|
sl@0
|
77 |
HCR_TRACE_RETURN(err);
|
sl@0
|
78 |
|
sl@0
|
79 |
err = sref.iRep->GetLargeValue(sref, aValue);
|
sl@0
|
80 |
__NK_ASSERT_DEBUG(err == KErrNone);
|
sl@0
|
81 |
|
sl@0
|
82 |
return KErrNone;
|
sl@0
|
83 |
}
|
sl@0
|
84 |
|
sl@0
|
85 |
|
sl@0
|
86 |
LOCAL_C TInt GetUValueLargeSettingTDes8 (const TSettingId& aId,
|
sl@0
|
87 |
TSettingType aType, TDes8& aValue)
|
sl@0
|
88 |
{
|
sl@0
|
89 |
HCR_FUNC("GetUValueLargeSettingTDes8");
|
sl@0
|
90 |
|
sl@0
|
91 |
if (HCRNotReady)
|
sl@0
|
92 |
HCR_TRACE_RETURN(KErrNotReady);
|
sl@0
|
93 |
|
sl@0
|
94 |
__NK_ASSERT_DEBUG(aType == ETypeBinData || aType == ETypeText8);
|
sl@0
|
95 |
|
sl@0
|
96 |
TSettingRef sref(0,0);
|
sl@0
|
97 |
TInt err = 0;
|
sl@0
|
98 |
err = HCRSingleton->FindSetting(aId, aType, sref);
|
sl@0
|
99 |
if (err != KErrNone)
|
sl@0
|
100 |
HCR_TRACE_RETURN(err);
|
sl@0
|
101 |
|
sl@0
|
102 |
UValueLarge value;
|
sl@0
|
103 |
err = sref.iRep->GetLargeValue(sref, value);
|
sl@0
|
104 |
__NK_ASSERT_DEBUG(err == KErrNone);
|
sl@0
|
105 |
|
sl@0
|
106 |
TInt len = sref.iRep->GetLength(sref);
|
sl@0
|
107 |
if (len > aValue.MaxSize())
|
sl@0
|
108 |
HCR_TRACE_RETURN(KErrTooBig);
|
sl@0
|
109 |
|
sl@0
|
110 |
if (aType == ETypeBinData)
|
sl@0
|
111 |
aValue.Copy(value.iData, len);
|
sl@0
|
112 |
else
|
sl@0
|
113 |
aValue.Copy(value.iString8, len);
|
sl@0
|
114 |
|
sl@0
|
115 |
return KErrNone;
|
sl@0
|
116 |
}
|
sl@0
|
117 |
|
sl@0
|
118 |
LOCAL_C TInt GetUValueLargeSettingTUint8 (const TSettingId& aId, TSettingType aType,
|
sl@0
|
119 |
TUint16 aMaxLen, TUint8* aValue, TUint16& aLen)
|
sl@0
|
120 |
{
|
sl@0
|
121 |
HCR_FUNC("GetUValueLargeSettingTUint8");
|
sl@0
|
122 |
|
sl@0
|
123 |
if (HCRNotReady)
|
sl@0
|
124 |
HCR_TRACE_RETURN(KErrNotReady);
|
sl@0
|
125 |
|
sl@0
|
126 |
__NK_ASSERT_DEBUG(aType == ETypeBinData || aType == ETypeText8);
|
sl@0
|
127 |
|
sl@0
|
128 |
TSettingRef sref(0,0);
|
sl@0
|
129 |
TInt err = 0;
|
sl@0
|
130 |
err = HCRSingleton->FindSetting(aId, aType, sref);
|
sl@0
|
131 |
if (err != KErrNone)
|
sl@0
|
132 |
HCR_TRACE_RETURN(err);
|
sl@0
|
133 |
|
sl@0
|
134 |
UValueLarge value;
|
sl@0
|
135 |
err = sref.iRep->GetLargeValue(sref, value);
|
sl@0
|
136 |
__NK_ASSERT_DEBUG(err == KErrNone);
|
sl@0
|
137 |
|
sl@0
|
138 |
aLen = sref.iRep->GetLength(sref);
|
sl@0
|
139 |
if (aLen > aMaxLen)
|
sl@0
|
140 |
HCR_TRACE_RETURN(KErrTooBig);
|
sl@0
|
141 |
|
sl@0
|
142 |
if (aType == ETypeBinData)
|
sl@0
|
143 |
memcpy (aValue, value.iData, aLen);
|
sl@0
|
144 |
else
|
sl@0
|
145 |
memcpy (aValue, value.iString8, aLen);
|
sl@0
|
146 |
|
sl@0
|
147 |
return KErrNone;
|
sl@0
|
148 |
}
|
sl@0
|
149 |
|
sl@0
|
150 |
LOCAL_C TInt GetUValueLargeSettingArray (const TSettingId& aId, TSettingType aType,
|
sl@0
|
151 |
TUint16 aMaxLen, TUint32* aValue, TUint16& aLen)
|
sl@0
|
152 |
{
|
sl@0
|
153 |
HCR_FUNC("GetUValueLargeSettingArray");
|
sl@0
|
154 |
|
sl@0
|
155 |
if (HCRNotReady)
|
sl@0
|
156 |
HCR_TRACE_RETURN(KErrNotReady);
|
sl@0
|
157 |
|
sl@0
|
158 |
__NK_ASSERT_DEBUG(aType == ETypeArrayInt32 || aType == ETypeArrayUInt32);
|
sl@0
|
159 |
|
sl@0
|
160 |
TSettingRef sref(0,0);
|
sl@0
|
161 |
TInt err = 0;
|
sl@0
|
162 |
err = HCRSingleton->FindSetting(aId, aType, sref);
|
sl@0
|
163 |
if (err != KErrNone)
|
sl@0
|
164 |
HCR_TRACE_RETURN(err);
|
sl@0
|
165 |
|
sl@0
|
166 |
UValueLarge value;
|
sl@0
|
167 |
err = sref.iRep->GetLargeValue(sref, value);
|
sl@0
|
168 |
__NK_ASSERT_DEBUG(err == KErrNone);
|
sl@0
|
169 |
|
sl@0
|
170 |
aLen = sref.iRep->GetLength(sref);
|
sl@0
|
171 |
if (aLen > aMaxLen)
|
sl@0
|
172 |
HCR_TRACE_RETURN(KErrTooBig);
|
sl@0
|
173 |
|
sl@0
|
174 |
if (aType == ETypeArrayInt32)
|
sl@0
|
175 |
memcpy (aValue, value.iArrayInt32, aLen);
|
sl@0
|
176 |
else
|
sl@0
|
177 |
memcpy (aValue, value.iArrayUInt32, aLen);
|
sl@0
|
178 |
|
sl@0
|
179 |
return KErrNone;
|
sl@0
|
180 |
}
|
sl@0
|
181 |
|
sl@0
|
182 |
}
|
sl@0
|
183 |
|
sl@0
|
184 |
#endif // MAKE_DEF_FILE
|
sl@0
|
185 |
|
sl@0
|
186 |
|
sl@0
|
187 |
// -- SETTING GET -------------------------------------------------------------
|
sl@0
|
188 |
|
sl@0
|
189 |
|
sl@0
|
190 |
EXPORT_C TInt HCR::GetInt(const TSettingId& aId, TInt8& aValue)
|
sl@0
|
191 |
{
|
sl@0
|
192 |
#ifndef MAKE_DEF_FILE
|
sl@0
|
193 |
HCR_FUNC("HCR::GetInt8");
|
sl@0
|
194 |
|
sl@0
|
195 |
UValueWord value;
|
sl@0
|
196 |
TInt err = GetUValueWordSetting(aId, ETypeInt8, value);
|
sl@0
|
197 |
if (err != KErrNone)
|
sl@0
|
198 |
HCR_TRACE_RETURN(err);
|
sl@0
|
199 |
|
sl@0
|
200 |
aValue = value.iInt8;
|
sl@0
|
201 |
return KErrNone;
|
sl@0
|
202 |
#else
|
sl@0
|
203 |
HCR_TRACE_RETURN(KErrGeneral);
|
sl@0
|
204 |
#endif // MAKE_DEF_FILE
|
sl@0
|
205 |
}
|
sl@0
|
206 |
|
sl@0
|
207 |
|
sl@0
|
208 |
EXPORT_C TInt HCR::GetInt(const TSettingId& aId, TInt16& aValue)
|
sl@0
|
209 |
{
|
sl@0
|
210 |
#ifndef MAKE_DEF_FILE
|
sl@0
|
211 |
HCR_FUNC("HCR::GetInt16");
|
sl@0
|
212 |
|
sl@0
|
213 |
UValueWord value;
|
sl@0
|
214 |
TInt err = GetUValueWordSetting(aId, ETypeInt16, value);
|
sl@0
|
215 |
if (err != KErrNone)
|
sl@0
|
216 |
HCR_TRACE_RETURN(err);
|
sl@0
|
217 |
|
sl@0
|
218 |
aValue = value.iInt16;
|
sl@0
|
219 |
return KErrNone;
|
sl@0
|
220 |
#else
|
sl@0
|
221 |
HCR_TRACE_RETURN(KErrGeneral);
|
sl@0
|
222 |
#endif // MAKE_DEF_FILE
|
sl@0
|
223 |
}
|
sl@0
|
224 |
|
sl@0
|
225 |
|
sl@0
|
226 |
EXPORT_C TInt HCR::GetInt(const TSettingId& aId, TInt32& aValue)
|
sl@0
|
227 |
{
|
sl@0
|
228 |
#ifndef MAKE_DEF_FILE
|
sl@0
|
229 |
HCR_FUNC("HCR::GetInt32");
|
sl@0
|
230 |
|
sl@0
|
231 |
UValueWord value;
|
sl@0
|
232 |
TInt err = GetUValueWordSetting(aId, ETypeInt32, value);
|
sl@0
|
233 |
if (err != KErrNone)
|
sl@0
|
234 |
HCR_TRACE_RETURN(err);
|
sl@0
|
235 |
|
sl@0
|
236 |
aValue = value.iInt32;
|
sl@0
|
237 |
return KErrNone;
|
sl@0
|
238 |
#else
|
sl@0
|
239 |
HCR_TRACE_RETURN(KErrGeneral);
|
sl@0
|
240 |
#endif // MAKE_DEF_FILE
|
sl@0
|
241 |
}
|
sl@0
|
242 |
|
sl@0
|
243 |
|
sl@0
|
244 |
EXPORT_C TInt HCR::GetInt(const TSettingId& aId, TInt64& aValue)
|
sl@0
|
245 |
{
|
sl@0
|
246 |
#ifndef MAKE_DEF_FILE
|
sl@0
|
247 |
HCR_FUNC("HCR::GetInt64");
|
sl@0
|
248 |
|
sl@0
|
249 |
UValueLarge value;
|
sl@0
|
250 |
TInt err = GetUValueLargeSetting64(aId, ETypeInt64, value);
|
sl@0
|
251 |
if (err != KErrNone)
|
sl@0
|
252 |
HCR_TRACE_RETURN(err);
|
sl@0
|
253 |
|
sl@0
|
254 |
aValue = *(value.iInt64);
|
sl@0
|
255 |
return KErrNone;
|
sl@0
|
256 |
#else
|
sl@0
|
257 |
HCR_TRACE_RETURN(KErrGeneral);
|
sl@0
|
258 |
#endif // MAKE_DEF_FILE
|
sl@0
|
259 |
}
|
sl@0
|
260 |
|
sl@0
|
261 |
|
sl@0
|
262 |
EXPORT_C TInt HCR::GetBool(const TSettingId& aId, TBool& aValue)
|
sl@0
|
263 |
{
|
sl@0
|
264 |
#ifndef MAKE_DEF_FILE
|
sl@0
|
265 |
HCR_FUNC("HCR::GetBool");
|
sl@0
|
266 |
|
sl@0
|
267 |
UValueWord value;
|
sl@0
|
268 |
TInt err = GetUValueWordSetting(aId, ETypeBool, value);
|
sl@0
|
269 |
if (err != KErrNone)
|
sl@0
|
270 |
HCR_TRACE_RETURN(err);
|
sl@0
|
271 |
|
sl@0
|
272 |
aValue = value.iBool;
|
sl@0
|
273 |
return KErrNone;
|
sl@0
|
274 |
#else
|
sl@0
|
275 |
HCR_TRACE_RETURN(KErrGeneral);
|
sl@0
|
276 |
#endif // MAKE_DEF_FILE
|
sl@0
|
277 |
}
|
sl@0
|
278 |
|
sl@0
|
279 |
|
sl@0
|
280 |
EXPORT_C TInt HCR::GetUInt(const TSettingId& aId, TUint8& aValue)
|
sl@0
|
281 |
{
|
sl@0
|
282 |
#ifndef MAKE_DEF_FILE
|
sl@0
|
283 |
HCR_FUNC("HCR::GetUInt8");
|
sl@0
|
284 |
|
sl@0
|
285 |
UValueWord value;
|
sl@0
|
286 |
TInt err = GetUValueWordSetting(aId, ETypeUInt8, value);
|
sl@0
|
287 |
if (err != KErrNone)
|
sl@0
|
288 |
HCR_TRACE_RETURN(err);
|
sl@0
|
289 |
|
sl@0
|
290 |
aValue = value.iUInt8;
|
sl@0
|
291 |
return KErrNone;
|
sl@0
|
292 |
#else
|
sl@0
|
293 |
HCR_TRACE_RETURN(KErrGeneral);
|
sl@0
|
294 |
#endif // MAKE_DEF_FILE
|
sl@0
|
295 |
}
|
sl@0
|
296 |
|
sl@0
|
297 |
|
sl@0
|
298 |
EXPORT_C TInt HCR::GetUInt(const TSettingId& aId, TUint16& aValue)
|
sl@0
|
299 |
{
|
sl@0
|
300 |
#ifndef MAKE_DEF_FILE
|
sl@0
|
301 |
HCR_FUNC("HCR::GetUInt16");
|
sl@0
|
302 |
|
sl@0
|
303 |
UValueWord value;
|
sl@0
|
304 |
TInt err = GetUValueWordSetting(aId, ETypeUInt16,value);
|
sl@0
|
305 |
if (err != KErrNone)
|
sl@0
|
306 |
HCR_TRACE_RETURN(err);
|
sl@0
|
307 |
|
sl@0
|
308 |
aValue = value.iUInt16;
|
sl@0
|
309 |
return KErrNone;
|
sl@0
|
310 |
#else
|
sl@0
|
311 |
HCR_TRACE_RETURN(KErrGeneral);
|
sl@0
|
312 |
#endif // MAKE_DEF_FILE
|
sl@0
|
313 |
}
|
sl@0
|
314 |
|
sl@0
|
315 |
|
sl@0
|
316 |
EXPORT_C TInt HCR::GetUInt(const TSettingId& aId, TUint32& aValue)
|
sl@0
|
317 |
{
|
sl@0
|
318 |
#ifndef MAKE_DEF_FILE
|
sl@0
|
319 |
HCR_FUNC("HCR::GetUInt32");
|
sl@0
|
320 |
|
sl@0
|
321 |
UValueWord value;
|
sl@0
|
322 |
TInt err = GetUValueWordSetting(aId, ETypeUInt32, value);
|
sl@0
|
323 |
if (err != KErrNone)
|
sl@0
|
324 |
HCR_TRACE_RETURN(err);
|
sl@0
|
325 |
|
sl@0
|
326 |
aValue = value.iUInt32;
|
sl@0
|
327 |
return KErrNone;
|
sl@0
|
328 |
#else
|
sl@0
|
329 |
HCR_TRACE_RETURN(KErrGeneral);
|
sl@0
|
330 |
#endif // MAKE_DEF_FILE
|
sl@0
|
331 |
}
|
sl@0
|
332 |
|
sl@0
|
333 |
|
sl@0
|
334 |
EXPORT_C TInt HCR::GetUInt(const TSettingId& aId, TUint64& aValue)
|
sl@0
|
335 |
{
|
sl@0
|
336 |
#ifndef MAKE_DEF_FILE
|
sl@0
|
337 |
HCR_FUNC("HCR::GetUInt64");
|
sl@0
|
338 |
|
sl@0
|
339 |
UValueLarge value;
|
sl@0
|
340 |
TInt err = GetUValueLargeSetting64(aId, ETypeUInt64, value);
|
sl@0
|
341 |
if (err != KErrNone)
|
sl@0
|
342 |
HCR_TRACE_RETURN(err);
|
sl@0
|
343 |
|
sl@0
|
344 |
aValue = *(value.iUInt64);
|
sl@0
|
345 |
return KErrNone;
|
sl@0
|
346 |
#else
|
sl@0
|
347 |
HCR_TRACE_RETURN(KErrGeneral);
|
sl@0
|
348 |
#endif // MAKE_DEF_FILE
|
sl@0
|
349 |
}
|
sl@0
|
350 |
|
sl@0
|
351 |
|
sl@0
|
352 |
EXPORT_C TInt HCR::GetLinAddr(const TSettingId& aId, TLinAddr& aValue)
|
sl@0
|
353 |
{
|
sl@0
|
354 |
#ifndef MAKE_DEF_FILE
|
sl@0
|
355 |
HCR_FUNC("HCR::GetLinAddr");
|
sl@0
|
356 |
|
sl@0
|
357 |
UValueWord value;
|
sl@0
|
358 |
TInt err = GetUValueWordSetting(aId, ETypeLinAddr, value);
|
sl@0
|
359 |
if (err != KErrNone)
|
sl@0
|
360 |
HCR_TRACE_RETURN(err);
|
sl@0
|
361 |
|
sl@0
|
362 |
aValue = value.iAddress;
|
sl@0
|
363 |
return KErrNone;
|
sl@0
|
364 |
#else
|
sl@0
|
365 |
HCR_TRACE_RETURN(KErrGeneral);
|
sl@0
|
366 |
#endif // MAKE_DEF_FILE
|
sl@0
|
367 |
}
|
sl@0
|
368 |
|
sl@0
|
369 |
|
sl@0
|
370 |
EXPORT_C TInt HCR::GetData(const TSettingId& aId, TUint16 aMaxLen,
|
sl@0
|
371 |
TUint8* aValue, TUint16& aLen)
|
sl@0
|
372 |
{
|
sl@0
|
373 |
#ifndef MAKE_DEF_FILE
|
sl@0
|
374 |
HCR_FUNC("HCR::GetDataTUint8");
|
sl@0
|
375 |
|
sl@0
|
376 |
TInt err = GetUValueLargeSettingTUint8(aId, ETypeBinData, aMaxLen, aValue, aLen);
|
sl@0
|
377 |
if (err != KErrNone)
|
sl@0
|
378 |
HCR_TRACE_RETURN(err);
|
sl@0
|
379 |
|
sl@0
|
380 |
return KErrNone;
|
sl@0
|
381 |
#else
|
sl@0
|
382 |
HCR_TRACE_RETURN(KErrGeneral);
|
sl@0
|
383 |
#endif // MAKE_DEF_FILE
|
sl@0
|
384 |
}
|
sl@0
|
385 |
|
sl@0
|
386 |
|
sl@0
|
387 |
EXPORT_C TInt HCR::GetData(const TSettingId& aId, TDes8& aValue)
|
sl@0
|
388 |
{
|
sl@0
|
389 |
#ifndef MAKE_DEF_FILE
|
sl@0
|
390 |
HCR_FUNC("HCR::GetDataTDes8");
|
sl@0
|
391 |
|
sl@0
|
392 |
TInt err = GetUValueLargeSettingTDes8(aId, ETypeBinData, aValue);
|
sl@0
|
393 |
if (err != KErrNone)
|
sl@0
|
394 |
HCR_TRACE_RETURN(err);
|
sl@0
|
395 |
|
sl@0
|
396 |
return KErrNone;
|
sl@0
|
397 |
#else
|
sl@0
|
398 |
HCR_TRACE_RETURN(KErrGeneral);
|
sl@0
|
399 |
#endif // MAKE_DEF_FILE
|
sl@0
|
400 |
}
|
sl@0
|
401 |
|
sl@0
|
402 |
|
sl@0
|
403 |
EXPORT_C TInt HCR::GetString(const TSettingId& aId, TUint16 aMaxLen,
|
sl@0
|
404 |
TText8* aValue, TUint16& aLen)
|
sl@0
|
405 |
{
|
sl@0
|
406 |
#ifndef MAKE_DEF_FILE
|
sl@0
|
407 |
HCR_FUNC("HCR::GetStringTUint8");
|
sl@0
|
408 |
|
sl@0
|
409 |
TInt err = GetUValueLargeSettingTUint8(aId, ETypeText8, aMaxLen, aValue, aLen);
|
sl@0
|
410 |
if (err != KErrNone)
|
sl@0
|
411 |
HCR_TRACE_RETURN(err);
|
sl@0
|
412 |
|
sl@0
|
413 |
return KErrNone;
|
sl@0
|
414 |
#else
|
sl@0
|
415 |
HCR_TRACE_RETURN(KErrGeneral);
|
sl@0
|
416 |
#endif // MAKE_DEF_FILE
|
sl@0
|
417 |
}
|
sl@0
|
418 |
|
sl@0
|
419 |
|
sl@0
|
420 |
EXPORT_C TInt HCR::GetString(const TSettingId& aId, TDes8& aValue)
|
sl@0
|
421 |
{
|
sl@0
|
422 |
#ifndef MAKE_DEF_FILE
|
sl@0
|
423 |
HCR_FUNC("HCR::GetStringTUint8");
|
sl@0
|
424 |
|
sl@0
|
425 |
TInt err = GetUValueLargeSettingTDes8(aId, ETypeText8, aValue);
|
sl@0
|
426 |
if (err != KErrNone)
|
sl@0
|
427 |
HCR_TRACE_RETURN(err);
|
sl@0
|
428 |
|
sl@0
|
429 |
return KErrNone;
|
sl@0
|
430 |
#else
|
sl@0
|
431 |
HCR_TRACE_RETURN(KErrGeneral);
|
sl@0
|
432 |
#endif // MAKE_DEF_FILE
|
sl@0
|
433 |
}
|
sl@0
|
434 |
|
sl@0
|
435 |
EXPORT_C TInt HCR::GetArray(const TSettingId& aId, TUint16 aMaxLen,
|
sl@0
|
436 |
TInt32* aValue, TUint16& aLen)
|
sl@0
|
437 |
{
|
sl@0
|
438 |
#ifndef MAKE_DEF_FILE
|
sl@0
|
439 |
HCR_FUNC("HCR::GetArrayTInt32");
|
sl@0
|
440 |
|
sl@0
|
441 |
TInt err = GetUValueLargeSettingArray(aId, ETypeArrayInt32, aMaxLen, (TUint32*)aValue, aLen);
|
sl@0
|
442 |
if (err != KErrNone)
|
sl@0
|
443 |
HCR_TRACE_RETURN(err);
|
sl@0
|
444 |
|
sl@0
|
445 |
return KErrNone;
|
sl@0
|
446 |
#else
|
sl@0
|
447 |
HCR_TRACE_RETURN(KErrGeneral);
|
sl@0
|
448 |
#endif // MAKE_DEF_FILE
|
sl@0
|
449 |
}
|
sl@0
|
450 |
|
sl@0
|
451 |
EXPORT_C TInt HCR::GetArray(const TSettingId& aId, TUint16 aMaxLen,
|
sl@0
|
452 |
TUint32* aValue, TUint16& aLen)
|
sl@0
|
453 |
{
|
sl@0
|
454 |
#ifndef MAKE_DEF_FILE
|
sl@0
|
455 |
HCR_FUNC("HCR::GetArrayTUInt32");
|
sl@0
|
456 |
|
sl@0
|
457 |
TInt err = GetUValueLargeSettingArray(aId, ETypeArrayUInt32, aMaxLen, aValue, aLen);
|
sl@0
|
458 |
if (err != KErrNone)
|
sl@0
|
459 |
HCR_TRACE_RETURN(err);
|
sl@0
|
460 |
|
sl@0
|
461 |
return KErrNone;
|
sl@0
|
462 |
#else
|
sl@0
|
463 |
HCR_TRACE_RETURN(KErrGeneral);
|
sl@0
|
464 |
#endif // MAKE_DEF_FILE
|
sl@0
|
465 |
}
|
sl@0
|
466 |
|
sl@0
|
467 |
|
sl@0
|
468 |
// -- MULTIPLE GETS -----------------------------------------------------------
|
sl@0
|
469 |
|
sl@0
|
470 |
EXPORT_C TInt HCR::GetWordSettings(TInt aNum, const SSettingId aIds[],
|
sl@0
|
471 |
TInt32 aValues[], TSettingType aTypes[], TInt aErrors[])
|
sl@0
|
472 |
{
|
sl@0
|
473 |
|
sl@0
|
474 |
#ifndef MAKE_DEF_FILE
|
sl@0
|
475 |
HCR_FUNC("GetWordSettings");
|
sl@0
|
476 |
|
sl@0
|
477 |
if (HCRNotReady)
|
sl@0
|
478 |
HCR_TRACE_RETURN(KErrNotReady);
|
sl@0
|
479 |
|
sl@0
|
480 |
if(aNum <= 0 || aIds == NULL || aErrors == NULL || aValues == NULL)
|
sl@0
|
481 |
HCR_TRACE_RETURN(KErrArgument);
|
sl@0
|
482 |
|
sl@0
|
483 |
TInt err = KErrNone;
|
sl@0
|
484 |
|
sl@0
|
485 |
//Don't leave while the resources are not fully allocated/deallocated
|
sl@0
|
486 |
NKern::ThreadEnterCS();
|
sl@0
|
487 |
|
sl@0
|
488 |
err = HCRSingleton->GetWordSettings(aNum, aIds, aValues, aTypes, aErrors);
|
sl@0
|
489 |
|
sl@0
|
490 |
//All de-allocations are done, leave a critical section
|
sl@0
|
491 |
NKern::ThreadLeaveCS();
|
sl@0
|
492 |
|
sl@0
|
493 |
__NK_ASSERT_DEBUG(err >= KErrNone);
|
sl@0
|
494 |
|
sl@0
|
495 |
return err;
|
sl@0
|
496 |
|
sl@0
|
497 |
#else
|
sl@0
|
498 |
HCR_TRACE_RETURN(KErrGeneral);
|
sl@0
|
499 |
#endif // MAKE_DEF_FILE
|
sl@0
|
500 |
}
|
sl@0
|
501 |
|
sl@0
|
502 |
|
sl@0
|
503 |
// -- SETTING PROPERTIES ------------------------------------------------------
|
sl@0
|
504 |
|
sl@0
|
505 |
EXPORT_C TInt HCR::GetTypeAndSize(const TSettingId& aId, TSettingType& aType,
|
sl@0
|
506 |
TUint16& aLen)
|
sl@0
|
507 |
{
|
sl@0
|
508 |
#ifndef MAKE_DEF_FILE
|
sl@0
|
509 |
HCR_FUNC("GetTypeAndSize");
|
sl@0
|
510 |
if (HCRNotReady)
|
sl@0
|
511 |
HCR_TRACE_RETURN(KErrNotReady);
|
sl@0
|
512 |
|
sl@0
|
513 |
TSettingRef sref(0,0);
|
sl@0
|
514 |
TInt err = HCRSingleton->FindSettingWithType(aId, aType, sref);
|
sl@0
|
515 |
|
sl@0
|
516 |
__NK_ASSERT_DEBUG(err == KErrNone || err == KErrNotFound);
|
sl@0
|
517 |
|
sl@0
|
518 |
if(err == KErrNotFound)
|
sl@0
|
519 |
{
|
sl@0
|
520 |
aLen = 0;
|
sl@0
|
521 |
HCR_TRACE_RETURN(KErrNotFound);
|
sl@0
|
522 |
}
|
sl@0
|
523 |
|
sl@0
|
524 |
aLen = sref.iRep->GetLength(sref);
|
sl@0
|
525 |
return KErrNone;
|
sl@0
|
526 |
|
sl@0
|
527 |
#else
|
sl@0
|
528 |
HCR_TRACE_RETURN(KErrGeneral);
|
sl@0
|
529 |
#endif //MAKE_DEF_FILE
|
sl@0
|
530 |
}
|
sl@0
|
531 |
|
sl@0
|
532 |
|
sl@0
|
533 |
// -- SETTING SEARCHES --------------------------------------------------------
|
sl@0
|
534 |
|
sl@0
|
535 |
EXPORT_C TInt HCR::FindNumSettingsInCategory (TCategoryUid aCatUid)
|
sl@0
|
536 |
{
|
sl@0
|
537 |
#ifndef MAKE_DEF_FILE
|
sl@0
|
538 |
|
sl@0
|
539 |
HCR_FUNC("FindNumSettingsInCategory");
|
sl@0
|
540 |
|
sl@0
|
541 |
if (HCRNotReady)
|
sl@0
|
542 |
HCR_TRACE_RETURN(KErrNotReady);
|
sl@0
|
543 |
|
sl@0
|
544 |
TInt err = HCRSingleton->FindNumSettingsInCategory(aCatUid);
|
sl@0
|
545 |
|
sl@0
|
546 |
if(err < 0)
|
sl@0
|
547 |
HCR_TRACE_RETURN(err);
|
sl@0
|
548 |
|
sl@0
|
549 |
return err;
|
sl@0
|
550 |
|
sl@0
|
551 |
#else
|
sl@0
|
552 |
HCR_TRACE_RETURN(KErrGeneral);
|
sl@0
|
553 |
#endif // MAKE_DEF_FILE
|
sl@0
|
554 |
}
|
sl@0
|
555 |
|
sl@0
|
556 |
EXPORT_C TInt HCR::FindSettings(TCategoryUid aCat, TInt aMaxNum,
|
sl@0
|
557 |
TElementId aElIds[], TSettingType aTypes[], TUint16 aLens[])
|
sl@0
|
558 |
{
|
sl@0
|
559 |
#ifndef MAKE_DEF_FILE
|
sl@0
|
560 |
|
sl@0
|
561 |
HCR_FUNC("FindSettings without pattern/mask");
|
sl@0
|
562 |
|
sl@0
|
563 |
|
sl@0
|
564 |
if (HCRNotReady)
|
sl@0
|
565 |
HCR_TRACE_RETURN(KErrNotReady);
|
sl@0
|
566 |
|
sl@0
|
567 |
if(aMaxNum <= 0 || aElIds == NULL)
|
sl@0
|
568 |
HCR_TRACE_RETURN(KErrArgument);
|
sl@0
|
569 |
|
sl@0
|
570 |
TInt err = HCRSingleton->FindSettings(aCat, aMaxNum, aElIds,
|
sl@0
|
571 |
aTypes, aLens);
|
sl@0
|
572 |
|
sl@0
|
573 |
if(err < 0)
|
sl@0
|
574 |
HCR_TRACE_RETURN(err);
|
sl@0
|
575 |
|
sl@0
|
576 |
return err;
|
sl@0
|
577 |
|
sl@0
|
578 |
#else
|
sl@0
|
579 |
HCR_TRACE_RETURN(KErrGeneral);
|
sl@0
|
580 |
#endif // MAKE_DEF_FILE
|
sl@0
|
581 |
}
|
sl@0
|
582 |
|
sl@0
|
583 |
EXPORT_C TInt HCR::FindSettings(TCategoryUid aCat,
|
sl@0
|
584 |
TInt aMaxNum, TUint32 aMask, TUint32 aPattern,
|
sl@0
|
585 |
TElementId aElIds[], TSettingType aTypes[], TUint16 aLens[])
|
sl@0
|
586 |
{
|
sl@0
|
587 |
#ifndef MAKE_DEF_FILE
|
sl@0
|
588 |
|
sl@0
|
589 |
HCR_FUNC("FindSettings with pattern/mask");
|
sl@0
|
590 |
|
sl@0
|
591 |
|
sl@0
|
592 |
if (HCRNotReady)
|
sl@0
|
593 |
HCR_TRACE_RETURN(KErrNotReady);
|
sl@0
|
594 |
|
sl@0
|
595 |
if(aMaxNum <= 0 || aElIds == NULL)
|
sl@0
|
596 |
HCR_TRACE_RETURN(KErrArgument);
|
sl@0
|
597 |
|
sl@0
|
598 |
TInt err = KErrNone;
|
sl@0
|
599 |
|
sl@0
|
600 |
//Don't leave while the resources are not fully allocated/deallocated
|
sl@0
|
601 |
NKern::ThreadEnterCS();
|
sl@0
|
602 |
|
sl@0
|
603 |
err = HCRSingleton->FindSettings(aCat, aMaxNum, aMask, aPattern,
|
sl@0
|
604 |
aElIds, aTypes, aLens);
|
sl@0
|
605 |
|
sl@0
|
606 |
//All de-allocations are done, leave a critical section
|
sl@0
|
607 |
NKern::ThreadLeaveCS();
|
sl@0
|
608 |
|
sl@0
|
609 |
if(err < 0)
|
sl@0
|
610 |
HCR_TRACE_RETURN(err);
|
sl@0
|
611 |
|
sl@0
|
612 |
return err;
|
sl@0
|
613 |
|
sl@0
|
614 |
#else
|
sl@0
|
615 |
HCR_TRACE_RETURN(KErrGeneral);
|
sl@0
|
616 |
#endif // MAKE_DEF_FILE
|
sl@0
|
617 |
}
|
sl@0
|
618 |
|
sl@0
|
619 |
|
sl@0
|
620 |
// -- KERNEL ENTRY POINT ------------------------------------------------------
|
sl@0
|
621 |
|
sl@0
|
622 |
|
sl@0
|
623 |
#ifdef MAKE_DEF_FILE
|
sl@0
|
624 |
|
sl@0
|
625 |
DECLARE_STANDARD_EXTENSION()
|
sl@0
|
626 |
{
|
sl@0
|
627 |
return KErrNone;
|
sl@0
|
628 |
}
|
sl@0
|
629 |
|
sl@0
|
630 |
#endif // MAKE_DEF_FILE
|
sl@0
|
631 |
|