Interface Device

All Superinterfaces:
AutoCloseable, Commented, ComprehensiveIdentification, Identified<Identification>, Named, Serializable
All Known Subinterfaces:
Actuator<C>, BallotCaster, Centrifuge, ComplexInstrument, HumidityProbe, Microscope, Multimeter, Oscilloscope, PHMeter, PressureGauge, Seismograph, Sensor<Q>, Spectrometer, Telescope, TemperatureProbe, VitalSignsMonitor, VoterScanner, VotingMachine, WeatherStation
All Known Implementing Classes:
AbstractActuator, AbstractDevice, AbstractSensor, AbstractSimulatedActuator, AbstractSimulatedDevice, AbstractSimulatedSensor, GPIBDevice, MassSpectra, SimulatedBallotCaster, SimulatedCentrifuge, SimulatedGPIBDevice, SimulatedHumidityProbe, SimulatedMicroscope, SimulatedMultimeter, SimulatedOscilloscope, SimulatedPHMeter, SimulatedPressureGauge, SimulatedSeismograph, SimulatedSpectrometer, SimulatedTelescope, SimulatedTemperatureProbe, SimulatedUSBDevice, SimulatedVitalSignsMonitor, SimulatedVoterScanner, SimulatedVotingMachine, SimulatedWeatherStation, USBDevice

public interface Device extends ComprehensiveIdentification, AutoCloseable
Primary interface for all hardware and software devices in the Episteme ecosystem.

A Device represents any physical or virtual component that can be identified, monitored, and controlled. This includes sensors, actuators, and complex scientific instruments.

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

    • connect

      void connect() throws IOException
      Connects to the device.
      Throws:
      IOException - if the connection fails
    • disconnect

      void disconnect() throws IOException
      Disconnects from the device.
      Throws:
      IOException - if the disconnection fails
    • isConnected

      boolean isConnected()
      Checks if the device is currently connected.
      Returns:
      true if connected, false otherwise
    • getId

      Returns the unique identifier for this device.
      Specified by:
      getId in interface Identified<Identification>
      Returns:
      the device ID
    • getManufacturer

      default String getManufacturer()
      Returns the manufacturer name.
      Returns:
      the manufacturer
    • getModel

      default String getModel()
      Returns the model name.
      Returns:
      the model
    • getFirmware

      default String getFirmware()
      Returns the firmware version of this device.
      Returns:
      the firmware version, or "N/A" if not applicable
    • getPrecisionDescription

      default String getPrecisionDescription()
      Returns the precision description of the device.
      Returns:
      the precision description
    • getSensitivity

      default Optional<Quantity<?>> getSensitivity()
      Returns the sensitivity of the device.
      Returns:
      the sensitivity
    • getAccuracy

      default Optional<Quantity<?>> getAccuracy()
      Returns the accuracy of the device.
      Returns:
      the accuracy
    • getResolution

      default Optional<Quantity<?>> getResolution()
      Returns the resolution of the device.
      Returns:
      the resolution
    • getMinRange

      default Optional<Quantity<?>> getMinRange()
      Returns the minimum measurement range.
    • getMaxRange

      default Optional<Quantity<?>> getMaxRange()
      Returns the maximum measurement range.
    • getMeasurableQuantities

      default List<Class<? extends Quantity<?>>> getMeasurableQuantities()
      Returns the types of quantities this instrument can measure.
    • getDisplayUnit

      default Optional<Unit<?>> getDisplayUnit()
      Returns the preferred unit for display.
    • setDisplayUnit

      default void setDisplayUnit(Unit<?> unit)
      Sets the preferred unit for display.
    • measure

      default Optional<Quantity<?>> measure()
      Takes a measurement.
      Returns:
      the measured value
    • getLocationDescription

      default String getLocationDescription()
      Returns the location description of the device.
      Returns:
      the location description
    • getLastCalibration

      default Instant getLastCalibration()
      Returns the timestamp of the last calibration.
      Returns:
      the last calibration instant
    • getCalibrationHistory

      default List<?> getCalibrationHistory()
      Returns the calibration history.
    • calibrate

      default void calibrate() throws Exception
      Calibrates the device.
      Throws:
      Exception - if calibration fails
    • calibrate

      default void calibrate(Quantity<?> reference) throws Exception
      Calibrates the device using a reference value.
      Throws:
      Exception
    • needsCalibration

      default boolean needsCalibration(int maxAgeHours)
      Checks if the device needs calibration based on its maximum age.
    • isEnabled

      default boolean isEnabled()
      Checks if the device is enabled.
      Returns:
      true if enabled
    • setEnabled

      default void setEnabled(boolean enabled)
      Sets whether the device is enabled.
      Parameters:
      enabled - true to enable
    • getCapabilities

      default Map<String,Boolean> getCapabilities()
      Returns a map of capabilities and their status (active/inactive).
      Returns:
      the capabilities map
    • getReadings

      default Map<String,String> getReadings()
      Returns the current status readings (Power, Uptime, etc.).
      Returns:
      the readings map
    • getStatus

      default String getStatus()
      Returns the current status of the device as a string.
      Returns:
      the status string
    • getDeviceStatus

      default Device.Status getDeviceStatus()
      Returns the actual status enum if available.
    • getValue

      Optional<Quantity<?>> getValue()
      Returns the current primary value of the device (e.g. sensor reading).
      Returns:
      the current value
    • getHistory

      List<? extends Device.Record> getHistory()
      Returns the history of values for this device.
      Returns:
      the value history