public class HidServices extends Object
JNA bridge class to provide the following to USB HID:
signal11/hidapi
via JNARequires the hidapi to be present on the classpath or the system library search path.
Constructor and Description |
---|
HidServices()
Initialise and start scanning for USB devices at 500ms interval.
|
HidServices(boolean autoShutdown)
Initialise and start scanning for USB devices at 500ms interval.
|
HidServices(boolean autoShutdown,
int scanInterval)
Initialise and start scanning for USB devices at the given interval.
|
Modifier and Type | Method and Description |
---|---|
void |
addHidServicesListener(HidServicesListener listener) |
List<HidDevice> |
getAttachedHidDevices() |
HidDevice |
getHidDevice(int vendorId,
int productId,
String serialNumber) |
void |
removeUsbServicesListener(HidServicesListener listener) |
void |
scan()
Manually scans for HID device connection changes and triggers listener events as required
|
void |
shutdown()
Stop scanning for devices and shut down the
HidApi |
void |
start()
Start scanning for devices (if not already scanning)
|
void |
start(int scanInterval)
Start scanning for devices with the specified interval (if not already scanning)
|
void |
stop()
Stop scanning for devices and close connection to HidApi
|
public HidServices() throws HidException
HidException
- If something goes wrong (see HidDeviceManager.HidDeviceManager(HidServicesListenerList, int)
public HidServices(boolean autoShutdown) throws HidException
autoShutdown
- True if a shutdown hook should be set to close the API automaticallyHidException
- If something goes wrong (see HidDeviceManager.HidDeviceManager(HidServicesListenerList, int)
public HidServices(boolean autoShutdown, int scanInterval) throws HidException
autoShutdown
- True if a shutdown hook should be set to close the API automaticallyHidException
- If something goes wrong (see HidDeviceManager.HidDeviceManager(HidServicesListenerList, int)
public void shutdown()
HidApi
public void stop()
public void start()
public void start(int scanInterval)
scanInterval
- The (new) scan interval in millispublic void addHidServicesListener(HidServicesListener listener)
listener
- The listener to addpublic void removeUsbServicesListener(HidServicesListener listener)
listener
- The listener to removepublic void scan()
public List<HidDevice> getAttachedHidDevices()
Copyright © 2014–2015 Bitcoin Solutions Ltd. All rights reserved.