Difference between revisions of "Unit Touch"

From Ultibo.org
Jump to: navigation, search
 
(24 intermediate revisions by the same user not shown)
Line 5: Line 5:
 
----
 
----
  
''To be documented''
+
'''Ultibo Touch Interface unit'''
  
 
=== Constants ===
 
=== Constants ===
 
----
 
----
  
''To be documented''
+
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Touch specific constants''' <code> TOUCH_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>TOUCH_NAME_PREFIX = 'Touch';</code>
 +
| Name prefix for Touch Devices
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Touch device type''' <code> TOUCH_TYPE_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>TOUCH_TYPE_NONE = 0;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>TOUCH_TYPE_RESISTIVE = 1;</code>
 +
| &nbsp;
 +
|-
 +
| <code>TOUCH_TYPE_CAPACITIVE = 2;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>TOUCH_TYPE_MAX = 2;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Touch device state''' <code> TOUCH_STATE_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>TOUCH_STATE_DISABLED = 0;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>TOUCH_STATE_ENABLED = 1;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>TOUCH_STATE_MAX = 1;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Touch device flag''' <code> TOUCH_FLAG_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>TOUCH_FLAG_NONE = $00000000;</code>
 +
| &nbsp;
 +
|-
 +
| <code>TOUCH_FLAG_NON_BLOCK = $00000001;</code>
 +
| If set device reads are non blocking (Also supported in Flags parameter of TouchDeviceRead)
 +
|-
 +
| <code>TOUCH_FLAG_PEEK_BUFFER = $00000002;</code>
 +
| Peek at the buffer to see if any data is available, don't remove it (Used only in Flags parameter of TouchDeviceRead)
 +
|-
 +
| <code>TOUCH_FLAG_MOUSE_DATA = $00000004;</code>
 +
| If set the device will write a mouse data event for each touch event
 +
|-
 +
| <code>TOUCH_FLAG_MULTI_POINT = $00000008;</code>
 +
| If set the device supports multi point touch
 +
|-
 +
| <code>TOUCH_FLAG_PRESSURE = $00000010;</code>
 +
| If set the device supports pressure value on touch points
 +
|-
 +
| <code>TOUCH_FLAG_SWAP_XY = $00000020;</code>
 +
| If set swap the X and Y coordinates
 +
|-
 +
| <code>TOUCH_FLAG_INVERT_X = $00000040;</code>
 +
| If set invert the X coordinate
 +
|-
 +
| <code>TOUCH_FLAG_INVERT_Y = $00000080;</code>
 +
| If set invert the Y coordinate
 +
|-
 +
| <code>TOUCH_FLAG_SWAP_MAX_XY = $00000100;</code>
 +
| If set swap the maximum X and Y values
 +
|-
 +
| <code>TOUCH_FLAG_RELEASE_TIMER = $00000200;</code>
 +
| If set enable the touch release timer for devices that don't provide release events
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''Flags supported by TOUCH_CONTROL_GET/SET/CLEAR_FLAG''
 +
|-
 +
|colspan="2"|<code>TOUCH_FLAG_MASK = TOUCH_FLAG_NON_BLOCK or TOUCH_FLAG_MOUSE_DATA or TOUCH_FLAG_MULTI_POINT or TOUCH_FLAG_PRESSURE or TOUCH_FLAG_SWAP_XY or TOUCH_FLAG_INVERT_X or TOUCH_FLAG_INVERT_Y or TOUCH_FLAG_SWAP_MAX_XY or TOUCH_FLAG_RELEASE_TIMER;</code>
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Touch device control code''' <code> TOUCH_CONTROL_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>TOUCH_CONTROL_GET_FLAG = 1;</code>
 +
| Get Flag
 +
|-
 +
| <code>TOUCH_CONTROL_SET_FLAG = 2;</code>
 +
| Set Flag
 +
|-
 +
| <code>TOUCH_CONTROL_CLEAR_FLAG = 3;</code>
 +
| Clear Flag
 +
|-
 +
| <code>TOUCH_CONTROL_FLUSH_BUFFER = 4;</code>
 +
| Flush Buffer
 +
|-
 +
| <code>TOUCH_CONTROL_GET_WIDTH = 5;</code>
 +
| Get Screen Width
 +
|-
 +
| <code>TOUCH_CONTROL_GET_HEIGHT = 6;</code>
 +
| Get Screen Height
 +
|-
 +
| <code>TOUCH_CONTROL_GET_MAX_X = 7;</code>
 +
| Get Maximum X value (Only applies to Absolute X values)
 +
|-
 +
| <code>TOUCH_CONTROL_GET_MAX_Y = 8;</code>
 +
| Get Maximum Y value (Only applies to Absolute Y values)
 +
|-
 +
| <code>TOUCH_CONTROL_GET_MAX_Z = 9;</code>
 +
| Get Maximum Z value (Only applies to Absolute Z values)
 +
|-
 +
| <code>TOUCH_CONTROL_GET_MAX_POINTS = 10;</code>
 +
| Get Maximum number of Touch Points
 +
|-
 +
| <code>TOUCH_CONTROL_GET_ROTATION = 11;</code>
 +
| Get Rotation value (0, 90, 180, 270)(Only where supported by the driver)
 +
|-
 +
| <code>TOUCH_CONTROL_SET_ROTATION = 12;</code>
 +
| Set Rotation value (0, 90, 180, 270)(Only where supported by the driver)
 +
|-
 +
| <code> TOUCH_CONTROL_GET_CALLBACK = 13;</code>
 +
| Get the registered callback function for touch events
 +
|-
 +
| <code>TOUCH_CONTROL_SET_CALLBACK = 14;</code>
 +
| Set the registered callback function for touch events
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Touch buffer size''' <code> TOUCH_BUFFER_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>TOUCH_BUFFER_SIZE = 1024;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Touch data definitions''' <code> TOUCH_FINGER*, TOUCH_ID_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|''Values for TTouchData.Info''
 +
|-
 +
| <code>TOUCH_FINGER = $00000001;</code>
 +
| A finger is pressed at this touch point
 +
|-
 +
|colspan="2"|''Values for TTouchData.PointID''
 +
|-
 +
| <code>TOUCH_ID_UNKNOWN = Word(-1);</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|''Values for TTouchData.PositionX''
 +
|-
 +
| <code>TOUCH_X_UNKNOWN = -1;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|''Values for TTouchData.PositionY''
 +
|-
 +
| <code>TOUCH_Y_UNKNOWN = -1;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|''Values for TTouchData.PositionZ''
 +
|-
 +
| <code>TOUCH_Z_UNKNOWN = -1;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Touch rotation''' <code> TOUCH_ROTATION_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>TOUCH_ROTATION_0 = FRAMEBUFFER_ROTATION_0;</code>
 +
