1 /** |
1 /** |
2 * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
33 #include <d32usbc.h> |
33 #include <d32usbc.h> |
34 #include <e32std.h> |
34 #include <e32std.h> |
35 #include <usb/usblogger.h> |
35 #include <usb/usblogger.h> |
36 #include <musbmanextensionpluginobserver.h> |
36 #include <musbmanextensionpluginobserver.h> |
37 |
37 |
|
38 |
|
39 |
38 class CUsbDeviceStateWatcher; |
40 class CUsbDeviceStateWatcher; |
39 class CUsbClassControllerBase; |
41 class CUsbClassControllerBase; |
40 class CUsbServer; |
42 class CUsbServer; |
41 class MUsbDeviceNotify; |
43 class MUsbDeviceNotify; |
42 class CPersonality; |
44 class CPersonality; |
43 class CUsbmanExtensionPlugin; |
45 class CUsbmanExtensionPlugin; |
|
46 class CUsbManCenRepManager; |
|
47 |
44 |
48 |
45 const TUid KUidUsbPlugIns = {0x101fbf21}; |
49 const TUid KUidUsbPlugIns = {0x101fbf21}; |
46 |
50 |
47 /** |
51 /** |
48 * The CUsbDevice class |
52 * The CUsbDevice class |
72 TUint8 iDeviceClass; |
76 TUint8 iDeviceClass; |
73 TUint8 iDeviceSubClass; |
77 TUint8 iDeviceSubClass; |
74 TUint8 iDeviceProtocol; |
78 TUint8 iDeviceProtocol; |
75 TUint8 iMaxPacketSize; |
79 TUint8 iMaxPacketSize; |
76 TUint16 iIdVendor; |
80 TUint16 iIdVendor; |
77 TUint16 iIdProduct; |
81 TUint16 iProductId; |
78 TUint16 iBcdDevice; |
82 TUint16 iBcdDevice; |
79 TUint8 iManufacturer; |
83 TUint8 iManufacturer; |
80 TUint8 iProduct; |
84 TUint8 iProduct; |
81 TUint8 iSerialNumber; |
85 TUint8 iSerialNumber; |
82 TUint8 iNumConfigurations; |
86 TUint8 iNumConfigurations; |
83 }; |
87 }; |
84 |
88 |
|
89 /** |
|
90 * See Central Repository |
|
91 */ |
|
92 class TUsbDeviceConfiguration |
|
93 { |
|
94 public: |
|
95 TUint16 iVendorId; |
|
96 HBufC* iManufacturerName; |
|
97 HBufC* iProductName; |
|
98 }; |
85 public: |
99 public: |
86 static CUsbDevice* NewL(CUsbServer& aUsbServer); |
100 static CUsbDevice* NewL(CUsbServer& aUsbServer); |
87 virtual ~CUsbDevice(); |
101 virtual ~CUsbDevice(); |
88 |
102 |
89 void EnumerateClassControllersL(); |
103 void EnumerateClassControllersL(); |
113 const CPersonality* GetPersonality(TInt aPersonalityId) const; |
127 const CPersonality* GetPersonality(TInt aPersonalityId) const; |
114 void ValidatePersonalitiesL(); |
128 void ValidatePersonalitiesL(); |
115 void ReadPersonalitiesL(); |
129 void ReadPersonalitiesL(); |
116 void SetDefaultPersonalityL(); |
130 void SetDefaultPersonalityL(); |
117 void LoadFallbackClassControllersL(); |
131 void LoadFallbackClassControllersL(); |
|
132 void ConvertUidsL(const TDesC& aStr, RArray<TUint>& aUidArray); |
118 |
133 |
119 public: // From CActive |
134 public: // From CActive |
120 void RunL(); |
135 void RunL(); |
121 void DoCancel(); |
136 void DoCancel(); |
122 TInt RunError(TInt aError); |
137 TInt RunError(TInt aError); |
135 void StartCurrentClassController(); |
150 void StartCurrentClassController(); |
136 void StopCurrentClassController(); |
151 void StopCurrentClassController(); |
137 |
152 |
138 private: |
153 private: |
139 void SetDeviceDescriptorL(); |
154 void SetDeviceDescriptorL(); |
140 void SetUsbDeviceSettingsL(TUsbDeviceDescriptor& aDeviceDescriptor); |
|
141 void SetUsbDeviceSettingsDefaultsL(TUsbDeviceDescriptor& aDeviceDescriptor); |
155 void SetUsbDeviceSettingsDefaultsL(TUsbDeviceDescriptor& aDeviceDescriptor); |
142 void SelectClassControllersL(); |
156 void SelectClassControllersL(); |
143 void SetCurrentPersonalityL(TInt aPersonalityId); |
157 void SetCurrentPersonalityL(TInt aPersonalityId); |
144 void SetUsbDeviceSettingsFromPersonalityL(CUsbDevice::TUsbDeviceDescriptor& aDeviceDescriptor); |
158 void SetUsbDeviceSettingsFromPersonalityL(CUsbDevice::TUsbDeviceDescriptor& aDeviceDescriptor); |
145 void ResourceFileNameL(TFileName& aFileName); |
159 void ResourceFileNameL(TFileName& aFileName); |
146 void CreateClassControllersL(const RArray<TUid>& aClassUids); |
160 void CreateClassControllersL(const RArray<TUid>& aClassUids); |
147 void ConvertUidsL(const TDesC& aStr, RArray<TUint>& aUidArray); |
|
148 TInt PowerUpAndConnect(); |
161 TInt PowerUpAndConnect(); |
149 #ifdef __FLOG_ACTIVE |
162 #ifdef __FLOG_ACTIVE |
150 void PrintDescriptor(CUsbDevice::TUsbDeviceDescriptor& aDeviceDescriptor); |
163 void PrintDescriptor(CUsbDevice::TUsbDeviceDescriptor& aDeviceDescriptor); |
151 #endif |
164 #endif |
152 void InstantiateExtensionPluginsL(); |
165 void InstantiateExtensionPluginsL(); |
165 RPointerArray<CPersonality> iSupportedPersonalities; |
178 RPointerArray<CPersonality> iSupportedPersonalities; |
166 RArray<TUid> iSupportedClassUids; |
179 RArray<TUid> iSupportedClassUids; |
167 TBool iPersonalityCfged; |
180 TBool iPersonalityCfged; |
168 TBool iUdcSupportsCableDetectWhenUnpowered; |
181 TBool iUdcSupportsCableDetectWhenUnpowered; |
169 HBufC16* iDefaultSerialNumber; |
182 HBufC16* iDefaultSerialNumber; |
|
183 CUsbManCenRepManager* iCenRepManager; // Own CenRepManager instance |
|
184 TUsbDeviceConfiguration iDeviceConfiguration; |
170 |
185 |
171 REComSession* iEcom; // Not to be deleted, only closed! |
186 REComSession* iEcom; // Not to be deleted, only closed! |
172 }; |
187 }; |
173 |
188 |
174 #include "CUsbDevice.inl" |
189 #include "CUsbDevice.inl" |