Class AbstractSimulatedSensor<Q extends Quantity<Q>>

Type Parameters:
Q - the type of quantity produced by the sensor
All Implemented Interfaces:
Serializable, AutoCloseable, Device, Sensor<Q>, Commented, ComprehensiveIdentification, Identified<Identification>, Named
Direct Known Subclasses:
SimulatedHumidityProbe, SimulatedMicroscope, SimulatedMultimeter, SimulatedOscilloscope, SimulatedPHMeter, SimulatedPressureGauge, SimulatedSeismograph, SimulatedSpectrometer, SimulatedTemperatureProbe, SimulatedVoterScanner

public abstract class AbstractSimulatedSensor<Q extends Quantity<Q>> extends AbstractSensor<Q>
Abstract base implementation for simulated sensors.
Since:
1.2
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
See Also:
  • Field Details

  • Constructor Details

    • AbstractSimulatedSensor

      protected AbstractSimulatedSensor(String name)
    • AbstractSimulatedSensor

      protected AbstractSimulatedSensor(Identification identification)
  • Method Details

    • connect

      public void connect() throws IOException
      Description copied from interface: Device
      Connects to the device.
      Throws:
      IOException - if the connection fails
    • disconnect

      public void disconnect() throws IOException
      Description copied from interface: Device
      Disconnects from the device.
      Throws:
      IOException - if the disconnection fails
    • isConnected

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

      public Map<String,Boolean> getCapabilities()
      Description copied from interface: Device
      Returns a map of capabilities and their status (active/inactive).
      Returns:
      the capabilities map
    • getReadings

      public Map<String,String> getReadings()
      Description copied from interface: Device
      Returns the current status readings (Power, Uptime, etc.).
      Returns:
      the readings map
    • addCustomReadings

      protected void addCustomReadings(Map<String,String> readings)
      Subclasses can override to add custom readings.
    • getStatus

      public String getStatus()
      Description copied from interface: Device
      Returns the current status of the device as a string.
      Specified by:
      getStatus in interface Device
      Overrides:
      getStatus in class AbstractDevice
      Returns:
      the status string
    • getFormattedInfo

      public String getFormattedInfo()
    • close

      public void close() throws Exception
      Throws:
      Exception