| No rotation
 +
|-
 +
| <code>TOUCH_ROTATION_90 = FRAMEBUFFER_ROTATION_90;</code>
 +
| 90 degree rotation
 +
|-
 +
| <code>TOUCH_ROTATION_180 = FRAMEBUFFER_ROTATION_180;</code>
 +
| 180 degree rotation
 +
|-
 +
| <code>TOUCH_ROTATION_270 = FRAMEBUFFER_ROTATION_270;</code>
 +
| 270 degree rotation
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Touch logging''' <code> TOUCH_LOG_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>TOUCH_LOG_LEVEL_DEBUG = LOG_LEVEL_DEBUG;</code>
 +
| Touch debugging messages
 +
|-
 +
| <code>TOUCH_LOG_LEVEL_INFO = LOG_LEVEL_INFO;</code>
 +
| Touch informational messages, such as a device being attached or detached
 +
|-
 +
| <code>TOUCH_LOG_LEVEL_WARN = LOG_LEVEL_WARN;</code>
 +
| Touch warning messages
 +
|-
 +
| <code>TOUCH_LOG_LEVEL_ERROR = LOG_LEVEL_ERROR;</code>
 +
| Touch error messages
 +
|-
 +
| <code>TOUCH_LOG_LEVEL_NONE = LOG_LEVEL_NONE;</code>
 +
| No Touch messages
 +
|-
 +
|}
 +
</div></div>
 +
<br />
  
 
=== Type definitions ===
 
=== Type definitions ===
 
----
 
----
  
''To be documented''
+
 
 +
'''Touch data'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PTouchData = ^TTouchData;</code>
 +
 
 +
<code>TTouchData = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>Info:LongWord;</code>
 +
| Bitmap of touch info values (eg TOUCH_FINGER)
 +
|-
 +
| <code>PointID:Word;</code>
 +
| The touch point ID value for this touch (First ID is 1)
 +
|-
 +
| <code>PositionX:SmallInt;</code>
 +
| The X position of this touch point
 +
|-
 +
| <code>PositionY:SmallInt;</code>
 +
| The Y position of this touch point
 +
|-
 +
| <code>The Z position of this touch point (If applicable)</code>
 +
| &nbsp;
 +
|-
 +
| <code>TouchWidth:Word;</code>
 +
| The Width of this touch point (If applicable)
 +
|-
 +
| <code>TouchHeight:Word;</code>
 +
| The Height of this touch point (If applicable)
 +
|-
 +
| <code>Parameter:Pointer;</code>
 +
| The parameter for the event callback (If applicable)
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''Touch buffer'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PTouchBuffer = ^TTouchBuffer;</code>
 +
 
 +
<code>TTouchBuffer = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>Wait:TSemaphoreHandle;</code>
 +
| Buffer ready semaphore
 +
|-
 +
| <code>Start:LongWord;</code>
 +
| Index of first buffer ready
 +
|-
 +
| <code>Count:LongWord;</code>
 +
| Number of entries ready in buffer
 +
|-
 +
| <code>Buffer:array[0..(TOUCH_BUFFER_SIZE - 1)] of TTouchData;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''Touch properties'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PTouchProperties = ^TTouchProperties;</code>
 +
 
 +
<code>TTouchProperties = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>Flags:LongWord;</code>
 +
| Device flags (eg TOUCH_FLAG_MULTI_POINT)
 +
|-
 +
| <code>Width:LongWord;</code>
 +
| Screen Width
 +
|-
 +
| <code>Height:LongWord;</code>
 +
| Screen Height
 +
|-
 +
| <code>Rotation:LongWord;</code>
 +
| Screen Rotation (eg TOUCH_ROTATION_180)
 +
|-
 +
| <code>MaxX:LongWord;</code>
 +
| Maximum (absolute) X position for the touch device
 +
|-
 +
| <code>MaxY:LongWord;</code>
 +
| Maximum (absolute) Y position for the touch device
 +
|-
 +
| <code>MaxZ:LongWord;</code>
 +
| Maximum (absolute) Z position for the touch device (If applicable)
 +
|-
 +
| <code>MaxWidth:LongWord;</code>
 +
| Maximum touch width value for the touch device (If applicable)
 +
|-
 +
| <code>MaxHeight:LongWord;</code>
 +
| Maximum touch height value for the touch device (If applicable)
 +
|-
 +
| <code>MaxPoints:LongWord;</code>
 +
| Maximum number of touch points
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''Touch event callback'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TTouchEvent = function(Touch:PTouchDevice; Data:PTouchData):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|} 
 +
 
 +
