Difference between revisions of "Unit Mouse"
From Ultibo.org
Line 39: | Line 39: | ||
! '''Note''' | ! '''Note''' | ||
| Called only during system startup | | Called only during system startup | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | |||
+ | '''Mouse functions''' | ||
+ | |||
+ | <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 MousePeek:LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Peek at the global mouse buffer to see if any data packets are ready</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Return''' | ||
+ | | ERROR_SUCCESS if packets are ready, ERROR_NO_MORE_ITEMS if not or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </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 MouseRead(Buffer:Pointer; Size:LongWord; var Count:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Read mouse data packets from the global mouse buffer</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Buffer''' | ||
+ | | Pointer to a buffer to copy the mouse data packets to | ||
+ | |- | ||
+ | ! '''Size''' | ||
+ | | The size of the buffer in bytes (Must be at least TMouseData or greater) | ||
+ | |- | ||
+ | ! '''Count''' | ||
+ | | The number of mouse data packets copied to the buffer | ||
+ | |- | ||
+ | ! '''Return''' | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </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 MouseReadEx(Buffer:Pointer; Size,Flags:LongWord; var Count:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Read mouse data packets from the global mouse buffer</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Buffer''' | ||
+ | | Pointer to a buffer to copy the mouse data packets to | ||
+ | |- | ||
+ | ! '''Size''' | ||
+ | | The size of the buffer in bytes (Must be at least TMouseData or greater) | ||
+ | |- | ||
+ | ! '''Flags''' | ||
+ | | The flags for the behaviour of the read (eg MOUSE_FLAG_NON_BLOCK) | ||
+ | |- | ||
+ | ! '''Count''' | ||
+ | | The number of mouse data packets copied to the buffer | ||
+ | |- | ||
+ | ! '''Return''' | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </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 MouseWrite(Buffer:Pointer; Size,Count:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Write mouse data packets to the global mouse buffer</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Buffer''' | ||
+ | | Pointer to a buffer to copy the mouse data packets from | ||
+ | |- | ||
+ | ! '''Size''' | ||
+ | | The size of the buffer in bytes (Must be at least TMouseData or greater) | ||
+ | |- | ||
+ | ! '''Count''' | ||
+ | | The number of mouse data packets to copy from the buffer | ||
+ | |- | ||
+ | ! '''Return''' | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </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 MouseFlush:LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Flush the contents of the global mouse buffer</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Return''' | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </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 MouseDeviceRead(Mouse:PMouseDevice; Buffer:Pointer; Size:LongWord; var Count:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Read mouse data packets from the buffer of the specified mouse</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Mouse''' | ||
+ | | The mouse device to read from | ||
+ | |- | ||
+ | ! '''Buffer''' | ||
+ | | Pointer to a buffer to copy the mouse data packets to | ||
+ | |- | ||
+ | ! '''Size''' | ||
+ | | The size of the buffer in bytes (Must be at least TMouseData or greater) | ||
+ | |- | ||
+ | ! '''Count''' | ||
+ | | The number of mouse data packets copied to the buffer | ||
+ | |- | ||
+ | ! '''Return''' | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </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 MouseDeviceControl(Mouse:PMouseDevice; Request:Integer; Argument1:LongWord; var Argument2:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Perform a control request on the specified mouse device</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Mouse''' | ||
+ | | The mouse device to control | ||
+ | |- | ||
+ | ! '''Request''' | ||
+ | | The request code for the operation (eg MOUSE_CONTROL_GET_FLAG) | ||
+ | |- | ||
+ | ! '''Argument1''' | ||
+ | | The first argument for the operation (Dependant on request code) | ||
+ | |- | ||
+ | ! '''Argument2''' | ||
+ | | The second argument for the operation (Dependant on request code) | ||
+ | |- | ||
+ | ! '''Return''' | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </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 MouseDeviceSetState(Mouse:PMouseDevice; State:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the state of the specified mouse and send a notification</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Mouse''' | ||
+ | | The mouse to set the state for | ||
+ | |- | ||
+ | ! '''State''' | ||
+ | | The new state to set and notify | ||
+ | |- | ||
+ | ! '''Return''' | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </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 MouseDeviceCreate:PMouseDevice;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Create a new Mouse device entry</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Return''' | ||
+ | | Pointer to new Mouse device entry or nil if mouse could not be created | ||
+ | |- | ||
+ | |} | ||
+ | </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 MouseDeviceCreateEx(Size:LongWord):PMouseDevice;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Create a new Mouse device entry</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Size''' | ||
+ | | Size in bytes to allocate for new mouse (Including the mouse device entry) | ||
+ | |- | ||
+ | ! '''Return''' | ||
+ | | Pointer to new Mouse device entry or nil if mouse could not be created | ||
+ | |- | ||
+ | |} | ||
+ | </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 MouseDeviceDestroy(Mouse:PMouseDevice):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Destroy an existing Mouse device entry</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Mouse''' | ||
+ | | The mouse device to destroy | ||
+ | |- | ||
+ | ! '''Return''' | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </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 MouseDeviceRegister(Mouse:PMouseDevice):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Register a new Mouse device in the Mouse table</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Mouse''' | ||
+ | | The mouse device to register | ||
+ | |- | ||
+ | ! '''Return''' | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </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 MouseDeviceDeregister(Mouse:PMouseDevice):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Deregister a Mouse device from the Mouse table</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Mouse''' | ||
+ | | The mouse device to deregister | ||
+ | |- | ||
+ | ! '''Return''' | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </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 MouseDeviceFind(MouseId:LongWord):PMouseDevice;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find a mouse device by ID in the mouse table</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''MouseId''' | ||
+ | | The ID number of the mouse to find | ||
+ | |- | ||
+ | ! '''Return''' | ||
+ | | Pointer to mouse 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 MouseDeviceFindByName(const Name:String):PMouseDevice; inline;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find a mouse device by name in the mouse table</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Name''' | ||
+ | | The name of the mouse to find (eg Mouse0) | ||
+ | |- | ||
+ | ! '''Return''' | ||
+ | | Pointer to mouse 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 MouseDeviceFindByDescription(const Description:String):PMouseDevice; inline;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find a mouse device by description in the mouse table</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Description''' | ||
+ | | The description of the mouse to find (eg USB HID Mouse) | ||
+ | |- | ||
+ | ! '''Return''' | ||
+ | | Pointer to mouse 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 MouseDeviceEnumerate(Callback:TMouseEnumerate; Data:Pointer):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Enumerate all mouse devices in the mouse table</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Callback''' | ||
+ | | The callback function to call for each mouse in the table | ||
+ | |- | ||
+ | ! '''Data''' | ||
+ | | A private data pointer to pass to callback for each mouse in the table | ||
+ | |- | ||
+ | ! '''Return''' | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </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 MouseDeviceNotification(Mouse:PMouseDevice; Callback:TMouseNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Register a notification for mouse device changes</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Mouse''' | ||
+ | | The mouse device to notify changes for (Optional, pass nil for all mice) | ||
+ | |- | ||
+ | ! '''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) | ||
|- | |- | ||
|} | |} |
Revision as of 04:06, 19 August 2016
Return to Unit Reference
Contents
[hide]Description
Mouse Devices
This unit provides both the Mouse device interface and the generic USB HID mouse driver.
Constants
To be documented
Type definitions
To be documented
Public variables
To be documented
Function declarations
Initialization functions
[Expand]
procedure MouseInit;
Description: Initialize the mouse unit, device table and USB mouse driver
Mouse functions
[Expand]
function MousePeek:LongWord;
Description: Peek at the global mouse buffer to see if any data packets are ready
[Expand]
function MouseRead(Buffer:Pointer; Size:LongWord; var Count:LongWord):LongWord;
Description: Read mouse data packets from the global mouse buffer
[Expand]
function MouseReadEx(Buffer:Pointer; Size,Flags:LongWord; var Count:LongWord):LongWord;
Description: Read mouse data packets from the global mouse buffer
[Expand]
function MouseWrite(Buffer:Pointer; Size,Count:LongWord):LongWord;
Description: Write mouse data packets to the global mouse buffer
[Expand]
function MouseDeviceRead(Mouse:PMouseDevice; Buffer:Pointer; Size:LongWord; var Count:LongWord):LongWord;
Description: Read mouse data packets from the buffer of the specified mouse
[Expand]
function MouseDeviceControl(Mouse:PMouseDevice; Request:Integer; Argument1:LongWord; var Argument2:LongWord):LongWord;
Description: Perform a control request on the specified mouse device
[Expand]
function MouseDeviceSetState(Mouse:PMouseDevice; State:LongWord):LongWord;
Description: Set the state of the specified mouse and send a notification
[Expand]
function MouseDeviceCreateEx(Size:LongWord):PMouseDevice;
Description: Create a new Mouse device entry
[Expand]
function MouseDeviceDestroy(Mouse:PMouseDevice):LongWord;
Description: Destroy an existing Mouse device entry
[Expand]
function MouseDeviceRegister(Mouse:PMouseDevice):LongWord;
Description: Register a new Mouse device in the Mouse table
[Expand]
function MouseDeviceDeregister(Mouse:PMouseDevice):LongWord;
Description: Deregister a Mouse device from the Mouse table
[Expand]
function MouseDeviceFind(MouseId:LongWord):PMouseDevice;
Description: Find a mouse device by ID in the mouse table
[Expand]
function MouseDeviceFindByName(const Name:String):PMouseDevice; inline;
Description: Find a mouse device by name in the mouse table
[Expand]
function MouseDeviceFindByDescription(const Description:String):PMouseDevice; inline;
Description: Find a mouse device by description in the mouse table
[Expand]
function MouseDeviceEnumerate(Callback:TMouseEnumerate; Data:Pointer):LongWord;
Description: Enumerate all mouse devices in the mouse table
[Expand]
function MouseDeviceNotification(Mouse:PMouseDevice; Callback:TMouseNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;
Description: Register a notification for mouse device changes
Return to Unit Reference