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