17 // |
17 // |
18 |
18 |
19 #include "modelleddevices.h" |
19 #include "modelleddevices.h" |
20 #include "testinterfacesettingbase.h" |
20 #include "testinterfacesettingbase.h" |
21 #include "testinterfacebase.h" |
21 #include "testinterfacebase.h" |
|
22 #include "OstTraceDefinitions.h" |
|
23 #ifdef OST_TRACE_COMPILER_IN_USE |
|
24 #include "testdevicebTraces.h" |
|
25 #endif |
22 #include <e32test.h> |
26 #include <e32test.h> |
23 |
27 |
24 namespace NUnitTesting_USBDI |
28 namespace NUnitTesting_USBDI |
25 { |
29 { |
26 |
30 |
27 RUsbDeviceB::RUsbDeviceB() |
31 RUsbDeviceB::RUsbDeviceB() |
28 { |
32 { |
|
33 OstTraceFunctionEntry1( RUSBDEVICEB_RUSBDEVICEB_ENTRY, this ); |
|
34 OstTraceFunctionExit1( RUSBDEVICEB_RUSBDEVICEB_EXIT, this ); |
29 } |
35 } |
30 |
36 |
31 RUsbDeviceB::RUsbDeviceB(CBaseTestCase* aTestCase):RUsbTestDevice(aTestCase) |
37 RUsbDeviceB::RUsbDeviceB(CBaseTestCase* aTestCase):RUsbTestDevice(aTestCase) |
32 { |
38 { |
33 LOG_FUNC |
39 OstTraceFunctionEntryExt( RUSBDEVICEB_RUSBDEVICEB_ENTRY_DUP01, this ); |
|
40 OstTraceFunctionExit1( RUSBDEVICEB_RUSBDEVICEB_EXIT_DUP01, this ); |
34 } |
41 } |
35 |
42 |
36 RUsbDeviceB::~RUsbDeviceB() |
43 RUsbDeviceB::~RUsbDeviceB() |
37 { |
44 { |
|
45 OstTraceFunctionEntry1( RUSBDEVICEB_RUSBDEVICEB_ENTRY_DUP02, this ); |
|
46 OstTraceFunctionExit1( RUSBDEVICEB_RUSBDEVICEB_EXIT_DUP02, this ); |
38 } |
47 } |
39 |
48 |
40 |
49 |
41 void RUsbDeviceB::OpenL(const TDesC& aSerialNumber) |
50 void RUsbDeviceB::OpenL(const TDesC& aSerialNumber) |
42 { |
51 { |
43 LOG_FUNC |
52 OstTraceFunctionEntryExt( RUSBDEVICEB_OPENL_ENTRY, this ); |
44 |
53 |
45 RUsbTestDevice::OpenL(); |
54 RUsbTestDevice::OpenL(); |
46 |
55 |
47 // Device/Product information |
56 // Device/Product information |
48 SetUsbSpecification(0x0200); // Usb spec. 2.0 |
57 SetUsbSpecification(0x0200); // Usb spec. 2.0 |
76 // Interface 0 |
85 // Interface 0 |
77 |
86 |
78 TInt err(iClientDriver.SetInterface(0,interfaceSetting)); |
87 TInt err(iClientDriver.SetInterface(0,interfaceSetting)); |
79 if(err != KErrNone) |
88 if(err != KErrNone) |
80 { |
89 { |
81 RDebug::Printf("<Error %d> Unable to set interface setting 0",err); |
90 OstTrace1(TRACE_NORMAL, RUSBDEVICEB_OPENL, "<Error %d> Unable to set interface setting 0",err); |
82 User::Leave(err); |
91 User::Leave(err); |
83 } |
92 } |
84 |
93 |
85 // class-specific..... |
94 // class-specific..... |
86 |
95 |
87 // .....interface |
96 // .....interface |
88 |
97 |
89 err = iClientDriver.SetCSInterfaceDescriptorBlock(0,cs_interfaceDescriptor); |
98 err = iClientDriver.SetCSInterfaceDescriptorBlock(0,cs_interfaceDescriptor); |
90 if(err != KErrNone) |
99 if(err != KErrNone) |
91 { |
100 { |
92 RDebug::Printf("<Error %d> Unable to set class-specific interface setting 0 descriptor",err); |
101 OstTrace1(TRACE_NORMAL, RUSBDEVICEB_OPENL_DUP01, "<Error %d> Unable to set class-specific interface setting 0 descriptor",err); |
93 User::Leave(err); |
102 User::Leave(err); |
94 } |
103 } |
95 |
104 |
96 // .....endpoints |
105 // .....endpoints |
97 |
106 |
98 err = iClientDriver.SetCSEndpointDescriptorBlock(0,1,cs_endpointDescriptor); |
107 err = iClientDriver.SetCSEndpointDescriptorBlock(0,1,cs_endpointDescriptor); |
99 if(err != KErrNone) |
108 if(err != KErrNone) |
100 { |
109 { |
101 RDebug::Printf("<Error %d> Unable to set class-specific endpoint 1 descriptor on setting 0",err); |
110 OstTrace1(TRACE_NORMAL, RUSBDEVICEB_OPENL_DUP02, "<Error %d> Unable to set class-specific endpoint 1 descriptor on setting 0",err); |
102 User::Leave(err); |
111 User::Leave(err); |
103 } |
112 } |
104 |
113 |
105 err = iClientDriver.SetCSEndpointDescriptorBlock(0,2,cs_endpointDescriptor); |
114 err = iClientDriver.SetCSEndpointDescriptorBlock(0,2,cs_endpointDescriptor); |
106 if(err != KErrNone) |
115 if(err != KErrNone) |
107 { |
116 { |
108 RDebug::Printf("<Error %d> Unable to set class-specific endpoint 2 descriptor on setting 0",err); |
117 OstTrace1(TRACE_NORMAL, RUSBDEVICEB_OPENL_DUP03, "<Error %d> Unable to set class-specific endpoint 2 descriptor on setting 0",err); |
109 User::Leave(err); |
118 User::Leave(err); |
110 } |
119 } |
111 |
120 |
112 err = iClientDriver.SetCSEndpointDescriptorBlock(0,3,cs_endpointDescriptor); |
121 err = iClientDriver.SetCSEndpointDescriptorBlock(0,3,cs_endpointDescriptor); |
113 if(err != KErrNone) |
122 if(err != KErrNone) |
114 { |
123 { |
115 RDebug::Printf("<Error %d> Unable to set class-specific endpoint 3 descriptor on setting 0",err); |
124 OstTrace1(TRACE_NORMAL, RUSBDEVICEB_OPENL_DUP04, "<Error %d> Unable to set class-specific endpoint 3 descriptor on setting 0",err); |
116 User::Leave(err); |
125 User::Leave(err); |
117 } |
126 } |
118 |
127 |
119 // Interface 1 |
128 // Interface 1 |
120 |
129 |
121 err = iClientDriver.SetInterface(1,interfaceSetting); |
130 err = iClientDriver.SetInterface(1,interfaceSetting); |
122 if(err != KErrNone) |
131 if(err != KErrNone) |
123 { |
132 { |
124 RDebug::Printf("<Error %d> Unable to set interface setting 1",err); |
133 OstTrace1(TRACE_NORMAL, RUSBDEVICEB_OPENL_DUP05, "<Error %d> Unable to set interface setting 1",err); |
125 User::Leave(err); |
134 User::Leave(err); |
126 } |
135 } |
127 |
136 |
128 // class-specific...... |
137 // class-specific...... |
129 |
138 |
130 // ......interface |
139 // ......interface |
131 |
140 |
132 err = iClientDriver.SetCSInterfaceDescriptorBlock(1,cs_interfaceDescriptor); |
141 err = iClientDriver.SetCSInterfaceDescriptorBlock(1,cs_interfaceDescriptor); |
133 if(err != KErrNone) |
142 if(err != KErrNone) |
134 { |
143 { |
135 RDebug::Printf("<Error %d> Unable to set class-specific interface setting 1 descriptor",err); |
144 OstTrace1(TRACE_NORMAL, RUSBDEVICEB_OPENL_DUP06, "<Error %d> Unable to set class-specific interface setting 1 descriptor",err); |
136 User::Leave(err); |
145 User::Leave(err); |
137 } |
146 } |
138 |
147 |
139 // .....endpoints |
148 // .....endpoints |
140 |
149 |
141 err = iClientDriver.SetCSEndpointDescriptorBlock(1,1,cs_endpointDescriptor); |
150 err = iClientDriver.SetCSEndpointDescriptorBlock(1,1,cs_endpointDescriptor); |
142 if(err != KErrNone) |
151 if(err != KErrNone) |
143 { |
152 { |
144 RDebug::Printf("<Error %d> Unable to set class-specific endpoint 1 descriptor on setting 1",err); |
153 OstTrace1(TRACE_NORMAL, RUSBDEVICEB_OPENL_DUP07, "<Error %d> Unable to set class-specific endpoint 1 descriptor on setting 1",err); |
145 User::Leave(err); |
154 User::Leave(err); |
146 } |
155 } |
147 |
156 |
148 err = iClientDriver.SetCSEndpointDescriptorBlock(1,2,cs_endpointDescriptor); |
157 err = iClientDriver.SetCSEndpointDescriptorBlock(1,2,cs_endpointDescriptor); |
149 if(err != KErrNone) |
158 if(err != KErrNone) |
150 { |
159 { |
151 RDebug::Printf("<Error %d> Unable to set class-specific endpoint 2 descriptor on setting 1",err); |
160 OstTrace1(TRACE_NORMAL, RUSBDEVICEB_OPENL_DUP08, "<Error %d> Unable to set class-specific endpoint 2 descriptor on setting 1",err); |
152 User::Leave(err); |
161 User::Leave(err); |
153 } |
162 } |
154 |
163 |
155 err = iClientDriver.SetCSEndpointDescriptorBlock(1,3,cs_endpointDescriptor); |
164 err = iClientDriver.SetCSEndpointDescriptorBlock(1,3,cs_endpointDescriptor); |
156 if(err != KErrNone) |
165 if(err != KErrNone) |
157 { |
166 { |
158 RDebug::Printf("<Error %d> Unable to set class-specific endpoint 3 descriptor on setting 1",err); |
167 OstTrace1(TRACE_NORMAL, RUSBDEVICEB_OPENL_DUP09, "<Error %d> Unable to set class-specific endpoint 3 descriptor on setting 1",err); |
159 User::Leave(err); |
168 User::Leave(err); |
160 } |
169 } |
161 |
170 |
162 // Interface 2 |
171 // Interface 2 |
163 |
172 |
164 err = iClientDriver.SetInterface(2,interfaceSetting); |
173 err = iClientDriver.SetInterface(2,interfaceSetting); |
165 if(err != KErrNone) |
174 if(err != KErrNone) |
166 { |
175 { |
167 RDebug::Printf("<Error %d> Unable to set interface setting 2",err); |
176 OstTrace1(TRACE_NORMAL, RUSBDEVICEB_OPENL_DUP10, "<Error %d> Unable to set interface setting 2",err); |
168 User::Leave(err); |
177 User::Leave(err); |
169 } |
178 } |
170 |
179 |
171 // class-specific...... |
180 // class-specific...... |
172 |
181 |
173 // ......interface |
182 // ......interface |
174 |
183 |
175 err = iClientDriver.SetCSInterfaceDescriptorBlock(2,cs_interfaceDescriptor); |
184 err = iClientDriver.SetCSInterfaceDescriptorBlock(2,cs_interfaceDescriptor); |
176 if(err != KErrNone) |
185 if(err != KErrNone) |
177 { |
186 { |
178 RDebug::Printf("<Error %d> Unable to set class-specific interface setting 2 descriptor",err); |
187 OstTrace1(TRACE_NORMAL, RUSBDEVICEB_OPENL_DUP11, "<Error %d> Unable to set class-specific interface setting 2 descriptor",err); |
179 User::Leave(err); |
188 User::Leave(err); |
180 } |
189 } |
181 |
190 |
182 // ......endpoints |
191 // ......endpoints |
183 |
192 |
184 err = iClientDriver.SetCSEndpointDescriptorBlock(2,1,cs_endpointDescriptor); |
193 err = iClientDriver.SetCSEndpointDescriptorBlock(2,1,cs_endpointDescriptor); |
185 if(err != KErrNone) |
194 if(err != KErrNone) |
186 { |
195 { |
187 RDebug::Printf("<Error %d> Unable to set class-specific endpoint 1 descriptor on setting 2",err); |
196 OstTrace1(TRACE_NORMAL, RUSBDEVICEB_OPENL_DUP12, "<Error %d> Unable to set class-specific endpoint 1 descriptor on setting 2",err); |
188 User::Leave(err); |
197 User::Leave(err); |
189 } |
198 } |
190 |
199 |
191 err = iClientDriver.SetCSEndpointDescriptorBlock(2,2,cs_endpointDescriptor); |
200 err = iClientDriver.SetCSEndpointDescriptorBlock(2,2,cs_endpointDescriptor); |
192 if(err != KErrNone) |
201 if(err != KErrNone) |
193 { |
202 { |
194 RDebug::Printf("<Error %d> Unable to set class-specific endpoint 2 descriptor on setting 2",err); |
203 OstTrace1(TRACE_NORMAL, RUSBDEVICEB_OPENL_DUP13, "<Error %d> Unable to set class-specific endpoint 2 descriptor on setting 2",err); |
195 User::Leave(err); |
204 User::Leave(err); |
196 } |
205 } |
197 |
206 |
198 err = iClientDriver.SetCSEndpointDescriptorBlock(2,3,cs_endpointDescriptor); |
207 err = iClientDriver.SetCSEndpointDescriptorBlock(2,3,cs_endpointDescriptor); |
199 if(err != KErrNone) |
208 if(err != KErrNone) |
200 { |
209 { |
201 RDebug::Printf("<Error %d> Unable to set class-specific endpoint 3 descriptor on setting 2",err); |
210 OstTrace1(TRACE_NORMAL, RUSBDEVICEB_OPENL_DUP14, "<Error %d> Unable to set class-specific endpoint 3 descriptor on setting 2",err); |
202 User::Leave(err); |
211 User::Leave(err); |
203 } |
212 } |
|
213 OstTraceFunctionExit1( RUSBDEVICEB_OPENL_EXIT, this ); |
204 } |
214 } |
205 |
215 |
206 |
216 |
207 void RUsbDeviceB::OnStateChangeL(TUsbcDeviceState aNewState) |
217 void RUsbDeviceB::OnStateChangeL(TUsbcDeviceState aNewState) |
208 { |
218 { |
209 LOG_FUNC |
219 OstTraceFunctionEntryExt( RUSBDEVICEB_ONSTATECHANGEL_ENTRY, this ); |
210 } |
220 OstTraceFunctionExit1( RUSBDEVICEB_ONSTATECHANGEL_EXIT, this ); |
211 |
221 } |
212 |
222 |
213 } |
223 |
214 |
224 } |
215 |
225 |
|
226 |