os/kernelhwsrv/kerneltest/e32test/usbho/t_usbdi/src/testdeviceA.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/usbho/t_usbdi/src/testdeviceA.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,101 @@
     1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// @file testdeviceA.cpp
    1.18 +// @internalComponent
    1.19 +// 
    1.20 +//
    1.21 +
    1.22 +#include "modelleddevices.h"
    1.23 +#include "testinterfacebase.h"
    1.24 +#include "testinterfacesettingbase.h"
    1.25 +
    1.26 +
    1.27 +namespace NUnitTesting_USBDI
    1.28 +	{
    1.29 +	
    1.30 +RUsbDeviceA::RUsbDeviceA()
    1.31 +	{
    1.32 +	LOG_FUNC
    1.33 +	}
    1.34 +	
    1.35 +RUsbDeviceA::RUsbDeviceA(CBaseTestCase* aTestCase):RUsbDeviceVendor(aTestCase)
    1.36 +	{
    1.37 +	LOG_FUNC
    1.38 +	}
    1.39 +	
    1.40 +RUsbDeviceA::~RUsbDeviceA()
    1.41 +	{
    1.42 +	LOG_FUNC	
    1.43 +	}
    1.44 +	
    1.45 +
    1.46 +void RUsbDeviceA::OpenL(const TDesC16& aSerialNumber)
    1.47 +	{
    1.48 +	LOG_FUNC
    1.49 +	
    1.50 +	RUsbDeviceVendor::OpenL(aSerialNumber);
    1.51 +	
    1.52 +	// Create another interface (interface1)
    1.53 +	
    1.54 +	CInterfaceBase* interface1 = new (ELeave) CInterfaceBase(*this,_L("i1"));
    1.55 +	CleanupStack::PushL(interface1);
    1.56 +	interface1->BaseConstructL();
    1.57 +	
    1.58 +	// Create default interface setting 0
    1.59 +	
    1.60 +	CInterfaceSettingBase* interface1s0 = new (ELeave) CInterfaceSettingBase(_L("i1s0"));
    1.61 +	CleanupStack::PushL(interface1s0);
    1.62 +	interface1s0->SetClassCodeL(0xFF,0xFF,0xFF);
    1.63 +
    1.64 +	// Create some endpoints
    1.65 +	TBulkOutEndpoint s0_ep1(EEndpoint1);
    1.66 +	TBulkInEndpoint s0_ep2(EEndpoint2);
    1.67 +	
    1.68 +	interface1s0->AddEndpoint(s0_ep1);
    1.69 +	interface1s0->AddEndpoint(s0_ep2);
    1.70 +
    1.71 +	interface1->AddInterfaceSettingL(interface1s0);	
    1.72 +	CleanupStack::Pop(interface1s0);
    1.73 +	
    1.74 +	// Create alternate interface setting 1
    1.75 +	
    1.76 +	CInterfaceSettingBase* interface1s1 = new (ELeave) CInterfaceSettingBase(_L("i1s1"));
    1.77 +	CleanupStack::PushL(interface1s1);
    1.78 +	interface1s1->SetClassCodeL(0xFF,0xFF,0xFF);
    1.79 +	
    1.80 +	// Create endpoints
    1.81 +	
    1.82 +	TIntInEndpoint s1_ep1(EEndpoint1,64);
    1.83 +	TBulkOutEndpoint s1_ep2(EEndpoint2);
    1.84 +	TBulkInEndpoint s1_ep3(EEndpoint3);
    1.85 +	
    1.86 +	interface1s1->AddEndpoint(s1_ep1);
    1.87 +	interface1s1->AddEndpoint(s1_ep2);
    1.88 +	interface1s1->AddEndpoint(s1_ep3);
    1.89 +	
    1.90 +	interface1->AddInterfaceSettingL(interface1s1);	
    1.91 +	CleanupStack::Pop(interface1s1);
    1.92 +	
    1.93 +	AddInterface(interface1);
    1.94 +	CleanupStack::Pop(interface1);
    1.95 +	}
    1.96 +
    1.97 +	
    1.98 +void RUsbDeviceA::OnStateChangeL(TUsbcDeviceState aNewState)
    1.99 +	{
   1.100 +	LOG_FUNC
   1.101 +	}	
   1.102 +	
   1.103 +	
   1.104 +	}