|
1 /* |
|
2 * Copyright (c) 2004-2007 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: Declares main application class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef C_HIDDRIVER_H |
|
21 #define C_HIDDRIVER_H |
|
22 |
|
23 #include <ecom/ecom.h> |
|
24 |
|
25 |
|
26 class CReportRoot; |
|
27 class MDriverAccess; |
|
28 class MTransportLayer; |
|
29 class CHidDriver; |
|
30 // ---------------------------------------------------------------------- |
|
31 |
|
32 // Return codes from the Generic HID to Transport layers |
|
33 // |
|
34 const TInt KErrHidBase = -8000; |
|
35 |
|
36 const TInt KErrHidNoDriver = KErrHidBase; /*!< No driver could be found to handle the request */ |
|
37 const TInt KErrHidSuspended = KErrHidBase - 1; /*!< Command not handled - driver is suspended */ |
|
38 const TInt KErrHidUnrecognised = KErrHidBase - 2; /*!< Driver could not understand the data */ |
|
39 const TInt KErrHidUnexpected = KErrHidBase - 3; /*!< Unsolicited data from the device */ |
|
40 const TInt KErrHidBadChannel = KErrHidBase - 4; /*!< Channel was not Int or Ctrl type */ |
|
41 const TInt KErrHidPartialSupported = KErrHidBase - 5; /*!< Partil supported hid device */ |
|
42 |
|
43 // Errors returned by the report translator / generator: |
|
44 // |
|
45 const TInt KErrUsageNotFound = KErrHidBase - 10; //!< Usage page/ID wasn't found in the field |
|
46 const TInt KErrValueOutOfRange = KErrHidBase - 11; //!< Value specified is outside the logical range |
|
47 const TInt KErrNoSpaceInArray = KErrHidBase - 12; //!< Array field already contains the maximum number of values |
|
48 const TInt KErrBadControlIndex = KErrHidBase - 13; //!< Control index exceeds the number of controls in the field |
|
49 |
|
50 // ACK codes returned by Set/Get requests to the devices |
|
51 // |
|
52 const TInt KErrCommandAckBase = -8100; |
|
53 |
|
54 const TInt KErrAckInvalidReportID = KErrCommandAckBase; /*!< Invalid report ID */ |
|
55 const TInt KErrAckInvalidParameter = KErrCommandAckBase - 1; /*!< Invalid or out of range param */ |
|
56 const TInt KErrAckUnknown = KErrCommandAckBase - 2; /*!< Command failed, but the device can't determine why */ |
|
57 const TInt KErrAckFatal = KErrCommandAckBase - 3; /*!< The device is in an unrecoverable state and must be restarted */ |
|
58 |
|
59 // Constant for plugin interface: |
|
60 const TUid KHidDriverPluginInterfaceUid = { 0x10201d26 }; |
|
61 |
|
62 |
|
63 class THidEvent |
|
64 { |
|
65 public: |
|
66 /** |
|
67 * Usage page |
|
68 */ |
|
69 TInt iUsagePage; |
|
70 |
|
71 /** |
|
72 * Keycode |
|
73 */ |
|
74 TInt iKeyCode; |
|
75 }; |
|
76 |
|
77 class CHidInputDataHandlingReg: public CBase |
|
78 { |
|
79 |
|
80 public: |
|
81 /** |
|
82 * Two-phased constructor. |
|
83 */ |
|
84 static CHidInputDataHandlingReg* NewL(); |
|
85 |
|
86 /** |
|
87 * Destructor |
|
88 */ |
|
89 virtual ~CHidInputDataHandlingReg(); |
|
90 |
|
91 public: |
|
92 |
|
93 /** |
|
94 * Check if key event is not allready processed |
|
95 * |
|
96 * @since S60 v5.0 |
|
97 * @param aUsagePage a usage page to be checked |
|
98 * @param aUsage a usage code to be checked |
|
99 * @return true if event is not allready handled |
|
100 */ |
|
101 IMPORT_C TBool AllowedToHandleEvent(TInt aUsagePage, TInt aUsage); |
|
102 |
|
103 |
|
104 /** |
|
105 * Add handled event |
|
106 * |
|
107 * @since S60 v5.0 |
|
108 * @param aUsagePage usage page to be handled |
|
109 * @param aUsage Usage to be handled |
|
110 * @return None. |
|
111 */ |
|
112 IMPORT_C void AddHandledEvent( TInt aUsagePage, TInt aUsage); |
|
113 |
|
114 /** |
|
115 * Reset Array |
|
116 */ |
|
117 void Reset(); |
|
118 |
|
119 private: |
|
120 |
|
121 CHidInputDataHandlingReg(); |
|
122 void ConstructL(); |
|
123 |
|
124 private: |
|
125 |
|
126 /** |
|
127 * Event array |
|
128 * Own. |
|
129 */ |
|
130 CArrayFixFlat<THidEvent>* iEventArray; |
|
131 |
|
132 }; |
|
133 |
|
134 /** |
|
135 * |
|
136 * Transport layer interface class |
|
137 * Interface allowing the generic HID layer to pass data to a Transport layer |
|
138 * All commands are asynchronous. The results are returned via the |
|
139 * |
|
140 * @since S60 v5.0 |
|
141 */ |
|
142 class MTransportLayer |
|
143 { |
|
144 public: |
|
145 |
|
146 /** |
|
147 * Request for the country code of the given device. |
|
148 * |
|
149 * @since S60 v5.0 |
|
150 * @param aConnID The device identifier |
|
151 * @return country code. |
|
152 */ |
|
153 virtual TUint CountryCodeL(TInt aConnID) = 0; |
|
154 |
|
155 /** |
|
156 * Request for the vendor identifier for the given device. |
|
157 * |
|
158 * @since S60 v5.0 |
|
159 * @param aConnID The device identifier |
|
160 * @return vendor id. |
|
161 */ |
|
162 virtual TUint VendorIdL(TInt aConnID) = 0; |
|
163 |
|
164 /** |
|
165 * Request for the product identifier for the given device. |
|
166 * |
|
167 * @since S60 v5.0 |
|
168 * @param aConnID The device identifier |
|
169 * @return product id. |
|
170 */ |
|
171 virtual TUint ProductIdL(TInt aConnID) = 0; |
|
172 |
|
173 /** |
|
174 * Request for the current device report protocol. The protocol will be |
|
175 * received as a control report via the CHidTransport::DataIn function |
|
176 * |
|
177 * @since S60 v5.0 |
|
178 * @param aConnID The device identifier |
|
179 * @param aInterface The interface we want to get the protocol from |
|
180 * @return None. |
|
181 */ |
|
182 virtual void GetProtocolL(TInt aConnID, TUint16 aInterface) = 0; |
|
183 |
|
184 /** |
|
185 * Request to put the device in the specified protocol |
|
186 * |
|
187 * @since S60 v5.0 |
|
188 * @param aConnID The device identifier |
|
189 * @param aValue The requested protocol for the device (boot or report) |
|
190 * @param aInterface The interface we want to set the protocol for |
|
191 * @return None. |
|
192 */ |
|
193 virtual void SetProtocolL(TInt aConnID, TUint16 aValue, |
|
194 TUint16 aInterface) = 0; |
|
195 |
|
196 /** |
|
197 * Request for a device report. The data will be received as a control report |
|
198 * via the CHidTransport::DataIn function |
|
199 * |
|
200 * @since S60 v5.0 |
|
201 * @param aConnID The device identifier |
|
202 * @param aReportType The type of report (input/output/feature) requested |
|
203 * @param aReportID The specific report required |
|
204 * @param aInterface The interface we want the report from |
|
205 * @param aLength The expected length of the report buffer |
|
206 * @return None. |
|
207 */ |
|
208 virtual void GetReportL(TInt aConnID, TUint8 aReportType,TUint8 aReportID, |
|
209 TUint16 aInterface, TUint16 aLength) = 0; |
|
210 |
|
211 /** |
|
212 * Request to send a report to a device. The response will be reported via the |
|
213 * CHidTransport::CommandResult function |
|
214 * |
|
215 * @since S60 v5.0 |
|
216 * @param aConnID The device identifier |
|
217 * @param aReportType The type of report (input/output/feature) requested |
|
218 * @param aReportID The specific report required to set |
|
219 * @param aInterface The interface we want to send the report to |
|
220 * @param aReport The report payload to be sent to the device |
|
221 * @return None. |
|
222 */ |
|
223 virtual void SetReportL(TInt aConnID, TUint8 aReportType,TUint8 aReportID, |
|
224 TUint16 aInterface, const TDesC8& aReport) = 0; |
|
225 |
|
226 /** |
|
227 * Request to send data to a device. There are no responses to this report from device. |
|
228 * |
|
229 * @since S60 v5.0 |
|
230 * @param aConnID The device identifier |
|
231 * @param aReportID The specific report required |
|
232 * @param aInterface The interface we want to send the report to |
|
233 * @param aReport The report payload to be sent to the device |
|
234 * @return None. |
|
235 */ |
|
236 virtual void DataOutL(TInt aConnID, TUint8 aReportID, |
|
237 TUint16 aInterface, const TDesC8& aReport) = 0; |
|
238 |
|
239 /** |
|
240 * Request for the current idle rate of a report from the device. The response |
|
241 * will be recevied via the CHidTransport::DataIn function |
|
242 * |
|
243 * @since S60 v5.0 |
|
244 * @param aConnID The device identifier |
|
245 * @param aReportID The specific report to be queried |
|
246 * @param aInterface The interface we want to query for idle rate |
|
247 * @return None. |
|
248 */ |
|
249 virtual void GetIdleL(TInt aConnID, TUint8 aReportID, |
|
250 TUint16 aInterface) = 0; |
|
251 |
|
252 /** |
|
253 * Request to set the current idle rate for a report on the device. |
|
254 * The response will be received via the CHidTransport::CommandResult function |
|
255 * |
|
256 * @since S60 v5.0 |
|
257 * @param aConnID The device identifier |
|
258 * @param aReportID The specific report to be queried |
|
259 * @param aDuration The time period between idle reports (4ms per bit. An |
|
260 * interval of 0 disables idle reports so that Interrupt reports are only ever |
|
261 * received when the reported data has changed |
|
262 * @param aReportID The specific report to be queried |
|
263 * @param aInterface The interface we want to query for idle rate |
|
264 * @return None. |
|
265 */ |
|
266 virtual void SetIdleL(TInt aConnID, TUint8 aDuration, TUint8 aReportID, |
|
267 TUint16 aInterface) = 0; |
|
268 }; |
|
269 |
|
270 /** |
|
271 * |
|
272 * Driver access interface |
|
273 * Interface allowing drivers to request data from and send data to devices via |
|
274 * the Generic HID layer. |
|
275 * |
|
276 * @since S60 v5.0 |
|
277 */ |
|
278 class MDriverAccess |
|
279 { |
|
280 public: |
|
281 |
|
282 /** |
|
283 * The type of report requested from the device |
|
284 * Note: The enumeration values map directly to the HID equivalent values |
|
285 * (Passed as TUint16 values to the transport layer) |
|
286 */ |
|
287 enum TReportType |
|
288 { |
|
289 EInput=1, /*!< Input report */ |
|
290 EOutput, /*!< Output report */ |
|
291 EFeature /*!< Feature report */ |
|
292 }; |
|
293 |
|
294 /** Return codes from the Generic HID to the device drivers |
|
295 * Note: The enumeration values map directly to the HID equivalent values |
|
296 *(Passed as TUint8 values to the transport layer) |
|
297 */ |
|
298 |
|
299 enum TProtocols |
|
300 { |
|
301 EBoot=0, /*!< Boot Protocol */ |
|
302 EReport=1 /*!< Report Protocol */ |
|
303 }; |
|
304 |
|
305 public: |
|
306 |
|
307 /** |
|
308 * Retrieves the country code for the HID device |
|
309 * |
|
310 * @since S60 v5.0 |
|
311 * @param aConnID The device identifier |
|
312 * @return contry code |
|
313 */ |
|
314 virtual TUint CountryCodeL(TInt aConnID) = 0; |
|
315 |
|
316 /** |
|
317 * Retrieves the for the HID device |
|
318 * |
|
319 * @since S60 v5.0 |
|
320 * @param aConnID The device identifier |
|
321 * @return vendor id |
|
322 */ |
|
323 virtual TUint VendorIdL(TInt aConnID) = 0; |
|
324 |
|
325 /** |
|
326 * Retrieves the product identifier for the HID device |
|
327 * |
|
328 * @since S60 v5.0 |
|
329 * @param aConnID The device identifier |
|
330 * @return produrct id |
|
331 */ |
|
332 virtual TUint ProductIdL(TInt aConnID) = 0; |
|
333 |
|
334 /** |
|
335 * Requests the current protocol for the device (boot or report) |
|
336 * Leaves whit KErrInUse The request was not successful because the transport |
|
337 * layer is busy with previous request and KErrNotReady The request failed |
|
338 * because the device is currently unavaila |
|
339 * |
|
340 * @since S60 v5.0 |
|
341 * @param aConnectionID The connection id |
|
342 * @param aInterface The current interface being used by the driver |
|
343 * @return None. |
|
344 */ |
|
345 virtual void GetProtocolL(TInt aConnectionID, |
|
346 TUint16 aInterface) = 0; |
|
347 |
|
348 /** |
|
349 * Requests a report from the device |
|
350 * Leaves whit KErrInUse The request was not successful because the transport |
|
351 * layer is busy with previous request and KErrNotReady The request failed |
|
352 * because the device is currently unavailable |
|
353 * |
|
354 * @since S60 v5.0 |
|
355 * @param aConnectionId The connection id |
|
356 * @param aReportId The report required from the device |
|
357 * @param aInterface The current interface being used by the driver |
|
358 * @param aLength ** NOT USED ** |
|
359 * @return None |
|
360 */ |
|
361 virtual void GetReportL(TInt aConnectionId, TUint8 aReportId, |
|
362 TUint16 aInterface, TUint16 aLength) = 0; |
|
363 |
|
364 /** |
|
365 * Requests the current Idle setting for the device |
|
366 * Leaves whit KErrInUse The request was not successful because the transport |
|
367 * layer is busy with previous request and KErrNotReady The request failed |
|
368 * because the device is currently unavailable |
|
369 * |
|
370 * @since S60 v5.0 |
|
371 * @param aConnectionId The device ID |
|
372 * @param aReportId The report required from the device |
|
373 * @param aInterface The current interface being used by the driver |
|
374 * @return None. |
|
375 */ |
|
376 virtual void GetIdleL(TInt aConnectionId, TUint8 aReportId, |
|
377 TUint16 aInterface ) = 0; |
|
378 |
|
379 /** |
|
380 * Sets the protocol to be used for reports |
|
381 * Leaves whit KErrInUse The request was not successful because the transport |
|
382 * layer is busy with previous request and KErrNotReady The request failed |
|
383 * because the device is currently unavailable |
|
384 * |
|
385 * @since S60 v5.0 |
|
386 * @param aConnectionId The device ID |
|
387 * @param aInterface The current interface being used by the driver |
|
388 * @param aProtocol The required protocol (boot or report) |
|
389 * @parem aDriver Calling driver |
|
390 * @return None. |
|
391 */ |
|
392 virtual void SetProtocolL(TInt aConnectionId, |
|
393 TUint16 aInterface, TProtocols aProtocol, CHidDriver* aDriver) = 0; |
|
394 |
|
395 /** |
|
396 * Sets the idle interval for interrupt data. |
|
397 * Leaves whit KErrInUse The request was not successful because the transport |
|
398 * layer is busy with previous request and KErrNotReady The request failed |
|
399 * because the device is currently unavailable |
|
400 * |
|
401 * @since S60 v5.0 |
|
402 * @param aConnectionId The device ID |
|
403 * @param aDuration The idle interval, in steps of 0.04ms intervals (where |
|
404 * 1 = 0.04ms, 2=0.08ms). 0 will disable idle so reports |
|
405 * are only sent when the state of the device changes |
|
406 * @param aInterface The current interface being used by the driver |
|
407 * @param aReportId The report whose idle rate is being set |
|
408 * @param aInterface The current interface being used by the driver |
|
409 * @parem aDriver Calling driver |
|
410 * @return None. |
|
411 */ |
|
412 virtual void SetIdleL(TInt aConnectionId, TUint8 aDuration, |
|
413 TUint8 aReportId, TUint16 aInterface, CHidDriver* aDriver) = 0; |
|
414 |
|
415 |
|
416 /** |
|
417 * Sends a report to the device |
|
418 * |
|
419 * @since S60 v5.0 |
|
420 * @param aConnectionId The device ID |
|
421 * @param aReportId The report to receive the setup report |
|
422 * @param aReportType The type of report being sent to the device (input, output |
|
423 * or Feature) |
|
424 * @param aPayload The report being sent to the device |
|
425 * @parem aDriver Calling driver |
|
426 * @param aInterface The current interface being used by the driver |
|
427 * @return KErrNone The request was successful and the result of the command is |
|
428 * expected at a later time (as a CmdAck message), KErrInUse The request |
|
429 * was not successful because the transport layer is busy with a previous |
|
430 * request, KErrNotReady The request failed because the device is currently |
|
431 * unavailable and KErrNoMemory The request failed because not enough memory |
|
432 * available |
|
433 */ |
|
434 virtual void SetReportL(TInt aConnectionId, TUint8 aReportId, |
|
435 TReportType aReportType, const TDesC8& aPayload, |
|
436 TUint16 aInterface, CHidDriver* aDriver) = 0; |
|
437 |
|
438 /** |
|
439 * Sends a report to the device (from host) using Interrupt Channel as DATA |
|
440 * |
|
441 * @since S60 v5.0 |
|
442 * @param aConnectionId The device ID |
|
443 * @param aReportId The report to receive the setup report |
|
444 * @param aPayload The report being sent to the device |
|
445 * @param aInterface The current interface being used by the driver |
|
446 * @return KErrNone The request was successful and the result of the |
|
447 * command is expected at a later time (as a CmdAck message), |
|
448 * KErrInUse The request was not successful because the transport layer is |
|
449 * busy with a previous request, KErrNotReady The request failed because the |
|
450 * device is currently unavailable and KErrNoMemory The request failed because |
|
451 * not enough memory available |
|
452 */ |
|
453 virtual void DataOutL(TInt aConnectionId, TUint8 aReportId, |
|
454 /*TReportType aReportType,*/ const TDesC8& aPayload, |
|
455 TUint16 aInterface) = 0; |
|
456 |
|
457 /** |
|
458 * A request for the parsed descriptor container object so the driver can |
|
459 * retrieve the report format(s) |
|
460 * |
|
461 * @since S60 v5.0 |
|
462 * @param aConnectionId The device ID |
|
463 * @return A pointer to the parsed report descriptor container and |
|
464 * NULL if no parsed report descriptor container exists |
|
465 */ |
|
466 virtual CReportRoot* ReportDescriptor(TInt aConnectionId) = 0; |
|
467 }; |
|
468 |
|
469 |
|
470 /** |
|
471 * |
|
472 * Hid transport interface |
|
473 * Interface allowing the transport layer to pass data to the Generic HID |
|
474 * |
|
475 * @since S60 v5.0 |
|
476 */ |
|
477 class CHidTransport : public CBase |
|
478 { |
|
479 public: |
|
480 /** |
|
481 * Defines the channel type for the DataIn function |
|
482 */ |
|
483 enum THidChannelType |
|
484 { |
|
485 EHidChannelInt, /*!< Interrupt channel */ |
|
486 EHidChannelCtrl /*!< Control channel */ |
|
487 }; |
|
488 |
|
489 /** |
|
490 *Driver state (active or suspended) |
|
491 */ |
|
492 enum TDriverState |
|
493 { |
|
494 EActive, /*!< Driver will handle interrupt data */ |
|
495 ESuspend /*!< the driver will not handle interrupt data */ |
|
496 }; |
|
497 |
|
498 public: |
|
499 |
|
500 /** |
|
501 * Called when a device has connected |
|
502 * |
|
503 * @since S60 v5.0 |
|
504 * @param aConnectionId The transport-layer enumeration for the connection |
|
505 * @param aDescriptor The report descriptor for the device |
|
506 * @return KErrNone The connection will be handled by one or more drivers, |
|
507 * KErrHidNoDriver No driver was found to handle the connected device |
|
508 */ |
|
509 virtual TInt ConnectedL(TInt aConnectionId, const TDesC8& aDescriptor) = 0; |
|
510 |
|
511 /** |
|
512 * Called when a device has been disconnected |
|
513 * |
|
514 * @since S60 v5.0 |
|
515 * @param aConnectionId The transport-layer enumeration for the connection |
|
516 * @param aDescriptor The report descriptor for the device |
|
517 * @return KErrNone The device was recognised and its drivers were unloaded and |
|
518 * KErrHidNoDriver No driver was found to handle the connected device |
|
519 */ |
|
520 virtual TInt Disconnected(TInt aConnectionId) = 0; |
|
521 |
|
522 /** |
|
523 * Called when a device has been disconnected |
|
524 * |
|
525 * @since S60 v5.0 |
|
526 * @param aConnectionId Transport layer connection enumeration |
|
527 * @param aChannel Channel ID (Interrupt or Control) |
|
528 * @param aPayload The complete report payload |
|
529 * @return KErrNone The payload was handled by one or more drivers, |
|
530 * KErrHidNoDriver No driver is handling reports from the device |
|
531 * and KErrHidSuspended The report was not handled because all the drivers |
|
532 * handling the device are suspended |
|
533 */ |
|
534 virtual TInt DataIn(TInt aConnectionId, |
|
535 THidChannelType aChannel, const TDesC8& aPayload) = 0; |
|
536 |
|
537 /** |
|
538 * Suspends or Resumes the driver(s) handling the connection |
|
539 * |
|
540 * @since S60 v5.0 |
|
541 * @param aConnectionId Transport layer connection enumeration |
|
542 * @param aActive The requested state of the driver (active or suspended) |
|
543 * @return KErrNone The driver was successfully put into the requested state, |
|
544 * and KErrHidAlreadyInState All the drivers were already in the |
|
545 * requested state |
|
546 */ |
|
547 virtual TInt DriverActive(TInt aConnectionId, |
|
548 CHidTransport::TDriverState aActive) = 0; |
|
549 |
|
550 /** |
|
551 * Called by the transport layers to inform the generic HID of the |
|
552 * success of the last Set... command. |
|
553 * |
|
554 * @since S60 v5.0 |
|
555 * @param aConnectionId Transport layer connection enumeration |
|
556 * @param aCmdAck Status of the last Set... command |
|
557 * @return None. |
|
558 */ |
|
559 virtual void CommandResult(TInt aConnectionId, TInt aCmdAck) = 0; |
|
560 }; |
|
561 |
|
562 /** |
|
563 * |
|
564 * Driver plugin interface |
|
565 * Interface allowing drivers to request data from and send data to devices via |
|
566 * the Generic HID layer. |
|
567 * |
|
568 * @lib generichid.lib |
|
569 * @since S60 v5.0 |
|
570 */ |
|
571 class CHidDriver : public CBase |
|
572 { |
|
573 public: |
|
574 |
|
575 |
|
576 /** |
|
577 * Two-phased constructor. |
|
578 * @param aImplementationUid Implementation UID of the plugin to be |
|
579 * created. |
|
580 * @param aHid Driver acces interface |
|
581 */ |
|
582 IMPORT_C static CHidDriver* NewL( |
|
583 const TUid aImplementationUid, |
|
584 MDriverAccess* aHid ); |
|
585 |
|
586 /** |
|
587 * Destructor |
|
588 */ |
|
589 IMPORT_C virtual ~CHidDriver(); |
|
590 |
|
591 /** |
|
592 * Called by the Generic HID to see if the factory can use reports described by |
|
593 * the parsed report descriptor |
|
594 * NOTE: The current implementation supports just one driver and that driver |
|
595 * that will either handle all the reports from the device or none at all. |
|
596 * Report ID is not currently being taken into account. |
|
597 * |
|
598 * @since S60 v5.0 |
|
599 * @param aReportDescriptor Parsed HID report descriptor |
|
600 * @return KErrNone The driver will handle reports from the report descriptor and |
|
601 * KErrHidUnrecognised The driver cannot handle reports from the device |
|
602 */ |
|
603 virtual TInt CanHandleReportL(CReportRoot* aReportDescriptor) = 0; |
|
604 |
|
605 /** |
|
606 * Called by the Generic HID layer when a device has sent a report on the |
|
607 * interrupt or control channel |
|
608 * |
|
609 * @since S60 v5.0 |
|
610 * @param aChannel Channel ID (Interrupt or Control) |
|
611 * @param aPayload The complete report payload |
|
612 * @return Error if data can't be handled. |
|
613 */ |
|
614 virtual TInt DataIn(CHidTransport::THidChannelType aChannel, |
|
615 const TDesC8& aPayload) = 0; |
|
616 |
|
617 /** |
|
618 * Called by the Generic HID layer when the handled device has been disconnected |
|
619 * interrupt or control channel |
|
620 * |
|
621 * @since S60 v5.0 |
|
622 * @param aReason Disconnection code |
|
623 * @return None. |
|
624 */ |
|
625 virtual void Disconnected(TInt aReason) = 0; |
|
626 |
|
627 /** |
|
628 * Called after a driver is sucessfully created by the Generic HID, |
|
629 * when a device is connected. |
|
630 * |
|
631 * @since S60 v5.0 |
|
632 * @param aConnectionId An number used to identify the device in |
|
633 * subsequent calls from the driver to the generic HID, for example |
|
634 * when sending data to the device. |
|
635 * @return None. |
|
636 */ |
|
637 virtual void InitialiseL(TInt aConnectionId) = 0; |
|
638 |
|
639 /** |
|
640 * Enables the driver so that it will configure the device and |
|
641 * start handling interrupt reports from the device |
|
642 * |
|
643 * @since S60 v5.0 |
|
644 * @param aConnectionId A number used to identify the device in |
|
645 * subsequent calls from the driver to the Generic HID, for example |
|
646 * when sending data to the device. |
|
647 * @return None. |
|
648 */ |
|
649 virtual void StartL(TInt aConnectionId) = 0; |
|
650 |
|
651 /** |
|
652 * Disables the driver so that it will stop handling device |
|
653 * interrupt reports |
|
654 * |
|
655 * @since S60 v5.0 |
|
656 * @return None. |
|
657 */ |
|
658 virtual void Stop() = 0; |
|
659 |
|
660 /** |
|
661 * Called by the transport layers to inform the generic HID of |
|
662 * the success of the last Set... command. |
|
663 * |
|
664 * @since S60 v5.0 |
|
665 * @param aCmdAck Status of the last Set... command |
|
666 * @return None. |
|
667 */ |
|
668 virtual void CommandResult(TInt aCmdAck) = 0; |
|
669 |
|
670 /** |
|
671 * Return count of supported fields |
|
672 * |
|
673 * @since S60 v5.0 |
|
674 * @return Number of supported fields. |
|
675 */ |
|
676 virtual TInt SupportedFieldCount()= 0; |
|
677 |
|
678 |
|
679 /** |
|
680 * Set input handling registy |
|
681 * |
|
682 * @since S60 v5.0 |
|
683 * @param aHandlingReg a Input handling registry |
|
684 * @return Number of supported fields. |
|
685 */ |
|
686 virtual void SetInputHandlingReg(CHidInputDataHandlingReg* aHandlingReg) = 0; |
|
687 |
|
688 protected: |
|
689 /** |
|
690 * C++ constructor. |
|
691 */ |
|
692 IMPORT_C CHidDriver(); |
|
693 |
|
694 private: // Data |
|
695 |
|
696 /** |
|
697 * ECOM plugin instance UID. |
|
698 */ |
|
699 TUid iDtor_ID_Key; |
|
700 }; |
|
701 |
|
702 #endif |
|
703 |
|
704 |