common/tools/ats/smoketest/lbs/lbstestchannel/inc/tlbschannelutils.h
changeset 748 e13acd883fbe
child 872 17498133d9ad
equal deleted inserted replaced
747:76f9aaeefbab 748:e13acd883fbe
       
     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 the License "Symbian Foundation License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // @file tlbschannelutils.h
       
    15 // This is the header file which contains the msg data types and other utilities
       
    16 // 
       
    17 //
       
    18 
       
    19 
       
    20 
       
    21 /**
       
    22  @file
       
    23  @internalTechnology
       
    24  @test
       
    25 */
       
    26 
       
    27 #ifndef TLBSCHANNELUTILS_H
       
    28 #define TLBSCHANNELUTILS_H
       
    29 
       
    30 #include <lbs/test/tlbsutils.h>
       
    31 
       
    32 
       
    33 /* Key value used to publish messages from Test Harness to Test AGPS Module 
       
    34    and the corresponding acknowledgement */
       
    35 const TUint KTH2TAGPSMessageKey = 0x0F001010;
       
    36 const TUint KTH2TAGPSMessageReadAckKey = 0x0F001020;
       
    37 /* Key value used to publish messages from Test AGPS Module to Test Harness  
       
    38    and the corresponding acknowledgement */
       
    39 const TUint KTAGPS2THMessageKey = 0x0F001030;
       
    40 const TUint KTAGPS2THMessageReadAckKey = 0x0F001040;
       
    41 
       
    42 
       
    43 
       
    44 /** Base class for messages sent between the Test Harness and Test A-Gps Module.
       
    45 
       
    46 This class defines the types of messages and reserves a buffer to store
       
    47 information, but it can't be used itself. Instead derived classes will
       
    48 implement each of the types of messages and supply accessor functions.
       
    49 
       
    50 */
       
    51 class TT_LbsMsgBase
       
    52 	{
       
    53 public:
       
    54 	/** List of all possible message types.
       
    55 	
       
    56 	Each type of message listed here must be implemented as a
       
    57 	separate class that inherits from TLbsNetInternalMsgBase.
       
    58 	*/
       
    59 	enum TLbsMsgType
       
    60 		{
       
    61 		EUnknown = 0,
       
    62 		EModuleRequestUpdateInit,	// TH --> AGPS-Module
       
    63 		EModuleRequestTimeOut,		// TH --> AGPS-Module
       
    64 		EModuleRequestOptions,		// TH --> AGPS-Module
       
    65 		EModuleRequestError,		// TH --> AGPS-Module
       
    66 		EModuleRequestForcedUpdate,	// TH --> AGPS-Module
       
    67 		EModuleResponse				// AGPS-Module --> TH
       
    68 		};
       
    69 
       
    70 public:
       
    71 	IMPORT_C TT_LbsMsgBase();
       
    72 	
       
    73 	IMPORT_C TLbsMsgType Type() const;
       
    74 
       
    75 protected:
       
    76 	// Derived classes set their type by using these constructors.
       
    77 	IMPORT_C TT_LbsMsgBase(TLbsMsgType aType);	
       
    78 
       
    79 private:
       
    80 	TLbsMsgType iType;
       
    81 	
       
    82 protected:	
       
    83 	// A TUint64 is used to ensure that any objects that use the buffer 
       
    84 	// are at least 8byte aligned. (The compiler will organise the arrangement
       
    85 	// of iBuffer within TLbsNetInternalMsgBase to be aligned to the minimum
       
    86 	// for a TUint64, which is 8bytes.)
       
    87 	TUint64 iBuffer[((1576 - (sizeof(TLbsMsgType))) >> 3)];
       
    88 	};
       
    89 	
       
    90 /** 
       
    91 Test A-Gps Module Request UpdateInit Message
       
    92 */
       
    93 NONSHARABLE_CLASS(TT_LbsAGpsRequestUpdateInitMsg) : public TT_LbsMsgBase
       
    94 	{
       
    95 public:
       
    96 	IMPORT_C TT_LbsAGpsRequestUpdateInitMsg(const TDesC& aConfigFileName, const TDesC& aConfigSection);
       
    97 	
       
    98 	IMPORT_C const TDesC& ConfigFileName() const;
       
    99 	IMPORT_C const TDesC& ConfigSection() const;
       
   100 
       
   101 private:
       
   102 	TT_LbsAGpsRequestUpdateInitMsg();
       
   103 
       
   104 private:
       
   105 	struct ST_LbsAGpsRequestUpdateInit
       
   106 		{
       
   107 		TBuf<KMaxModuleDataBusIniFileName>	iConfigFileName; 	/** Config request data. */
       
   108 		TBuf<40>							iConfigSection;  	/** Config request data. */
       
   109 		};
       
   110 
       
   111 	inline ST_LbsAGpsRequestUpdateInit& Data();
       
   112 	inline const ST_LbsAGpsRequestUpdateInit& Data() const;
       
   113 	};
       
   114 
       
   115 /** 
       
   116 Test A-Gps Module Request TimeOut Message
       
   117 */
       
   118 NONSHARABLE_CLASS(TT_LbsAGpsRequestTimeOut) : public TT_LbsMsgBase
       
   119 	{
       
   120 public:
       
   121 	IMPORT_C TT_LbsAGpsRequestTimeOut(const TTimeIntervalMicroSeconds& aTimeOut);
       
   122 	IMPORT_C const TTimeIntervalMicroSeconds& TimeOut() const;
       
   123 
       
   124 private:
       
   125 	TT_LbsAGpsRequestTimeOut();
       
   126 
       
   127 private:
       
   128 	struct ST_LbsAGpsRequestTimeOut
       
   129 		{
       
   130 		TTimeIntervalMicroSeconds 	iTimeOut;	/** Module time out. */
       
   131 		};	
       
   132 	inline ST_LbsAGpsRequestTimeOut& Data();
       
   133 	inline const ST_LbsAGpsRequestTimeOut& Data() const;
       
   134 	};
       
   135 
       
   136 /** 
       
   137 Test A-Gps Module Request Options Message
       
   138 */
       
   139 NONSHARABLE_CLASS(TT_LbsAGpsRequestOptions) : public TT_LbsMsgBase
       
   140 	{
       
   141 public:
       
   142 	IMPORT_C TT_LbsAGpsRequestOptions(TLbsHybridModuleOptions aModuleOption);
       
   143 	IMPORT_C TT_LbsAGpsRequestOptions(TLbsHybridModuleOptions aModuleOption, TBool aOptionValue);
       
   144 
       
   145 	IMPORT_C TLbsHybridModuleOptions ModuleOption() const;
       
   146 	IMPORT_C TBool ModuleValue() const;
       
   147 
       
   148 private:
       
   149 	TT_LbsAGpsRequestOptions();
       
   150 
       
   151 private:
       
   152 	struct ST_LbsAGpsRequestOptions
       
   153 		{
       
   154 		TLbsHybridModuleOptions 	iModuleOption; 	// Module option
       
   155 		TBool	 					iModuleValue; 	// Value for the module option
       
   156 		};	
       
   157 
       
   158 	inline ST_LbsAGpsRequestOptions& Data();
       
   159 	inline const ST_LbsAGpsRequestOptions& Data() const;
       
   160 	};
       
   161 
       
   162 /** 
       
   163 Test A-Gps Module Request Error Message
       
   164 */
       
   165 NONSHARABLE_CLASS(TT_LbsAGpsRequestError) : public TT_LbsMsgBase
       
   166 	{
       
   167 public:
       
   168 	IMPORT_C TT_LbsAGpsRequestError(TInt aOptions);
       
   169 	IMPORT_C TInt Error() const;
       
   170 
       
   171 private:
       
   172 	TT_LbsAGpsRequestError();
       
   173 
       
   174 private:
       
   175 	struct ST_LbsAGpsRequestError
       
   176 		{
       
   177 		TInt iError;				/** Module Error Code */
       
   178 		};	
       
   179 
       
   180 	inline ST_LbsAGpsRequestError& Data();
       
   181 	inline const ST_LbsAGpsRequestError& Data() const;
       
   182 	};
       
   183 
       
   184 /** 
       
   185 Test A-Gps Module Request Forced Update Message
       
   186 
       
   187 This message forces the test A-Gps module to send
       
   188 the next position update from the update array
       
   189 now, even if there is no outstanding request from LBS.
       
   190 */
       
   191 NONSHARABLE_CLASS(TT_LbsAGpsRequestForcedUpdate) : public TT_LbsMsgBase
       
   192 	{
       
   193 public:
       
   194 	IMPORT_C TT_LbsAGpsRequestForcedUpdate();
       
   195 
       
   196 private:
       
   197 	struct ST_LbsAGpsRequestForcedUpdate
       
   198 		{
       
   199 		TInt iDummy;				/** Dummy value; unused */
       
   200 		};	
       
   201 
       
   202 	inline ST_LbsAGpsRequestForcedUpdate& Data();
       
   203 	inline const ST_LbsAGpsRequestForcedUpdate& Data() const;
       
   204 	};
       
   205 	
       
   206 /** 
       
   207 Test A-Gps Module Response Message
       
   208 */
       
   209 NONSHARABLE_CLASS(TT_LbsAGpsResponseMsg) : public TT_LbsMsgBase
       
   210 	{
       
   211 public:
       
   212 
       
   213     enum TModuleResponseType
       
   214 		{
       
   215 		EModuleResponseOk,
       
   216 		EModuleErr
       
   217 		};
       
   218 		
       
   219 	IMPORT_C TT_LbsAGpsResponseMsg(const TModuleResponseType& 	aResponse);
       
   220 
       
   221 	IMPORT_C TModuleResponseType ResponseType() const;
       
   222 
       
   223 private:
       
   224 	TT_LbsAGpsResponseMsg();
       
   225 
       
   226 private:
       
   227 
       
   228 	struct ST_LbsAGpsResponse
       
   229 		{
       
   230 		TModuleResponseType iResponseType;
       
   231 		};
       
   232 	
       
   233 	inline ST_LbsAGpsResponse& Data();
       
   234 	inline const ST_LbsAGpsResponse& Data() const;
       
   235 	};	
       
   236 	
       
   237 #endif // TLBSCHANNELUTILS_H