1 /* 2 * Copyright 2003-2008 Stephan Aßmus <superstippi@gmx.de>. All rights reserved. 3 * Distributed under the terms of the MIT license. 4 */ 5 6 // This class encapsulates all info and status about a tablet. 7 // It runs the thread polling from the USB and sends messages 8 // to/via the InputServer. 9 10 #ifndef TABLET_DEVICE_H 11 #define TABLET_DEVICE_H 12 13 #include <OS.h> 14 15 #include "PointingDevice.h" 16 17 class TabletDevice : public PointingDevice { 18 public: 19 TabletDevice(MasterServerDevice* parent, 20 DeviceReader* reader); 21 virtual ~TabletDevice(); 22 23 virtual status_t InitCheck(); 24 25 virtual status_t Start(); 26 virtual status_t Stop(); 27 28 status_t DetectDevice(const DeviceReader* reader); 29 30 void SetDevice(float maxX, float maxY, 31 uint32 mode = DEVICE_INTUOS); 32 33 void ReadData(const uchar* data, 34 int dataBytes, 35 bool& hasContact, 36 uint32& mode, 37 uint32& buttons, 38 float& x, float& y, 39 float& pressure, 40 int32& clicks, 41 int32& eraser, 42 float& wheelX, 43 float& wheelY, 44 float& tiltX, 45 float& tiltY) const; 46 47 void SetStatus(uint32 mode, 48 uint32 buttons, 49 float x, float y, 50 float pressure, 51 int32 clicks, 52 uint32 modifiers, 53 int32 eraser, 54 float wheelX, 55 float wheelY, 56 float tiltX = 0.0, 57 float tiltY = 0.0, 58 const uchar* data = NULL); 59 60 void SetContact(bool contact); 61 62 private: 63 static int32 poll_usb_device(void* arg); 64 65 bool _DeviceSupportsTilt() const; 66 void _GetName(uint16 productID, 67 const char** name) const; 68 69 enum { 70 DEVICE_UNKOWN, 71 DEVICE_PENPARTNER, 72 DEVICE_GRAPHIRE, 73 DEVICE_INTUOS, 74 DEVICE_INTUOS3, 75 DEVICE_PL500, 76 DEVICE_VOLITO, 77 DEVICE_PENSTATION, 78 DEVICE_CINTIQ, 79 DEVICE_BAMBOO, 80 DEVICE_BAMBOO_PT, 81 }; 82 83 enum { 84 MODE_PEN, 85 MODE_MOUSE, 86 }; 87 88 thread_id fThreadID; 89 90 // device specific settings 91 uint32 fDeviceMode; 92 float fMaxX; 93 float fMaxY; 94 int fDataBytes; 95 96 float fPosX; 97 float fPosY; 98 float fFakeMouseX; 99 float fFakeMouseY; 100 uint32 fButtons; 101 float fPressure; 102 uint32 fModifiers; 103 bool fEraser; 104 float fTiltX; 105 float fTiltY; 106 float fWheelX; 107 float fWheelY; 108 bigtime_t fLastClickTime; 109 int32 fClicks; 110 bool fHasContact; 111 112 float fJitterX; 113 float fJitterY; 114 }; 115 116 #endif // WACOM_TABLET_H 117