Update contrib.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // @file testdeviceA.cpp
19 #include "modelleddevices.h"
20 #include "testinterfacebase.h"
21 #include "testinterfacesettingbase.h"
24 namespace NUnitTesting_USBDI
28 RUsbDeviceC::RUsbDeviceC()
33 RUsbDeviceC::RUsbDeviceC(CBaseTestCase* aTestCase):RUsbDeviceVendor(aTestCase)
38 RUsbDeviceC::~RUsbDeviceC()
44 void RUsbDeviceC::OpenL(const TDesC16& aSerialNumber)
48 RUsbDeviceVendor::OpenL(aSerialNumber);
50 // Create another interface (interface1)
51 CInterfaceBase* interface1 = new (ELeave) CInterfaceBase(*this,_L("i1"));
52 CleanupStack::PushL(interface1);
53 interface1->BaseConstructL();
55 // Create default interface setting 0
56 CInterfaceSettingBase* interface1s0 = new (ELeave) CInterfaceSettingBase(_L("i1s0"));
57 CleanupStack::PushL(interface1s0);
58 interface1s0->SetClassCodeL(0xFF,0xFF,0xFF);
60 // Create some endpoints
61 TBulkOutEndpoint s0_ep1(EEndpoint1);
62 TBulkInEndpoint s0_ep2(EEndpoint2);
64 interface1s0->AddEndpoint(s0_ep1);
65 interface1s0->AddEndpoint(s0_ep2);
67 interface1->AddInterfaceSettingL(interface1s0);
68 CleanupStack::Pop(interface1s0);
70 // Create alternate interface setting 1
71 CInterfaceSettingBase* interface1s1 = new (ELeave) CInterfaceSettingBase(_L("i1s1"));
72 CleanupStack::PushL(interface1s1);
73 interface1s1->SetClassCodeL(0xFF,0xFF,0xFF);
76 TIntInEndpoint s1_ep1(EEndpoint1,64);
77 TBulkOutEndpoint s1_ep2(EEndpoint2);
78 TBulkInEndpoint s1_ep3(EEndpoint3);
80 interface1s1->AddEndpoint(s1_ep1);
81 interface1s1->AddEndpoint(s1_ep2);
82 interface1s1->AddEndpoint(s1_ep3);
84 interface1->AddInterfaceSettingL(interface1s1);
85 CleanupStack::Pop(interface1s1);
88 // Create alternate interface setting 2
89 CInterfaceSettingBase* interface1s2 = new (ELeave) CInterfaceSettingBase(_L("i1s2"));
90 CleanupStack::PushL(interface1s2);
91 interface1s2->SetClassCodeL(0xFF,0xFF,0xFF);
94 TBulkOutEndpoint s2_ep1(EEndpoint1);
95 TBulkInEndpoint s2_ep2(EEndpoint2);
98 interface1s2->AddEndpoint(s2_ep1);
99 interface1s2->AddEndpoint(s2_ep2);
102 interface1->AddInterfaceSettingL(interface1s2);
103 CleanupStack::Pop(interface1s2);
105 AddInterface(interface1);
106 CleanupStack::Pop(interface1);
110 void RUsbDeviceC::OnStateChangeL(TUsbcDeviceState aNewState)