|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.usb.examples.MouseDriver
public class MouseDriver
Example driver for USB mice.
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.
| Nested Class Summary | |
|---|---|
static class |
MouseDriver.HidMouseRunnable
Class to listen in a dedicated Thread for mouse movement events. |
| Field Summary | |
|---|---|
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 Summary | |
|---|---|
MouseDriver()
|
|
| Method Summary | |
|---|---|
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)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
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
| Constructor Detail |
|---|
public MouseDriver()
| Method Detail |
|---|
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.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||