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

public abstract class USBDevice extends AbstractDevice
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:
  • Field Details

    • vendorId

      protected int vendorId
    • productId

      protected int productId
    • serialNumber

      protected String serialNumber
  • Constructor Details

    • USBDevice

      protected USBDevice(String name)
    • USBDevice

      protected USBDevice(String name, int vendorId, int productId)
  • Method Details

    • getVendorId

      public int getVendorId()
      Returns the USB Vendor ID.
    • getProductId

      public int getProductId()
      Returns the USB Product ID.
    • getSerialNumber

      public String getSerialNumber()
      Returns the USB serial number.
    • setSerialNumber

      public void setSerialNumber(String serialNumber)
    • write

      public abstract void write(byte[] data) throws IOException
      Sends raw bytes to the USB device.
      Throws:
      IOException
    • read

      public abstract byte[] read(int length) throws IOException
      Reads raw bytes from the USB device.
      Throws:
      IOException
    • sendCommand

      public void sendCommand(String command) throws IOException
      Sends a command string to the device.
      Throws:
      IOException
    • readResponse

      public String readResponse(int maxLength) throws IOException
      Reads a response string from the device.
      Throws:
      IOException
    • isConnected

      public boolean isConnected()
      Description copied from interface: Device
      Checks if the device is currently connected.
      Returns:
      true if connected, false otherwise
    • close

      public void close() throws Exception
      Throws:
      Exception