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