author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 31 Aug 2010 16:34:26 +0300 | |
branch | RCL_3 |
changeset 43 | c1f20ce4abcf |
parent 0 | a41df078684a |
child 44 | 3e88ff8f41d5 |
permissions | -rw-r--r-- |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1 |
// Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 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" |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
22 |
#include "OstTraceDefinitions.h" |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
23 |
#ifdef OST_TRACE_COMPILER_IN_USE |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
24 |
#include "testdeviceCTraces.h" |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
25 |
#endif |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
26 |
|
0 | 27 |
|
28 |
||
29 |
namespace NUnitTesting_USBDI |
|
30 |
{ |
|
31 |
||
32 |
||
33 |
RUsbDeviceC::RUsbDeviceC() |
|
34 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
35 |
OstTraceFunctionEntry1( RUSBDEVICEC_RUSBDEVICEC_ENTRY, this ); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
36 |
OstTraceFunctionExit1( RUSBDEVICEC_RUSBDEVICEC_EXIT, this ); |
0 | 37 |
} |
38 |
||
39 |
RUsbDeviceC::RUsbDeviceC(CBaseTestCase* aTestCase):RUsbDeviceVendor(aTestCase) |
|
40 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
41 |
OstTraceFunctionEntryExt( RUSBDEVICEC_RUSBDEVICEC_ENTRY_DUP01, this ); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
42 |
OstTraceFunctionExit1( RUSBDEVICEC_RUSBDEVICEC_EXIT_DUP01, this ); |
0 | 43 |
} |
44 |
||
45 |
RUsbDeviceC::~RUsbDeviceC() |
|
46 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
47 |
OstTraceFunctionEntry1( RUSBDEVICEC_RUSBDEVICEC_ENTRY_DUP02, this ); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
48 |
OstTraceFunctionExit1( RUSBDEVICEC_RUSBDEVICEC_EXIT_DUP02, this ); |
0 | 49 |
} |
50 |
||
51 |
||
52 |
void RUsbDeviceC::OpenL(const TDesC16& aSerialNumber) |
|
53 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
54 |
OstTraceFunctionEntryExt( RUSBDEVICEC_OPENL_ENTRY, this ); |
0 | 55 |
|
56 |
RUsbDeviceVendor::OpenL(aSerialNumber); |
|
57 |
||
58 |
// Create another interface (interface1) |
|
59 |
CInterfaceBase* interface1 = new (ELeave) CInterfaceBase(*this,_L("i1")); |
|
60 |
CleanupStack::PushL(interface1); |
|
61 |
interface1->BaseConstructL(); |
|
62 |
||
63 |
// Create default interface setting 0 |
|
64 |
CInterfaceSettingBase* interface1s0 = new (ELeave) CInterfaceSettingBase(_L("i1s0")); |
|
65 |
CleanupStack::PushL(interface1s0); |
|
66 |
interface1s0->SetClassCodeL(0xFF,0xFF,0xFF); |
|
67 |
||
68 |
// Create some endpoints |
|
69 |
TBulkOutEndpoint s0_ep1(EEndpoint1); |
|
70 |
TBulkInEndpoint s0_ep2(EEndpoint2); |
|
71 |
||
72 |
interface1s0->AddEndpoint(s0_ep1); |
|
73 |
interface1s0->AddEndpoint(s0_ep2); |
|
74 |
||
75 |
interface1->AddInterfaceSettingL(interface1s0); |
|
76 |
CleanupStack::Pop(interface1s0); |
|
77 |
||
78 |
// Create alternate interface setting 1 |
|
79 |
CInterfaceSettingBase* interface1s1 = new (ELeave) CInterfaceSettingBase(_L("i1s1")); |
|
80 |
CleanupStack::PushL(interface1s1); |
|
81 |
interface1s1->SetClassCodeL(0xFF,0xFF,0xFF); |
|
82 |
||
83 |
// Create endpoints |
|
84 |
TIntInEndpoint s1_ep1(EEndpoint1,64); |
|
85 |
TBulkOutEndpoint s1_ep2(EEndpoint2); |
|
86 |
TBulkInEndpoint s1_ep3(EEndpoint3); |
|
87 |
||
88 |
interface1s1->AddEndpoint(s1_ep1); |
|
89 |
interface1s1->AddEndpoint(s1_ep2); |
|
90 |
interface1s1->AddEndpoint(s1_ep3); |
|
91 |
||
92 |
interface1->AddInterfaceSettingL(interface1s1); |
|
93 |
CleanupStack::Pop(interface1s1); |
|
94 |
||
95 |
||
96 |
// Create alternate interface setting 2 |
|
97 |
CInterfaceSettingBase* interface1s2 = new (ELeave) CInterfaceSettingBase(_L("i1s2")); |
|
98 |
CleanupStack::PushL(interface1s2); |
|
99 |
interface1s2->SetClassCodeL(0xFF,0xFF,0xFF); |
|
100 |
||
101 |
// Create endpoints |
|
102 |
TBulkOutEndpoint s2_ep1(EEndpoint1); |
|
103 |
TBulkInEndpoint s2_ep2(EEndpoint2); |
|
104 |
||
105 |
||
106 |
interface1s2->AddEndpoint(s2_ep1); |
|
107 |
interface1s2->AddEndpoint(s2_ep2); |
|
108 |
||
109 |
||
110 |
interface1->AddInterfaceSettingL(interface1s2); |
|
111 |
CleanupStack::Pop(interface1s2); |
|
112 |
||
113 |
AddInterface(interface1); |
|
114 |
CleanupStack::Pop(interface1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
115 |
OstTraceFunctionExit1( RUSBDEVICEC_OPENL_EXIT, this ); |
0 | 116 |
} |
117 |
||
118 |
||
119 |
void RUsbDeviceC::OnStateChangeL(TUsbcDeviceState aNewState) |
|
120 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
121 |
OstTraceFunctionEntryExt( RUSBDEVICEC_ONSTATECHANGEL_ENTRY, this ); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
122 |
OstTraceFunctionExit1( RUSBDEVICEC_ONSTATECHANGEL_EXIT, this ); |
0 | 123 |
} |
124 |
||
125 |
||
126 |
} |