Class USBDevice
java.lang.Object
org.episteme.core.device.AbstractDevice
org.episteme.core.device.USBDevice
- All Implemented Interfaces:
Serializable, AutoCloseable, Device, Commented, ComprehensiveIdentification, Identified<Identification>, Named
Abstract base class for USB-connected devices.
This class provides the foundation for communication with USB-based laboratory devices including sensors (input) and actuators (output).
- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractDevice
AbstractDevice.RecordNested classes/interfaces inherited from interface Device
Device.Status -
Field Summary
FieldsFields inherited from class AbstractDevice
accuracy, calibrationHistory, currentValue, displayUnit, firmware, history, identification, lastCalibration, locationDescription, manufacturer, maxRange, minRange, model, precisionDescription, resolution, sensitivity, status -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()intReturns the USB Product ID.Returns the USB serial number.intReturns the USB Vendor ID.booleanChecks if the device is currently connected.abstract byte[]read(int length) Reads raw bytes from the USB device.readResponse(int maxLength) Reads a response string from the device.voidsendCommand(String command) Sends a command string to the device.voidsetSerialNumber(String serialNumber) abstract voidwrite(byte[] data) Sends raw bytes to the USB device.Methods inherited from class AbstractDevice
calibrate, getAccuracy, getCalibrationHistory, getDeviceStatus, getDisplayUnit, getFirmware, getHistory, getId, getLastCalibration, getLocationDescription, getManufacturer, getMaxRange, getMeasurableQuantities, getMinRange, getModel, getPrecisionDescription, getResolution, getSensitivity, getStatus, getTrait, getTraitOptional, getTraits, getValue, isEnabled, measure, needsCalibration, performCalibration, recordMeasurement, setAccuracy, setCurrentValue, setDisplayUnit, setEnabled, setFirmware, setLastCalibration, setLocationDescription, setManufacturer, setMaxRange, setMinRange, setModel, setPrecisionDescription, setResolution, setSensitivity, setStatusMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Commented
getComments, getTrait, setCommentsMethods inherited from interface ComprehensiveIdentification
getName, setName, setTraitMethods inherited from interface Device
calibrate, connect, disconnect, getCapabilities, getReadings
-
Field Details
-
vendorId
protected int vendorId -
productId
protected int productId -
serialNumber
-
-
Constructor Details
-
USBDevice
-
USBDevice
-
-
Method Details
-
getVendorId
public int getVendorId()Returns the USB Vendor ID. -
getProductId
public int getProductId()Returns the USB Product ID. -
getSerialNumber
Returns the USB serial number. -
setSerialNumber
-
write
Sends raw bytes to the USB device.- Throws:
IOException
-
read
Reads raw bytes from the USB device.- Throws:
IOException
-
sendCommand
Sends a command string to the device.- Throws:
IOException
-
readResponse
Reads a response string from the device.- Throws:
IOException
-
isConnected
public boolean isConnected()Description copied from interface:DeviceChecks if the device is currently connected.- Returns:
- true if connected, false otherwise
-
close
-