Class SimulatedUSBDevice
java.lang.Object
org.episteme.core.device.AbstractDevice
org.episteme.core.device.sim.AbstractSimulatedDevice
org.episteme.core.device.sim.SimulatedUSBDevice
- All Implemented Interfaces:
Serializable, AutoCloseable, Device, Commented, ComprehensiveIdentification, Identified<Identification>, Named
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:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class AbstractDevice
AbstractDevice.RecordNested classes/interfaces inherited from interface Device
Device.Status -
Field Summary
Fields inherited from class AbstractSimulatedDevice
supportFields inherited from class AbstractDevice
accuracy, calibrationHistory, currentValue, displayUnit, firmware, history, identification, lastCalibration, locationDescription, manufacturer, maxRange, minRange, model, precisionDescription, resolution, sensitivity, status -
Constructor Summary
ConstructorsConstructorDescriptionSimulatedUSBDevice(String name) SimulatedUSBDevice(String name, int vendorId, int productId) SimulatedUSBDevice(String name, SimulatedUSBDevice.DeviceType type) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddCustomReadings(Map<String, String> readings) Subclasses can override to add custom readings.voidSimulates sensor calibration.doubledoubledoubleGets the current actuator output value.intintgetUnit()intbooleandoubleSimulates reading a sample from the device (sensor mode).double[]readSamples(int count) Reads multiple samples.voidsetBaseValue(double baseValue) voidsetDeviceType(SimulatedUSBDevice.DeviceType deviceType) voidsetNoiseLevel(double noiseLevel) voidsetOutput(double value) Sets the actuator output value.voidsetSamplingRateHz(int samplingRateHz) voidMethods inherited from class AbstractSimulatedDevice
close, connect, disconnect, getCapabilities, getDriverClass, getErrorCode, getFormattedInfo, getReadings, getStatus, getUptimeSeconds, isConnected, isPowerOn, setCapability, setDriverClass, setErrorCode, setPowerOnMethods inherited from class AbstractDevice
calibrate, getAccuracy, getCalibrationHistory, getDeviceStatus, getDisplayUnit, getFirmware, getHistory, getId, getLastCalibration, getLocationDescription, getManufacturer, getMaxRange, getMeasurableQuantities, getMinRange, getModel, getPrecisionDescription, getResolution, getSensitivity, 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, setTrait
-
Constructor Details
-
SimulatedUSBDevice
public SimulatedUSBDevice() -
SimulatedUSBDevice
-
SimulatedUSBDevice
-
SimulatedUSBDevice
-
-
Method Details
-
getVendorId
public int getVendorId() -
getProductId
public int getProductId() -
getDeviceType
-
setDeviceType
-
getUnit
-
setUnit
-
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
Simulates reading a sample from the device (sensor mode).- Throws:
IOException
-
readSamples
Reads multiple samples.- Throws:
IOException
-
calibrate
public void calibrate()Simulates sensor calibration. -
setOutput
Sets the actuator output value.- Throws:
IOException
-
getOutput
public double getOutput()Gets the current actuator output value. -
addCustomReadings
Description copied from class:AbstractSimulatedDeviceSubclasses can override to add custom readings.- Overrides:
addCustomReadingsin classAbstractSimulatedDevice
-