devicesrvapitest/hwrmhaitest/common/inc/DataWrapperBase.h
changeset 0 4e1aa6a622a0
child 52 d6b9e89d80a3
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     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					GetArrayRectFromConfig(const TDesC& aSectName, const TDesC& aKeyName, RPointerArray<HBufC>& aResult);
       
    73 	TBool 					KeyPress();
       
    74 	void 					Timedelay(TInt aTimeoutInSecs);
       
    75 	virtual void			InitialiseL();
       
    76 	inline RFs&				FileServer() { return iFs; }
       
    77 	inline CConsoleBase*	GetConsole() { return(Console::NewL(KConsname,TSize(KConsFullScreen,KConsFullScreen)));}
       
    78 	TBool					GetEnumFromConfig(const TDesC& aSectName, const TDesC& aKeyName, const TEnumEntryTable* aTable, TInt& aResult);
       
    79 
       
    80 protected:
       
    81 	CDataWrapperBase();
       
    82 	virtual ~CDataWrapperBase();
       
    83 
       
    84 private:
       
    85 	TBool	GetCommandStringParameterL(const TDesC& aSectName, const TDesC& aKeyName, TPtrC& aResult);
       
    86 	TBool 	KeyCheck();
       
    87 
       
    88 private:
       
    89 	// Included ini files
       
    90 	RPointerArray<CIniData>	iInclude;
       
    91 	RPointerArray<HBufC>	iBuffer;
       
    92 	RFs                     iFs;
       
    93 	RTimer					iTimer;
       
    94 	};
       
    95 
       
    96 #endif // DATA_WRAPPER_BASE_H