Class TemperatureSensor
- java.lang.Object
-
- com.inhousegreenhouse.ch.backend.model.greenhouse.sensor.core.BaseSensor<T>
-
- com.inhousegreenhouse.ch.backend.model.greenhouse.sensor.core.AnalogSensor<java.lang.Double>
-
- com.inhousegreenhouse.ch.backend.model.greenhouse.sensor.TemperatureSensor
-
- All Implemented Interfaces:
ISensor<java.lang.Double>
public class TemperatureSensor extends AnalogSensor<java.lang.Double>
TemperatureSensor class defines a temperature sensor.
-
-
Field Summary
-
Fields inherited from class com.inhousegreenhouse.ch.backend.model.greenhouse.sensor.core.AnalogSensor
channels
-
Fields inherited from class com.inhousegreenhouse.ch.backend.model.greenhouse.sensor.core.BaseSensor
isEnabled, POSITION, SENSOR_NAME, value
-
-
Constructor Summary
Constructors Constructor Description TemperatureSensor(java.lang.String name, double value, ADC adc, int channel)
TemperatureSensor constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Double
updateAndGet()
Update the cached value of the sensor and return it.-
Methods inherited from class com.inhousegreenhouse.ch.backend.model.greenhouse.sensor.core.AnalogSensor
getChannel, getConversionData
-
Methods inherited from class com.inhousegreenhouse.ch.backend.model.greenhouse.sensor.core.BaseSensor
getCachedValue, getName, getPosition, isEnabled, setEnabled
-
-
-
-
Constructor Detail
-
TemperatureSensor
public TemperatureSensor(java.lang.String name, double value, ADC adc, int channel)
TemperatureSensor constructor.- Parameters:
name
- the name of the sensor.value
- the value of the sensor.adc
- the AdC object to use to convert analog signal.channel
- the ADC channel where the sensor is connected.
-
-
Method Detail
-
updateAndGet
public java.lang.Double updateAndGet() throws SpiCannotBeInitializedException
Update the cached value of the sensor and return it.- Returns:
- the new value of the sensor.
- Throws:
SpiCannotBeInitializedException
- if the SPI cannot be initialized.
-
-