Difference between revisions of "Unit Mouse"

From Ultibo.org
Jump to: navigation, search
Line 194: Line 194:
 
</div></div>
 
</div></div>
 
<br />
 
<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;">'''USB mouse specific constants''' <code> USBMOUSE_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>USBMOUSE_DRIVER_NAME = 'USB Mouse Driver (HID boot protocol)';</code>
 +
| Name of USB mouse driver
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>USBMOUSE_MOUSE_DESCRIPTION = 'USB HID Mouse';</code>
 +
| Description of USB mouse device
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''HID Interface Subclass types (See USB HID v1.11 specification)''
 +
|-
 +
| <code>USB_HID_SUBCLASS_BOOT = 1;</code>
 +
| Section 4.2
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''HID Interface Protocol types (See USB HID v1.11 specification)''
 +
|-
 +
| <code>USB_HID_BOOT_PROTOCOL_KEYBOARD = 1;</code>
 +
| Section 4.3
 +
|-
 +
| <code>USB_HID_BOOT_PROTOCOL_MOUSE = 2;</code>
 +
| Section 4.3
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''HID Request types''
 +
|-
 +
| <code>USB_HID_REQUEST_GET_REPORT = $01;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_HID_REQUEST_GET_IDLE = $02;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_HID_REQUEST_GET_PROTOCOL = $03;</code>
 +
| Section 7.2
 +
|-
 +
| <code>USB_HID_REQUEST_SET_REPORT = $09;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_HID_REQUEST_SET_IDLE = $0A;</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_HID_REQUEST_SET_PROTOCOL = $0B;</code>
 +
| Section 7.2
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''HID Protocol types''
 +
|-
 +
| <code>USB_HID_PROTOCOL_BOOT = 0;</code>
 +
| Section 7.2.5
 +
|-
 +
| <code>USB_HID_PROTOCOL_REPORT = 1;</code>
 +
| Section 7.2.5
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''HID Report types''
 +
|-
 +
| <code>USB_HID_REPORT_INPUT = 1;</code>
 +
| Section 7.2.1
 +
|-
 +
| <code>USB_HID_REPORT_OUTPUT = 2;</code>
 +
| Section 7.2.1
 +
|-
 +
| <code>USB_HID_REPORT_FEATURE = 3;</code>
 +
| Section 7.2.1
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''HID Report IDs''
 +
|-
 +
| <code>USB_HID_REPORTID_NONE = 0;</code>
 +
| Section 7.2.1
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''HID Boot Protocol Button bits''
 +
|-
 +
| <code>USB_HID_BOOT_LEFT_BUTTON = (1 shl 0);</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_HID_BOOT_RIGHT_BUTTON = (1 shl 1);</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_HID_BOOT_MIDDLE_BUTTON = (1 shl 2);</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_HID_BOOT_SIDE_BUTTON = (1 shl 3);</code>
 +
| &nbsp;
 +
|-
 +
| <code>USB_HID_BOOT_EXTRA_BUTTON = (1 shl 4);</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''HID Boot Protocol Report data''
 +
|-
 +
| <code>USB_HID_BOOT_REPORT_SIZE = 3;</code>
 +
| Appendix B of HID Device Class Definition 1.11
 +
|-
 +
| <code>USB_HID_BOOT_DATA_SIZE = 8;</code>
 +
| Allocate more than the minimum to allow for extra data
 +
|-
 +
|}
 +
</div></div>
 +
<br />
  
 
=== Type definitions ===
 
=== Type definitions ===

Revision as of 05:45, 30 December 2016

Return to Unit Reference


Description


Ultibo Mouse interface unit

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_*


[Expand]
USB mouse specific constants USBMOUSE_*


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 MouseFlush:LongWord;
Description: Flush the contents of 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 MouseDeviceCreate:PMouseDevice;
Description: Create a new Mouse device entry


[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 MouseGetCount:LongWord; inline;
Description: Get the current mouse count


[Expand]
function MouseDeviceCheck(Mouse:PMouseDevice):PMouseDevice;
Description: Check if the supplied Mouse is in the mouse table


[Expand]
function MouseDeviceTypeToString(MouseType:LongWord):String;
Description: To be documented


[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