'''Touch enumeration callback'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TTouchEnumerate = function(Touch:PTouchDevice; Data:Pointer):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''Touch notification callback'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TTouchNotification = function(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''Touch device start'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TTouchDeviceStart = function(Touch:PTouchDevice):LongWord; </code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''Touch device stop'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TTouchDeviceStop = function(Touch:PTouchDevice):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''Touch device peek'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TTouchDevicePeek = function(Touch:PTouchDevice):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''Touch device read'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TTouchDeviceRead = function(Touch:PTouchDevice; Buffer:Pointer; Size,Flags:LongWord; var Count:LongWord):LongWord; </code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''Touch device write'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TTouchDeviceWrite = function(Touch:PTouchDevice; Buffer:Pointer; Size,Count:LongWord):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''Touch device flush'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TTouchDeviceFlush = function(Touch:PTouchDevice):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''Touch device update'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TTouchDeviceUpdate = function(Touch:PTouchDevice):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''Touch device control'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TTouchDeviceControl = function(Touch:PTouchDevice; Request:Integer; Argument1:PtrUInt; var Argument2:PtrUInt):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''Touch device get properties'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TTouchDeviceGetProperties = function(Touch:PTouchDevice; Properties:PTouchProperties):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''Touch device'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PTouchDevice = ^TTouchDevice;</code>
 +
 
 +
<code>TTouchDevice = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|''Device Properties''
 +
|-
 +
| <code>Device:TDevice;</code>
 +
| The Device entry for this Touch device
 +
|-
 +
|colspan="2"|''Touch Properties''
 +
|-
 +
| <code>TouchId:LongWord;</code>
 +
| Unique Id of this Touch device in the Touch device table
 +
|-
 +
| <code>TouchState:LongWord;</code>
 +
| Touch device state (eg TOUCH_STATE_ENABLED)
 +
|-
 +
| <code>DeviceStart:TTouchDeviceStart;</code>
 +
| A Device specific DeviceStart method implementing the standard Touch device interface (Mandatory)
 +
|-
 +
| <code>DeviceStop:TTouchDeviceStop;</code>
 +
| A Device specific DeviceStop method implementing the standard Touch device interface (Mandatory)
 +
|-
 +
| <code>DevicePeek:TTouchDevicePeek;</code>
 +
| A Device specific DevicePeek method implementing a standard Touch device interface (Or nil if the default method is suitable)
 +
|-
 +
| <code>DeviceRead:TTouchDeviceRead;</code>
 +
| A Device specific DeviceRead method implementing a standard Touch device interface (Or nil if the default method is suitable)
 +
|-
 +
| <code>DeviceWrite:TTouchDeviceWrite;</code>
 +
| A Device specific DeviceWrite method implementing a standard Touch device interface (Or nil if the default method is suitable)
 +
|-
 +
| <code>DeviceFlush:TTouchDeviceFlush;</code>
 +
| A Device specific DeviceFlush method implementing a standard Touch device interface (Or nil if the default method is suitable)
 +
|-
 +
| <code>DeviceUpdate:TTouchDeviceUpdate;</code>
 +
| A Device specific DeviceUpdate method implementing a standard Touch device interface (Or nil if the default method is suitable)
 +
|-
 +
| <code>DeviceControl:TTouchDeviceControl;</code>
 +
| A Device specific DeviceControl method implementing a standard Touch device interface (Or nil if the default method is suitable)
 +
|-
 +
| <code>DeviceGetProperties:TTouchDeviceGetProperties;</code>
 +
| A Device specific DeviceGetProperties method implementing a standard Touch device interface (Or nil if the default method is suitable)
 +
|-
 +
|colspan="2"|''Driver Properties''
 +
|-
 +
| <code>Lock:TMutexHandle;</code>
 +
| Device lock
 +
|-
 +
| <code>Event:TTouchEvent;</code>
 +
| Event callback function (If assigned)
 +
|-
 +
| <code>Parameter:Pointer;</code>
 +
| Parameter for the event callback (or nil)
 +
|-
 +
| <code>Buffer:TTouchBuffer;</code>
 +
| Touch input buffer
 +
|-
 +
| <code>Properties:TTouchProperties;</code>
 +
| Device properties
 +
|-
 +
|colspan="2"|''Statistics Properties''
 +
|-
 +
| <code>ReceiveCount:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>ReceiveErrors:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>BufferOverruns:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|''Internal Properties''
 +
|-
 +
| <code>Prev:PTouchDevice;</code>
 +
| Previous entry in Touch device table
 +
|-
 +
| <code>Next:PTouchDevice;</code>
 +
| Next entry in Touch device table
 +
|-
 +
|}
 +
</div></div> 
 +
<br />
  
 
=== Public variables ===
 
=== Public variables ===
 
----
 
----
  
''To be documented''
+
 
 +
'''Touch logging'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TOUCH_DEFAULT_LOG_LEVEL:LongWord = TOUCH_LOG_LEVEL_DEBUG;</code>
 +
| style="width: 40%;"|Minimum level for Touch messages. Only messages with level greater than or equal to this will be printed.
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TOUCH_LOG_ENABLED:Boolean;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
<br />
  
 
=== Function declarations ===
 
=== Function declarations ===
Line 34: Line 583:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| Called only during system startup
 
| Called only during system startup
 
|-
 
|-
Line 49: Line 598:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Touch'''
+
! Touch
 
| The Touch device to start
 
| The Touch device to start
 
|-
 
|-
! '''Return'''
+
! Return
 
| ERROR_SUCCESS if completed or another error code on failure
 
| ERROR_SUCCESS if completed or another error code on failure
 
|-
 
|-
Line 64: Line 613:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Touch'''
+
! Touch
 
| The Touch device to stop
 
| The Touch device to stop
 
|-
 
|-
! '''Return'''
+
! Return
 
| ERROR_SUCCESS if completed or another error code on failure
 
| ERROR_SUCCESS if completed or another error code on failure
 
|-
 
|-
Line 79: Line 628:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Touch'''
+
! Touch
 
| The Touch device to peek at
 
| The Touch device to peek at
 
|-
 
|-
! '''Return'''
+
! Return
| ERROR_SUCCESS if packets are ready, ERROR_NO_MORE_ITEMS if not or another error code on failure
+
| ERROR_SUCCESS if packets are ready, ERROR_NO_MORE_ITEMS if not or another error code on failure.
 
|-
 
|-
 
|}
 
|}
Line 94: Line 643:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Touch'''
+
! Touch
 
| The Touch device to read from
 
| The Touch device to read from
 
|-
 
|-
! '''Buffer'''
+
! Buffer
 
| Pointer to a buffer to copy the touch data packets to
 
| Pointer to a buffer to copy the touch data packets to
 
|-
 
|-
! '''Size'''
+
! Size
 
| The size of the buffer in bytes (Must be at least TTouchData or greater)
 
| The size of the buffer in bytes (Must be at least TTouchData or greater)
 
|-
 
|-
! '''Flags'''
+
! Flags
 
| The flags for the behaviour of the read (eg TOUCH_FLAG_NON_BLOCK)
 
| The flags for the behaviour of the read (eg TOUCH_FLAG_NON_BLOCK)
 
|-
 
|-
! '''Count'''
+
! Count
 
| The number of touch data packets copied to the buffer
 
| The number of touch data packets copied to the buffer
 
|-
 
|-
! '''Return'''
+
! Return
 
| ERROR_SUCCESS if completed or another error code on failure
 
| ERROR_SUCCESS if completed or another error code on failure
 
|-
 
