com.codeminders.hidapi
Class HIDManager

java.lang.Object
  extended by com.codeminders.hidapi.HIDManager

public class HIDManager
extends java.lang.Object

HIDManager.java High-level interface to enumerate, find , open HID devices and get connect/disconnect notifications.

Version:
1.0
Author:
lord

Field Summary
protected  long peer
           
 
Method Summary
protected  void finalize()
          Release HID manager.
static HIDManager getInstance()
           
 HIDDeviceInfo[] listDevices()
          Get list of all the HID devices attached to the system.
 HIDDevice openById(int vendor_id, int product_id, java.lang.String serial_number)
          Convenience method to open a HID device using a Vendor ID (VID), Product ID (PID) and optionally a serial number.
 HIDDevice openByPath(java.lang.String path)
          Convenience method to find and open device by path
 void release()
          Release underlying HID layer.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

peer

protected long peer
Method Detail

listDevices

public HIDDeviceInfo[] listDevices()
                            throws java.io.IOException
Get list of all the HID devices attached to the system.

Returns:
list of devices
Throws:
java.io.IOException

release

public void release()
Release underlying HID layer. This method must be called when HIDManager object is no longer needed. Failure to do so could cause memory leaks or unterminated threads. It is safe to call this method multiple times.


finalize

protected void finalize()
                 throws java.lang.Throwable
Release HID manager. Will call release().

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

openByPath

public HIDDevice openByPath(java.lang.String path)
                     throws java.io.IOException,
                            HIDDeviceNotFoundException
Convenience method to find and open device by path

Parameters:
path - USB device path
Returns:
open device reference HIDDevice object
Throws:
java.io.IOException - in case of internal error
HIDDeviceNotFoundException - if devive was not found

openById

public HIDDevice openById(int vendor_id,
                          int product_id,
                          java.lang.String serial_number)
                   throws java.io.IOException,
                          HIDDeviceNotFoundException
Convenience method to open a HID device using a Vendor ID (VID), Product ID (PID) and optionally a serial number.

Parameters:
vendor_id - USB vendor ID
product_id - USB product ID
serial_number - USB device serial number (could be null)
Returns:
open device
Throws:
java.io.IOException - in case of internal error
HIDDeviceNotFoundException - if devive was not found

getInstance

public static HIDManager getInstance()
                              throws java.io.IOException
Throws:
java.io.IOException