Steve Kondik | 107d2e5 | 2017-06-13 17:34:56 -0700 | [diff] [blame] | 1 | #ifndef INPUT_DEVICE_H |
| 2 | #define INPUT_DEVICE_H |
| 3 | |
| 4 | #include <utils/Errors.h> |
| 5 | #include <utils/RefBase.h> |
| 6 | |
| 7 | #include <rfb/rfb.h> |
| 8 | |
| 9 | |
| 10 | #define UINPUT_DEVICE "/dev/uinput" |
| 11 | |
| 12 | namespace android { |
| 13 | |
| 14 | class InputDevice : public RefBase { |
| 15 | public: |
| 16 | static status_t start(uint32_t width, uint32_t height); |
| 17 | static status_t stop(); |
| 18 | |
| 19 | static void keyEvent(rfbBool down, rfbKeySym key, rfbClientPtr cl); |
| 20 | static void pointerEvent(int buttonMask, int x, int y, rfbClientPtr cl); |
| 21 | |
| 22 | private: |
| 23 | |
| 24 | static status_t inject(uint16_t type, uint16_t code, int32_t value); |
| 25 | static status_t injectSyn(uint16_t type, uint16_t code, int32_t value); |
| 26 | static status_t movePointer(int32_t x, int32_t y); |
| 27 | static status_t setPointer(int32_t x, int32_t y); |
| 28 | static status_t press(uint16_t code); |
| 29 | static status_t release(uint16_t code); |
| 30 | static status_t click(uint16_t code); |
| 31 | |
| 32 | static int keysym2scancode(rfbKeySym c, rfbClientPtr cl, int* sh, int* alt); |
| 33 | |
| 34 | static int sFD; |
| 35 | |
| 36 | }; |
| 37 | |
| 38 | }; |
| 39 | #endif |