Difference between revisions of "Unit Mouse"
From Ultibo.org
Line 10: | Line 10: | ||
---- | ---- | ||
− | '' | + | |
+ | <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;">'''Mouse specific constants''' <code> MOUSE_* </code></div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>MOUSE_NAME_PREFIX = 'Mouse';</code> | ||
+ | | Name prefix for Mouse 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;">'''Mouse device type constants''' <code> MOUSE_TYPE_* </code></div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>MOUSE_TYPE_NONE = 0;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>MOUSE_TYPE_USB = 1;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>MOUSE_TYPE_PS2 = 2;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>MOUSE_TYPE_SERIAL = 3;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>MOUSE_TYPE_MAX = 3;</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;">'''Mouse device state constants''' <code> MOUSE_STATE_* </code></div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>MOUSE_STATE_DETACHED = 0;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>MOUSE_STATE_DETACHING = 1;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>MOUSE_STATE_ATTACHING = 2;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>MOUSE_STATE_ATTACHED = 3;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>MOUSE_STATE_MAX = 3;</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;">'''Mouse device flag constants''' <code> MOUSE_FLAG_* </code></div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>MOUSE_FLAG_NONE = $00000000;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>MOUSE_FLAG_NON_BLOCK = $00000001;</code> | ||
+ | | If set device reads are non blocking (Also supported in Flags parameter of MouseReadEx) | ||
+ | |- | ||
+ | | <code>MOUSE_FLAG_DIRECT_READ = $00000002;</code> | ||
+ | | If set device writes mouse data to its local buffer and which must be read using MouseDeviceRead | ||
+ | |- | ||
+ | | <code>MOUSE_FLAG_SWAP_BUTTONS = $00000004;</code> | ||
+ | | If set left and right mouse buttons will be swapped in mouse data | ||
+ | |- | ||
+ | | <code>MOUSE_FLAG_PEEK_BUFFER = $00000008;</code> | ||
+ | | Peek at the buffer to see if any data is available, don't remove it. (Used only in Flags parameter of MouseReadEx) | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | |colspan="2"|''Flags supported by MOUSE_CONTROL_GET/SET/CLEAR_FLAG'' | ||
+ | |- | ||
+ | | <code>MOUSE_FLAG_MASK = MOUSE_FLAG_NON_BLOCK or MOUSE_FLAG_DIRECT_READ or MOUSE_FLAG_SWAP_BUTTONS;</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;">'''Mouse device control code constants''' <code> MOUSE_CONTROL_* </code></div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>MOUSE_CONTROL_GET_FLAG = 1;</code> | ||
+ | | Get Flag | ||
+ | |- | ||
+ | | <code>MOUSE_CONTROL_SET_FLAG = 2;</code> | ||
+ | | Set Flag | ||
+ | |- | ||
+ | | <code>MOUSE_CONTROL_CLEAR_FLAG = 3;</code> | ||
+ | | Clear Flag | ||
+ | |- | ||
+ | | <code>MOUSE_CONTROL_FLUSH_BUFFER = 4;</code> | ||
+ | | Flush Buffer | ||
+ | |- | ||
+ | |} | ||
+ | </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;">'''Mouse buffer size constants''' <code> MOUSE_BUFFER_* </code></div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>MOUSE_BUFFER_SIZE = 512;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |} | ||
+ | </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;">'''Mouse data definition constants''' <code> MOUSE_LEFT_*, MOUSE_RIGHT_* </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 TMouseData.Buttons | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>MOUSE_LEFT_BUTTON = $0001;</code> | ||
+ | | The Left mouse button is pressed | ||
+ | |- | ||
+ | | <code>MOUSE_RIGHT_BUTTON = $0002;</code> | ||
+ | | The Right mouse button is pressed | ||
+ | |- | ||
+ | | <code>MOUSE_MIDDLE_BUTTON = $0004;</code> | ||
+ | | The Middle mouse button is pressed | ||
+ | |- | ||
+ | | <code>MOUSE_SIDE_BUTTON = $0008;</code> | ||
+ | | The Side mouse button is pressed | ||
+ | |- | ||
+ | | <code>MOUSE_EXTRA_BUTTON = $0010;</code> | ||
+ | | The Extra mouse button is pressed | ||
+ | |- | ||
+ | | <code>MOUSE_TOUCH_BUTTON = $0020;</code> | ||
+ | | The Touch screen is being touched | ||
+ | |- | ||
+ | | <code>MOUSE_ABSOLUTE_X = $0040;</code> | ||
+ | | The OffsetX value is absolute not relative | ||
+ | |- | ||
+ | | <code>MOUSE_ABSOLUTE_Y = $0080;</code> | ||
+ | | The OffsetY value is absolute not relative | ||
+ | |- | ||
+ | | <code>MOUSE_ABSOLUTE_WHEEL = $0100;</code> | ||
+ | | The OffsetWheel value is absolute not relative | ||
+ | |- | ||
+ | |} | ||
+ | </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;">'''Mouse logging constants''' <code> MOUSE_LOG_* </code></div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>MOUSE_LOG_LEVEL_DEBUG = LOG_LEVEL_DEBUG;</code> | ||
+ | | Mouse debugging messages | ||
+ | |- | ||
+ | | <code>MOUSE_LOG_LEVEL_INFO = LOG_LEVEL_INFO;</code> | ||
+ | | Mouse informational messages, such as a device being attached or detached | ||
+ | |- | ||
+ | | <code>MOUSE_LOG_LEVEL_ERROR = LOG_LEVEL_ERROR;</code> | ||
+ | | Mouse error messages | ||
+ | |- | ||
+ | | <code>MOUSE_LOG_LEVEL_NONE = LOG_LEVEL_NONE;</code> | ||
+ | | No Mouse messages | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
=== Type definitions === | === Type definitions === |
Revision as of 04:38, 28 November 2016
Return to Unit Reference
Contents
[hide]Description
This unit provides both the Mouse device interface and the generic USB HID mouse driver.
Constants
[Expand]
Mouse specific constants
MOUSE_*
[Expand]
Mouse device type constants
MOUSE_TYPE_*
[Expand]
Mouse device state constants
MOUSE_STATE_*
[Expand]
Mouse device flag constants
MOUSE_FLAG_*
[Expand]
Mouse device control code constants
MOUSE_CONTROL_*
[Expand]
Mouse buffer size constants
MOUSE_BUFFER_*
[Expand]
Mouse data definition constants
MOUSE_LEFT_*, MOUSE_RIGHT_*
[Expand]
Mouse logging constants
MOUSE_LOG_*
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
RTL console functions
[Expand]
function SysConsoleHideMouse(AUserData:Pointer):Boolean;
Description: Handler for Platform ConsoleHideMouse function
[Expand]
function SysConsoleShowMouse(X,Y:LongWord; AUserData:Pointer):Boolean;
Description: Handler for Platform ConsoleShowMouse function
[Expand]
function SysConsoleReadMouse(var X,Y,Buttons:LongWord; AUserData:Pointer):Boolean;
Description: Handler for Platform ConsoleReadMouse function
USB mouse functions
[Expand]
function USBMouseDeviceRead(Mouse:PMouseDevice; Buffer:Pointer; Size:LongWord; var Count:LongWord):LongWord;
Description: Implementation of MouseDeviceRead API for USB Mouse
[Expand]
function USBMouseDeviceControl(Mouse:PMouseDevice; Request:Integer; Argument1:LongWord; var Argument2:LongWord):LongWord;
Description: Implementation of MouseDeviceControl API for USB Mouse
[Expand]
function USBMouseDriverBind(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;
Description: Bind the Mouse driver to a USB device if it is suitable
[Expand]
function USBMouseDriverUnbind(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;
Description: Unbind the Mouse driver from a USB device
[Expand]
procedure USBMouseReportWorker(Request:PUSBRequest);
Description: Called (by a Worker thread) to process a completed USB request from a USB mouse IN interrupt endpoint
[Expand]
procedure USBMouseReportComplete(Request:PUSBRequest);
Description: Called when a USB request from a USB mouse IN interrupt endpoint completes
Mouse helper functions
[Expand]
function MouseDeviceCheck(Mouse:PMouseDevice):PMouseDevice;
Description: Check if the supplied Mouse is in the mouse table
[Expand]
function MouseDeviceStateToString(MouseState:LongWord):String;
Description: To be documented
[Expand]
function MouseDeviceStateToNotification(State:LongWord):LongWord;
Description: Convert a Mouse state value into the notification code for device notifications
[Expand]
procedure MouseLog(Level:LongWord; Mouse:PMouseDevice; const AText:String);
Description: To be documented
[Expand]
procedure MouseLogInfo(Mouse:PMouseDevice; const AText:String);
Description: To be documented
[Expand]
procedure MouseLogError(Mouse:PMouseDevice; const AText:String);
Description: To be documented
[Expand]
procedure MouseLogDebug(Mouse:PMouseDevice; const AText:String);
Description: To be documented
USB mouse helper functions
[Expand]
function USBMouseDeviceSetProtocol(Mouse:PUSBMouseDevice; Protocol:Byte):LongWord;
Description: Set the report protocol for a USB mouse device
Return to Unit Reference