private class Thermometer.ReadTask
extends java.lang.Object
implements java.lang.Runnable
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
DATA_NAME
Data name.
|
private boolean |
initialize
Flag to initialize sensor.
|
private byte[] |
state
1-Wire device state.
|
private double[] |
tValues
Temperature values for RMS calculation.
|
private int |
tValuesIndex
Temperature values index.
|
private java.lang.String |
VALUE_ERROR_1
Value error message format for out of range exceptions.
|
Modifier | Constructor and Description |
---|---|
private |
ReadTask() |
Modifier and Type | Method and Description |
---|---|
private double |
getDeviceTemperature()
Reads the temperature from the device.
|
private double |
getRmsTemperature()
Spins reading the temperature until the RMS values are not greater
than a standard deviation of one degree Celsius.
|
private void |
initDevice()
Initializes the sensor for operation.
|
void |
run()
Initializes the thermometer if necessary, then gets the temperature
value from the thermometer and posts it to the data exchange.
|
private final java.lang.String DATA_NAME
private final java.lang.String VALUE_ERROR_1
private boolean initialize
private byte[] state
private final double[] tValues
private int tValuesIndex
public void run()
run
in interface java.lang.Runnable
private void initDevice() throws com.dalsemi.onewire.OneWireException, ServiceException
com.dalsemi.onewire.OneWireException
- if 1-Wire communication fails.ServiceException
- if initialization fails.private double getDeviceTemperature() throws com.dalsemi.onewire.OneWireException
com.dalsemi.onewire.OneWireException
- if 1-Wire communication fails.private double getRmsTemperature() throws com.dalsemi.onewire.OneWireException, ValueException
com.dalsemi.onewire.OneWireException
- if 1-Wire communication fails.ValueException
- if timeout occurs waiting for RMS readings to
converge.