|
1 /** |
|
2 * Copyright (c) 2002-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 |
|
20 /** |
|
21 @file WapStackSuiteStepBase.h |
|
22 */ |
|
23 |
|
24 #if (!defined __WAPSTACK_SUITE_STEP_BASE__) |
|
25 #define __WAPSTACK_SUITE_STEP_BASE__ |
|
26 #include <test/testexecutestepbase.h> |
|
27 #include <es_wsms.h> |
|
28 |
|
29 #define WAP_MAX_HOST_NAME 128 |
|
30 |
|
31 #if defined (__WINS__) |
|
32 #define PDD_NAME _L("ECDRV") |
|
33 #define PDD_NAME2 _L("ECDRV") |
|
34 #define LDD_NAME _L("ECOMM") |
|
35 #else |
|
36 #define PDD_NAME _L("EUART1") |
|
37 #define LDD_NAME _L("ECOMM") |
|
38 #endif |
|
39 |
|
40 typedef enum |
|
41 { |
|
42 EIdle, |
|
43 EConnect, |
|
44 ESend, |
|
45 EAwaitSize, |
|
46 EReceive, |
|
47 EMutipleReceive, |
|
48 EAwaitPush, |
|
49 EUnitInvoke, |
|
50 EUnitResult, |
|
51 EFinish, |
|
52 EAbortTest |
|
53 } TWapStep; |
|
54 const TUint KMaxWapWdpPduBufferLength=1024; |
|
55 const TUint KMaxWapWspHeaderBufferLength=256; |
|
56 const TUint KMaxWapWspDataBufferLength=1024; |
|
57 class MControlNotify |
|
58 { |
|
59 public: |
|
60 virtual TInt CallStateMachine() = 0; |
|
61 }; |
|
62 |
|
63 class CActiveControl : public CActive |
|
64 { |
|
65 public: |
|
66 static CActiveControl* NewL(MControlNotify* aControl); |
|
67 CActiveControl(MControlNotify* aControl); |
|
68 ~CActiveControl(); |
|
69 void ConstructL(); |
|
70 virtual void RunL(); |
|
71 virtual void DoCancel(); |
|
72 virtual void ReStart(); |
|
73 inline TRequestStatus* Status() {return &iStatus;} |
|
74 public: |
|
75 MControlNotify* iControl; |
|
76 }; |
|
77 |
|
78 class CWapStackSuiteStepBase : public CTestStep, public MControlNotify |
|
79 { |
|
80 public: |
|
81 CWapStackSuiteStepBase(); |
|
82 virtual ~CWapStackSuiteStepBase(); |
|
83 virtual TVerdict doTestStepPreambleL(); |
|
84 virtual TVerdict doTestStepPostambleL(); |
|
85 virtual TInt CallStateMachine(); |
|
86 void StartScheduler(); |
|
87 void StopScheduler(); |
|
88 void WaitForInitializeL(); |
|
89 inline void SetScheduler(CActiveScheduler* aScheduler) {iScheduler = aScheduler;} |
|
90 inline CActiveScheduler* Scheduler() {return iScheduler;} |
|
91 inline void SetState(TWapStep aState) { iState = aState; } |
|
92 inline TWapStep State() { return iState; } |
|
93 inline void SetLastError(TInt aError) { iLastError = aError; } |
|
94 inline TInt GetLastError() { return iLastError; } |
|
95 inline void SetExpectedError(TInt aError) {iExError = aError; } |
|
96 inline TInt GetExpectedError() { return iExError; } |
|
97 inline TBool UseSimTsy() { return iUseSIMTSY; } |
|
98 inline TBool DetailedLogging() { return iDetailedLogging; } |
|
99 void LoadConfig(); |
|
100 void DumpBuf(const TDesC8& aBuf); |
|
101 void ShowConnectionInfo(); |
|
102 protected: |
|
103 CActiveControl* iControl; |
|
104 TWapStep iState; |
|
105 TRequestStatus* iStatus; |
|
106 |
|
107 //Predefined value in .ini file |
|
108 TInt iExError; |
|
109 TInt iExError2; |
|
110 TInt iRepeat; |
|
111 TUint32 iTimeout; |
|
112 TBool iSecure; |
|
113 TBool iReconnect; |
|
114 TBool iUseSIMTSY; |
|
115 TBool iAwaitLengthCancel; |
|
116 TBool iMiddleCancel; |
|
117 TBool iMultiReadCancel; |
|
118 TBool iAwaitLengthTwice; |
|
119 TBool iDetailedLogging; |
|
120 TBool iDelayPortClosure; |
|
121 TInt iSimTsyState; |
|
122 TUint16 iWdpRecvBufLength; |
|
123 TUint16 iHeaderRecvBufLength; |
|
124 TUint16 iBodyRecvBufLength; |
|
125 Wap::TBearer iBearer; |
|
126 Wap::TPort iLocalPort; |
|
127 Wap::TPort iRemotePort; |
|
128 TBuf8<WAP_MAX_HOST_NAME> iRemoteHost; |
|
129 TBuf8<WAP_MAX_HOST_NAME> iLocalHost; |
|
130 TInetAddr iRemoteAddr; |
|
131 TInetAddr iLocalAddr; |
|
132 TInt iRmtPort; |
|
133 TInt iLclPort; |
|
134 //For WDP sending and receiving |
|
135 HBufC8* iSendBuffPtr; |
|
136 HBufC8* iRecvBuffPtr; |
|
137 TUint16 iLenBuffer; |
|
138 TPckg<TUint16> iLength; |
|
139 TPtr8 iRecvBuf; |
|
140 TBool iTruncated; |
|
141 Wap::TPort iRecvRemotePort; |
|
142 TBuf8<WAP_MAX_HOST_NAME> iRecvRemoteHost; |
|
143 TBuf8<KMaxWapWdpPduBufferLength> iMaxWdpRecvBuffer; |
|
144 |
|
145 |
|
146 //For both WSP Sending; |
|
147 TUint8 iTransactionId; |
|
148 TUint iMethod; |
|
149 HBufC16* iURI; |
|
150 HBufC8* iSendHeaders; |
|
151 HBufC8* iSendBody; |
|
152 |
|
153 //For WSP Receiving and Push |
|
154 TPckgBuf<TUint8> iTransactionIdPckg; |
|
155 TWSPStatus iWspStatus; |
|
156 HBufC8* iRecvHeaders; |
|
157 HBufC8* iRecvBody; |
|
158 TPtr8 iRecvHeadersBuf; |
|
159 TPtr8 iRecvBodyBuf; |
|
160 TBuf8<KMaxWapWspHeaderBufferLength> iMaxWspHeaderRecvBuffer; |
|
161 TBuf8<KMaxWapWspDataBufferLength> iMaxWspDataRecvBuffer; |
|
162 private: |
|
163 CActiveScheduler* iScheduler; |
|
164 TInt iLastError; |
|
165 }; |
|
166 |
|
167 #endif |