|-
Line 121: Line 670:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Touch'''
+
! Touch
 
| The Touch device to write to
 
| The Touch device to write to
 
|-
 
|-
! '''Buffer'''
+
! Buffer
 
| Pointer to a buffer to copy the touch data packets from
 
| Pointer to a buffer to copy the touch data packets from
 
|-
 
|-
! '''Size'''
+
! Size
 
| The size of the buffer in bytes (Must be at least TTouchData or greater)
 
| The size of the buffer in bytes (Must be at least TTouchData or greater)
 
|-
 
|-
! '''Count'''
+
! Count
 
| The number of touch data packets to copy from the buffer
 
| The number of touch data packets to copy from the buffer
 
|-
 
|-
! '''Return'''
+
! Return
 
| ERROR_SUCCESS if completed or another error code on failure
 
| ERROR_SUCCESS if completed or another error code on failure
 
|-
 
|-
Line 145: Line 694:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Touch'''
+
! Touch
 
| The Touch device to flush
 
| The Touch device to flush
 
|-
 
|-
! '''Return'''
+
! Return
 
| ERROR_SUCCESS if completed or another error code on failure
 
| ERROR_SUCCESS if completed or another error code on failure
 
|-
 
|-
Line 155: Line 704:
 
<br />
 
<br />
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
<pre style="border: 0; padding-bottom:0px;">function TouchDeviceControl(Touch:PTouchDevice; Request:Integer; Argument1:LongWord; var Argument2:LongWord):LongWord;</pre>
+
<pre style="border: 0; padding-bottom:0px;">function TouchDeviceUpdate(Touch:PTouchDevice):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Request the specified touch device to update the current configuration</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Touch
 +
| The Touch device to update
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
! Note
 +
| Items updated can include rotation, maximum X and Y and flags (If supported)
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function TouchDeviceControl(Touch:PTouchDevice; Request:Integer; Argument1:PtrUInt; var Argument2:PtrUInt):LongWord;</pre>
 
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Perform a control request on the specified touch device</div>
 
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Perform a control request on the specified touch device</div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Touch'''
+
! Touch
 
| The Touch device to control
 
| The Touch device to control
 
|-
 
|-
! '''Request'''
+
! Request
 
| The request code for the operation (eg TOUCH_CONTROL_GET_FLAG)
 
| The request code for the operation (eg TOUCH_CONTROL_GET_FLAG)
 
|-
 
|-
! '''Argument1'''
+
! Argument1
| The first argument for the operation (Dependant on request code)
+
| The first argument for the operation (Dependent on request code)
 
|-
 
|-
! '''Argument2'''
+
! Argument2
| The second argument for the operation (Dependant on request code)
+
| The second argument for the operation (Dependent on request code)
 
|-
 
|-
! '''Return'''
+
! Return
 
| ERROR_SUCCESS if completed or another error code on failure
 
| ERROR_SUCCESS if completed or another error code on failure
 
|-
 
|-
Line 179: Line 746:
 
<br />
 
<br />
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
<pre style="border: 0; padding-bottom:0px;">function TouchDeviceProperties(Touch:PTouchDevice; Properties:PTouchProperties):LongWord;</pre>
+
<pre style="border: 0; padding-bottom:0px;">function TouchDeviceProperties(Touch:PTouchDevice; Properties:PTouchProperties):LongWord; inline;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the properties for the specified Touch device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Touch
 +
| The Touch device to get properties from
 +
|-
 +
! Properties
 +
| Pointer to a TTouchProperties structure to fill in
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
! Note
 +
| Replaced by TouchDeviceGetProperties for consistency
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function TouchDeviceGetProperties(Touch:PTouchDevice;Properties:PTouchProperties):LongWord;</pre>
 
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the properties for the specified Touch device</div>
 
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the properties for the specified Touch device</div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Touch'''
+
! Touch
 
| The Touch device to get properties from
 
| The Touch device to get properties from
 
|-
 
|-
! '''Properties'''
+
! Properties
 
| Pointer to a TTouchProperties structure to fill in
 
| Pointer to a TTouchProperties structure to fill in
 
|-
 
|-
! '''Return'''
+
! Return
 
| ERROR_SUCCESS if completed or another error code on failure
 
| ERROR_SUCCESS if completed or another error code on failure
 
|-
 
|-
Line 202: Line 790:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Return'''
+
! Return
 
| Pointer to new Touch device entry or nil if Touch device could not be created
 
| Pointer to new Touch device entry or nil if Touch device could not be created
 
|-
 
|-
Line 214: Line 802:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Size'''
+
! Size
 
| Size in bytes to allocate for new Touch device (Including the Touch device entry)
 
| Size in bytes to allocate for new Touch device (Including the Touch device entry)
 
|-
 
|-
! '''Return'''
+
! Return
 
| Pointer to new Touch device entry or nil if Touch device could not be created
 
| Pointer to new Touch device entry or nil if Touch device could not be created
 
|-
 
|-
Line 229: Line 817:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Touch
| None documented
+
| The Touch device to destroy
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 
|-
 
|-
 
|}
 
|}
Line 241: Line 832:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Touch
| None documented
+
| The Touch device to register
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 
|-
 
|-
 
|}
 
|}
Line 249: Line 843:
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<pre style="border: 0; padding-bottom:0px;">function TouchDeviceDeregister(Touch:PTouchDevice):LongWord;</pre>
 
<pre style="border: 0; padding-bottom:0px;">function TouchDeviceDeregister(Touch:PTouchDevice):LongWord;</pre>
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Deregister an Touch device from the Touch device table</div>
+
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Deregister a Touch device from the Touch device table</div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Touch
| None documented
+
| The Touch device to dregister
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 
|-
 
|-
 
|}
 
|}
Line 261: Line 858:
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<pre style="border: 0; padding-bottom:0px;">function TouchDeviceFind(TouchId:LongWord):PTouchDevice;</pre>
 
<pre style="border: 0; padding-bottom:0px;">function TouchDeviceFind(TouchId:LongWord):PTouchDevice;</pre>
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
+
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find a Touch device by ID in the Touch device table</div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! TouchId
| None documented
+
| The ID number of the Touch device to find
 +
|-
 +
! Return
 +
| Pointer to Touch device entry or nil if not found
 
|-
 
|-
 
|}
 
|}
Line 273: Line 873:
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<pre style="border: 0; padding-bottom:0px;">function TouchDeviceFindByName(const Name:String):PTouchDevice; inline;</pre>
 
<pre style="border: 0; padding-bottom:0px;">function TouchDeviceFindByName(const Name:String):PTouchDevice; inline;</pre>
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
+
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find a Touch device by name in the device table</div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Name
| None documented
+
| The name of the Touch device to find (eg Touch0)
 +
|-
 +
! Return
 +
| Pointer to Touch device entry or nil if not found
 
