Class AbstractDevice
java.lang.Object
org.episteme.core.device.AbstractDevice
- All Implemented Interfaces:
Serializable, AutoCloseable, Device, Commented, ComprehensiveIdentification, Identified<Identification>, Named
- Direct Known Subclasses:
AbstractActuator, AbstractSensor, AbstractSimulatedDevice, MassSpectra, USBDevice
Base implementation for the
Device interface.
Delegates identification and naming to an internal Identification object.- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordRepresents a single record in the device history.Nested classes/interfaces inherited from interface Device
Device.Status -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Quantity<?> protected final List<Calibration> protected Quantity<?> protected Unit<?> protected Stringprotected final List<AbstractDevice.Record> protected final Identificationprotected Instantprotected Stringprotected Stringprotected Quantity<?> protected Quantity<?> protected Stringprotected Stringprotected Quantity<?> protected Quantity<?> protected Device.Status -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCalibrates the device using a reference value.Returns the accuracy of the device.Returns the calibration history.Returns the actual status enum if available.Returns the preferred unit for display.Returns the firmware version of this device.Returns the history of values for this device.getId()Returns the unique identifier for this device.Returns the timestamp of the last calibration.Returns the location description of the device.Returns the manufacturer name.Returns the maximum measurement range.Returns the types of quantities this instrument can measure.Returns the minimum measurement range.getModel()Returns the model name.Returns the precision description of the device.Returns the resolution of the device.Returns the sensitivity of the device.Returns the current status of the device as a string.Returns a trait value by name.getTraitOptional(String key) Returns a trait value wrapped in an Optional.Returns the traits map for this entity.getValue()Returns the current primary value of the device (e.g. sensor reading).booleanChecks if the device is enabled.measure()Takes a measurement.booleanneedsCalibration(int maxAgeHours) Checks if the device needs calibration based on its maximum age.protected voidperformCalibration(Quantity<?> reference) Performs actual calibration logic.protected voidrecordMeasurement(Quantity<?> value) Records a value in the device history with a timestamp.protected voidsetAccuracy(Quantity<?> accuracy) protected voidsetCurrentValue(Quantity<?> value) Updates the current value and records it in history.voidsetDisplayUnit(Unit<?> unit) Sets the preferred unit for display.voidsetEnabled(boolean enabled) Sets whether the device is enabled.protected voidsetFirmware(String firmware) protected voidsetLastCalibration(Instant lastCalibration) protected voidsetLocationDescription(String locationDescription) protected voidsetManufacturer(String manufacturer) protected voidsetMaxRange(Quantity<?> maxRange) protected voidsetMinRange(Quantity<?> minRange) protected voidprotected voidsetPrecisionDescription(String precisionDescription) protected voidsetResolution(Quantity<?> resolution) protected voidsetSensitivity(Quantity<?> sensitivity) voidsetStatus(Device.Status status) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface AutoCloseable
closeMethods inherited from interface Commented
getComments, getTrait, setCommentsMethods inherited from interface ComprehensiveIdentification
getName, setName, setTraitMethods inherited from interface Device
calibrate, connect, disconnect, getCapabilities, getReadings, isConnected
-
Field Details
-
identification
-
manufacturer
-
model
-
locationDescription
-
firmware
-
precisionDescription
-
sensitivity
-
accuracy
-
resolution
-
minRange
-
maxRange
-
status
-
lastCalibration
-
calibrationHistory
-
history
-
displayUnit
-
currentValue
-
-
Constructor Details
-
AbstractDevice
-
-
Method Details
-
getId
Description copied from interface:DeviceReturns the unique identifier for this device.- Specified by:
getIdin interfaceDevice- Specified by:
getIdin interfaceIdentified<Identification>- Returns:
- the device ID
-
getTraits
Description copied from interface:ComprehensiveIdentificationReturns the traits map for this entity.- Specified by:
getTraitsin interfaceCommented- Specified by:
getTraitsin interfaceComprehensiveIdentification- Returns:
- the traits map
-
getTrait
Description copied from interface:ComprehensiveIdentificationReturns a trait value by name.- Specified by:
getTraitin interfaceCommented- Specified by:
getTraitin interfaceComprehensiveIdentification- Parameters:
key- the trait name- Returns:
- the trait value, or null if not found
-
getTraitOptional
-
getManufacturer
Description copied from interface:DeviceReturns the manufacturer name.- Specified by:
getManufacturerin interfaceDevice- Returns:
- the manufacturer
-
setManufacturer
-
getModel
-
setModel
-
getLocationDescription
Description copied from interface:DeviceReturns the location description of the device.- Specified by:
getLocationDescriptionin interfaceDevice- Returns:
- the location description
-
setLocationDescription
-
getFirmware
Description copied from interface:DeviceReturns the firmware version of this device.- Specified by:
getFirmwarein interfaceDevice- Returns:
- the firmware version, or "N/A" if not applicable
-
setFirmware
-
getPrecisionDescription
Description copied from interface:DeviceReturns the precision description of the device.- Specified by:
getPrecisionDescriptionin interfaceDevice- Returns:
- the precision description
-
setPrecisionDescription
-
getSensitivity
Description copied from interface:DeviceReturns the sensitivity of the device.- Specified by:
getSensitivityin interfaceDevice- Returns:
- the sensitivity
-
setSensitivity
-
getAccuracy
Description copied from interface:DeviceReturns the accuracy of the device.- Specified by:
getAccuracyin interfaceDevice- Returns:
- the accuracy
-
setAccuracy
-
getResolution
Description copied from interface:DeviceReturns the resolution of the device.- Specified by:
getResolutionin interfaceDevice- Returns:
- the resolution
-
setResolution
-
getMinRange
Description copied from interface:DeviceReturns the minimum measurement range.- Specified by:
getMinRangein interfaceDevice
-
setMinRange
-
getMaxRange
Description copied from interface:DeviceReturns the maximum measurement range.- Specified by:
getMaxRangein interfaceDevice
-
setMaxRange
-
getStatus
-
getDeviceStatus
Description copied from interface:DeviceReturns the actual status enum if available.- Specified by:
getDeviceStatusin interfaceDevice
-
setStatus
-
getLastCalibration
Description copied from interface:DeviceReturns the timestamp of the last calibration.- Specified by:
getLastCalibrationin interfaceDevice- Returns:
- the last calibration instant
-
setLastCalibration
-
getCalibrationHistory
Description copied from interface:DeviceReturns the calibration history.- Specified by:
getCalibrationHistoryin interfaceDevice
-
getDisplayUnit
Description copied from interface:DeviceReturns the preferred unit for display.- Specified by:
getDisplayUnitin interfaceDevice
-
setDisplayUnit
Description copied from interface:DeviceSets the preferred unit for display.- Specified by:
setDisplayUnitin interfaceDevice
-
calibrate
-
performCalibration
-
needsCalibration
public boolean needsCalibration(int maxAgeHours) Description copied from interface:DeviceChecks if the device needs calibration based on its maximum age.- Specified by:
needsCalibrationin interfaceDevice
-
getValue
-
measure
-
setCurrentValue
Updates the current value and records it in history. -
getHistory
Description copied from interface:DeviceReturns the history of values for this device.- Specified by:
getHistoryin interfaceDevice- Returns:
- the value history
-
recordMeasurement
Records a value in the device history with a timestamp. -
isEnabled
-
setEnabled
public void setEnabled(boolean enabled) Description copied from interface:DeviceSets whether the device is enabled.- Specified by:
setEnabledin interfaceDevice- Parameters:
enabled- true to enable
-
getMeasurableQuantities
-