|
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 testdeviceA.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 |
|
28 RUsbDeviceC::RUsbDeviceC() |
|
29 { |
|
30 LOG_FUNC |
|
31 } |
|
32 |
|
33 RUsbDeviceC::RUsbDeviceC(CBaseTestCase* aTestCase):RUsbDeviceVendor(aTestCase) |
|
34 { |
|
35 LOG_FUNC |
|
36 } |
|
37 |
|
38 RUsbDeviceC::~RUsbDeviceC() |
|
39 { |
|
40 LOG_FUNC |
|
41 } |
|
42 |
|
43 |
|
44 void RUsbDeviceC::OpenL(const TDesC16& aSerialNumber) |
|
45 { |
|
46 LOG_FUNC |
|
47 |
|
48 RUsbDeviceVendor::OpenL(aSerialNumber); |
|
49 |
|
50 // Create another interface (interface1) |
|
51 CInterfaceBase* interface1 = new (ELeave) CInterfaceBase(*this,_L("i1")); |
|
52 CleanupStack::PushL(interface1); |
|
53 interface1->BaseConstructL(); |
|
54 |
|
55 // Create default interface setting 0 |
|
56 CInterfaceSettingBase* interface1s0 = new (ELeave) CInterfaceSettingBase(_L("i1s0")); |
|
57 CleanupStack::PushL(interface1s0); |
|
58 interface1s0->SetClassCodeL(0xFF,0xFF,0xFF); |
|
59 |
|
60 // Create some endpoints |
|
61 TBulkOutEndpoint s0_ep1(EEndpoint1); |
|
62 TBulkInEndpoint s0_ep2(EEndpoint2); |
|
63 |
|
64 interface1s0->AddEndpoint(s0_ep1); |
|
65 interface1s0->AddEndpoint(s0_ep2); |
|
66 |
|
67 interface1->AddInterfaceSettingL(interface1s0); |
|
68 CleanupStack::Pop(interface1s0); |
|
69 |
|
70 // Create alternate interface setting 1 |
|
71 CInterfaceSettingBase* interface1s1 = new (ELeave) CInterfaceSettingBase(_L("i1s1")); |
|
72 CleanupStack::PushL(interface1s1); |
|
73 interface1s1->SetClassCodeL(0xFF,0xFF,0xFF); |
|
74 |
|
75 // Create endpoints |
|
76 TIntInEndpoint s1_ep1(EEndpoint1,64); |
|
77 TBulkOutEndpoint s1_ep2(EEndpoint2); |
|
78 TBulkInEndpoint s1_ep3(EEndpoint3); |
|
79 |
|
80 interface1s1->AddEndpoint(s1_ep1); |
|
81 interface1s1->AddEndpoint(s1_ep2); |
|
82 interface1s1->AddEndpoint(s1_ep3); |
|
83 |
|
84 interface1->AddInterfaceSettingL(interface1s1); |
|
85 CleanupStack::Pop(interface1s1); |
|
86 |
|
87 |
|
88 // Create alternate interface setting 2 |
|
89 CInterfaceSettingBase* interface1s2 = new (ELeave) CInterfaceSettingBase(_L("i1s2")); |
|
90 CleanupStack::PushL(interface1s2); |
|
91 interface1s2->SetClassCodeL(0xFF,0xFF,0xFF); |
|
92 |
|
93 // Create endpoints |
|
94 TBulkOutEndpoint s2_ep1(EEndpoint1); |
|
95 TBulkInEndpoint s2_ep2(EEndpoint2); |
|
96 |
|
97 |
|
98 interface1s2->AddEndpoint(s2_ep1); |
|
99 interface1s2->AddEndpoint(s2_ep2); |
|
100 |
|
101 |
|
102 interface1->AddInterfaceSettingL(interface1s2); |
|
103 CleanupStack::Pop(interface1s2); |
|
104 |
|
105 AddInterface(interface1); |
|
106 CleanupStack::Pop(interface1); |
|
107 } |
|
108 |
|
109 |
|
110 void RUsbDeviceC::OnStateChangeL(TUsbcDeviceState aNewState) |
|
111 { |
|
112 LOG_FUNC |
|
113 } |
|
114 |
|
115 |
|
116 } |