BPicture: Fix archive constructor.
[haiku.git] / src / add-ons / kernel / drivers / input / usb_hid / HIDWriter.h
blobb5e58875e9a10dd935045fa41f56b76701bffcc5
1 /*
2 * Copyright 2011, Michael Lotz, mmlr@mlotz.ch.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef HID_WRITER_H
6 #define HID_WRITER_H
8 #include "HIDDataTypes.h"
11 class HIDWriter {
12 public:
13 HIDWriter(size_t blockSize = 20);
14 ~HIDWriter();
16 // High Level
18 status_t DefineInputPadding(uint8 count,
19 uint8 bitLength);
20 status_t DefineInputData(uint8 count, uint8 bitLength,
21 main_item_data data, uint32 logicalMinimum,
22 uint32 logicalMaximum, uint16 usagePage,
23 uint16 usageMinimum,
24 uint16 usageMaximum = 0xffff);
26 status_t BeginCollection(uint8 collectionType,
27 uint16 usagePage, uint16 usageID);
28 status_t EndCollection();
30 // Low Level
32 status_t SetUsagePage(uint16 usagePage);
33 status_t SetLogicalMinimum(uint32 logicalMinimum);
34 status_t SetLogicalMaximum(uint32 logicalMaximum);
35 status_t SetReportSize(uint8 reportSize);
36 status_t SetReportID(uint8 reportID);
37 status_t SetReportCount(uint8 reportCount);
39 status_t LocalSetUsageID(uint16 usageID);
40 status_t LocalSetUsageMinimum(uint16 usageMinimum);
41 status_t LocalSetUsageMaximum(uint16 usageMaximum);
43 status_t BeginCollection(uint8 collectionType);
45 status_t Input(main_item_data data);
46 status_t Output(main_item_data data);
47 status_t Feature(main_item_data data);
49 // Generic
51 status_t WriteShortItem(uint8 type, uint8 tag,
52 uint32 value);
53 status_t Write(const void *data, size_t length);
55 size_t BufferLength() { return fBufferUsed; };
56 const uint8 * Buffer() { return fBuffer; };
58 void Reset();
60 private:
61 size_t fBlockSize;
62 size_t fBufferAllocated;
63 size_t fBufferUsed;
64 uint8 * fBuffer;
65 status_t fStatus;
68 #endif // HID_WRITER_H