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: HID field descriptor definition |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef C_FIELD_H |
|
19 #define C_FIELD_H |
|
20 |
|
21 |
|
22 #include <e32base.h> |
|
23 |
|
24 |
|
25 const TInt KFieldAttributeConstant = 1<<0; //!< Data (0) or Constant (1) |
|
26 const TInt KFieldAttributeVariable = 1<<1; //!< Array (0) or Variable (1) |
|
27 const TInt KFieldAttributeRelative = 1<<2; //!< Absolute (0) or Relative (1) |
|
28 const TInt KFieldAttributeWrap = 1<<3; //!< No wrap (0) or Wrap (1) |
|
29 const TInt KFieldAttributeNonLinear = 1<<4; //!< Linear (0) or Non-linear (1) |
|
30 const TInt KFieldAttributeNoPreferred = 1<<5; //!< Preferred state (0) or not (1) |
|
31 const TInt KFieldAttributeNullState = 1<<6; //!< No null position (0) or null state (1) |
|
32 const TInt KFieldAttributeVolatile = 1<<7; //!< Non-volatile (0) or volatile (1) |
|
33 const TInt KFieldAttributeBufferedBytes = 1<<8; //!< Bit field (0) or buffered bytes (1) |
|
34 |
|
35 const TInt KSizeOfByte = 8; |
|
36 /** |
|
37 * HID report field presentation |
|
38 * Represents an individual field in a HID report, ie. the attributes |
|
39 * of an input, output or feature Main item defined in the HID report |
|
40 * descriptor. |
|
41 * |
|
42 * The CField contains information such as the usage IDs sent in the |
|
43 * the report, the type of the report (input, output or feature) and |
|
44 * the logical range. |
|
45 * |
|
46 * |
|
47 * @lib generichid.lib |
|
48 * @since S60 v5.0 |
|
49 */ |
|
50 class CField : public CBase |
|
51 { |
|
52 public: |
|
53 enum TType |
|
54 { |
|
55 EInput, //!< Input report |
|
56 EOutput, //!< Output report |
|
57 EFeature //!< Feature report |
|
58 }; |
|
59 |
|
60 |
|
61 |
|
62 public: |
|
63 static CField* NewL(); |
|
64 static CField* NewLC(); |
|
65 |
|
66 /** |
|
67 * Destructor. |
|
68 */ |
|
69 virtual ~CField(); |
|
70 |
|
71 public: |
|
72 // Accessors: |
|
73 |
|
74 /** |
|
75 * Set Report root |
|
76 * |
|
77 * @since S60 v5.0 |
|
78 * @return None |
|
79 */ |
|
80 IMPORT_C TInt UsagePage() const; |
|
81 |
|
82 /** |
|
83 * Return report id |
|
84 * |
|
85 * @since S60 v5.0 |
|
86 * @return report id |
|
87 */ |
|
88 IMPORT_C TInt ReportId() const; |
|
89 |
|
90 /** |
|
91 * Return offset |
|
92 * |
|
93 * @since S60 v5.0 |
|
94 * @return offset |
|
95 */ |
|
96 IMPORT_C TInt Offset() const; |
|
97 |
|
98 /** |
|
99 * Return size |
|
100 * |
|
101 * @since S60 v5.0 |
|
102 * @return None |
|
103 */ |
|
104 IMPORT_C TInt Size() const; |
|
105 |
|
106 /** |
|
107 * Return count |
|
108 * |
|
109 * @since S60 v5.0 |
|
110 * @return count |
|
111 */ |
|
112 IMPORT_C TInt Count() const; |
|
113 |
|
114 /** |
|
115 * Return logical minimium |
|
116 * |
|
117 * @since S60 v5.0 |
|
118 * @return Logical minimium |
|
119 */ |
|
120 IMPORT_C TInt LogicalMin() const; |
|
121 |
|
122 /** |
|
123 * Return logical maximum |
|
124 * |
|
125 * @since S60 v5.0 |
|
126 * @return logical maximum |
|
127 */ |
|
128 IMPORT_C TInt LogicalMax() const; |
|
129 |
|
130 /** |
|
131 * Return usage min |
|
132 * |
|
133 * @since S60 v5.0 |
|
134 * @return None |
|
135 */ |
|
136 IMPORT_C TInt UsageMin() const; |
|
137 |
|
138 /** |
|
139 * Return usage max |
|
140 * |
|
141 * @since S60 v5.0 |
|
142 * @return usage max |
|
143 */ |
|
144 IMPORT_C TInt UsageMax() const; |
|
145 |
|
146 /** |
|
147 * Return Physical minimum |
|
148 * |
|
149 * @since S60 v5.0 |
|
150 * @return physical minimum |
|
151 */ |
|
152 IMPORT_C TInt PhysicalMin() const; |
|
153 |
|
154 /** |
|
155 * Return Physical max |
|
156 * |
|
157 * @since S60 v5.0 |
|
158 * @return return physical max |
|
159 */ |
|
160 IMPORT_C TInt PhysicalMax() const; |
|
161 |
|
162 /** |
|
163 * Return unit |
|
164 * |
|
165 * @since S60 v5.0 |
|
166 * @return Unit |
|
167 */ |
|
168 IMPORT_C TInt Unit() const; |
|
169 |
|
170 /** |
|
171 * Return unit exponent |
|
172 * |
|
173 * @since S60 v5.0 |
|
174 * @return unit exponent |
|
175 */ |
|
176 IMPORT_C TInt UnitExponent() const; |
|
177 |
|
178 /** |
|
179 * Return Designator index |
|
180 * |
|
181 * @since S60 v5.0 |
|
182 * @return Designator Index |
|
183 */ |
|
184 IMPORT_C TInt DesignatorIndex() const; |
|
185 |
|
186 /** |
|
187 * Return designator minimium |
|
188 * |
|
189 * @since S60 v5.0 |
|
190 * @return return designator index minimium |
|
191 */ |
|
192 IMPORT_C TInt DesignatorMin() const; |
|
193 |
|
194 /** |
|
195 * Return designator maximium |
|
196 * |
|
197 * @since S60 v5.0 |
|
198 * @return designator maximium |
|
199 */ |
|
200 IMPORT_C TInt DesignatorMax() const; |
|
201 |
|
202 /** |
|
203 * Return string minimum |
|
204 * |
|
205 * @since S60 v5.0 |
|
206 * @return None |
|
207 */ |
|
208 IMPORT_C TInt StringMin() const; |
|
209 |
|
210 /** |
|
211 * Return string maximum |
|
212 * |
|
213 * @since S60 v5.0 |
|
214 * @return string maximum |
|
215 */ |
|
216 IMPORT_C TInt StringMax() const; |
|
217 |
|
218 /** |
|
219 * Return string index |
|
220 * |
|
221 * @since S60 v5.0 |
|
222 * @return string index |
|
223 */ |
|
224 IMPORT_C TInt StringIndex() const; |
|
225 |
|
226 /** |
|
227 * Return attributes |
|
228 * |
|
229 * @since S60 v5.0 |
|
230 * @return attributes |
|
231 */ |
|
232 IMPORT_C TUint32 Attributes() const; |
|
233 |
|
234 /** |
|
235 * Return type |
|
236 * |
|
237 * @since S60 v5.0 |
|
238 * @return type |
|
239 */ |
|
240 IMPORT_C TType Type() const; |
|
241 |
|
242 /** |
|
243 * Return variable status |
|
244 * |
|
245 * @since S60 v5.0 |
|
246 * @return variable status |
|
247 */ |
|
248 IMPORT_C TBool IsVariable() const; |
|
249 |
|
250 /** |
|
251 * Return array status |
|
252 * |
|
253 * @since S60 v5.0 |
|
254 * @return arrau status |
|
255 */ |
|
256 IMPORT_C TBool IsArray() const; |
|
257 |
|
258 /** |
|
259 * Return data status |
|
260 * |
|
261 * @since S60 v5.0 |
|
262 * @return data status |
|
263 */ |
|
264 IMPORT_C TBool IsData() const; |
|
265 |
|
266 /** |
|
267 * Return constant status |
|
268 * |
|
269 * @since S60 v5.0 |
|
270 * @return constant status |
|
271 */ |
|
272 IMPORT_C TBool IsConstant() const; |
|
273 |
|
274 /** |
|
275 * Return input status |
|
276 * |
|
277 * @since S60 v5.0 |
|
278 * @return input status |
|
279 */ |
|
280 IMPORT_C TBool IsInput() const; |
|
281 |
|
282 /** |
|
283 * Return output status |
|
284 * |
|
285 * @since S60 v5.0 |
|
286 * @return None |
|
287 */ |
|
288 IMPORT_C TBool IsOutput() const; |
|
289 |
|
290 /** |
|
291 * Return feature status |
|
292 * |
|
293 * @since S60 v5.0 |
|
294 * @return feature status |
|
295 */ |
|
296 IMPORT_C TBool IsFeature() const; |
|
297 |
|
298 /** |
|
299 * Check if reportid is in report |
|
300 * |
|
301 * @since S60 v5.0 |
|
302 * @param aReportId report id |
|
303 * @return true if reportid is in report |
|
304 */ |
|
305 IMPORT_C TBool IsInReport(TInt aReportId) const; |
|
306 |
|
307 /** |
|
308 * Check if usage exsist |
|
309 * |
|
310 * @since S60 v5.0 |
|
311 * @param aUsage Usage id |
|
312 * @return None |
|
313 */ |
|
314 IMPORT_C TBool HasUsage(TInt aUsage) const; |
|
315 |
|
316 /** |
|
317 * Return usage array |
|
318 * |
|
319 * @since S60 v5.0 |
|
320 * @return usage array |
|
321 */ |
|
322 IMPORT_C TArray<TInt> UsageArray() const; |
|
323 |
|
324 /** |
|
325 * Return usage |
|
326 * |
|
327 * @since S60 v5.0 |
|
328 * @param aIndex usage array index |
|
329 * @return usage |
|
330 */ |
|
331 IMPORT_C TInt Usage(TInt aIndex) const; |
|
332 |
|
333 /** |
|
334 * Return usage count |
|
335 * |
|
336 * @since S60 v5.0 |
|
337 * @return usage count |
|
338 */ |
|
339 IMPORT_C TInt UsageCount() const; |
|
340 |
|
341 /** |
|
342 * Return last usage |
|
343 * |
|
344 * @since S60 v5.0 |
|
345 * @return last usage |
|
346 */ |
|
347 IMPORT_C TInt LastUsage() const; |
|
348 |
|
349 /** |
|
350 * Set type |
|
351 * |
|
352 * @since S60 v5.0 |
|
353 * @param aType type of field |
|
354 * @return None |
|
355 */ |
|
356 IMPORT_C void SetType(const TType& aType); |
|
357 |
|
358 /** |
|
359 * Add usage |
|
360 * |
|
361 * @since S60 v5.0 |
|
362 * @param aUsage usage to be added |
|
363 * @return None |
|
364 */ |
|
365 IMPORT_C void AddUsageL(TInt aUsage); |
|
366 |
|
367 /** |
|
368 * Clear usage list |
|
369 * |
|
370 * @since S60 v5.0 |
|
371 * @return None |
|
372 */ |
|
373 IMPORT_C void ClearUsageList(); |
|
374 |
|
375 /** |
|
376 * Set usage page |
|
377 * |
|
378 * @since S60 v5.0 |
|
379 * @param aUsagePage usagepage to be set |
|
380 * @return None |
|
381 */ |
|
382 IMPORT_C void SetUsagePage(TInt aUsagePage); |
|
383 |
|
384 /** |
|
385 * Set offset |
|
386 * |
|
387 * @since S60 v5.0 |
|
388 * @param aOffset offset to be set |
|
389 * @return None |
|
390 */ |
|
391 IMPORT_C void SetOffset(TInt aOffset); |
|
392 |
|
393 /** |
|
394 * Set size |
|
395 * |
|
396 * @since S60 v5.0 |
|
397 * @param aSize size to be set |
|
398 * @return None |
|
399 */ |
|
400 IMPORT_C void SetSize(TInt aSize); |
|
401 |
|
402 /** |
|
403 * Set count |
|
404 * |
|
405 * @since S60 v5.0 |
|
406 * @param aCount Count to be set |
|
407 * @return None |
|
408 */ |
|
409 IMPORT_C void SetCount(TInt aCount); |
|
410 |
|
411 /** |
|
412 * Set logical minimium |
|
413 * |
|
414 * @since S60 v5.0 |
|
415 * @param aMin Logical minimium to be set |
|
416 * @return None |
|
417 */ |
|
418 IMPORT_C void SetLogicalMin(TInt aMin); |
|
419 |
|
420 /** |
|
421 * Set logical maximum |
|
422 * |
|
423 * @since S60 v5.0 |
|
424 * @param aMax logical maximum to be used |
|
425 * @return None |
|
426 */ |
|
427 IMPORT_C void SetLogicalMax(TInt aMax); |
|
428 |
|
429 /** |
|
430 * Set usage min |
|
431 * |
|
432 * @since S60 v5.0 |
|
433 * @param aMin usage minimium to be set. |
|
434 * @return None |
|
435 */ |
|
436 IMPORT_C void SetUsageMin(TInt aMin); |
|
437 |
|
438 /** |
|
439 * Set usage maximum |
|
440 * |
|
441 * @since S60 v5.0 |
|
442 * @param aMax usage max to be set |
|
443 * @return None |
|
444 */ |
|
445 IMPORT_C void SetUsageMax(TInt aMax); |
|
446 |
|
447 /** |
|
448 * Set Report ID |
|
449 * |
|
450 * @since S60 v5.0 |
|
451 * @param aReportId report id to be set |
|
452 * @return None |
|
453 */ |
|
454 IMPORT_C void SetReportId(TInt aReportId); |
|
455 |
|
456 /** |
|
457 * Set attributes |
|
458 * |
|
459 * @since S60 v5.0 |
|
460 * @param aAttributes attributes to be set |
|
461 * @return None |
|
462 */ |
|
463 IMPORT_C void SetAttributes(TUint32 aAttributes); |
|
464 |
|
465 /** |
|
466 * Set physical minimium |
|
467 * |
|
468 * @since S60 v5.0 |
|
469 * @param aValue physical minimium value |
|
470 * @return None |
|
471 */ |
|
472 IMPORT_C void SetPhysicalMin(TInt aValue); |
|
473 |
|
474 /** |
|
475 * Set Physical maximum |
|
476 * |
|
477 * @since S60 v5.0 |
|
478 * @param aValue physical maximum value |
|
479 * @return None |
|
480 */ |
|
481 IMPORT_C void SetPhysicalMax(TInt aValue); |
|
482 |
|
483 /** |
|
484 * Set unit value |
|
485 * |
|
486 * @since S60 v5.0 |
|
487 * @param aValue unit value |
|
488 * @return None |
|
489 */ |
|
490 IMPORT_C void SetUnit(TInt aValue); |
|
491 |
|
492 /** |
|
493 * Set unit exponent |
|
494 * |
|
495 * @since S60 v5.0 |
|
496 * @param aValue unit exponent valut to be set |
|
497 * @return None |
|
498 */ |
|
499 IMPORT_C void SetUnitExponent(TInt aValue); |
|
500 |
|
501 /** |
|
502 * Set Designator index |
|
503 * |
|
504 * @since S60 v5.0 |
|
505 * @param aValue Designator index value |
|
506 * @return None |
|
507 */ |
|
508 IMPORT_C void SetDesignatorIndex(TInt aValue); |
|
509 |
|
510 /** |
|
511 * Set designator minimium |
|
512 * |
|
513 * @since S60 v5.0 |
|
514 * @param aValue designator minimum value |
|
515 * @return None |
|
516 */ |
|
517 IMPORT_C void SetDesignatorMin(TInt aValue); |
|
518 |
|
519 /** |
|
520 * Set designator maximium value |
|
521 * |
|
522 * @since S60 v5.0 |
|
523 * @param aValue designator maximium value |
|
524 * @return None |
|
525 */ |
|
526 IMPORT_C void SetDesignatorMax(TInt aValue); |
|
527 |
|
528 /** |
|
529 * Set string minimium value |
|
530 * |
|
531 * @since S60 v5.0 |
|
532 * @param aValue string minimium value |
|
533 * @return None |
|
534 */ |
|
535 IMPORT_C void SetStringMin(TInt aValue); |
|
536 |
|
537 /** |
|
538 * Set string maximum value |
|
539 * |
|
540 * @since S60 v5.0 |
|
541 * @param aValue string maximum value to be set |
|
542 * @return None |
|
543 */ |
|
544 IMPORT_C void SetStringMax(TInt aValue); |
|
545 |
|
546 /** |
|
547 * Set string index |
|
548 * |
|
549 * @since S60 v5.0 |
|
550 * @param aValue string index |
|
551 * @return None |
|
552 */ |
|
553 IMPORT_C void SetStringIndex(TInt aValue); |
|
554 |
|
555 /** |
|
556 * Set Logical range |
|
557 * |
|
558 * @since S60 v5.0 |
|
559 * @param aMin logical range minimium value |
|
560 * @param aMax logical range maximum value |
|
561 * @return None |
|
562 */ |
|
563 IMPORT_C void SetLogicalRange(TInt aMin, TInt aMax); |
|
564 |
|
565 /** |
|
566 * Set Usage range |
|
567 * |
|
568 * @since S60 v5.0 |
|
569 * @param aMin usage range minimium value |
|
570 * @param aMax usage range maximum value |
|
571 * @return None |
|
572 */ |
|
573 IMPORT_C void SetUsageRange(TInt aMin, TInt aMax); |
|
574 |
|
575 /** |
|
576 * Set Physical range |
|
577 * |
|
578 * @since S60 v5.0 |
|
579 * @param aMin physical range minimium value |
|
580 * @param aMax physical range maximum value |
|
581 * @return None |
|
582 */ |
|
583 IMPORT_C void SetPhysicalRange(TInt aMin, TInt aMax); |
|
584 |
|
585 /** |
|
586 * Set string range |
|
587 * |
|
588 * @since S60 v5.0 |
|
589 * @param aMin string range minimium value |
|
590 * @param aMax string range maximum value |
|
591 * @return None |
|
592 */ |
|
593 IMPORT_C void SetStringRange(TInt aMin, TInt aMax); |
|
594 |
|
595 /** |
|
596 * Set designator range |
|
597 * |
|
598 * @since S60 v5.0 |
|
599 * @param aMin designator range minimium value |
|
600 * @param aMax designator range maximum value |
|
601 * @return None |
|
602 */ |
|
603 IMPORT_C void SetDesignatorRange(TInt aMin, TInt aMax); |
|
604 |
|
605 private: |
|
606 CField(); |
|
607 |
|
608 |
|
609 |
|
610 private: |
|
611 |
|
612 /** |
|
613 * Input, output or feature report |
|
614 */ |
|
615 TType iType; |
|
616 |
|
617 // For a detailed description of the use of the following members, |
|
618 // see "USB Device Class Definition for Human Interface Devices |
|
619 // (HID)", Firmware Specification, Version 1.11, USB Implementers' |
|
620 // Forum, June 2001. |
|
621 |
|
622 /** |
|
623 * The usage page this field is associated with (G) |
|
624 */ |
|
625 TInt iUsagePage; |
|
626 |
|
627 /** |
|
628 * ID for the HID report containing this field (G) |
|
629 */ |
|
630 TInt iReportId; |
|
631 |
|
632 /** |
|
633 * Field offset (in bits) from start of report |
|
634 */ |
|
635 TInt iPos; |
|
636 |
|
637 /** |
|
638 * Bit size of each item in the current field (G) |
|
639 */ |
|
640 TInt iSize; |
|
641 |
|
642 /** |
|
643 * Number of items in the report field (G) |
|
644 */ |
|
645 TInt iCount; |
|
646 |
|
647 /** |
|
648 * Minimum extent value in logical units (G) |
|
649 */ |
|
650 TInt iLogicalMin; |
|
651 |
|
652 /** |
|
653 * Maximum extent value in logical units (G) |
|
654 */ |
|
655 TInt iLogicalMax; |
|
656 |
|
657 /** |
|
658 * Starting usage associated with array / bitmap (L) |
|
659 */ |
|
660 TInt iUsageMin; |
|
661 |
|
662 /** |
|
663 * Ending usage associated with array / bitmap (L)L) |
|
664 */ |
|
665 TInt iUsageMax; |
|
666 |
|
667 /** |
|
668 * Unit value (G) |
|
669 */ |
|
670 TInt iUnit; |
|
671 |
|
672 /** |
|
673 * Value of the unit exponent in base 10 (G) |
|
674 */ |
|
675 TInt iUnitExponent; |
|
676 |
|
677 /** |
|
678 * Body part used for a control (L) |
|
679 */ |
|
680 TInt iDesignatorIndex; |
|
681 |
|
682 /** |
|
683 * String associated with a control (L) |
|
684 */ |
|
685 TInt iStringIndex; |
|
686 |
|
687 /** |
|
688 * Minimum physical extent for a variable item (G) |
|
689 */ |
|
690 TInt iPhysicalMin; |
|
691 |
|
692 /** |
|
693 * Maximum physical extent for a variable item (G) |
|
694 */ |
|
695 TInt iPhysicalMax; |
|
696 |
|
697 /** |
|
698 * First string index for a group of strings (L) |
|
699 */ |
|
700 TInt iStringMin; |
|
701 |
|
702 /** |
|
703 * Last string index for a group of strings (L) |
|
704 */ |
|
705 TInt iStringMax; |
|
706 |
|
707 /** |
|
708 * Starting designator index (L) |
|
709 */ |
|
710 TInt iDesignatorMin; |
|
711 |
|
712 /** |
|
713 * Ending designator index (L) |
|
714 */ |
|
715 TInt iDesignatorMax; |
|
716 |
|
717 /** |
|
718 * Flags associated with a main item (e.g. "array") |
|
719 */ |
|
720 TUint32 iAttributes; |
|
721 |
|
722 /** |
|
723 * The usage indexes associated with this field (G) |
|
724 */ |
|
725 RArray<TInt> iUsageList; |
|
726 |
|
727 // (G) = Global item |
|
728 // (L) = Local item |
|
729 }; |
|
730 |
|
731 #endif |
|
732 |
|