Difference between revisions of "Unit Touch"

From Ultibo.org
Jump to: navigation, search
Line 195: Line 195:
 
----
 
----
  
''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>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>PointID:Word;</code>
 +
| &nbsp;
 +
|-
 +
| <code>PositionX:SmallInt;</code>
 +
| &nbsp;
 +
|-
 +
| <code>PositionY:SmallInt;</code>
 +
| &nbsp;
 +
|-
 +
| <code>PositionZ:SmallInt;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</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 value for the touch device
 +
|-
 +
| <code>MaxY:LongWord;</code>
 +
| Maximum (absolute) Y value for the touch device
 +
|-
 +
| <code>MaxZ:LongWord;</code>
 +
| Maximum (absolute) Z value for the touch device
 +
|-
 +
| <code>MaxPoints:LongWord;</code>
 +
| Maximum number of touch points
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''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 control'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TTouchDeviceControl = function(Touch:PTouchDevice; Request:Integer; Argument1:LongWord; var Argument2:LongWord):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''Touch device properties'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TTouchDeviceProperties = 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 dveice 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>DeviceControl:TTouchDeviceControl;</code>
 +
| A Device specific DeviceControl method implementing a standard Touch device interface (Or nil if the default method is suitable)
 +
|-
 +
| <code>DeviceProperties:TTouchDeviceProperties;</code>
 +
| A Device specific DeviceProperties 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>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 ===

Revision as of 02:59, 26 January 2017

Return to Unit Reference


Description


Ultibo Touch interface unit

To be documented

Constants



[Expand]
Touch specific constants TOUCH_*


[Expand]
Touch device type constants TOUCH_TYPE_*


[Expand]
Touch device state constants TOUCH_STATE_*


[Expand]
Touch device flag constants TOUCH_FLAG_*


[Expand]
Touch device control code constants TOUCH_CONTROL_*


[Expand]
Touch buffer size constants TOUCH_BUFFER_*


[Expand]
Touch data definitions constants TOUCH_FINGER*, TOUCH_ID_*


[Expand]
Touch rotation constants TOUCH_ROTATION_*


[Expand]
Touch logging constants TOUCH_LOG_*


Type definitions



Touch data

[Expand]

PTouchData = ^TTouchData;

TTouchData = record

Touch buffer

[Expand]

PTouchBuffer = ^TTouchBuffer;

TTouchBuffer = record

Touch properties

[Expand]

PTouchProperties = ^TTouchProperties;

TTouchProperties = record

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 control

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

Touch device properties

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

Touch device

[Expand]

PTouchDevice = ^TTouchDevice;

TTouchDevice = record


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

[Expand]
procedure TouchInit;
Description: Initialize the Touch unit and Touch device table


Touch functions

[Expand]
function TouchDeviceStart(Touch:PTouchDevice):LongWord;
Description: Start the specified Touch device ready for receiving events


[Expand]
function TouchDeviceStop(Touch:PTouchDevice):LongWord;
Description: Stop the specified Touch device and terminate receiving events


[Expand]
function TouchDevicePeek(Touch:PTouchDevice):LongWord;
Description: Peek at the buffer of the specified touch device to see if any data packets are ready


[Expand]
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


[Expand]
function TouchDeviceWrite(Touch:PTouchDevice; Buffer:Pointer; Size,Count:LongWord):LongWord;
Description: Write touch data packets to the buffer of the specified touch device


[Expand]
function TouchDeviceFlush(Touch:PTouchDevice):LongWord;
Description: Flush the contents of the buffer of the specified touch device


[Expand]
function TouchDeviceControl(Touch:PTouchDevice; Request:Integer; Argument1:LongWord; var Argument2:LongWord):LongWord;
Description: Perform a control request on the specified touch device


[Expand]
function TouchDeviceProperties(Touch:PTouchDevice; Properties:PTouchProperties):LongWord;
Description: Get the properties for the specified Touch device


[Expand]
function TouchDeviceCreate:PTouchDevice;
Description: Create a new Touch device entry


[Expand]
function TouchDeviceCreateEx(Size:LongWord):PTouchDevice;
Description: Create a new Touch device entry


[Expand]
function TouchDeviceDestroy(Touch:PTouchDevice):LongWord;
Description: Destroy an existing Touch device entry


[Expand]
function TouchDeviceRegister(Touch:PTouchDevice):LongWord;
Description: Register a new Touch device in the Touch device table


[Expand]
function TouchDeviceDeregister(Touch:PTouchDevice):LongWord;
Description: Deregister an Touch device from the Touch device table


[Expand]
function TouchDeviceFind(TouchId:LongWord):PTouchDevice;
Description: To be documented


[Expand]
function TouchDeviceFindByName(const Name:String):PTouchDevice; inline;
Description: To be documented


[Expand]
function TouchDeviceFindByDescription(const Description:String):PTouchDevice; inline;
Description: To be documented


[Expand]
function TouchDeviceEnumerate(Callback:TTouchEnumerate; Data:Pointer):LongWord;
Description: To be documented


[Expand]
function TouchDeviceNotification(Touch:PTouchDevice; Callback:TTouchNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;
Description: To be documented


Touch helper functions

[Expand]
function TouchGetCount:LongWord; inline;
Description: Get the current Touch device count


[Expand]
function TouchDeviceGetDefault:PTouchDevice; inline;
Description: Get the current default Touch device


[Expand]
function TouchDeviceSetDefault(Touch:PTouchDevice):LongWord;
Description: Set the current default Touch device


[Expand]
function TouchDeviceCheck(Touch:PTouchDevice):PTouchDevice;
Description: Check if the supplied Touch device is in the Touch device table


[Expand]
procedure TouchLog(Level:LongWord; Touch:PTouchDevice; const AText:String);
Description: To be documented


[Expand]
procedure TouchLogInfo(Touch:PTouchDevice; const AText:String); inline;
Description: To be documented


[Expand]
procedure TouchLogError(Touch:PTouchDevice; const AText:String); inline;
Description: To be documented


[Expand]
procedure TouchLogDebug(Touch:PTouchDevice; const AText:String); inline;
Description: To be documented


Return to Unit Reference