Package org.hid4java
Class HidServices
java.lang.Object
org.hid4java.HidServices
JNA bridge class to provide the following to USB HID:
- Access to the
signal11/hidapi
via JNA
Requires the hidapi to be present on the classpath or the system library search path.
- Since:
- 0.0.1
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final HidDeviceManager
The HID device manager handles scanning operationsprivate final HidServicesListenerList
The HID services listeners for receiving attach/detach events etc -
Constructor Summary
ConstructorsConstructorDescriptionInitialise with a default HID specificationHidServices
(HidServicesSpecification hidServicesSpecification) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addHidServicesListener
(HidServicesListener listener) getHidDevice
(int vendorId, int productId, String serialNumber) static String
static void
Jar entry point to allow for version interrogationvoid
removeHidServicesListener
(HidServicesListener listener) void
scan()
Manually scans for HID device connection changes and triggers listener events as requiredvoid
shutdown()
Stop scanning for devices and shut down theHidApi
void
start()
Start scanning for devices (if not already scanning)void
stop()
Stop scanning for devices
-
Field Details
-
listeners
The HID services listeners for receiving attach/detach events etc -
hidDeviceManager
The HID device manager handles scanning operations
-
-
Constructor Details
-
HidServices
Initialise with a default HID specification- Throws:
HidException
- If something goes wrong (seeHidDeviceManager(HidServicesListenerList, HidServicesSpecification)
-
HidServices
- Parameters:
hidServicesSpecification
- Provides various parameters for configuring HID services- Throws:
HidException
- If something goes wrong (seeHidDeviceManager(HidServicesListenerList, HidServicesSpecification)
-
-
Method Details
-
main
Jar entry point to allow for version interrogation- Parameters:
args
- Nothing required
-
shutdown
public void shutdown()Stop scanning for devices and shut down theHidApi
-
stop
public void stop()Stop scanning for devices -
start
public void start()Start scanning for devices (if not already scanning) -
addHidServicesListener
- Parameters:
listener
- The listener to add
-
removeHidServicesListener
- Parameters:
listener
- The listener to remove
-
scan
public void scan()Manually scans for HID device connection changes and triggers listener events as required -
getAttachedHidDevices
- Returns:
- A list of all attached HID devices
-
getHidDevice
- Parameters:
vendorId
- The vendor IDproductId
- The product IDserialNumber
- The serial number (use null for wildcard)- Returns:
- The device if attached, null if detached
-
getVersion
- Returns:
- The current library version from the manifest or 0.0.x if an error occurs
-