BPicture: Fix archive constructor.
[haiku.git] / src / add-ons / kernel / drivers / input / usb_hid / HIDParser.h
blobc4be3f7962e5a125b227985c48693266572eb185
1 /*
2 * Copyright 2009, Michael Lotz, mmlr@mlotz.ch.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef HID_PARSER_H
6 #define HID_PARSER_H
8 #include "HIDDataTypes.h"
10 class HIDCollection;
11 class HIDDevice;
12 class HIDReport;
14 class HIDParser {
15 public:
16 HIDParser(HIDDevice *device);
17 ~HIDParser();
19 HIDDevice * Device() { return fDevice; };
21 status_t ParseReportDescriptor(
22 const uint8 *reportDescriptor,
23 size_t descriptorLength);
25 bool UsesReportIDs() { return fUsesReportIDs; };
27 HIDReport * FindReport(uint8 type, uint8 id);
28 uint8 CountReports(uint8 type);
29 HIDReport * ReportAt(uint8 type, uint8 index);
30 size_t MaxReportSize();
32 HIDCollection * RootCollection() { return fRootCollection; };
34 void SetReport(status_t status, uint8 *report,
35 size_t length);
37 void PrintToStream();
39 private:
40 HIDReport * _FindOrCreateReport(uint8 type, uint8 id);
41 float _CalculateResolution(global_item_state *state);
42 void _Reset();
44 HIDDevice * fDevice;
45 bool fUsesReportIDs;
46 uint8 fReportCount;
47 HIDReport ** fReports;
48 HIDCollection * fRootCollection;
51 #endif // HID_PARSER_H