public class MouseDriver extends Object
This shows how to get events from a USB mouse. This class should not be used except by other example code.
WARNING : The code in the class is intended for example use only! Some functionality (e.g. HID usage detection) is simplified for example purposes, and should not be reproduced in non-example code. Also this code is designed to be example code, not robust well-written code, and so the design should not be duplicated in normal code.
| Modifier and Type | Class and Description |
|---|---|
static class |
MouseDriver.HidMouseRunnable
Class to listen in a dedicated Thread for mouse movement events.
|
| Modifier and Type | Field and Description |
|---|---|
static byte |
GET_REPORT_DESCRIPTOR_REQUEST |
static byte |
GET_REPORT_DESCRIPTOR_REQUESTTYPE |
static short |
GET_REPORT_DESCRIPTOR_VALUE |
static byte |
HID_CLASS |
static byte |
HID_DESCRIPTOR_TYPE_REPORT |
static short |
HID_MOUSE_USAGE_ID |
static short |
HID_MOUSE_USAGE_PAGE |
static byte |
HID_PROTOCOL_MOUSE |
static byte |
HID_SUBCLASS_BOOT_INTERFACE |
| Constructor and Description |
|---|
MouseDriver() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
checkHidInterface(UsbInterface usbInterface,
short usagePage,
short usageID)
Check the HID-class UsbInterface to see if matches the usagePage and usageID.
|
static boolean |
checkUsbInterfaceIsMouse(UsbInterface usbInterface)
Check if the HID-class UsbInterface is a boot-type USB mouse.
|
static void |
driveHidMouse(UsbInterface usbInterface)
Drive the HID mouse until the user aborts.
|
static void |
main(String[] argv) |
public static final byte HID_CLASS
public static final byte HID_SUBCLASS_BOOT_INTERFACE
public static final byte HID_PROTOCOL_MOUSE
public static final short HID_MOUSE_USAGE_PAGE
public static final short HID_MOUSE_USAGE_ID
public static final byte HID_DESCRIPTOR_TYPE_REPORT
public static final byte GET_REPORT_DESCRIPTOR_REQUESTTYPE
public static final byte GET_REPORT_DESCRIPTOR_REQUEST
public static final short GET_REPORT_DESCRIPTOR_VALUE
public static void main(String[] argv)
public static void driveHidMouse(UsbInterface usbInterface)
usbInterface - The UsbInterface for the mouse.public static boolean checkUsbInterfaceIsMouse(UsbInterface usbInterface)
usbInterface - The HID-class UsbInterface to check.public static boolean checkHidInterface(UsbInterface usbInterface, short usagePage, short usageID)
usbInterface - The HID-class UsbInterface to check.Copyright © 2014 LSST. All Rights Reserved.