|
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 "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // @file testdeviceD.cpp |
|
15 // @internalComponent |
|
16 // |
|
17 // |
|
18 |
|
19 #include "modelleddevices.h" |
|
20 #include "testinterfacebase.h" |
|
21 #include "testinterfacesettingbase.h" |
|
22 |
|
23 |
|
24 namespace NUnitTesting_USBDI |
|
25 { |
|
26 |
|
27 RUsbDeviceD::RUsbDeviceD() |
|
28 { |
|
29 LOG_FUNC |
|
30 } |
|
31 |
|
32 RUsbDeviceD::RUsbDeviceD(CBaseTestCase* aTestCase):RUsbDeviceVendor(aTestCase) |
|
33 { |
|
34 LOG_FUNC |
|
35 } |
|
36 |
|
37 RUsbDeviceD::~RUsbDeviceD() |
|
38 { |
|
39 LOG_FUNC |
|
40 } |
|
41 |
|
42 |
|
43 void RUsbDeviceD::OpenL(const TDesC16& aSerialNumber) |
|
44 { |
|
45 LOG_FUNC |
|
46 |
|
47 RUsbDeviceVendor::OpenL(aSerialNumber); |
|
48 |
|
49 // Create another interface (interface1) |
|
50 |
|
51 CInterfaceBase* interface1 = new (ELeave) CInterfaceBase(*this,_L("i1")); |
|
52 CleanupStack::PushL(interface1); |
|
53 interface1->BaseConstructL(); |
|
54 |
|
55 // Create default interface setting 0 |
|
56 |
|
57 CInterfaceSettingBase* interface1s0 = new (ELeave) CInterfaceSettingBase(_L("i1s0")); |
|
58 CleanupStack::PushL(interface1s0); |
|
59 interface1s0->SetClassCodeL(0xFF,0xFF,0xFF); |
|
60 |
|
61 // Create some endpoints |
|
62 TBulkOutEndpoint if1_s0_ep1(EEndpoint1); |
|
63 TBulkInEndpoint if1_s0_ep2(EEndpoint2); |
|
64 |
|
65 interface1s0->AddEndpoint(if1_s0_ep1); |
|
66 interface1s0->AddEndpoint(if1_s0_ep2); |
|
67 |
|
68 interface1->AddInterfaceSettingL(interface1s0); |
|
69 CleanupStack::Pop(interface1s0); |
|
70 |
|
71 // Create alternate interface setting 1 |
|
72 |
|
73 CInterfaceSettingBase* interface1s1 = new (ELeave) CInterfaceSettingBase(_L("i1s1")); |
|
74 CleanupStack::PushL(interface1s1); |
|
75 interface1s1->SetClassCodeL(0xFF,0xFF,0xFF); |
|
76 |
|
77 // Create endpoints |
|
78 |
|
79 TIntInEndpoint if1_s1_ep1(EEndpoint1,64); |
|
80 TBulkOutEndpoint if1_s1_ep2(EEndpoint2); |
|
81 TBulkInEndpoint if1_s1_ep3(EEndpoint3); |
|
82 |
|
83 interface1s1->AddEndpoint(if1_s1_ep1); |
|
84 interface1s1->AddEndpoint(if1_s1_ep2); |
|
85 interface1s1->AddEndpoint(if1_s1_ep3); |
|
86 |
|
87 interface1->AddInterfaceSettingL(interface1s1); |
|
88 CleanupStack::Pop(interface1s1); |
|
89 |
|
90 AddInterface(interface1); |
|
91 CleanupStack::Pop(interface1); |
|
92 |
|
93 |
|
94 |
|
95 |
|
96 |
|
97 // Create another interface (interface2) |
|
98 |
|
99 CInterfaceBase* interface2 = new (ELeave) CInterfaceBase(*this,_L("i2")); |
|
100 CleanupStack::PushL(interface2); |
|
101 interface2->BaseConstructL(); |
|
102 |
|
103 // Create default interface setting 0 |
|
104 |
|
105 CInterfaceSettingBase* interface2s0 = new (ELeave) CInterfaceSettingBase(_L("i2s0")); |
|
106 CleanupStack::PushL(interface2s0); |
|
107 interface2s0->SetClassCodeL(0xFF,0xFF,0xFF); |
|
108 |
|
109 // Create some endpoints |
|
110 TBulkOutEndpoint if2_s0_ep1(EEndpoint1); |
|
111 TBulkOutEndpoint if2_s0_ep2(EEndpoint2); //this endpoint is designed to use a 32 byte max packet size |
|
112 TBulkInEndpoint if2_s0_ep3(EEndpoint3); |
|
113 |
|
114 interface2s0->AddEndpoint(if2_s0_ep1); |
|
115 interface2s0->AddEndpoint(if2_s0_ep2); |
|
116 interface2s0->AddEndpoint(if2_s0_ep3); |
|
117 |
|
118 interface2->AddInterfaceSettingL(interface2s0); |
|
119 CleanupStack::Pop(interface2s0); |
|
120 |
|
121 AddInterface(interface2); |
|
122 CleanupStack::Pop(interface2); |
|
123 } |
|
124 |
|
125 |
|
126 void RUsbDeviceD::OnStateChangeL(TUsbcDeviceState aNewState) |
|
127 { |
|
128 LOG_FUNC |
|
129 } |
|
130 |
|
131 |
|
132 } |