|
1 /** |
|
2 * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * Adheres to the UsbMan USB Class API and talks to C32 |
|
16 * to manage the stub1.CSY that is used to provide a virtual |
|
17 * serial port service to clients |
|
18 * |
|
19 * |
|
20 */ |
|
21 |
|
22 |
|
23 |
|
24 /** |
|
25 @file |
|
26 */ |
|
27 |
|
28 #ifndef __CUsbstub1CLASSCONTROLLER_H__ |
|
29 #define __CUsbstub1CLASSCONTROLLER_H__ |
|
30 |
|
31 #include <e32std.h> |
|
32 #include <cusbclasscontrollerplugin.h> |
|
33 #include <d32usbc.h> |
|
34 |
|
35 class MUsbClassControllerNotify; |
|
36 |
|
37 const TInt Kstub1StartupPriority = 4; |
|
38 |
|
39 const TInt Kstub1CCDefaultDelay = 500; //0.5 sec default delay for start and stop |
|
40 |
|
41 const TInt Kstub1NumberOfInterfacesPerstub1Function = 2; // data and control interfaces |
|
42 |
|
43 // The name of the ini file specifying the number of functions required different from default |
|
44 /* |
|
45 _LIT(Kstub1FunctionsIniFileName, "NumberOfstub1Functions.ini"); |
|
46 _LIT(Kstub1ConfigSection,"stub1_CONF"); |
|
47 _LIT(KNumberOfstub1FunctionsKeyWord,"NumberOfstub1Functions"); |
|
48 */ |
|
49 // Lengths of the various bits of the descriptor. Taken from the USB |
|
50 // WMCDC specification, v1.0. |
|
51 const TInt Kstub1InterfaceDescriptorLength = 3; |
|
52 const TInt Kstub1CcHeaderDescriptorLength = 5; |
|
53 const TInt Kstub1FunctionalDescriptorLength = 4; |
|
54 const TInt Kstub1CcUfdDescriptorLength = 5; |
|
55 const TInt Kstub1NotificationEndpointDescriptorLength = 7; |
|
56 const TInt Kstub1DataClassInterfaceDescriptorLength = 3; |
|
57 const TInt Kstub1DataClassHeaderDescriptorLength = 5; |
|
58 const TInt Kstub1DataClassEndpointInDescriptorLength = 7; |
|
59 const TInt Kstub1DataClassEndpointOutDescriptorLength = 7; |
|
60 |
|
61 const TInt Kstub1DescriptorLength = |
|
62 Kstub1InterfaceDescriptorLength + |
|
63 Kstub1CcHeaderDescriptorLength + |
|
64 Kstub1FunctionalDescriptorLength + |
|
65 Kstub1CcUfdDescriptorLength + |
|
66 Kstub1NotificationEndpointDescriptorLength + |
|
67 Kstub1DataClassInterfaceDescriptorLength + |
|
68 Kstub1DataClassHeaderDescriptorLength + |
|
69 Kstub1DataClassEndpointInDescriptorLength + |
|
70 Kstub1DataClassEndpointOutDescriptorLength; |
|
71 |
|
72 /** |
|
73 * The CUsbstub1ClassController class |
|
74 * |
|
75 * Implements the USB Class Controller API and manages the stub1.CSY |
|
76 */ |
|
77 NONSHARABLE_CLASS(CUsbstub1ClassController) : public CUsbClassControllerPlugIn |
|
78 { |
|
79 |
|
80 public: // New functions. |
|
81 static CUsbstub1ClassController* NewL(MUsbClassControllerNotify& aOwner); |
|
82 |
|
83 public: // Functions derived from CBase. |
|
84 virtual ~CUsbstub1ClassController(); |
|
85 |
|
86 public: // Functions derived from CActive. |
|
87 virtual void RunL(); |
|
88 virtual void DoCancel(); |
|
89 virtual TInt RunError(TInt aError); |
|
90 |
|
91 public: // Functions derived from CUsbClassControllerBase |
|
92 virtual void Start(TRequestStatus& aStatus); |
|
93 virtual void Stop(TRequestStatus& aStatus); |
|
94 |
|
95 virtual void GetDescriptorInfo(TUsbDescriptor& aDescriptorInfo) const; |
|
96 |
|
97 protected: |
|
98 CUsbstub1ClassController(MUsbClassControllerNotify& aOwner); |
|
99 void ConstructL(); |
|
100 |
|
101 |
|
102 |
|
103 private: |
|
104 TInt SetUpInterface(); |
|
105 |
|
106 // delays in microseconds |
|
107 TInt iStartDelay; |
|
108 TInt iStopDelay; |
|
109 |
|
110 TBool iFailToStart; |
|
111 TBool iFailToStop; |
|
112 |
|
113 RTimer iTimer; |
|
114 TRequestStatus* iReportStatus; |
|
115 RDevUsbcClient iLdd; |
|
116 |
|
117 |
|
118 }; |
|
119 |
|
120 #endif //__CUsbstub1CLASSCONTROLLER_H__ |