|-
 
|-
 
|}
 
|}
Line 285: Line 888:
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<pre style="border: 0; padding-bottom:0px;">function TouchDeviceFindByDescription(const Description:String):PTouchDevice; inline;</pre>
 
<pre style="border: 0; padding-bottom:0px;">function TouchDeviceFindByDescription(const Description:String):PTouchDevice; inline;</pre>
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
+
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find a Touch device by description in the device table</div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Description
| None documented
+
| The description of the Touch to find (eg USB Touchscreen)
 +
|-
 +
! Return
 +
| Pointer to Touch device entry or nil if not found
 
|-
 
|-
 
|}
 
|}
Line 297: Line 903:
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<pre style="border: 0; padding-bottom:0px;">function TouchDeviceEnumerate(Callback:TTouchEnumerate; Data:Pointer):LongWord;</pre>
 
<pre style="border: 0; padding-bottom:0px;">function TouchDeviceEnumerate(Callback:TTouchEnumerate; Data:Pointer):LongWord;</pre>
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
+
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Enumerate all Touch devices in the Touch device table</div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Callback
| None documented
+
| The callback function to call for each Touch device in the table
 +
|-
 +
! Data
 +
| A private data pointer to pass to callback for each Touch device in the table
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 
|-
 
|-
 
|}
 
|}
Line 309: Line 921:
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<pre style="border: 0; padding-bottom:0px;">function TouchDeviceNotification(Touch:PTouchDevice; Callback:TTouchNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;</pre>
 
<pre style="border: 0; padding-bottom:0px;">function TouchDeviceNotification(Touch:PTouchDevice; Callback:TTouchNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;</pre>
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
+
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Register a notification for Touch device changes</div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Touch
| None documented
+
| The Touch device to notify changes for (Optional, pass nil for all Touch devices)
 +
|-
 +
! Callback
 +
| The function to call when a notification event occurs
 +
|-
 +
! Data
 +
| A private data pointer to pass to callback when a notification event occurs
 +
|-
 +
! Notification
 +
| The events to register for notification of (eg DEVICE_NOTIFICATION_REGISTER)
 +
|-
 +
! Flags
 +
| The flags to control the notification (eg NOTIFIER_FLAG_WORKER)
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 
|-
 
|-
 
|}
 
|}
Line 323: Line 950:
  
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
<pre style="border: 0; padding-bottom:0px;">function TouchGetCount:LongWord; inline;</pre>
+
<pre style="border: 0; padding-bottom:0px;">function TouchGetCount:LongWord;</pre>
 
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current Touch device count</div>
 
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current Touch device count</div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Return
| None documented
+
| The number of Touch devices
 
|-
 
|-
 
|}
 
|}
Line 335: Line 962:
 
<br />
 
<br />
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
<pre style="border: 0; padding-bottom:0px;">function TouchDeviceGetDefault:PTouchDevice; inline;</pre>
+
<pre style="border: 0; padding-bottom:0px;">function TouchDeviceGetDefault:PTouchDevice;</pre>
 
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current default Touch device</div>
 
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current default Touch device</div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Return
| None documented
+
| Pointer to default Touch device entry
 
|-
 
|-
 
|}
 
|}
Line 352: Line 979:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Touch
| None documented
+
| The Touch device to set as default
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 
|-
 
|-
 
|}
 
|}
Line 364: Line 994:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Touch
 +
| The Touch device to check
 +
|-
 +
! Return
 +
| Pointer to Touch device entry or nil if not found
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function TouchDeviceTypeToString(TouchType:LongWord):String;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return a string describing the Touch device type (eg TOUCH_TYPE_CAPACITIVE)</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 
| None documented
 
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function TouchDeviceStateToString(TouchState:LongWord):String;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return a string describing the Touch device state (eg TOUCH_STATE_ENABLED)</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function TouchDeviceRotationToString(Rotation:LongWord):String;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return a string describing the supplied touch rotation value</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function TouchDeviceResolveRotation(ARotation:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Resolve a value of 0, 90, 180 or 270 to a touch rotation constant (eg TOUCH_ROTATION_180)</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| Also accepts passing the touch rotation constant values directly
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function TouchDeviceSetCallback(Touch:PTouchDevice; Event:TTouchEvent; Parameter:Pointer):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the event callback function for the specified touch device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Touch
 +
| The touch device to set the event callback for
 +
|-
 +
! Event
 +
| The event callback function to be called when touch data is received
 +
|-
 +
! Parameter
 +
| A pointer to private data to be passed to the callback with each event
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
! Note
 +
| This function also clears the TOUCH_FLAG_MOUSE_DATA flag because the event callback is not compatible with receiving touch events as mouse data
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function TouchInsertData(Touch:PTouchDevice; Data:PTouchData; Signal:Boolean):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Insert a TTouchData entry into the touch device buffer</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Touch
 +
| The touch device to insert data for
 +
|-
 +
! Data
 +
| The TTouchData entry to insert
 +
|-
 +
! Signal
 +
| If True then signal that new data is available in the buffer
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
! Note
 +
| Caller must hold the touch device lock
 
|-
 
|-
 
|}
 
|}
Line 376: Line 1,105:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 388: Line 1,117:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">procedure TouchLogWarn(Touch:PTouchDevice; const AText:String); inline;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 400: Line 1,141:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 412: Line 1,153:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-

Latest revision as of 00:32, 14 June 2024

Return to Unit Reference


Description


Ultibo Touch Interface unit

Constants



Touch specific constants TOUCH_*
TOUCH_NAME_PREFIX = 'Touch'; Name prefix for Touch Devices


Touch device type TOUCH_TYPE_*
TOUCH_TYPE_NONE = 0;  
TOUCH_TYPE_RESISTIVE = 1;  
TOUCH_TYPE_CAPACITIVE = 2;  
 
TOUCH_TYPE_MAX = 2;  


Touch device state TOUCH_STATE_*
TOUCH_STATE_DISABLED = 0;  
TOUCH_STATE_ENABLED = 1;  
 
TOUCH_STATE_MAX = 1;  


