2
|
1 |
/*
|
|
2 |
* Copyright (c) 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: This file contains the header file of the
|
|
15 |
* CStifTFwIfProt.
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
#ifndef STIF_TFW_IF_PROT_H
|
|
20 |
#define STIF_TFW_IF_PROT_H
|
|
21 |
|
|
22 |
// INCLUDES
|
|
23 |
#include <e32std.h>
|
|
24 |
#include <e32base.h>
|
|
25 |
#include <StifTestEventInterface.h>
|
|
26 |
#include <StifParser.h>
|
|
27 |
|
|
28 |
// CONSTANTS
|
|
29 |
// Protocol identifier length
|
|
30 |
const TInt KProtocolIdLength=8;
|
|
31 |
// Default allocation size for message created with CreateL
|
|
32 |
const TInt KDefaultMsgSize=0x200;
|
|
33 |
// Maximum length for value added to type-value parameter
|
|
34 |
const TInt KMaxValueLength=12;
|
|
35 |
|
|
36 |
// MACROS
|
|
37 |
// Macros for identifier manipulation
|
|
38 |
#define DEVID(x) ((TUint16)( ( 0xffff0000 & ((TUint32)(x)) ) >> 16 ))
|
|
39 |
#define TESTID(x) ((TUint16)( 0x0000ffff & ((TUint32)(x)) ))
|
|
40 |
#define SETID(d,t) ((TUint32)(( ( 0x0000ffff & ((TUint32)(d)) ) << 16 )|( 0x0000ffff & ((TUint32)(t)) )))
|
|
41 |
#define GETDEVID(x) ((TUint32)( 0xffff0000 & ((TUint32)(x)) ))
|
|
42 |
|
|
43 |
// DATA TYPES
|
|
44 |
typedef TPtrC (*KeywordFunc)( TInt aKeyword );
|
|
45 |
// typedef TBuf<KDefaultMessageSize> TRemoteProtMsg;
|
|
46 |
|
|
47 |
// FUNCTION PROTOTYPES
|
|
48 |
// None
|
|
49 |
|
|
50 |
// FORWARD DECLARATIONS
|
|
51 |
// None
|
|
52 |
|
|
53 |
// CLASS DECLARATION
|
|
54 |
|
|
55 |
// DESCRIPTION
|
|
56 |
|
|
57 |
// CStifTFwIfProt is the control protocol interface
|
|
58 |
class CStifTFwIfProt
|
|
59 |
:public CBase
|
|
60 |
{
|
|
61 |
public: // Enumerations
|
|
62 |
|
|
63 |
// Message type
|
|
64 |
enum TMsgType
|
|
65 |
{
|
|
66 |
EMsgReserve,
|
|
67 |
EMsgRelease,
|
|
68 |
EMsgRemote,
|
|
69 |
EMsgResponse,
|
|
70 |
};
|
|
71 |
|
|
72 |
// Command types
|
|
73 |
enum TCmdType
|
|
74 |
{
|
|
75 |
ECmdRun,
|
|
76 |
ECmdPause,
|
|
77 |
ECmdResume,
|
|
78 |
ECmdCancel,
|
|
79 |
ECmdRequest,
|
|
80 |
ECmdRelease,
|
|
81 |
ECmdSendReceive,
|
|
82 |
ECmdSetEvent,
|
|
83 |
ECmdUnsetEvent,
|
|
84 |
|
|
85 |
ECmdUnknown,
|
|
86 |
};
|
|
87 |
|
|
88 |
// Remote device type
|
|
89 |
enum TRemoteType
|
|
90 |
{
|
|
91 |
ERemotePhone,
|
|
92 |
//ERemoteCallBox, ...
|
|
93 |
|
|
94 |
ERemoteUnknown,
|
|
95 |
};
|
|
96 |
|
|
97 |
// Run parameters
|
|
98 |
enum TRunParams
|
|
99 |
{
|
|
100 |
ERunModule,
|
|
101 |
ERunInifile,
|
|
102 |
ERunTestcasefile,
|
|
103 |
ERunTestcasenum,
|
|
104 |
ERunTitle,
|
|
105 |
};
|
|
106 |
|
|
107 |
// Response parameters
|
|
108 |
enum TRespParam
|
|
109 |
{
|
|
110 |
ERespResult,
|
|
111 |
};
|
|
112 |
|
|
113 |
// Run status
|
|
114 |
enum TRunStatus
|
|
115 |
{
|
|
116 |
ERunStarted,
|
|
117 |
ERunError,
|
|
118 |
ERunReady,
|
|
119 |
};
|
|
120 |
|
|
121 |
// Run status parameters
|
|
122 |
enum TRunStatusParams
|
|
123 |
{
|
|
124 |
ERunResult,
|
|
125 |
ERunCategory,
|
|
126 |
};
|
|
127 |
|
|
128 |
// Execution result category
|
|
129 |
enum TResultCategory
|
|
130 |
{
|
|
131 |
EResultNormal = 0,
|
|
132 |
EResultPanic,
|
|
133 |
EResultException,
|
|
134 |
EResultTimeout,
|
|
135 |
EResultLeave,
|
|
136 |
};
|
|
137 |
|
|
138 |
// Event status
|
|
139 |
enum TEventStatus
|
|
140 |
{
|
|
141 |
EEventActive,
|
|
142 |
EEventSet,
|
|
143 |
EEventError,
|
|
144 |
EEventUnset,
|
|
145 |
};
|
|
146 |
|
|
147 |
// Event status
|
|
148 |
enum TEventStatusParams
|
|
149 |
{
|
|
150 |
EEventResult,
|
|
151 |
EEventType,
|
|
152 |
};
|
|
153 |
|
|
154 |
private: // Enumerations
|
|
155 |
|
|
156 |
public: // Constructors and destructor
|
|
157 |
|
|
158 |
/**
|
|
159 |
* Two-phased constructor.
|
|
160 |
*/
|
|
161 |
IMPORT_C static CStifTFwIfProt* NewL();
|
|
162 |
|
|
163 |
/**
|
|
164 |
* Destructor.
|
|
165 |
*/
|
|
166 |
IMPORT_C virtual ~CStifTFwIfProt();
|
|
167 |
|
|
168 |
public: // New functions
|
|
169 |
|
|
170 |
/*
|
|
171 |
* Get message handle
|
|
172 |
*/
|
|
173 |
virtual const TDesC& Message(){ return iMessage; };
|
|
174 |
|
|
175 |
/**
|
|
176 |
* Set message.
|
|
177 |
*/
|
|
178 |
IMPORT_C TInt SetL( const TDesC& aMessage );
|
|
179 |
|
|
180 |
/**
|
|
181 |
* Create message.
|
|
182 |
*/
|
|
183 |
IMPORT_C void CreateL( TInt aLength = KDefaultMsgSize );
|
|
184 |
|
|
185 |
/**
|
|
186 |
* Append string to message.
|
|
187 |
*/
|
|
188 |
IMPORT_C TInt Append( const TDesC& aStr );
|
|
189 |
|
|
190 |
/**
|
|
191 |
* Append hexadecimal protocol identifier to message.
|
|
192 |
*/
|
|
193 |
IMPORT_C TInt AppendId( TUint32 aId );
|
|
194 |
|
|
195 |
/**
|
|
196 |
* Append keyword string to message.
|
|
197 |
*/
|
|
198 |
IMPORT_C TInt Append( KeywordFunc aFunc, TInt aKeyword );
|
|
199 |
|
|
200 |
/**
|
|
201 |
* Append keyword type-value string to message.
|
|
202 |
*/
|
|
203 |
IMPORT_C TInt Append( KeywordFunc aFunc, TInt aKeyword, TInt aValue );
|
|
204 |
|
|
205 |
/**
|
|
206 |
* Append keyword type-value string to message.
|
|
207 |
*/
|
|
208 |
IMPORT_C TInt Append( KeywordFunc aFunc,
|
|
209 |
TInt aKeyword,
|
|
210 |
const TDesC& aStr );
|
|
211 |
|
|
212 |
/**
|
|
213 |
* Append keyword type-value string to message.
|
|
214 |
*/
|
|
215 |
IMPORT_C TInt Append( KeywordFunc aFunc,
|
|
216 |
TInt aKeyword,
|
|
217 |
KeywordFunc aValueFunc,
|
|
218 |
TInt aValue );
|
|
219 |
|
|
220 |
/**
|
|
221 |
* Get protocol source identifier.
|
|
222 |
*/
|
|
223 |
IMPORT_C TUint32 SrcId();
|
|
224 |
|
|
225 |
/**
|
|
226 |
* Get protocol source device identifier.
|
|
227 |
*/
|
|
228 |
IMPORT_C TUint16 SrcDevId();
|
|
229 |
|
|
230 |
/**
|
|
231 |
* Get protocol source test identifier.
|
|
232 |
*/
|
|
233 |
IMPORT_C TUint16 SrcTestId();
|
|
234 |
|
|
235 |
/**
|
|
236 |
* Get protocol destination identifier.
|
|
237 |
*/
|
|
238 |
IMPORT_C TUint32 DstId();
|
|
239 |
|
|
240 |
/**
|
|
241 |
* Get protocol destination device identifier.
|
|
242 |
*/
|
|
243 |
IMPORT_C TUint16 DstDevId();
|
|
244 |
|
|
245 |
/**
|
|
246 |
* Get protocol destination test identifier.
|
|
247 |
*/
|
|
248 |
IMPORT_C TUint16 DstTestId();
|
|
249 |
|
|
250 |
/**
|
|
251 |
* Set protocol source identifier.
|
|
252 |
*/
|
|
253 |
IMPORT_C TInt SetSrcId( TUint32 aSrcId );
|
|
254 |
|
|
255 |
/**
|
|
256 |
* Set protocol destination identifier.
|
|
257 |
*/
|
|
258 |
IMPORT_C TInt SetDstId( TUint32 aDstId );
|
|
259 |
|
|
260 |
/**
|
|
261 |
* Set message type.
|
|
262 |
*/
|
|
263 |
IMPORT_C TInt SetMsgType( TMsgType aMsgType );
|
|
264 |
|
|
265 |
/**
|
|
266 |
* Set response type.
|
|
267 |
*/
|
|
268 |
IMPORT_C TInt SetRespType( TMsgType aRespType );
|
|
269 |
|
|
270 |
/**
|
|
271 |
* Set message type.
|
|
272 |
*/
|
|
273 |
IMPORT_C TInt SetCmdType( TCmdType aCmdType );
|
|
274 |
|
|
275 |
/*
|
|
276 |
* String containers.
|
|
277 |
*/
|
|
278 |
IMPORT_C static TPtrC MsgType( TInt aKeyword );
|
|
279 |
|
|
280 |
IMPORT_C static TPtrC CmdType( TInt aKeyword );
|
|
281 |
|
|
282 |
IMPORT_C static TPtrC RemoteType( TInt aKeyword );
|
|
283 |
|
|
284 |
IMPORT_C static TPtrC RunParams( TInt aKeyword );
|
|
285 |
|
|
286 |
IMPORT_C static TPtrC RunStatus( TInt aKeyword );
|
|
287 |
|
|
288 |
IMPORT_C static TPtrC RunStatusParams( TInt aKeyword );
|
|
289 |
|
|
290 |
IMPORT_C static TPtrC ResultCategory( TInt aKeyword );
|
|
291 |
|
|
292 |
IMPORT_C static TPtrC EventStatus( TInt aKeyword );
|
|
293 |
|
|
294 |
IMPORT_C static TPtrC EventStatusParams( TInt aKeyword );
|
|
295 |
|
|
296 |
IMPORT_C static TPtrC EventType( TInt aKeyword );
|
|
297 |
|
|
298 |
IMPORT_C static TPtrC RespParam( TInt aKeyword );
|
|
299 |
|
|
300 |
public: // Functions from base classes
|
|
301 |
|
|
302 |
/**
|
|
303 |
* From <base_class member_description.
|
|
304 |
*/
|
|
305 |
//<type member_function( type arg1 );>
|
|
306 |
|
|
307 |
protected: // New functions
|
|
308 |
|
|
309 |
/**
|
|
310 |
* <member_description.>
|
|
311 |
*/
|
|
312 |
//<type member_function( type arg1 );>
|
|
313 |
|
|
314 |
protected: // Functions from base classes
|
|
315 |
|
|
316 |
/**
|
|
317 |
* From <base_class member_description>
|
|
318 |
*/
|
|
319 |
//<type member_function();>
|
|
320 |
|
|
321 |
private:
|
|
322 |
/**
|
|
323 |
* C++ default constructor.
|
|
324 |
*/
|
|
325 |
CStifTFwIfProt();
|
|
326 |
|
|
327 |
/**
|
|
328 |
* By default Symbian OS constructor is private.
|
|
329 |
*/
|
|
330 |
void ConstructL();
|
|
331 |
|
|
332 |
/**
|
|
333 |
* Parsing functions.
|
|
334 |
*/
|
|
335 |
TInt ParseMessageL();
|
|
336 |
|
|
337 |
void ParseHeaderL();
|
|
338 |
|
|
339 |
void ParseReserveL();
|
|
340 |
|
|
341 |
void ParseRemoteL();
|
|
342 |
|
|
343 |
void ParseResponseL();
|
|
344 |
|
|
345 |
void ParseCmdResponseL();
|
|
346 |
|
|
347 |
static TInt Parse( TDesC& aKeyword, KeywordFunc aFunc );
|
|
348 |
|
|
349 |
static TInt ParseOptArg( const TDesC& aOptArg, TPtrC& aArg, TPtrC& aVal );
|
|
350 |
|
|
351 |
public: //Data
|
|
352 |
// Message type
|
|
353 |
TMsgType iMsgType;
|
|
354 |
// Remote type
|
|
355 |
TRemoteType iRemoteType;
|
|
356 |
// Response request type
|
|
357 |
TMsgType iRespType;
|
|
358 |
// Remote command type (valid only if TMsgType is EMsgRemote)
|
|
359 |
TCmdType iCmdType;
|
|
360 |
TPtrC iCmdDes;
|
|
361 |
|
|
362 |
// Run parameters (valid only if run command)
|
|
363 |
// Test module name
|
|
364 |
TPtrC iModule;
|
|
365 |
// Test module initialization file
|
|
366 |
TPtrC iIniFile;
|
|
367 |
// Test module initialization file
|
|
368 |
TPtrC iTestCaseFile;
|
|
369 |
// Test case number
|
|
370 |
TInt iTestCaseNumber;
|
|
371 |
// Test case title
|
|
372 |
TPtrC iTitle;
|
|
373 |
|
|
374 |
// Event parameters
|
|
375 |
// Event name
|
|
376 |
TPtrC iEventName;
|
|
377 |
|
|
378 |
// Result from request or command
|
|
379 |
TInt iResult;
|
|
380 |
|
|
381 |
// Response status
|
|
382 |
union
|
|
383 |
{
|
|
384 |
TRunStatus iRunStatus;
|
|
385 |
TEventStatus iEventStatus;
|
|
386 |
};
|
|
387 |
// Result category
|
|
388 |
TResultCategory iResultCategory;
|
|
389 |
// Event response parameters
|
|
390 |
// Event type
|
|
391 |
TEventIf::TEventType iEventType;
|
|
392 |
|
|
393 |
protected: // Data
|
|
394 |
//<data_declaration;>
|
|
395 |
|
|
396 |
private: // Data
|
|
397 |
// Message buffer
|
|
398 |
HBufC* iMessageBuf;
|
|
399 |
// Message ptr
|
|
400 |
TPtr iMessage;
|
|
401 |
|
|
402 |
// Message parser
|
|
403 |
CStifItemParser* iItem;
|
|
404 |
|
|
405 |
// SrcId
|
|
406 |
TInt32 iSrcId;
|
|
407 |
// DstId
|
|
408 |
TInt32 iDstId;
|
|
409 |
|
|
410 |
public: // Friend classes
|
|
411 |
//<friend_class_declaration;>
|
|
412 |
|
|
413 |
protected: // Friend classes
|
|
414 |
//<friend_class_declaration;>
|
|
415 |
|
|
416 |
private: // Friend classes
|
|
417 |
//<friend_class_declaration;>
|
|
418 |
|
|
419 |
};
|
|
420 |
|
|
421 |
#endif // STIF_TFW_IF_PROT_H
|
|
422 |
|
|
423 |
// End of File
|