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