Touch device flag TOUCH_FLAG_*
TOUCH_FLAG_NONE = $00000000;  
TOUCH_FLAG_NON_BLOCK = $00000001; If set device reads are non blocking (Also supported in Flags parameter of TouchDeviceRead)
TOUCH_FLAG_PEEK_BUFFER = $00000002; Peek at the buffer to see if any data is available, don't remove it (Used only in Flags parameter of TouchDeviceRead)
TOUCH_FLAG_MOUSE_DATA = $00000004; If set the device will write a mouse data event for each touch event
TOUCH_FLAG_MULTI_POINT = $00000008; If set the device supports multi point touch
TOUCH_FLAG_PRESSURE = $00000010; If set the device supports pressure value on touch points
TOUCH_FLAG_SWAP_XY = $00000020; If set swap the X and Y coordinates
TOUCH_FLAG_INVERT_X = $00000040; If set invert the X coordinate
TOUCH_FLAG_INVERT_Y = $00000080; If set invert the Y coordinate
TOUCH_FLAG_SWAP_MAX_XY = $00000100; If set swap the maximum X and Y values
TOUCH_FLAG_RELEASE_TIMER = $00000200; If set enable the touch release timer for devices that don't provide release events
 
Flags supported by TOUCH_CONTROL_GET/SET/CLEAR_FLAG
TOUCH_FLAG_MASK = TOUCH_FLAG_NON_BLOCK or TOUCH_FLAG_MOUSE_DATA or TOUCH_FLAG_MULTI_POINT or TOUCH_FLAG_PRESSURE or TOUCH_FLAG_SWAP_XY or TOUCH_FLAG_INVERT_X or TOUCH_FLAG_INVERT_Y or TOUCH_FLAG_SWAP_MAX_XY or TOUCH_FLAG_RELEASE_TIMER;


Touch device control code TOUCH_CONTROL_*
TOUCH_CONTROL_GET_FLAG = 1; Get Flag
TOUCH_CONTROL_SET_FLAG = 2; Set Flag
TOUCH_CONTROL_CLEAR_FLAG = 3; Clear Flag
TOUCH_CONTROL_FLUSH_BUFFER = 4; Flush Buffer
TOUCH_CONTROL_GET_WIDTH = 5; Get Screen Width
TOUCH_CONTROL_GET_HEIGHT = 6; Get Screen Height
TOUCH_CONTROL_GET_MAX_X = 7; Get Maximum X value (Only applies to Absolute X values)
TOUCH_CONTROL_GET_MAX_Y = 8; Get Maximum Y value (Only applies to Absolute Y values)
TOUCH_CONTROL_GET_MAX_Z = 9; Get Maximum Z value (Only applies to Absolute Z values)
TOUCH_CONTROL_GET_MAX_POINTS = 10; Get Maximum number of Touch Points
TOUCH_CONTROL_GET_ROTATION = 11; Get Rotation value (0, 90, 180, 270)(Only where supported by the driver)
TOUCH_CONTROL_SET_ROTATION = 12; Set Rotation value (0, 90, 180, 270)(Only where supported by the driver)
TOUCH_CONTROL_GET_CALLBACK = 13; Get the registered callback function for touch events
TOUCH_CONTROL_SET_CALLBACK = 14; Set the registered callback function for touch events


Touch buffer size TOUCH_BUFFER_*
TOUCH_BUFFER_SIZE = 1024;  


Touch data definitions TOUCH_FINGER*, TOUCH_ID_*
Values for TTouchData.Info
TOUCH_FINGER = $00000001; A finger is pressed at this touch point
Values for TTouchData.PointID
TOUCH_ID_UNKNOWN = Word(-1);  
Values for TTouchData.PositionX
TOUCH_X_UNKNOWN = -1;  
Values for TTouchData.PositionY
TOUCH_Y_UNKNOWN = -1;  
Values for TTouchData.PositionZ
TOUCH_Z_UNKNOWN = -1;  


Touch rotation TOUCH_ROTATION_*
TOUCH_ROTATION_0 = FRAMEBUFFER_ROTATION_0; No rotation
TOUCH_ROTATION_90 = FRAMEBUFFER_ROTATION_90; 90 degree rotation
TOUCH_ROTATION_180 = FRAMEBUFFER_ROTATION_180; 180 degree rotation
TOUCH_ROTATION_270 = FRAMEBUFFER_ROTATION_270; 270 degree rotation


Touch logging TOUCH_LOG_*
TOUCH_LOG_LEVEL_DEBUG = LOG_LEVEL_DEBUG; Touch debugging messages
TOUCH_LOG_LEVEL_INFO = LOG_LEVEL_INFO; Touch informational messages, such as a device being attached or detached
TOUCH_LOG_LEVEL_WARN = LOG_LEVEL_WARN; Touch warning messages
TOUCH_LOG_LEVEL_ERROR = LOG_LEVEL_ERROR; Touch error messages
TOUCH_LOG_LEVEL_NONE = LOG_LEVEL_NONE; No Touch messages


Type definitions



Touch data

PTouchData = ^TTouchData;

TTouchData = record

Info:LongWord; Bitmap of touch info values (eg TOUCH_FINGER)
PointID:Word; The touch point ID value for this touch (First ID is 1)
PositionX:SmallInt; The X position of this touch point
PositionY:SmallInt; The Y position of this touch point
The Z position of this touch point (If applicable)  
TouchWidth:Word; The Width of this touch point (If applicable)
TouchHeight:Word; The Height of this touch point (If applicable)
Parameter:Pointer; The parameter for the event callback (If applicable)

Touch buffer

PTouchBuffer = ^TTouchBuffer;

TTouchBuffer = record

Wait:TSemaphoreHandle; Buffer ready semaphore
Start:LongWord; Index of first buffer ready
Count:LongWord; Number of entries ready in buffer
Buffer:array[0..(TOUCH_BUFFER_SIZE - 1)] of TTouchData;  

Touch properties

PTouchProperties = ^TTouchProperties;

TTouchProperties = record

Flags:LongWord; Device flags (eg TOUCH_FLAG_MULTI_POINT)
Width:LongWord; Screen Width
Height:LongWord; Screen Height
Rotation:LongWord; Screen Rotation (eg TOUCH_ROTATION_180)
MaxX:LongWord; Maximum (absolute) X position for the touch device
MaxY:LongWord; Maximum (absolute) Y position for the touch device
MaxZ:LongWord; Maximum (absolute) Z position for the touch device (If applicable)
MaxWidth:LongWord; Maximum touch width value for the touch device (If applicable)
MaxHeight:LongWord; Maximum touch height value for the touch device (If applicable)
MaxPoints:LongWord; Maximum number of touch points

Touch event callback

TTouchEvent = function(Touch:PTouchDevice; Data:PTouchData):LongWord;

