26#ifndef _ULTIBO_TOUCH_H
27#define _ULTIBO_TOUCH_H
38#define TOUCH_NAME_PREFIX "Touch"
41#define TOUCH_TYPE_NONE 0
42#define TOUCH_TYPE_RESISTIVE 1
43#define TOUCH_TYPE_CAPACITIVE 2
45#define TOUCH_TYPE_MAX 2
48#define TOUCH_STATE_DISABLED 0
49#define TOUCH_STATE_ENABLED 1
51#define TOUCH_STATE_MAX 1
54#define TOUCH_FLAG_NONE 0x00000000
55#define TOUCH_FLAG_NON_BLOCK 0x00000001
56#define TOUCH_FLAG_PEEK_BUFFER 0x00000002
57#define TOUCH_FLAG_MOUSE_DATA 0x00000004
58#define TOUCH_FLAG_MULTI_POINT 0x00000008
59#define TOUCH_FLAG_PRESSURE 0x00000010
60#define TOUCH_FLAG_SWAP_XY 0x00000020
61#define TOUCH_FLAG_INVERT_X 0x00000040
62#define TOUCH_FLAG_INVERT_Y 0x00000080
63#define TOUCH_FLAG_SWAP_MAX_XY 0x00000100
64#define TOUCH_FLAG_RELEASE_TIMER 0x00000200
67#define TOUCH_FLAG_MASK TOUCH_FLAG_NON_BLOCK | TOUCH_FLAG_MOUSE_DATA | TOUCH_FLAG_MULTI_POINT | TOUCH_FLAG_PRESSURE | TOUCH_FLAG_SWAP_XY | TOUCH_FLAG_INVERT_X | TOUCH_FLAG_INVERT_Y | TOUCH_FLAG_SWAP_MAX_XY | TOUCH_FLAG_RELEASE_TIMER
70#define TOUCH_CONTROL_GET_FLAG 1
71#define TOUCH_CONTROL_SET_FLAG 2
72#define TOUCH_CONTROL_CLEAR_FLAG 3
73#define TOUCH_CONTROL_FLUSH_BUFFER 4
74#define TOUCH_CONTROL_GET_WIDTH 5
75#define TOUCH_CONTROL_GET_HEIGHT 6
76#define TOUCH_CONTROL_GET_MAX_X 7
77#define TOUCH_CONTROL_GET_MAX_Y 8
78#define TOUCH_CONTROL_GET_MAX_Z 9
79#define TOUCH_CONTROL_GET_MAX_POINTS 10
80#define TOUCH_CONTROL_GET_ROTATION 11
81#define TOUCH_CONTROL_SET_ROTATION 12
82#define TOUCH_CONTROL_GET_CALLBACK 13
83#define TOUCH_CONTROL_SET_CALLBACK 14
86#define TOUCH_BUFFER_SIZE 1024
89#define TOUCH_FINGER 0x00000001
92#define TOUCH_ID_UNKNOWN (uint16_t)-1
95#define TOUCH_X_UNKNOWN -1
98#define TOUCH_Y_UNKNOWN -1
101#define TOUCH_Z_UNKNOWN -1
104#define TOUCH_ROTATION_0 FRAMEBUFFER_ROTATION_0
105#define TOUCH_ROTATION_90 FRAMEBUFFER_ROTATION_90
106#define TOUCH_ROTATION_180 FRAMEBUFFER_ROTATION_180
107#define TOUCH_ROTATION_270 FRAMEBUFFER_ROTATION_270
struct _DEVICE DEVICE
Definition devices.h:373
#define STDCALL
Definition globaltypes.h:45
_Bool BOOL
Built in Boolean type (1 byte) (Redeclared here for flexibility).
Definition globaltypes.h:55
HANDLE SEMAPHORE_HANDLE
Definition globaltypes.h:107
HANDLE MUTEX_HANDLE
Definition globaltypes.h:105
TOUCH_DATA buffer[TOUCH_BUFFER_SIZE]
Definition touch.h:131
uint32_t start
Index of first buffer ready.
Definition touch.h:129
uint32_t count
Number of entries ready in buffer.
Definition touch.h:130
SEMAPHORE_HANDLE wait
Buffer ready semaphore.
Definition touch.h:128
uint16_t touchheight
The Height of this touch point (If applicable).
Definition touch.h:120
void * parameter
The parameter for the event callback (If applicable).
Definition touch.h:121
int16_t positionz
The Z position of this touch point (If applicable).
Definition touch.h:118
int16_t positionx
The X position of this touch point.
Definition touch.h:116
int16_t positiony
The Y position of this touch point.
Definition touch.h:117
uint16_t touchwidth
The Width of this touch point (If applicable).
Definition touch.h:119
uint16_t pointid
The touch point ID value for this touch (First ID is 1).
Definition touch.h:115
uint32_t info
Bitmap of touch info values (eg TOUCH_FINGER).
Definition touch.h:114
MUTEX_HANDLE lock
Device lock.
Definition touch.h:191
uint32_t receiveerrors
Definition touch.h:198
DEVICE device
The Device entry for this Touch device.
Definition touch.h:177
void * parameter
Parameter for the event callback (or nil).
Definition touch.h:193
touch_device_update_proc deviceupdate
A Device specific DeviceUpdate method implementing a standard Touch device interface (Or nil if the d...
Definition touch.h:187
uint32_t receivecount
Definition touch.h:197
touch_device_start_proc devicestart
A Device specific DeviceStart method implementing the standard Touch device interface (Mandatory).
Definition touch.h:181
TOUCH_BUFFER buffer
Touch input buffer.
Definition touch.h:194
TOUCH_PROPERTIES properties
Device properties.
Definition touch.h:195
touch_device_peek_proc devicepeek
A Device specific DevicePeek method implementing a standard Touch device interface (Or nil if the def...
Definition touch.h:183
touch_device_control_proc devicecontrol
A Device specific DeviceControl method implementing a standard Touch device interface (Or nil if the ...
Definition touch.h:188
TOUCH_DEVICE * prev
Previous entry in Touch device table.
Definition touch.h:201
touch_device_get_properties_proc devicegetproperties
A Device specific DeviceGetProperties method implementing a standard Touch device interface (Or nil i...
Definition touch.h:189
touch_device_write_proc devicewrite
A Device specific DeviceWrite method implementing a standard Touch device interface (Or nil if the de...
Definition touch.h:185
touch_device_stop_proc devicestop
A Device specific DeviceStop method implementing the standard Touch device interface (Mandatory).
Definition touch.h:182
touch_device_read_proc deviceread
A Device specific DeviceRead method implementing a standard Touch device interface (Or nil if the def...
Definition touch.h:184
TOUCH_DEVICE * next
Next entry in Touch device table.
Definition touch.h:202
touch_device_flush_proc deviceflush
A Device specific DeviceFlush method implementing a standard Touch device interface (Or nil if the de...
Definition touch.h:186
uint32_t bufferoverruns
Definition touch.h:199
uint32_t touchid
Unique Id of this Touch device in the Touch device table.
Definition touch.h:179
touch_event_cb event
Event callback function (If assigned).
Definition touch.h:192
uint32_t touchstate
Touch device state (eg TOUCH_STATE_ENABLED).
Definition touch.h:180
uint32_t maxheight
Maximum touch height value for the touch device (If applicable).
Definition touch.h:146
uint32_t maxz
Maximum (absolute) Z position for the touch device (If applicable).
Definition touch.h:144
uint32_t width
Screen Width.
Definition touch.h:139
uint32_t maxwidth
Maximum touch width value for the touch device (If applicable).
Definition touch.h:145
uint32_t height
Screen Height.
Definition touch.h:140
uint32_t maxx
Maximum (absolute) X position for the touch device.
Definition touch.h:142
uint32_t flags
Device flags (eg TOUCH_FLAG_MULTI_POINT).
Definition touch.h:138
uint32_t maxy
Maximum (absolute) Y position for the touch device.
Definition touch.h:143
uint32_t maxpoints
Maximum number of touch points.
Definition touch.h:147
uint32_t rotation
Screen Rotation (eg TOUCH_ROTATION_180).
Definition touch.h:141
uint32_t STDCALL touch_device_set_callback(TOUCH_DEVICE *touch, touch_event_cb event, void *parameter)
Set the event callback function for the specified touch device.
#define TOUCH_BUFFER_SIZE
Definition touch.h:86
uint32_t STDCALL touch_device_control(TOUCH_DEVICE *touch, int request, size_t argument1, size_t *argument2)
Perform a control request on the specified touch device.
uint32_t STDCALL(* touch_device_start_proc)(TOUCH_DEVICE *touch)
Definition touch.h:162
uint32_t STDCALL(* touch_device_peek_proc)(TOUCH_DEVICE *touch)
Definition touch.h:165
TOUCH_DEVICE *STDCALL touch_device_find_by_name(const char *name)
Find a Touch device by name in the device table.
uint32_t STDCALL touch_device_start(TOUCH_DEVICE *touch)
Start the specified Touch device ready for receiving events.
uint32_t STDCALL(* touch_device_flush_proc)(TOUCH_DEVICE *touch)
Definition touch.h:168
TOUCH_DEVICE *STDCALL touch_device_create_ex(uint32_t size)
Create a new Touch device entry.
uint32_t STDCALL touch_device_properties(TOUCH_DEVICE *touch, TOUCH_PROPERTIES *properties)
Get the properties for the specified Touch device.
uint32_t STDCALL touch_device_deregister(TOUCH_DEVICE *touch)
Deregister a Touch device from the Touch device table.
uint32_t STDCALL(* touch_device_write_proc)(TOUCH_DEVICE *touch, void *buffer, uint32_t size, uint32_t count)
Definition touch.h:167
uint32_t STDCALL touch_device_update(TOUCH_DEVICE *touch)
Request the specified touch device to update the current configuration.
uint32_t STDCALL touch_device_notification(TOUCH_DEVICE *touch, touch_notification_cb callback, void *data, uint32_t notification, uint32_t flags)
Register a notification for Touch device changes.
struct _TOUCH_DEVICE TOUCH_DEVICE
Definition touch.h:151
uint32_t STDCALL(* touch_device_update_proc)(TOUCH_DEVICE *touch)
Definition touch.h:169
struct _TOUCH_DATA TOUCH_DATA
Definition touch.h:111
uint32_t STDCALL(* touch_device_read_proc)(TOUCH_DEVICE *touch, void *buffer, uint32_t size, uint32_t flags, uint32_t *count)
Definition touch.h:166
uint32_t STDCALL(* touch_enumerate_cb)(TOUCH_DEVICE *touch, void *data)
Definition touch.h:157
uint32_t STDCALL touch_device_stop(TOUCH_DEVICE *touch)
Stop the specified Touch device and terminate receiving events.
uint32_t STDCALL touch_device_write(TOUCH_DEVICE *touch, void *buffer, uint32_t size, uint32_t count)
Write touch data packets to the buffer of the specified touch device.
uint32_t STDCALL(* touch_device_stop_proc)(TOUCH_DEVICE *touch)
Definition touch.h:163
uint32_t STDCALL touch_device_get_properties(TOUCH_DEVICE *touch, TOUCH_PROPERTIES *properties)
Get the properties for the specified Touch device.
uint32_t STDCALL touch_device_register(TOUCH_DEVICE *touch)
Register a new Touch device in the Touch device table.
TOUCH_DEVICE *STDCALL touch_device_get_default(void)
Get the current default Touch device.
uint32_t STDCALL touch_device_peek(TOUCH_DEVICE *touch)
Peek at the buffer of the specified touch device to see if any data packets are ready.
uint32_t STDCALL touch_device_flush(TOUCH_DEVICE *touch)
Flush the contents of the buffer of the specified touch device.
uint32_t STDCALL touch_device_destroy(TOUCH_DEVICE *touch)
Destroy an existing Touch device entry.
uint32_t STDCALL(* touch_notification_cb)(DEVICE *device, void *data, uint32_t notification)
Definition touch.h:159
uint32_t STDCALL touch_get_count(void)
Get the current Touch device count.
uint32_t STDCALL touch_device_enumerate(touch_enumerate_cb callback, void *data)
Enumerate all Touch devices in the Touch device table.
TOUCH_DEVICE *STDCALL touch_device_check(TOUCH_DEVICE *touch)
Check if the supplied Touch device is in the Touch device table.
uint32_t STDCALL touch_device_read(TOUCH_DEVICE *touch, void *buffer, uint32_t size, uint32_t flags, uint32_t *count)
Read touch data packets from the buffer of the specified touch device.
uint32_t STDCALL(* touch_device_control_proc)(TOUCH_DEVICE *touch, int request, size_t argument1, size_t *argument2)
Definition touch.h:170
uint32_t STDCALL touch_device_set_default(TOUCH_DEVICE *touch)
Set the current default Touch device.
uint32_t STDCALL(* touch_device_get_properties_proc)(TOUCH_DEVICE *touch, TOUCH_PROPERTIES *properties)
Definition touch.h:172
struct _TOUCH_PROPERTIES TOUCH_PROPERTIES
Definition touch.h:135
uint32_t STDCALL touch_device_resolve_rotation(uint32_t rotation)
Resolve a value of 0, 90, 180 or 270 to a touch rotation constant (eg TOUCH_ROTATION_180).
uint32_t STDCALL(* touch_event_cb)(TOUCH_DEVICE *touch, TOUCH_DATA *data)
Definition touch.h:154
TOUCH_DEVICE *STDCALL touch_device_find_by_description(const char *description)
Find a Touch device by description in the device table.
uint32_t STDCALL touch_insert_data(TOUCH_DEVICE *touch, TOUCH_DATA *data, BOOL signal)
Insert a TTouchData entry into the touch device buffer.
uint32_t STDCALL touch_device_state_to_string(uint32_t touchstate, char *string, uint32_t len)
Return a string describing the Touch device state (eg TOUCH_STATE_ENABLED).
uint32_t STDCALL touch_device_rotation_to_string(uint32_t rotation, char *string, uint32_t len)
Return a string describing the supplied touch rotation value.
struct _TOUCH_BUFFER TOUCH_BUFFER
Definition touch.h:125
uint32_t STDCALL touch_device_type_to_string(uint32_t touchtype, char *string, uint32_t len)
Return a string describing the Touch device type (eg TOUCH_TYPE_CAPACITIVE).
TOUCH_DEVICE *STDCALL touch_device_create(void)
Create a new Touch device entry.
TOUCH_DEVICE *STDCALL touch_device_find(uint32_t touchid)
Find a Touch device by ID in the Touch device table.