Class SimulatedUSBDevice

All Implemented Interfaces:
Serializable, AutoCloseable, Device, Commented, ComprehensiveIdentification, Identified<Identification>, Named

public class SimulatedUSBDevice extends AbstractSimulatedDevice
Simulated USB device for testing without physical hardware.

Can act as either a sensor (input) or actuator (output) depending on configuration.

Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
See Also:
  • Constructor Details

    • SimulatedUSBDevice

      public SimulatedUSBDevice()
    • SimulatedUSBDevice

      public SimulatedUSBDevice(String name)
    • SimulatedUSBDevice

      public SimulatedUSBDevice(String name, int vendorId, int productId)
    • SimulatedUSBDevice

      public SimulatedUSBDevice(String name, SimulatedUSBDevice.DeviceType type)
  • Method Details

    • getVendorId

      public int getVendorId()
    • getProductId

      public int getProductId()
    • getDeviceType

      public SimulatedUSBDevice.DeviceType getDeviceType()
    • setDeviceType

      public void setDeviceType(SimulatedUSBDevice.DeviceType deviceType)
    • getUnit

      public String getUnit()
    • setUnit

      public void setUnit(String unit)
    • getBaseValue

      public double getBaseValue()
    • setBaseValue

      public void setBaseValue(double baseValue)
    • getNoiseLevel

      public double getNoiseLevel()
    • setNoiseLevel

      public void setNoiseLevel(double noiseLevel)
    • getSamplingRateHz

      public int getSamplingRateHz()
    • setSamplingRateHz

      public void setSamplingRateHz(int samplingRateHz)
    • isCalibrated

      public boolean isCalibrated()
    • readSample

      public double readSample() throws IOException
      Simulates reading a sample from the device (sensor mode).
      Throws:
      IOException
    • readSamples

      public double[] readSamples(int count) throws IOException
      Reads multiple samples.
      Throws:
      IOException
    • calibrate

      public void calibrate()
      Simulates sensor calibration.
    • setOutput

      public void setOutput(double value) throws IOException
      Sets the actuator output value.
      Throws:
      IOException
    • getOutput

      public double getOutput()
      Gets the current actuator output value.
    • addCustomReadings

      protected void addCustomReadings(Map<String,String> readings)
      Description copied from class: AbstractSimulatedDevice
      Subclasses can override to add custom readings.
      Overrides:
      addCustomReadings in class AbstractSimulatedDevice