Update contrib.
1 // Copyright (c) 2004-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 // f32test\testusbcldd\src\dtestusblogdev.cpp
18 #include "dtestusblogdev.h"
22 TDynamicDfcQue* gDfcQ;
25 // DLL export number 1: Create a new LDD factory
27 DECLARE_STANDARD_LDD()
29 return(new DTestUsbcLogDevice);
32 DTestUsbcLogDevice::DTestUsbcLogDevice() :
33 iEndpoints(KMaxEndpointsPerClient+1)
35 iParseMask = KDeviceAllowUnit;
36 iUnitsMask = 0xffffffff;
37 iVersion = TVersion(KTestUsbcMajorVersion, KTestUsbcMinorVersion, KTestUsbcBuildVersion);
40 DTestUsbcLogDevice::~DTestUsbcLogDevice()
42 for (TInt i = 0; i < iEndpoints.Count(); i++)
53 const TInt KDSTestUsbThreadPriority = 27;
54 _LIT(KDTestUsbThread,"DTestUsbThread");
56 TInt DTestUsbcLogDevice::Install()
58 // Allocate a kernel thread to run the DFC
59 TInt r = Kern::DynamicDfcQCreate(gDfcQ, KDSTestUsbThreadPriority, KDTestUsbThread);
65 return SetName(&KName);
68 void DTestUsbcLogDevice::GetCaps(TDes8& aDes) const
70 TPckgBuf<TCapsDevUsbc> b;
72 Kern::InfoCopy(aDes, b);
75 TInt DTestUsbcLogDevice::Create(DLogicalChannelBase*& aChannel)
77 if (iEndpoints.Count() == 0)
79 for (TInt i = 0; i < KMaxEndpointsPerClient+1; i++)
81 DTestUsbcEndpoint* ep = new DTestUsbcEndpoint();
86 TInt err = ep->Create(DLddTestUsbcChannel::iEndpointData[i].iCaps);
91 iEndpoints.Append(ep);
94 aChannel = new DLddTestUsbcChannel(iEndpoints);
95 return aChannel ? KErrNone : KErrNoMemory;