Class AbstractSimulatedDevice

java.lang.Object
org.episteme.core.device.AbstractDevice
org.episteme.core.device.sim.AbstractSimulatedDevice
All Implemented Interfaces:
Serializable, AutoCloseable, Device, Commented, ComprehensiveIdentification, Identified<Identification>, Named
Direct Known Subclasses:
SimulatedGPIBDevice, SimulatedTelescope, SimulatedUSBDevice, SimulatedVitalSignsMonitor, SimulatedVotingMachine, SimulatedWeatherStation

public abstract class AbstractSimulatedDevice extends AbstractDevice
Abstract base implementation for all simulated devices. Uses SimulatedDeviceSupport to provide common simulation features.
Since:
1.2
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
See Also:
  • Field Details

  • Constructor Details

    • AbstractSimulatedDevice

      protected AbstractSimulatedDevice(String name)
    • AbstractSimulatedDevice

      protected AbstractSimulatedDevice(Identification identification)
    • AbstractSimulatedDevice

      protected AbstractSimulatedDevice(String name, String manufacturer)
  • 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
    • getDriverClass

      public String getDriverClass()
    • setDriverClass

      public void setDriverClass(String driverClass)
    • isPowerOn

      public boolean isPowerOn()
    • setPowerOn

      public void setPowerOn(boolean powerOn)
    • getErrorCode

      public int getErrorCode()
    • setErrorCode

      public void setErrorCode(int errorCode)
    • getUptimeSeconds

      public long getUptimeSeconds()
    • 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
    • setCapability

      public void setCapability(String name, boolean enabled)
    • 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