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
27 RUsbDeviceA::RUsbDeviceA()
32 RUsbDeviceA::RUsbDeviceA(CBaseTestCase* aTestCase):RUsbDeviceVendor(aTestCase)
37 RUsbDeviceA::~RUsbDeviceA()
43 void RUsbDeviceA::OpenL(const TDesC16& aSerialNumber)
47 RUsbDeviceVendor::OpenL(aSerialNumber);
49 // 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
57 CInterfaceSettingBase* interface1s0 = new (ELeave) CInterfaceSettingBase(_L("i1s0"));
58 CleanupStack::PushL(interface1s0);
59 interface1s0->SetClassCodeL(0xFF,0xFF,0xFF);
61 // Create some endpoints
62 TBulkOutEndpoint s0_ep1(EEndpoint1);
63 TBulkInEndpoint s0_ep2(EEndpoint2);
65 interface1s0->AddEndpoint(s0_ep1);
66 interface1s0->AddEndpoint(s0_ep2);
68 interface1->AddInterfaceSettingL(interface1s0);
69 CleanupStack::Pop(interface1s0);
71 // Create alternate interface setting 1
73 CInterfaceSettingBase* interface1s1 = new (ELeave) CInterfaceSettingBase(_L("i1s1"));
74 CleanupStack::PushL(interface1s1);
75 interface1s1->SetClassCodeL(0xFF,0xFF,0xFF);
79 TIntInEndpoint s1_ep1(EEndpoint1,64);
80 TBulkOutEndpoint s1_ep2(EEndpoint2);
81 TBulkInEndpoint s1_ep3(EEndpoint3);
83 interface1s1->AddEndpoint(s1_ep1);
84 interface1s1->AddEndpoint(s1_ep2);
85 interface1s1->AddEndpoint(s1_ep3);
87 interface1->AddInterfaceSettingL(interface1s1);
88 CleanupStack::Pop(interface1s1);
90 AddInterface(interface1);
91 CleanupStack::Pop(interface1);
95 void RUsbDeviceA::OnStateChangeL(TUsbcDeviceState aNewState)