mmhais/dvbhunittest/hai/dvbh/src/dvbhhaitestutil.h
changeset 0 40261b775718
equal deleted inserted replaced
-1:000000000000 0:40261b775718
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @internalComponent
       
    19  @prototype
       
    20 */
       
    21 
       
    22 #ifndef DVBHHAITESTUTIL_H
       
    23 #define DVBHHAITESTUTIL_H
       
    24 
       
    25 #include <e32base.h>
       
    26 #include <e32property.h>
       
    27 #include <mobiletv/hai/dvbh/dvbhtypes.h>
       
    28 #include <in_sock.h>
       
    29 
       
    30 
       
    31 /**
       
    32 * Constants for expected values
       
    33 */
       
    34 const TInt KDvbhTestFilterId = 977;
       
    35 const TIp6Addr KDvbhTestIpV6Addr = {{{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1}}};
       
    36 const TInt KDvbhTestCustomCommand = 0;
       
    37 _LIT8(KDvbhTestCustomCommandInput, 	"DvbhTestCustomCommandInput");
       
    38 _LIT8(KDvbhTestCustomCommandOutput, "DvbhTestCustomCommandOutput");
       
    39 _LIT8(KDvbhTestHardwareInfo, "Example Hardware Info;Version 1.0");
       
    40 
       
    41 const TInt KInitialState = EDvbhStateInactive;
       
    42 const TInt KExpectedState = EDvbhStateReady;
       
    43 
       
    44 const TInt KInitialSignalQuality = EDvbhSignalQualityFair;
       
    45 const TInt KExpectedSignalQuality = EDvbhSignalQualityExcellent;
       
    46 
       
    47 const TInt KInitialFrequency = 1500000;
       
    48 const TInt KExpectedFrequency = 3600000;
       
    49 
       
    50 const TInt KInitialCellId = 1006;
       
    51 const TInt KExpectedCellId = 756;
       
    52 
       
    53 const TInt KInitialNetworkId = 9993;
       
    54 const TInt KExpectedNetworkId = 3726;
       
    55 
       
    56 const TUint32 KDvbhTestTerminalTimeStamp = 987654321;
       
    57 
       
    58 const TInt KNoVerdict = -1;
       
    59 
       
    60 const TInt KInitialPlatformId = 123456789;
       
    61 _LIT8(KInitialPlatformName, "DvbhTestInitialPlatform");
       
    62 
       
    63 const TInt KExpectedPlatformId = 987654321;
       
    64 _LIT8(KExpectedPlatformName, "DvbhTestExpectedPlatform");
       
    65 
       
    66 /**
       
    67 * @internalComponent
       
    68 * @prototype
       
    69 *
       
    70 * Publish & Subscribe variables used for implementation to API communication.
       
    71 *
       
    72 * This must be kept identical to the ones defined in the non-exported header
       
    73 * file dvbhimplcommon.h
       
    74 */	
       
    75 enum TDvbhPropertyKey
       
    76 	{
       
    77 	EDvbhPropertyKeyState = 0,					// integer (TDvbhState)
       
    78 	EDvbhPropertyKeyPlatform = 1,   	 		// byte array (TDvbhPlatform + TIp6Addr + TInt16)
       
    79 	EDvbhPropertyKeyNetworkTime = 2, 	 		// byte array (TDvbhNetworkTime)
       
    80 	EDvbhPropertyKeyPerformanceData = 3, 		// byte array (TDvbhPerformanceData)
       
    81 	EDvbhPropertyKeyFrequency = 4, 		 		// byte array (TDvbhFrequency)
       
    82 	EDvbhPropertyKeyNetworkId = 5, 		 		// byte array (TDvbhNetworkId)
       
    83 	EDvbhPropertyKeySignalQuality = 6, 	 		// byte array (TDvbhSignalQuality)
       
    84 	EDvbhPropertyKeyCellId = 7	 		 		// byte array (TDvbhCellId)
       
    85 	};
       
    86 
       
    87 struct TDvbhPlatformProperty
       
    88 	{
       
    89 	TDvbhPlatform iPlatform;
       
    90 	TIp6Addr iEsgRoot;
       
    91 	};
       
    92 
       
    93 /**
       
    94 * Interface to enable CDvbhTestUtil to log test data & messages.
       
    95 */	
       
    96 class MDvbhHaiTestLoggerInterface
       
    97 	{
       
    98 public:
       
    99 	virtual void InfoPrintf3(const TDesC16& aString, TInt aInt1, TInt aInt2) = 0;
       
   100 	virtual void InfoPrintf4(const TDesC16& aString, TInt aInt1, TInt aInt2, TInt aInt3) = 0;
       
   101 	};
       
   102 	
       
   103 class RTestStep;
       
   104 
       
   105 /**
       
   106 * @internalComponent
       
   107 * @prototype
       
   108 *
       
   109 * A class of utility methods to help the DVB-H HAI test steps.
       
   110 */
       
   111 class CDvbhTestUtil : public CBase
       
   112 	{
       
   113 public:
       
   114 	enum 
       
   115 		{
       
   116 		ENoInitialState = -1
       
   117 		};
       
   118 		
       
   119 	enum
       
   120 		{
       
   121 		ENumDvbhProperties = 8
       
   122 		};
       
   123 public:
       
   124 	static CDvbhTestUtil* NewL(MDvbhHaiTestLoggerInterface& aTestStepLogger);
       
   125 		
       
   126 	TInt DefineDvbhProperty(TInt aPropertyKey, TInt aType = RProperty::EInt) const;
       
   127 	TInt DefineDvbhProperty(TInt aPropertyKey, TInt aType, const TDesC8& aInitialValue) const;
       
   128 	TInt DefineDvbhStateProperty(TInt aInitialState = ENoInitialState);
       
   129 	TInt DefineDvbhIntegerProperty(TInt aPropertyKey, TInt aInitialValue) const;
       
   130 	TInt DeleteDvbhProperty(TInt aPropertyKey);
       
   131 	TInt SetStateProperty(TInt aValue);
       
   132 	TInt SetByteArrayProperty(TInt aPropertyKey, const TDesC8& aValue) const;
       
   133 	TInt SetIntegerProperty(TInt aPropertyKey, TInt aValue) const;
       
   134 	TInt DefineAllDvbhProperties();
       
   135 	TInt DeleteAllDvbhProperties();
       
   136 public:
       
   137 	static TInt GetKey(TDvbhPropertyKey aKey);
       
   138 	static TInt GetType(TDvbhPropertyKey aKey);
       
   139 	static TBool CompareVersions(const TVersion& aVersion1, const TVersion& aVersion2);
       
   140 	static TBool ComparePlatforms(const TDvbhPlatform& aPlatform1, const TDvbhPlatform& aPlatform2);
       
   141 	static TBool ComparePerformanceDatas(const TDvbhPerformanceData& aData1, const TDvbhPerformanceData& aData2);
       
   142 	static TBool CompareScanConfigurations(const TDvbhScanConfiguration& aConfig1, const TDvbhScanConfiguration& aConfig2);
       
   143 private:
       
   144 	CDvbhTestUtil(MDvbhHaiTestLoggerInterface& aTestStepLogger);
       
   145 private:
       
   146 	MDvbhHaiTestLoggerInterface& iTestStepLogger;
       
   147 	};
       
   148 	
       
   149 #endif // DVBHHAITESTUTIL_H