Class WaterSensor
- 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.WaterSensor
-
- All Implemented Interfaces:
ISensor<java.lang.Double>
public class WaterSensor extends AnalogSensor<java.lang.Double>
WaterSensor class defines the water 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 WaterSensor(java.lang.String name, double defaultValue, ADC adc, int channel)
Constructor for WaterSensor.
-
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
-
WaterSensor
public WaterSensor(java.lang.String name, double defaultValue, ADC adc, int channel)
Constructor for WaterSensor.- Parameters:
name
- name of the sensor.defaultValue
- 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.
-
-