Class HidServices
java.lang.Object
org.hid4java.HidServices
JNA bridge class to provide the following to USB HID:
- Access to the
signal11/hidapivia 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 HidDeviceManagerThe HID device manager handles scanning operationsprivate final HidServicesListenerListThe HID services listeners for receiving attach/detach events etc -
Constructor Summary
ConstructorsConstructorDescriptionInitialise with a default HID specificationHidServices(HidServicesSpecification hidServicesSpecification) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddHidServicesListener(HidServicesListener listener) getHidDevice(int vendorId, int productId, String serialNumber) static Stringstatic voidJar entry point to allow for version interrogationvoidremoveHidServicesListener(HidServicesListener listener) voidscan()Manually scans for HID device connection changes and triggers listener events as requiredvoidshutdown()Stop scanning for devices and shut down theHidApivoidstart()Start scanning for devices (if not already scanning)voidstop()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
-
getHidDevice
-
getVersion
- Returns:
- The current library version from the manifest or 0.0.x if an error occurs
-