kerneltest/e32test/usbho/t_usbdi/src/testdeviceA.cpp
changeset 0 a41df078684a
child 43 c1f20ce4abcf
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     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".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // @file testdeviceA.cpp
       
    15 // @internalComponent
       
    16 // 
       
    17 //
       
    18 
       
    19 #include "modelleddevices.h"
       
    20 #include "testinterfacebase.h"
       
    21 #include "testinterfacesettingbase.h"
       
    22 
       
    23 
       
    24 namespace NUnitTesting_USBDI
       
    25 	{
       
    26 	
       
    27 RUsbDeviceA::RUsbDeviceA()
       
    28 	{
       
    29 	LOG_FUNC
       
    30 	}
       
    31 	
       
    32 RUsbDeviceA::RUsbDeviceA(CBaseTestCase* aTestCase):RUsbDeviceVendor(aTestCase)
       
    33 	{
       
    34 	LOG_FUNC
       
    35 	}
       
    36 	
       
    37 RUsbDeviceA::~RUsbDeviceA()
       
    38 	{
       
    39 	LOG_FUNC	
       
    40 	}
       
    41 	
       
    42 
       
    43 void RUsbDeviceA::OpenL(const TDesC16& aSerialNumber)
       
    44 	{
       
    45 	LOG_FUNC
       
    46 	
       
    47 	RUsbDeviceVendor::OpenL(aSerialNumber);
       
    48 	
       
    49 	// Create another interface (interface1)
       
    50 	
       
    51 	CInterfaceBase* interface1 = new (ELeave) CInterfaceBase(*this,_L("i1"));
       
    52 	CleanupStack::PushL(interface1);
       
    53 	interface1->BaseConstructL();
       
    54 	
       
    55 	// Create default interface setting 0
       
    56 	
       
    57 	CInterfaceSettingBase* interface1s0 = new (ELeave) CInterfaceSettingBase(_L("i1s0"));
       
    58 	CleanupStack::PushL(interface1s0);
       
    59 	interface1s0->SetClassCodeL(0xFF,0xFF,0xFF);
       
    60 
       
    61 	// Create some endpoints
       
    62 	TBulkOutEndpoint s0_ep1(EEndpoint1);
       
    63 	TBulkInEndpoint s0_ep2(EEndpoint2);
       
    64 	
       
    65 	interface1s0->AddEndpoint(s0_ep1);
       
    66 	interface1s0->AddEndpoint(s0_ep2);
       
    67 
       
    68 	interface1->AddInterfaceSettingL(interface1s0);	
       
    69 	CleanupStack::Pop(interface1s0);
       
    70 	
       
    71 	// Create alternate interface setting 1
       
    72 	
       
    73 	CInterfaceSettingBase* interface1s1 = new (ELeave) CInterfaceSettingBase(_L("i1s1"));
       
    74 	CleanupStack::PushL(interface1s1);
       
    75 	interface1s1->SetClassCodeL(0xFF,0xFF,0xFF);
       
    76 	
       
    77 	// Create endpoints
       
    78 	
       
    79 	TIntInEndpoint s1_ep1(EEndpoint1,64);
       
    80 	TBulkOutEndpoint s1_ep2(EEndpoint2);
       
    81 	TBulkInEndpoint s1_ep3(EEndpoint3);
       
    82 	
       
    83 	interface1s1->AddEndpoint(s1_ep1);
       
    84 	interface1s1->AddEndpoint(s1_ep2);
       
    85 	interface1s1->AddEndpoint(s1_ep3);
       
    86 	
       
    87 	interface1->AddInterfaceSettingL(interface1s1);	
       
    88 	CleanupStack::Pop(interface1s1);
       
    89 	
       
    90 	AddInterface(interface1);
       
    91 	CleanupStack::Pop(interface1);
       
    92 	}
       
    93 
       
    94 	
       
    95 void RUsbDeviceA::OnStateChangeL(TUsbcDeviceState aNewState)
       
    96 	{
       
    97 	LOG_FUNC
       
    98 	}	
       
    99 	
       
   100 	
       
   101 	}