24
|
1 |
/*
|
|
2 |
* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef DATA_WRAPPER_BASE_H
|
|
20 |
#define DATA_WRAPPER_BASE_H
|
|
21 |
|
|
22 |
// EPOC includes
|
|
23 |
#include <datawrapper.h>
|
|
24 |
#define SECS_TO_MS(x) (x*1000000)
|
|
25 |
|
|
26 |
_LIT(KConsname, "Test Console");
|
|
27 |
|
|
28 |
#define GETFROMCONFIGOPTIONAL(aType, aSectName, aKeyName, aResult, aLogMessage) \
|
|
29 |
if ( !Get##aType##FromConfig(aSectName, aKeyName, aResult) ) \
|
|
30 |
{ \
|
|
31 |
WARN_PRINTF3(aLogMessage, &aKeyName, aResult); \
|
|
32 |
}
|
|
33 |
|
|
34 |
#define GETFROMCONFIGMANDATORY(aType, aSectName, aKeyName, aResult, aLogMessage, aDataOk) \
|
|
35 |
if ( !Get##aType##FromConfig(aSectName, aKeyName, aResult) ) \
|
|
36 |
{ \
|
|
37 |
ERR_PRINTF2(aLogMessage, &aKeyName); \
|
|
38 |
SetBlockResult(EFail); \
|
|
39 |
aDataOk=EFalse; \
|
|
40 |
}
|
|
41 |
|
|
42 |
#define GETSTRINGFROMCONFIGOPTIONAL(aSectName, aKeyName, aResult, aLogMessage) \
|
|
43 |
if ( !GetStringFromConfig(aSectName, aKeyName, aResult) ) \
|
|
44 |
{ \
|
|
45 |
WARN_PRINTF3(aLogMessage, &aKeyName, &aResult); \
|
|
46 |
}
|
|
47 |
|
|
48 |
#define GETSTRINGFROMCONFIGMANDATORY(aSectName, aKeyName, aResult, aLogMessage, aDataOk) \
|
|
49 |
if ( !GetStringFromConfig(aSectName, aKeyName, aResult) ) \
|
|
50 |
{ \
|
|
51 |
ERR_PRINTF2(aLogMessage, &aKeyName); \
|
|
52 |
SetBlockResult(EFail); \
|
|
53 |
aDataOk=EFalse; \
|
|
54 |
}
|
|
55 |
|
|
56 |
class CDataWrapperBase : public CDataWrapper
|
|
57 |
{
|
|
58 |
public:
|
|
59 |
class TEnumEntryTable
|
|
60 |
{
|
|
61 |
public:
|
|
62 |
const TDesC& iString;
|
|
63 |
TInt iValue;
|
|
64 |
};
|
|
65 |
|
|
66 |
public:
|
|
67 |
TBool GetBoolFromConfig(const TDesC& aSectName,const TDesC& aKeyName,TBool& aResult);
|
|
68 |
TBool GetIntFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt& aResult);
|
|
69 |
TBool GetStringFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TPtrC& aResult);
|
|
70 |
TBool GetHexFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt& aResult);
|
|
71 |
TBool GetUintFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TUint& aResult);
|
|
72 |
TBool CDataWrapperBase::GetArrayFromConfig(const TDesC& aSectName, const TDesC& aKeyName, RPointerArray<HBufC>& aResult);
|
|
73 |
TBool GetArrayRectFromConfig(const TDesC& aSectName, const TDesC& aKeyName, RPointerArray<HBufC>& aResult);
|
|
74 |
TBool KeyPress();
|
|
75 |
void Timedelay(TInt aTimeoutInSecs);
|
|
76 |
virtual void InitialiseL();
|
|
77 |
inline RFs& FileServer() { return iFs; }
|
|
78 |
inline CConsoleBase* GetConsole() { return(Console::NewL(KConsname,TSize(KConsFullScreen,KConsFullScreen)));}
|
|
79 |
TBool GetEnumFromConfig(const TDesC& aSectName, const TDesC& aKeyName, const TEnumEntryTable* aTable, TInt& aResult);
|
|
80 |
|
|
81 |
protected:
|
|
82 |
CDataWrapperBase();
|
|
83 |
virtual ~CDataWrapperBase();
|
|
84 |
|
|
85 |
private:
|
|
86 |
TBool GetCommandStringParameterL(const TDesC& aSectName, const TDesC& aKeyName, TPtrC& aResult);
|
|
87 |
TBool KeyCheck();
|
|
88 |
|
|
89 |
private:
|
|
90 |
// Included ini files
|
|
91 |
RPointerArray<CIniData> iInclude;
|
|
92 |
RPointerArray<HBufC> iBuffer;
|
|
93 |
RFs iFs;
|
|
94 |
RTimer iTimer;
|
|
95 |
};
|
|
96 |
|
|
97 |
#endif // DATA_WRAPPER_BASE_H
|