Class HumiditySensor
- 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.HumiditySensor
-
- All Implemented Interfaces:
ISensor<java.lang.Double>
public class HumiditySensor extends AnalogSensor<java.lang.Double>
HumiditySensor class that defines the humidity 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 HumiditySensor(java.lang.String name, double defaultValue, ADC adc, int channel)
Constructor for the HumiditySensor class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Double
updateAndGet()
Updates the value of the sensor and returns 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
-
HumiditySensor
public HumiditySensor(java.lang.String name, double defaultValue, ADC adc, int channel)
Constructor for the HumiditySensor class.- Parameters:
name
- the name of the sensor.defaultValue
- the default 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
Updates the value of the sensor and returns it.- Returns:
- the value of the sensor.
- Throws:
SpiCannotBeInitializedException
- if the SPI cannot be initialized.
-
-