VirtualTouchpad.h revision 89af70bce420f011adfeb0f80984b3895c4d7d9b
1#ifndef ANDROID_DVR_VIRTUAL_TOUCHPAD_INTERFACE_H 2#define ANDROID_DVR_VIRTUAL_TOUCHPAD_INTERFACE_H 3 4#include <utils/Errors.h> 5#include <utils/RefBase.h> 6#include <utils/StrongPointer.h> 7 8namespace android { 9namespace dvr { 10 11// Provides a virtual touchpad for injecting events into the input system. 12// 13class VirtualTouchpad : public RefBase { 14 public: 15 // Create a virtual touchpad. 16 // Implementations should provide this, and hide their constructors. 17 // For the user, switching implementations should be as simple as changing 18 // the class whose |Create()| is called. 19 static sp<VirtualTouchpad> Create() { 20 return sp<VirtualTouchpad>(); 21 } 22 23 // Generate a simulated touch event. 24 // 25 // @param x Horizontal touch position. 26 // @param y Vertical touch position. 27 // Values must be in the range [0.0, 1.0). 28 // @param pressure Touch pressure. 29 // Positive values represent contact; use 1.0f if contact 30 // is binary. Use 0.0f for no contact. 31 // @returns OK on success. 32 // 33 virtual status_t Touch(float x, float y, float pressure) = 0; 34 35 // Generate a simulated touchpad button state. 36 // 37 // @param buttons A union of MotionEvent BUTTON_* values. 38 // @returns OK on success. 39 // 40 // Currently only BUTTON_BACK is supported, as the implementation 41 // restricts itself to operations actually required by VrWindowManager. 42 // 43 virtual status_t ButtonState(int buttons) = 0; 44 45 protected: 46 VirtualTouchpad() {} 47 virtual ~VirtualTouchpad() {} 48 49 private: 50 VirtualTouchpad(const VirtualTouchpad&) = delete; 51 void operator=(const VirtualTouchpad&) = delete; 52}; 53 54} // namespace dvr 55} // namespace android 56 57#endif // ANDROID_DVR_VIRTUAL_TOUCHPAD_INTERFACE_H 58