sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
#include "datawrapperbase.h"
|
sl@0
|
20 |
|
sl@0
|
21 |
/*@{*/
|
sl@0
|
22 |
/// Constant Literals used.
|
sl@0
|
23 |
_LIT(KPrefixHex, "0x");
|
sl@0
|
24 |
_LIT(KPrefixOctal, "0");
|
sl@0
|
25 |
_LIT(KSuffixBinary, "b");
|
sl@0
|
26 |
|
sl@0
|
27 |
_LIT(KIncludeSection, "include");
|
sl@0
|
28 |
_LIT(KFile, "file%d");
|
sl@0
|
29 |
_LIT(KMatch, "*{*,*}*");
|
sl@0
|
30 |
_LIT(KStart, "{");
|
sl@0
|
31 |
_LIT(KSeparator, ",");
|
sl@0
|
32 |
_LIT(KEnd, "}");
|
sl@0
|
33 |
_LIT(KDataRead, "INI READ : %S %S %S");
|
sl@0
|
34 |
|
sl@0
|
35 |
/*@}*/
|
sl@0
|
36 |
|
sl@0
|
37 |
CDataWrapperBase::CDataWrapperBase()
|
sl@0
|
38 |
: CDataWrapper()
|
sl@0
|
39 |
{
|
sl@0
|
40 |
}
|
sl@0
|
41 |
|
sl@0
|
42 |
/**
|
sl@0
|
43 |
* Public destructor
|
sl@0
|
44 |
*/
|
sl@0
|
45 |
CDataWrapperBase::~CDataWrapperBase()
|
sl@0
|
46 |
{
|
sl@0
|
47 |
iInclude.ResetAndDestroy();
|
sl@0
|
48 |
iBuffer.ResetAndDestroy();
|
sl@0
|
49 |
iFs.Close();
|
sl@0
|
50 |
}
|
sl@0
|
51 |
|
sl@0
|
52 |
void CDataWrapperBase::InitialiseL()
|
sl@0
|
53 |
{
|
sl@0
|
54 |
iTimer.CreateLocal();
|
sl@0
|
55 |
CDataWrapper::InitialiseL();
|
sl@0
|
56 |
TBuf<KMaxTestExecuteCommandLength> tempStore;
|
sl@0
|
57 |
TPtrC fileName;
|
sl@0
|
58 |
TBool moreData=ETrue;
|
sl@0
|
59 |
TBool index=0;
|
sl@0
|
60 |
while ( moreData )
|
sl@0
|
61 |
{
|
sl@0
|
62 |
tempStore.Format(KFile(), ++index);
|
sl@0
|
63 |
moreData=GetStringFromConfig(KIncludeSection, tempStore, fileName);
|
sl@0
|
64 |
|
sl@0
|
65 |
if (moreData)
|
sl@0
|
66 |
{
|
sl@0
|
67 |
CIniData* iniData=CIniData::NewL(fileName);
|
sl@0
|
68 |
CleanupStack::PushL(iniData);
|
sl@0
|
69 |
iInclude.Append(iniData);
|
sl@0
|
70 |
CleanupStack::Pop(iniData);
|
sl@0
|
71 |
}
|
sl@0
|
72 |
}
|
sl@0
|
73 |
User::LeaveIfError(iFs.Connect());
|
sl@0
|
74 |
}
|
sl@0
|
75 |
|
sl@0
|
76 |
/**
|
sl@0
|
77 |
* Reads the value present from the test steps ini file within the mentioned section name and key name
|
sl@0
|
78 |
* Copies the value to the TBool reference passed in possible values TRUE, FALSE
|
sl@0
|
79 |
* @param aSectName - Section within the test steps ini file
|
sl@0
|
80 |
* @param aKeyName - Name of a key within a section
|
sl@0
|
81 |
* @return aResult - The value of the boolean
|
sl@0
|
82 |
* @return TBool - ETrue for found, EFalse for not found
|
sl@0
|
83 |
*/
|
sl@0
|
84 |
TBool CDataWrapperBase::GetBoolFromConfig(const TDesC& aSectName,const TDesC& aKeyName,TBool& aResult)
|
sl@0
|
85 |
{
|
sl@0
|
86 |
TBool ret=EFalse;
|
sl@0
|
87 |
TPtrC result;
|
sl@0
|
88 |
TRAPD(err, ret=GetCommandStringParameterL(aSectName, aKeyName, result));
|
sl@0
|
89 |
if ( err != KErrNone )
|
sl@0
|
90 |
{
|
sl@0
|
91 |
ret=EFalse;
|
sl@0
|
92 |
}
|
sl@0
|
93 |
if ( ret )
|
sl@0
|
94 |
{
|
sl@0
|
95 |
_LIT(KTrue,"true");
|
sl@0
|
96 |
aResult=(result.FindF(KTrue) != KErrNotFound);
|
sl@0
|
97 |
}
|
sl@0
|
98 |
|
sl@0
|
99 |
return ret;
|
sl@0
|
100 |
}
|
sl@0
|
101 |
|
sl@0
|
102 |
/**
|
sl@0
|
103 |
* Reads the value present from the test steps ini file within the mentioned section name and key name
|
sl@0
|
104 |
* Copies the value to the TInt reference passed in
|
sl@0
|
105 |
* @param aSectName - Section within the test steps ini file
|
sl@0
|
106 |
* @param aKeyName - Name of a key within a section
|
sl@0
|
107 |
* @return aResult - The value of the integer
|
sl@0
|
108 |
* @return TBool - ETrue for found, EFalse for not found
|
sl@0
|
109 |
*/
|
sl@0
|
110 |
TBool CDataWrapperBase::GetIntFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt& aResult)
|
sl@0
|
111 |
{
|
sl@0
|
112 |
TPtrC result;
|
sl@0
|
113 |
TBool ret=EFalse;
|
sl@0
|
114 |
TRAPD(err, ret=GetCommandStringParameterL(aSectName, aKeyName, result));
|
sl@0
|
115 |
if ( err != KErrNone )
|
sl@0
|
116 |
{
|
sl@0
|
117 |
ret=EFalse;
|
sl@0
|
118 |
}
|
sl@0
|
119 |
if ( ret )
|
sl@0
|
120 |
{
|
sl@0
|
121 |
TLex lex(result);
|
sl@0
|
122 |
ret=(lex.Val(aResult)==KErrNone);
|
sl@0
|
123 |
}
|
sl@0
|
124 |
|
sl@0
|
125 |
return ret;
|
sl@0
|
126 |
}
|
sl@0
|
127 |
/**
|
sl@0
|
128 |
* Reads the value present from the test steps ini file within the mentioned section name and key name
|
sl@0
|
129 |
* Copies the value to the TReal reference passed in
|
sl@0
|
130 |
* @param aSectName - Section within the test steps ini file
|
sl@0
|
131 |
* @param aKeyName - Name of a key within a section
|
sl@0
|
132 |
* @return aResult - The value of the real
|
sl@0
|
133 |
* @return TBool - ETrue for found, EFalse for not found
|
sl@0
|
134 |
*/
|
sl@0
|
135 |
TBool CDataWrapperBase::GetRealFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TReal& aResult)
|
sl@0
|
136 |
{
|
sl@0
|
137 |
TPtrC result;
|
sl@0
|
138 |
TBool ret=EFalse;
|
sl@0
|
139 |
TRAPD(err, ret=GetCommandStringParameterL(aSectName, aKeyName, result));
|
sl@0
|
140 |
if ( err != KErrNone )
|
sl@0
|
141 |
{
|
sl@0
|
142 |
ret = EFalse;
|
sl@0
|
143 |
}
|
sl@0
|
144 |
if ( ret )
|
sl@0
|
145 |
{
|
sl@0
|
146 |
TLex lex(result);
|
sl@0
|
147 |
ret = ( lex.Val(aResult)==KErrNone );
|
sl@0
|
148 |
}
|
sl@0
|
149 |
return ret;
|
sl@0
|
150 |
}
|
sl@0
|
151 |
|
sl@0
|
152 |
/**
|
sl@0
|
153 |
* Reads the value present from the test steps ini file within the mentioned section name and key name
|
sl@0
|
154 |
* Copies the value to the TPtrC reference passed in
|
sl@0
|
155 |
* @param aSectName - Section within the test steps ini file
|
sl@0
|
156 |
* @param aKeyName - Name of a key within a section
|
sl@0
|
157 |
* @return aResult - Reference to the string on the heap
|
sl@0
|
158 |
* @return TBool - ETrue for found, EFalse for not found
|
sl@0
|
159 |
*/
|
sl@0
|
160 |
TBool CDataWrapperBase::GetStringFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TPtrC& aResult)
|
sl@0
|
161 |
{
|
sl@0
|
162 |
TBool ret=EFalse;
|
sl@0
|
163 |
TRAPD(err, ret=GetCommandStringParameterL(aSectName, aKeyName, aResult));
|
sl@0
|
164 |
if ( err != KErrNone )
|
sl@0
|
165 |
{
|
sl@0
|
166 |
ret=EFalse;
|
sl@0
|
167 |
}
|
sl@0
|
168 |
return ret;
|
sl@0
|
169 |
}
|
sl@0
|
170 |
|
sl@0
|
171 |
/**
|
sl@0
|
172 |
* Reads the value present from the test steps ini file within the mentioned section name and key name
|
sl@0
|
173 |
* Copies the value to the TInt reference passed in. The value can optionally be prefixed with 0x
|
sl@0
|
174 |
* @param aSectName - Section within the test steps ini file
|
sl@0
|
175 |
* @param aKeyName - Name of a key within a section
|
sl@0
|
176 |
* @return aResult - The integer value of the Hex input
|
sl@0
|
177 |
* @return TBool - ETrue for found, EFalse for not found
|
sl@0
|
178 |
*/
|
sl@0
|
179 |
TBool CDataWrapperBase::GetHexFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt& aResult)
|
sl@0
|
180 |
{
|
sl@0
|
181 |
TPtrC result;
|
sl@0
|
182 |
TBool ret=EFalse;
|
sl@0
|
183 |
TRAPD(err, ret=GetCommandStringParameterL(aSectName, aKeyName, result));
|
sl@0
|
184 |
if ( err != KErrNone )
|
sl@0
|
185 |
{
|
sl@0
|
186 |
ret=EFalse;
|
sl@0
|
187 |
}
|
sl@0
|
188 |
if ( ret )
|
sl@0
|
189 |
{
|
sl@0
|
190 |
TLex lex;
|
sl@0
|
191 |
if( result.FindC(KPrefixHex)==KErrNone )
|
sl@0
|
192 |
{
|
sl@0
|
193 |
lex=result.Mid(KPrefixHex().Length());
|
sl@0
|
194 |
}
|
sl@0
|
195 |
else
|
sl@0
|
196 |
{
|
sl@0
|
197 |
lex=result;
|
sl@0
|
198 |
}
|
sl@0
|
199 |
ret=(lex.Val((TUint &)aResult, EHex)==KErrNone);
|
sl@0
|
200 |
}
|
sl@0
|
201 |
|
sl@0
|
202 |
return ret;
|
sl@0
|
203 |
}
|
sl@0
|
204 |
|
sl@0
|
205 |
/**
|
sl@0
|
206 |
* Reads the value present from the test steps ini file within the mentioned section name and key name
|
sl@0
|
207 |
* Copies the value to the TUint reference passed in.
|
sl@0
|
208 |
* If the value is prefixed with 0x the value is read as a hexidecimal value
|
sl@0
|
209 |
* If the value is suffixed with b the value is read as a binary value
|
sl@0
|
210 |
* If the value is prefixed with a 0 the value is read as an octal value
|
sl@0
|
211 |
* If it does not match the above it is read in as an integer
|
sl@0
|
212 |
* @param aSectName - Section within the test steps ini file
|
sl@0
|
213 |
* @param aKeyName - Name of a key within a section
|
sl@0
|
214 |
* @return aResult - The integer value of the Hex input
|
sl@0
|
215 |
* @return TBool - ETrue for found, EFalse for not found
|
sl@0
|
216 |
*/
|
sl@0
|
217 |
TBool CDataWrapperBase::GetUintFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TUint& aResult)
|
sl@0
|
218 |
{
|
sl@0
|
219 |
TPtrC result;
|
sl@0
|
220 |
TBool ret=EFalse;
|
sl@0
|
221 |
TRAPD(err, ret=GetCommandStringParameterL(aSectName, aKeyName, result));
|
sl@0
|
222 |
if ( err != KErrNone )
|
sl@0
|
223 |
{
|
sl@0
|
224 |
ret=EFalse;
|
sl@0
|
225 |
}
|
sl@0
|
226 |
if ( ret )
|
sl@0
|
227 |
{
|
sl@0
|
228 |
TLex lex(result);
|
sl@0
|
229 |
if( result.FindC(KPrefixHex)==KErrNone )
|
sl@0
|
230 |
{
|
sl@0
|
231 |
lex=result.Mid(KPrefixHex().Length());
|
sl@0
|
232 |
ret=(lex.Val(aResult, EHex)==KErrNone);
|
sl@0
|
233 |
}
|
sl@0
|
234 |
else
|
sl@0
|
235 |
{
|
sl@0
|
236 |
TInt binarySuffixPosition=result.Length()-KSuffixBinary().Length();
|
sl@0
|
237 |
if ( result.FindC(KSuffixBinary)==binarySuffixPosition )
|
sl@0
|
238 |
{
|
sl@0
|
239 |
lex=result.Left(binarySuffixPosition);
|
sl@0
|
240 |
ret=(lex.Val(aResult, EBinary)==KErrNone);
|
sl@0
|
241 |
}
|
sl@0
|
242 |
else
|
sl@0
|
243 |
{
|
sl@0
|
244 |
if( result.FindC(KPrefixOctal)==KErrNone )
|
sl@0
|
245 |
{
|
sl@0
|
246 |
ret=(lex.Val(aResult, EOctal)==KErrNone);
|
sl@0
|
247 |
}
|
sl@0
|
248 |
else
|
sl@0
|
249 |
{
|
sl@0
|
250 |
TInt intResult;
|
sl@0
|
251 |
ret=(lex.Val(intResult)==KErrNone);
|
sl@0
|
252 |
if ( ret )
|
sl@0
|
253 |
{
|
sl@0
|
254 |
aResult=(TUint)intResult;
|
sl@0
|
255 |
}
|
sl@0
|
256 |
}
|
sl@0
|
257 |
}
|
sl@0
|
258 |
}
|
sl@0
|
259 |
}
|
sl@0
|
260 |
|
sl@0
|
261 |
return ret;
|
sl@0
|
262 |
}
|
sl@0
|
263 |
|
sl@0
|
264 |
/**
|
sl@0
|
265 |
* Return array of string parameters i.e. key=a1,a2,a3 returns array which contains
|
sl@0
|
266 |
* String a1, a2 and a3.
|
sl@0
|
267 |
* @return ret - EFalse if can't get a String parameter from Config file. ETrue if KErrNone
|
sl@0
|
268 |
*/
|
sl@0
|
269 |
TBool CDataWrapperBase::GetArrayRectFromConfig(const TDesC& aSectName, const TDesC& aKeyName, RPointerArray<HBufC>& aResult)
|
sl@0
|
270 |
{
|
sl@0
|
271 |
TBool ret=EFalse;
|
sl@0
|
272 |
TPtrC completeArray;
|
sl@0
|
273 |
|
sl@0
|
274 |
TRAPD(err, ret=GetCommandStringParameterL(aSectName, aKeyName, completeArray));
|
sl@0
|
275 |
if ( err != KErrNone )
|
sl@0
|
276 |
{
|
sl@0
|
277 |
ret=EFalse;
|
sl@0
|
278 |
}
|
sl@0
|
279 |
|
sl@0
|
280 |
TLex16 lex(completeArray); // Here we have the array as a string i.e. "a1,a2,a3"
|
sl@0
|
281 |
TBuf<256> buf;
|
sl@0
|
282 |
TChar chr;
|
sl@0
|
283 |
|
sl@0
|
284 |
while(!lex.Eos())
|
sl@0
|
285 |
{
|
sl@0
|
286 |
chr = lex.Get();
|
sl@0
|
287 |
// Check if there was a list separator
|
sl@0
|
288 |
if ((chr == ',') && (lex.Peek() == '('))
|
sl@0
|
289 |
{
|
sl@0
|
290 |
HBufC* param = buf.AllocLC();
|
sl@0
|
291 |
buf.Zero();
|
sl@0
|
292 |
aResult.Append(param);
|
sl@0
|
293 |
CleanupStack::Pop(param); // pointer to buf is stored in RPointerArray
|
sl@0
|
294 |
}
|
sl@0
|
295 |
// If not separator character we can store the character into array
|
sl@0
|
296 |
else
|
sl@0
|
297 |
{
|
sl@0
|
298 |
buf.Append(chr);
|
sl@0
|
299 |
}
|
sl@0
|
300 |
}
|
sl@0
|
301 |
// Remember to put last token into array (,a3)
|
sl@0
|
302 |
HBufC* param = buf.AllocLC();
|
sl@0
|
303 |
aResult.Append(param);
|
sl@0
|
304 |
CleanupStack::Pop(param);
|
sl@0
|
305 |
|
sl@0
|
306 |
return ret;
|
sl@0
|
307 |
}
|
sl@0
|
308 |
|
sl@0
|
309 |
/**
|
sl@0
|
310 |
* Reads the parameter asociated to the specified command
|
sl@0
|
311 |
* @param aSectName Section on ini file
|
sl@0
|
312 |
* @param aKeyName Name of the parameter
|
sl@0
|
313 |
* @param aResult descriptor containing parameter
|
sl@0
|
314 |
* @return TBool ETrue for found, EFalse for not found
|
sl@0
|
315 |
*/
|
sl@0
|
316 |
TBool CDataWrapperBase::GetCommandStringParameterL(const TDesC& aSectName, const TDesC& aKeyName, TPtrC& aResult)
|
sl@0
|
317 |
{
|
sl@0
|
318 |
TBool ret=EFalse;
|
sl@0
|
319 |
|
sl@0
|
320 |
if ( aSectName.Length()!=0 )
|
sl@0
|
321 |
{
|
sl@0
|
322 |
ret=CDataWrapper::GetStringFromConfig(aSectName, aKeyName, aResult);
|
sl@0
|
323 |
|
sl@0
|
324 |
for ( TInt index=iInclude.Count(); (index>0) && (!ret); )
|
sl@0
|
325 |
{
|
sl@0
|
326 |
ret=iInclude[--index]->FindVar(aSectName, aKeyName, aResult);
|
sl@0
|
327 |
}
|
sl@0
|
328 |
}
|
sl@0
|
329 |
|
sl@0
|
330 |
if ( ret )
|
sl@0
|
331 |
{
|
sl@0
|
332 |
if ( aResult.Match(KMatch)!=KErrNotFound )
|
sl@0
|
333 |
{
|
sl@0
|
334 |
// We have an entry of the format
|
sl@0
|
335 |
// entry =*{section,entry}*
|
sl@0
|
336 |
// where * is one or more characters
|
sl@0
|
337 |
// We need to construct this from other data in the ini file replacing {*,*}
|
sl@0
|
338 |
// with the data from
|
sl@0
|
339 |
// [section]
|
sl@0
|
340 |
// entry =some_value
|
sl@0
|
341 |
HBufC* buffer=HBufC::NewLC(aResult.Length());
|
sl@0
|
342 |
buffer->Des().Copy(aResult);
|
sl@0
|
343 |
|
sl@0
|
344 |
TInt startLength=KStart().Length();
|
sl@0
|
345 |
TInt sparatorLength=KSeparator().Length();
|
sl@0
|
346 |
TInt endLength=KEnd().Length();
|
sl@0
|
347 |
TInt bufferLength;
|
sl@0
|
348 |
TInt start;
|
sl@0
|
349 |
TInt sparator;
|
sl@0
|
350 |
TInt end;
|
sl@0
|
351 |
TPtrC remaining;
|
sl@0
|
352 |
TLex lex;
|
sl@0
|
353 |
do
|
sl@0
|
354 |
{
|
sl@0
|
355 |
bufferLength=buffer->Length();
|
sl@0
|
356 |
start=buffer->Find(KStart);
|
sl@0
|
357 |
|
sl@0
|
358 |
remaining.Set(buffer->Des().Right(bufferLength-start-startLength));
|
sl@0
|
359 |
sparator=remaining.Find(KSeparator);
|
sl@0
|
360 |
remaining.Set(remaining.Right(remaining.Length()-sparator-sparatorLength));
|
sl@0
|
361 |
sparator += (start + startLength);
|
sl@0
|
362 |
|
sl@0
|
363 |
end=remaining.Find(KEnd) + sparator + sparatorLength;
|
sl@0
|
364 |
|
sl@0
|
365 |
TPtrC sectionName(buffer->Ptr()+start+startLength, sparator-start-startLength);
|
sl@0
|
366 |
TPtrC keyName(buffer->Ptr()+sparator+sparatorLength, end-sparator-sparatorLength);
|
sl@0
|
367 |
sectionName.Set(TLex(sectionName).NextToken());
|
sl@0
|
368 |
keyName.Set(TLex(keyName).NextToken());
|
sl@0
|
369 |
|
sl@0
|
370 |
TInt entrySize=0;
|
sl@0
|
371 |
TPtrC entryData;
|
sl@0
|
372 |
TBool found=CDataWrapper::GetStringFromConfig(sectionName, keyName, entryData);
|
sl@0
|
373 |
for ( TInt index=iInclude.Count(); (index>0) && (!found); )
|
sl@0
|
374 |
{
|
sl@0
|
375 |
found=iInclude[--index]->FindVar(sectionName, keyName, entryData);
|
sl@0
|
376 |
}
|
sl@0
|
377 |
if ( found )
|
sl@0
|
378 |
{
|
sl@0
|
379 |
entrySize=entryData.Length();
|
sl@0
|
380 |
}
|
sl@0
|
381 |
|
sl@0
|
382 |
TInt newLength=start + bufferLength - end - endLength + entrySize;
|
sl@0
|
383 |
HBufC* bufferNew=HBufC::NewLC(newLength);
|
sl@0
|
384 |
bufferNew->Des().Copy(buffer->Ptr(), start);
|
sl@0
|
385 |
if ( entrySize>0 )
|
sl@0
|
386 |
{
|
sl@0
|
387 |
bufferNew->Des().Append(entryData);
|
sl@0
|
388 |
}
|
sl@0
|
389 |
bufferNew->Des().Append(buffer->Ptr() + end + endLength, bufferLength - end - endLength);
|
sl@0
|
390 |
CleanupStack::Pop(bufferNew);
|
sl@0
|
391 |
CleanupStack::PopAndDestroy(buffer);
|
sl@0
|
392 |
buffer=bufferNew;
|
sl@0
|
393 |
CleanupStack::PushL(buffer);
|
sl@0
|
394 |
}
|
sl@0
|
395 |
while ( buffer->Match(KMatch)!=KErrNotFound );
|
sl@0
|
396 |
iBuffer.Append(buffer);
|
sl@0
|
397 |
CleanupStack::Pop(buffer);
|
sl@0
|
398 |
aResult.Set(*buffer);
|
sl@0
|
399 |
INFO_PRINTF4(KDataRead, &aSectName, &aKeyName , &aResult);
|
sl@0
|
400 |
}
|
sl@0
|
401 |
}
|
sl@0
|
402 |
|
sl@0
|
403 |
return ret;
|
sl@0
|
404 |
}
|
sl@0
|
405 |
|
sl@0
|
406 |
/**
|
sl@0
|
407 |
* Utility function to produce time delay
|
sl@0
|
408 |
* @param aTimeoutInSecs Times in micro seconds
|
sl@0
|
409 |
*/
|
sl@0
|
410 |
void CDataWrapperBase::Timedelay(TInt aTimeoutInSecs)
|
sl@0
|
411 |
{
|
sl@0
|
412 |
TRequestStatus status;
|
sl@0
|
413 |
iTimer.After(status, aTimeoutInSecs);
|
sl@0
|
414 |
User::WaitForRequest(status);
|
sl@0
|
415 |
}
|
sl@0
|
416 |
|
sl@0
|
417 |
TBool CDataWrapperBase::GetEnumFromConfig(const TDesC& aSectName, const TDesC& aKeyName, const TEnumEntryTable* aTable, TInt& aResult)
|
sl@0
|
418 |
{
|
sl@0
|
419 |
TPtrC str;
|
sl@0
|
420 |
TBool ret=GetStringFromConfig(aSectName, aKeyName, str);
|
sl@0
|
421 |
|
sl@0
|
422 |
if ( ret )
|
sl@0
|
423 |
{
|
sl@0
|
424 |
TBool found=EFalse;
|
sl@0
|
425 |
TInt index=0;
|
sl@0
|
426 |
while ( (aTable[index].iValue!=-1) && !found )
|
sl@0
|
427 |
{
|
sl@0
|
428 |
if ( aTable[index].iString==str )
|
sl@0
|
429 |
{
|
sl@0
|
430 |
found=ETrue;
|
sl@0
|
431 |
aResult=aTable[index].iValue;
|
sl@0
|
432 |
}
|
sl@0
|
433 |
else
|
sl@0
|
434 |
{
|
sl@0
|
435 |
++index;
|
sl@0
|
436 |
}
|
sl@0
|
437 |
}
|
sl@0
|
438 |
|
sl@0
|
439 |
if ( !found )
|
sl@0
|
440 |
{
|
sl@0
|
441 |
ret=GetIntFromConfig(aSectName, aKeyName, aResult);
|
sl@0
|
442 |
}
|
sl@0
|
443 |
}
|
sl@0
|
444 |
|
sl@0
|
445 |
return ret;
|
sl@0
|
446 |
}
|
sl@0
|
447 |
|