BPicture: Fix archive constructor.
[haiku.git] / src / add-ons / kernel / drivers / input / usb_hid / HIDReportItem.h
blob2ee27341c8e57f5483288c262d9db1dcb011390e
1 /*
2 * Copyright 2009-2011, Michael Lotz, mmlr@mlotz.ch.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef HID_REPORT_ITEM_H
6 #define HID_REPORT_ITEM_H
8 #include <SupportDefs.h>
10 class HIDReport;
12 class HIDReportItem {
13 public:
14 HIDReportItem(HIDReport *report,
15 uint32 bitOffset, uint8 bitLength,
16 bool hasData, bool isArray, bool isRelative,
17 uint32 minimum, uint32 maximum,
18 uint32 usageMinimum, uint32 usageMaximum);
20 HIDReport * Report() { return fReport; };
22 bool HasData() { return fHasData; };
23 bool Relative() { return fRelative; };
24 bool Array() { return fArray; };
25 bool Signed() { return fMinimum > fMaximum; };
27 uint16 UsagePage();
28 uint16 UsageID();
30 uint32 UsageMinimum() { return fUsageMinimum; };
31 uint32 UsageMaximum() { return fUsageMaximum; };
33 status_t Extract();
34 status_t Insert();
36 status_t SetData(uint32 data);
37 uint32 Data() { return fData; };
39 uint32 ScaledData(uint8 scaleToBits, bool toBeSigned);
40 uint32 ScaledRangeData(uint32 minimum, uint32 maximum);
41 float ScaledFloatData();
43 bool Valid() { return fValid; };
45 void PrintToStream(uint32 indentLevel = 0);
46 private:
47 HIDReport * fReport;
48 uint32 fByteOffset;
49 uint8 fShift;
50 uint32 fMask;
51 uint8 fBitCount;
52 uint8 fByteCount;
53 bool fHasData;
54 bool fArray;
55 bool fRelative;
56 uint32 fMinimum;
57 uint32 fMaximum;
58 uint32 fUsageMinimum;
59 uint32 fUsageMaximum;
61 uint32 fData;
62 bool fValid;
65 #endif // HID_REPORT_ITEM_H