|
1 #ifndef __TEST_ENDPOINT_BASE_H |
|
2 #define __TEST_ENDPOINT_BASE_H |
|
3 |
|
4 /* |
|
5 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
6 * All rights reserved. |
|
7 * This component and the accompanying materials are made available |
|
8 * under the terms of the License "Eclipse Public License v1.0" |
|
9 * which accompanies this distribution, and is available |
|
10 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
11 * |
|
12 * Initial Contributors: |
|
13 * Nokia Corporation - initial contribution. |
|
14 * |
|
15 * Contributors: |
|
16 * |
|
17 * Description: |
|
18 * @file testendpointbase.h |
|
19 * @internalComponent |
|
20 * |
|
21 * |
|
22 */ |
|
23 |
|
24 |
|
25 |
|
26 #include <e32base.h> |
|
27 #include <d32usbc.h> |
|
28 |
|
29 namespace NUnitTesting_USBDI |
|
30 { |
|
31 |
|
32 /** |
|
33 This class describes a resource endpoint for use in transfers. |
|
34 An endpoint is configured with respect to the host so an 'in' endpoint |
|
35 is one where data is transfered to the host and an 'out' endpoint is where |
|
36 data is received from the host |
|
37 */ |
|
38 class TEndpoint |
|
39 { |
|
40 friend class CInterfaceBase; |
|
41 friend class CInterfaceSettingBase; |
|
42 friend class CControlXfer; |
|
43 |
|
44 public: |
|
45 // Compiler copy constructor and assignment ok |
|
46 |
|
47 protected: |
|
48 /** |
|
49 Constructor |
|
50 @param aEndpointNumber the number of the endpoint on the setting for the interface |
|
51 specify only EEndpoint1, EEndpoint2, EEndpoint3, EEndpoint4 or EEndpoint5 |
|
52 */ |
|
53 explicit TEndpoint(TEndpointNumber aEndpointNumber) : iEndpointNumber(aEndpointNumber) |
|
54 { |
|
55 } |
|
56 |
|
57 /** |
|
58 Non-virtual Destructor |
|
59 */ |
|
60 ~TEndpoint() |
|
61 { |
|
62 } |
|
63 |
|
64 protected: |
|
65 /** |
|
66 The information for the endpoint |
|
67 */ |
|
68 TUsbcEndpointInfo iEndpointInfo; |
|
69 |
|
70 /** |
|
71 The number for the endpoint w.r.t the interface it is associated with |
|
72 */ |
|
73 TEndpointNumber iEndpointNumber; |
|
74 }; |
|
75 |
|
76 |
|
77 /** |
|
78 This class represents an endpoint that a device can use to send |
|
79 data to the host via a transfer pipe |
|
80 */ |
|
81 class TInEndpoint : public TEndpoint |
|
82 { |
|
83 protected: |
|
84 /** |
|
85 Constructor, build an endpoint that will be used to transfer data |
|
86 to the host |
|
87 @param the number for the endpoint |
|
88 */ |
|
89 explicit TInEndpoint(TEndpointNumber aEndpointNumber) |
|
90 : TEndpoint(aEndpointNumber) |
|
91 { |
|
92 iEndpointInfo.iDir = KUsbEpDirIn; |
|
93 } |
|
94 }; |
|
95 |
|
96 |
|
97 /** |
|
98 This class represents an endpoint that a device can use to receive |
|
99 data from the host via a transfer pipe |
|
100 */ |
|
101 class TOutEndpoint : public TEndpoint |
|
102 { |
|
103 protected: |
|
104 /** |
|
105 Constructor, build an endpoint that will be used to receive data |
|
106 from the host in a transfer |
|
107 @param the number for the endpoint |
|
108 */ |
|
109 explicit TOutEndpoint(TEndpointNumber aEndpointNumber) |
|
110 : TEndpoint(aEndpointNumber) |
|
111 { |
|
112 iEndpointInfo.iDir = KUsbEpDirOut; |
|
113 } |
|
114 }; |
|
115 |
|
116 |
|
117 /** |
|
118 This class represents an allocated endpoint for bi-directional capacity |
|
119 via a transfer pipe |
|
120 */ |
|
121 class TBiEndpoint : public TEndpoint |
|
122 { |
|
123 protected: |
|
124 /** |
|
125 Constructor, build an endpoint that will be used to send/receive data with host |
|
126 @param the number for the endpoint |
|
127 */ |
|
128 explicit TBiEndpoint(TEndpointNumber aEndpointNumber) |
|
129 : TEndpoint(aEndpointNumber) |
|
130 { |
|
131 iEndpointInfo.iDir = KUsbEpDirBidirect; |
|
132 } |
|
133 }; |
|
134 |
|
135 /** |
|
136 This class describes an endpoint for Bulk in tansfers |
|
137 */ |
|
138 class TBulkInEndpoint : public TInEndpoint |
|
139 { |
|
140 public: |
|
141 /** |
|
142 Constructor, build a bulk in endpoint |
|
143 @param the number for the endpoint |
|
144 */ |
|
145 explicit TBulkInEndpoint(TEndpointNumber aEndpointNumber) |
|
146 : TInEndpoint(aEndpointNumber) |
|
147 { |
|
148 iEndpointInfo.iType = KUsbEpTypeBulk; |
|
149 } |
|
150 }; |
|
151 |
|
152 /** |
|
153 This class describes an endpoint for Bulk out transfers |
|
154 */ |
|
155 class TBulkOutEndpoint : public TOutEndpoint |
|
156 { |
|
157 public: |
|
158 /** |
|
159 Constructor, build a bulk out endpoint |
|
160 @param the number for the endpoint |
|
161 */ |
|
162 explicit TBulkOutEndpoint(TEndpointNumber aEndpointNumber) |
|
163 : TOutEndpoint(aEndpointNumber) |
|
164 { |
|
165 iEndpointInfo.iType = KUsbEpTypeBulk; |
|
166 } |
|
167 }; |
|
168 |
|
169 |
|
170 /** |
|
171 This class describes an endpoint for Control transfers |
|
172 */ |
|
173 class TCtrlEndpoint : public TBiEndpoint |
|
174 { |
|
175 public: |
|
176 /** |
|
177 Constructor, build a control endpoint |
|
178 @param the number for the endpoint |
|
179 */ |
|
180 explicit TCtrlEndpoint(TEndpointNumber aEndpointNumber) |
|
181 : TBiEndpoint(aEndpointNumber) |
|
182 { |
|
183 iEndpointInfo.iType = KUsbEpTypeControl; |
|
184 } |
|
185 }; |
|
186 |
|
187 |
|
188 /** |
|
189 This class describes an endpoint for Interrupt in transfers |
|
190 */ |
|
191 class TIntInEndpoint : public TInEndpoint |
|
192 { |
|
193 public: |
|
194 /** |
|
195 Constructor, build a interrupt in endpoint |
|
196 @param the number for the endpoint |
|
197 @param the interrupt transfer polling interval for the host |
|
198 */ |
|
199 explicit TIntInEndpoint(TEndpointNumber aEndpointNumber,TInt aPollingInterval) |
|
200 : TInEndpoint(aEndpointNumber) |
|
201 { |
|
202 iEndpointInfo.iType = KUsbEpTypeInterrupt; |
|
203 iEndpointInfo.iInterval = aPollingInterval; |
|
204 } |
|
205 }; |
|
206 |
|
207 /** |
|
208 This class describes an endpoint for Interrupt out transfers |
|
209 */ |
|
210 class TIntOutEndpoint : public TOutEndpoint |
|
211 { |
|
212 public: |
|
213 /** |
|
214 Constructor, build an interrupt out endpoint |
|
215 @param the number for the endpoint |
|
216 */ |
|
217 explicit TIntOutEndpoint(TEndpointNumber aEndpointNumber) |
|
218 : TOutEndpoint(aEndpointNumber) |
|
219 { |
|
220 iEndpointInfo.iType = KUsbEpTypeInterrupt; |
|
221 } |
|
222 }; |
|
223 |
|
224 /** |
|
225 This class describes an endpoint for Isochronous in transfers |
|
226 */ |
|
227 class TIsochInEndpoint : public TInEndpoint |
|
228 { |
|
229 public: |
|
230 /** |
|
231 Constructor, build an isochronous in endpoint |
|
232 @param the number for the endpoint |
|
233 */ |
|
234 explicit TIsochInEndpoint(TEndpointNumber aEndpointNumber) |
|
235 : TInEndpoint(aEndpointNumber) |
|
236 { |
|
237 iEndpointInfo.iType = KUsbEpTypeIsochronous; |
|
238 } |
|
239 }; |
|
240 |
|
241 /** |
|
242 This class describes an endpoint for Isochronous out transfers |
|
243 */ |
|
244 class TIsochOutEndpoint : public TOutEndpoint |
|
245 { |
|
246 public: |
|
247 /** |
|
248 Constructor, build an isochronous out endpoint |
|
249 @param the number for the endpoint |
|
250 */ |
|
251 explicit TIsochOutEndpoint(TEndpointNumber aEndpointNumber) |
|
252 : TOutEndpoint(aEndpointNumber) |
|
253 { |
|
254 iEndpointInfo.iType = KUsbEpTypeIsochronous; |
|
255 } |
|
256 }; |
|
257 |
|
258 |
|
259 } |
|
260 |
|
261 |
|
262 #endif |
|
263 |