Touch enumeration callback

TTouchEnumerate = function(Touch:PTouchDevice; Data:Pointer):LongWord;

Touch notification callback

TTouchNotification = function(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;

Touch device start

TTouchDeviceStart = function(Touch:PTouchDevice):LongWord;

Touch device stop

TTouchDeviceStop = function(Touch:PTouchDevice):LongWord;

Touch device peek

TTouchDevicePeek = function(Touch:PTouchDevice):LongWord;

Touch device read

TTouchDeviceRead = function(Touch:PTouchDevice; Buffer:Pointer; Size,Flags:LongWord; var Count:LongWord):LongWord;

Touch device write

TTouchDeviceWrite = function(Touch:PTouchDevice; Buffer:Pointer; Size,Count:LongWord):LongWord;

Touch device flush

TTouchDeviceFlush = function(Touch:PTouchDevice):LongWord;

Touch device update

TTouchDeviceUpdate = function(Touch:PTouchDevice):LongWord;

Touch device control

TTouchDeviceControl = function(Touch:PTouchDevice; Request:Integer; Argument1:PtrUInt; var Argument2:PtrUInt):LongWord;

Touch device get properties

TTouchDeviceGetProperties = function(Touch:PTouchDevice; Properties:PTouchProperties):LongWord;

Touch device

PTouchDevice = ^TTouchDevice;

TTouchDevice = record

Device Properties
Device:TDevice; The Device entry for this Touch device
Touch Properties
TouchId:LongWord; Unique Id of this Touch device in the Touch device table
TouchState:LongWord; Touch device state (eg TOUCH_STATE_ENABLED)
DeviceStart:TTouchDeviceStart; A Device specific DeviceStart method implementing the standard Touch device interface (Mandatory)
DeviceStop:TTouchDeviceStop; A Device specific DeviceStop method implementing the standard Touch device interface (Mandatory)
DevicePeek:TTouchDevicePeek; A Device specific DevicePeek method implementing a standard Touch device interface (Or nil if the default method is suitable)
DeviceRead:TTouchDeviceRead; A Device specific DeviceRead method implementing a standard Touch device interface (Or nil if the default method is suitable)
DeviceWrite:TTouchDeviceWrite; A Device specific DeviceWrite method implementing a standard Touch device interface (Or nil if the default method is suitable)
DeviceFlush:TTouchDeviceFlush; A Device specific DeviceFlush method implementing a standard Touch device interface (Or nil if the default method is suitable)
DeviceUpdate:TTouchDeviceUpdate; A Device specific DeviceUpdate method implementing a standard Touch device interface (Or nil if the default method is suitable)
DeviceControl:TTouchDeviceControl; A Device specific DeviceControl method implementing a standard Touch device interface (Or nil if the default method is suitable)
DeviceGetProperties:TTouchDeviceGetProperties; A Device specific DeviceGetProperties method implementing a standard Touch device interface (Or nil if the default method is suitable)
Driver Properties
Lock:TMutexHandle; Device lock
Event:TTouchEvent; Event callback function (If assigned)
Parameter:Pointer; Parameter for the event callback (or nil)
Buffer:TTouchBuffer; Touch input buffer
Properties:TTouchProperties; Device properties
Statistics Properties
ReceiveCount:LongWord;  
ReceiveErrors:LongWord;  
BufferOverruns:LongWord;  
Internal Properties
Prev:PTouchDevice; Previous entry in Touch device table
Next:PTouchDevice; Next entry in Touch device table


Public variables



Touch logging

TOUCH_DEFAULT_LOG_LEVEL:LongWord = TOUCH_LOG_LEVEL_DEBUG; Minimum level for Touch messages. Only messages with level greater than or equal to this will be printed.
TOUCH_LOG_ENABLED:Boolean;


Function declarations



Initialization functions

procedure TouchInit;
Description: Initialize the Touch unit and Touch device table
Note Called only during system startup


Touch functions

function TouchDeviceStart(Touch:PTouchDevice):LongWord;
Description: Start the specified Touch device ready for receiving events
Touch The Touch device to start
Return ERROR_SUCCESS if completed or another error code on failure


function TouchDeviceStop(Touch:PTouchDevice):LongWord;
Description: Stop the specified Touch device and terminate receiving events
Touch The Touch device to stop
Return ERROR_SUCCESS if completed or another error code on failure


function TouchDevicePeek(Touch:PTouchDevice):LongWord;
Description: Peek at the buffer of the specified touch device to see if any data packets are ready
Touch The Touch device to peek at
Return ERROR_SUCCESS if packets are ready, ERROR_NO_MORE_ITEMS if not or another error code on failure.


function TouchDeviceRead(Touch:PTouchDevice; Buffer:Pointer; Size,Flags:LongWord; var Count:LongWord):LongWord;
Description: Read touch data packets from the buffer of the specified touch device
Touch The Touch device to read from
Buffer Pointer to a buffer to copy the touch data packets to
Size The size of the buffer in bytes (Must be at least TTouchData or greater)
Flags The flags for the behaviour of the read (eg TOUCH_FLAG_NON_BLOCK)
Count The number of touch data packets copied to the buffer
Return ERROR_SUCCESS if completed or another error code on failure


function TouchDeviceWrite(Touch:PTouchDevice; Buffer:Pointer; Size,Count:LongWord):LongWord;
Description: Write touch data packets to the buffer of the specified touch device
Touch The Touch device to write to
Buffer Pointer to a buffer to copy the touch data packets from
Size The size of the buffer in bytes (Must be at least TTouchData or greater)
Count The number of touch data packets to copy from the buffer
Return ERROR_SUCCESS if completed or another error code on failure


function TouchDeviceFlush(Touch:PTouchDevice):LongWord;
Description: Flush the contents of the buffer of the specified touch device
Touch The Touch device to flush
Return ERROR_SUCCESS if completed or another error code on failure


function TouchDeviceUpdate(Touch:PTouchDevice):LongWord;
Description: Request the specified touch device to update the current configuration
Touch The Touch device to update
Return ERROR_SUCCESS if completed or another error code on failure
Note Items updated can include rotation, maximum X and Y and flags (If supported)


function TouchDeviceControl(Touch:PTouchDevice; Request:Integer; Argument1:PtrUInt; var Argument2:PtrUInt):LongWord;
Description: Perform a control request on the specified touch device
Touch The Touch device to control
Request The request code for the operation (eg TOUCH_CONTROL_GET_FLAG)
Argument1 The first argument for the operation (Dependent on request code)
Argument2 The second argument for the operation (Dependent on request code)
Return ERROR_SUCCESS if completed or another error code on failure


function TouchDeviceProperties(Touch:PTouchDevice; Properties:PTouchProperties):LongWord; inline;
Description: Get the properties for the specified Touch device
Touch The Touch device to get properties from
Properties Pointer to a TTouchProperties structure to fill in
Return ERROR_SUCCESS if completed or another error code on failure
Note Replaced by TouchDeviceGetProperties for consistency


function TouchDeviceGetProperties(Touch:PTouchDevice;Properties:PTouchProperties):LongWord;
Description: Get the properties for the specified Touch device
Touch The Touch device to get properties from
Properties Pointer to a TTouchProperties structure to fill in
Return ERROR_SUCCESS if completed or another error code on failure


function TouchDeviceCreate:PTouchDevice;
Description: Create a new Touch device entry
Return Pointer to new Touch device entry or nil if Touch device could not be created


function TouchDeviceCreateEx(Size:LongWord):PTouchDevice;
Description: Create a new Touch device entry
Size Size in bytes to allocate for new Touch device (Including the Touch device entry)
Return Pointer to new Touch device entry or nil if Touch device could not be created


function TouchDeviceDestroy(Touch:PTouchDevice):LongWord;
Description: Destroy an existing Touch device entry
Touch The Touch device to destroy
Return ERROR_SUCCESS if completed or another error code on failure


function TouchDeviceRegister(Touch:PTouchDevice):LongWord;
Description: Register a new Touch device in the Touch device table
Touch The Touch device to register
Return ERROR_SUCCESS if completed or another error code on failure


function TouchDeviceDeregister(Touch:PTouchDevice):LongWord;
Description: Deregister a Touch device from the Touch device table
Touch The Touch device to dregister
Return ERROR_SUCCESS if completed or another error code on failure


function TouchDeviceFind(TouchId:LongWord):PTouchDevice;
Description: Find a Touch device by ID in the Touch device table
TouchId The ID number of the Touch device to find
Return Pointer to Touch device entry or nil if not found


function TouchDeviceFindByName(const Name:String):PTouchDevice; inline;
Description: Find a Touch device by name in the device table
Name The name of the Touch device to find (eg Touch0)
Return Pointer to Touch device entry or nil if not found


function TouchDeviceFindByDescription(const Description:String):PTouchDevice; inline;
Description: Find a Touch device by description in the device table
Description The description of the Touch to find (eg USB Touchscreen)
Return Pointer to Touch device entry or nil if not found


function TouchDeviceEnumerate(Callback:TTouchEnumerate; Data:Pointer):LongWord;
Description: Enumerate all Touch devices in the Touch device table
Callback The callback function to call for each Touch device in the table
Data A private data pointer to pass to callback for each Touch device in the table
Return ERROR_SUCCESS if completed or another error code on failure


function TouchDeviceNotification(Touch:PTouchDevice; Callback:TTouchNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;
Description: Register a notification for Touch device changes
Touch The Touch device to notify changes for (Optional, pass nil for all Touch devices)
Callback The function to call when a notification event occurs
Data A private data pointer to pass to callback when a notification event occurs
Notification The events to register for notification of (eg DEVICE_NOTIFICATION_REGISTER)
Flags The flags to control the notification (eg NOTIFIER_FLAG_WORKER)
Return ERROR_SUCCESS if completed or another error code on failure


Touch helper functions

function TouchGetCount:LongWord;
Description: Get the current Touch device count
Return The number of Touch devices


function TouchDeviceGetDefault:PTouchDevice;
Description: Get the current default Touch device
Return Pointer to default Touch device entry


function TouchDeviceSetDefault(Touch:PTouchDevice):LongWord;
Description: Set the current default Touch device
Touch The Touch device to set as default
Return ERROR_SUCCESS if completed or another error code on failure


function TouchDeviceCheck(Touch:PTouchDevice):PTouchDevice;
Description: Check if the supplied Touch device is in the Touch device table
Touch The Touch device to check
Return Pointer to Touch device entry or nil if not found


function TouchDeviceTypeToString(TouchType:LongWord):String;
Description: Return a string describing the Touch device type (eg TOUCH_TYPE_CAPACITIVE)
Note None documented


function TouchDeviceStateToString(TouchState:LongWord):String;
Description: Return a string describing the Touch device state (eg TOUCH_STATE_ENABLED)
Note None documented


function TouchDeviceRotationToString(Rotation:LongWord):String;
Description: Return a string describing the supplied touch rotation value
Note None documented


function TouchDeviceResolveRotation(ARotation:LongWord):LongWord;
Description: Resolve a value of 0, 90, 180 or 270 to a touch rotation constant (eg TOUCH_ROTATION_180)
Note Also accepts passing the touch rotation constant values directly


function TouchDeviceSetCallback(Touch:PTouchDevice; Event:TTouchEvent; Parameter:Pointer):LongWord;
Description: Set the event callback function for the specified touch device
Touch The touch device to set the event callback for
Event The event callback function to be called when touch data is received
Parameter A pointer to private data to be passed to the callback with each event
Return ERROR_SUCCESS if completed or another error code on failure
Note This function also clears the TOUCH_FLAG_MOUSE_DATA flag because the event callback is not compatible with receiving touch events as mouse data


function TouchInsertData(Touch:PTouchDevice; Data:PTouchData; Signal:Boolean):LongWord;
Description: Insert a TTouchData entry into the touch device buffer
Touch The touch device to insert data for
Data The TTouchData entry to insert
Signal If True then signal that new data is available in the buffer
Return ERROR_SUCCESS if completed or another error code on failure
Note Caller must hold the touch device lock


procedure TouchLog(Level:LongWord; Touch:PTouchDevice; const AText:String);
Description: To be documented
Note None documented


procedure TouchLogInfo(Touch:PTouchDevice; const AText:String); inline;
Description: To be documented
Note None documented


procedure TouchLogWarn(Touch:PTouchDevice; const AText:String); inline;
Description: To be documented
Note None documented


procedure TouchLogError(Touch:PTouchDevice; const AText:String); inline;
Description: To be documented
Note None documented


procedure TouchLogDebug(Touch:PTouchDevice; const AText:String); inline;
Description: To be documented
Note None documented


Return to Unit Reference