1#ifndef ANDROID_DVR_VIRTUAL_TOUCHPAD_C_CLIENT_H 2#define ANDROID_DVR_VIRTUAL_TOUCHPAD_C_CLIENT_H 3 4#ifdef __cplusplus 5extern "C" { 6#endif 7 8typedef struct DvrVirtualTouchpad DvrVirtualTouchpad; 9 10enum { 11 DVR_VIRTUAL_TOUCHPAD_PRIMARY = 0, 12 DVR_VIRTUAL_TOUCHPAD_VIRTUAL = 1, 13}; 14 15// Creates a new virtual touchpad client. 16// 17// @return Pointer to the created virtual touchpad client; nullptr on failure. 18// 19DvrVirtualTouchpad* dvrVirtualTouchpadCreate(); 20 21// Destroys a virtual touchpad client. 22// 23// @param client Pointer to the virtual touchpad client to be destroyed. 24// 25void dvrVirtualTouchpadDestroy(DvrVirtualTouchpad* client); 26 27// Initialize the virtual touchpad. 28// 29// In the current server implementation, attachment creates and configures 30// the kernel virtual touchpad device(s). A single client may be attached 31// and detached repeatedly, e.g. on entering and leaving VR mode. 32// 33// @param client Pointer to the virtual touchpad client to be attached. 34// @return Zero on success, status_t-style error code on failure. 35// 36int dvrVirtualTouchpadAttach(DvrVirtualTouchpad* client); 37 38// Shut down the virtual touchpad. 39// 40// @param client Pointer to the virtual touchpad client to be detached. 41// @return Zero on success, status_t-style error code on failure. 42// 43int dvrVirtualTouchpadDetach(DvrVirtualTouchpad* client); 44 45// Generate a simulated touch event. 46// 47// @param client Pointer to the virtual touchpad client. 48// @param touchpad Selects touchpad. 49// @param x Horizontal touch position. 50// @param y Vertical touch position. 51// @param pressure Touch pressure; use 0.0 for no touch (lift or hover). 52// @return Zero on success, status_t-style error code on failure. 53// 54int dvrVirtualTouchpadTouch(DvrVirtualTouchpad* client, int touchpad, float x, 55 float y, float pressure); 56 57// Generate a simulated touchpad button state event. 58// 59// @param client Pointer to the virtual touchpad client. 60// @param touchpad Selects touchpad. 61// @param buttons A union of MotionEvent BUTTON_* values. 62// @return Zero on success, status_t-style error code on failure. 63// 64int dvrVirtualTouchpadButtonState(DvrVirtualTouchpad* client, int touchpad, 65 int buttons); 66 67#ifdef __cplusplus 68} // extern "C" 69#endif 70 71#endif // ANDROID_DVR_VIRTUAL_TOUCHPAD_CLIENT_H 72