1 /* 2 * Copyright 2013 Stephan Aßmus <superstippi@gmx.de> 3 * Copyright 2010-2011 Enrique Medina Gremaldos <quiqueiii@gmail.com> 4 * Copyright 2008-2011 Michael Lotz <mmlr@mlotz.ch> 5 * Distributed under the terms of the MIT license. 6 */ 7 #ifndef USB_TABLET_PROTOCOL_HANDLER_H 8 #define USB_TABLET_PROTOCOL_HANDLER_H 9 10 11 #include <InterfaceDefs.h> 12 13 #include "ProtocolHandler.h" 14 15 16 class HIDCollection; 17 class HIDReportItem; 18 19 20 #ifndef B_MAX_MOUSE_BUTTONS 21 # define B_MAX_MOUSE_BUTTONS 8 22 #endif 23 24 #ifndef B_MAX_DIGITIZER_SWITCHES 25 #define B_MAX_DIGITIZER_SWITCHES 5 26 #endif 27 28 class TabletProtocolHandler : public ProtocolHandler { 29 public: 30 TabletProtocolHandler(HIDReport &report, 31 HIDReportItem &xAxis, 32 HIDReportItem &yAxis); 33 34 static void AddHandlers(HIDDevice &device, 35 HIDCollection &collection, 36 ProtocolHandler *&handlerList); 37 38 virtual status_t Control(uint32 *cookie, uint32 op, void *buffer, 39 size_t length); 40 41 private: 42 status_t _ReadReport(void *buffer, uint32 *cookie); 43 44 HIDReport & fReport; 45 46 HIDReportItem & fXAxis; 47 HIDReportItem & fYAxis; 48 HIDReportItem * fWheel; 49 HIDReportItem * fButtons[B_MAX_MOUSE_BUTTONS]; 50 HIDReportItem * fSwitches[B_MAX_DIGITIZER_SWITCHES]; 51 52 HIDReportItem * fPressure; 53 HIDReportItem * fInRange; 54 HIDReportItem * fTip; 55 HIDReportItem * fBarrelSwitch; 56 HIDReportItem * fEraser; 57 HIDReportItem * fXTilt; 58 HIDReportItem * fYTilt; 59 60 uint32 fLastButtons; 61 uint32 fLastSwitches; 62 uint32 fClickCount; 63 bigtime_t fLastClickTime; 64 bigtime_t fClickSpeed; 65 }; 66 67 #endif // USB_TABLET_PROTOCOL_HANDLER_H 68