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