public class OneWireContainer10 extends OneWireContainer implements TemperatureContainer
1-Wire container for temperature iButton which measures temperatures from -55@htmlonly °C @endhtmlonly to +100@htmlonly °C @endhtmlonly, DS1920 or DS18S20. This container encapsulates the functionality of the iButton family type 10 (hex)
TemperatureContainer
for temperature specific operations.
TemperatureContainer
Modifier and Type | Field and Description |
---|---|
static double |
RESOLUTION_MAXIMUM
maximum temperature resolution for this
OneWireContainer10
device. |
static double |
RESOLUTION_NORMAL
default temperature resolution for this
OneWireContainer10
device. |
ALARM_HIGH, ALARM_LOW
Constructor and Description |
---|
OneWireContainer10()
Creates an empty
OneWireContainer10 . |
OneWireContainer10(DSPortAdapter sourceAdapter,
byte[] newAddress)
Creates a
OneWireContainer10 with the provided adapter
object and the address of this One-Wire device. |
OneWireContainer10(DSPortAdapter sourceAdapter,
long newAddress)
Creates a
OneWireContainer10 with the provided adapter
object and the address of this One-Wire device. |
OneWireContainer10(DSPortAdapter sourceAdapter,
java.lang.String newAddress)
Creates a
OneWireContainer10 with the provided adapter
object and the address of this One-Wire device. |
Modifier and Type | Method and Description |
---|---|
static double |
convertToCelsius(double fahrenheitTemperature)
Deprecated.
Replace with call to com.dalsemi.onewire.utils.Convert.toCelsius()
|
static double |
convertToFahrenheit(double celsiusTemperature)
Deprecated.
Replace with call to com.dalsemi.onewire.utils.Convert.toFahrenheit()
|
void |
doTemperatureConvert(byte[] state)
Performs a temperature conversion on
state information. |
java.lang.String |
getAlternateNames()
Retrieves the alternate Maxim Integrated Products part numbers or names.
|
java.lang.String |
getDescription()
Retrieves a short description of the function of this
OneWireContainer10 type. |
double |
getMaxTemperature()
Gets the maximum temperature in Celsius.
|
double |
getMinTemperature()
Gets the minimum temperature in Celsius.
|
java.lang.String |
getName()
Retrieves the Maxim Integrated Products part number of this
OneWireContainer10 as a String . |
double |
getTemperature(byte[] state)
Gets the temperature value in Celsius from the
state
data retrieved from the readDevice() method. |
double |
getTemperatureAlarm(int alarmType,
byte[] state)
Gets the specified temperature alarm value in Celsius from the
state data retrieved from the readDevice()
method. |
double |
getTemperatureAlarmResolution()
Gets the temperature alarm resolution in Celsius.
|
double |
getTemperatureResolution(byte[] state)
Gets the current temperature resolution in Celsius from the
state data retrieved from the readDevice()
method. |
double[] |
getTemperatureResolutions()
Gets an array of available temperature resolutions in Celsius.
|
boolean |
hasSelectableTemperatureResolution()
Checks to see if this device has selectable temperature resolution.
|
boolean |
hasTemperatureAlarms()
Checks to see if this temperature measuring device has high/low
trip alarms.
|
byte[] |
readDevice()
Retrieves this
OneWireContainer10 state information. |
void |
setTemperatureAlarm(int alarmType,
double alarmValue,
byte[] state)
Sets the temperature alarm value in Celsius in the provided
state data. |
void |
setTemperatureResolution(double resolution,
byte[] state)
Sets the current temperature resolution in Celsius in the provided
state data. |
void |
writeDevice(byte[] state)
Writes to this
OneWireContainer10 state
information that have been changed by 'set ' methods. |
doSpeed, equals, getAdapter, getAddress, getAddressAsLong, getAddressAsString, getMaxSpeed, getMemoryBanks, hashCode, isAlarming, isPresent, setSpeed, setupContainer, setupContainer, setupContainer, toString
public static final double RESOLUTION_NORMAL
OneWireContainer10
device.public static final double RESOLUTION_MAXIMUM
OneWireContainer10
device. Use RESOLUTION_MAXIMUM
in
setResolution()
if higher resolution is desired.public OneWireContainer10()
OneWireContainer10
. Must call
setupContainer()
before using this new container.
This is one of the methods to construct a OneWireContainer10
.
The others are through creating a OneWireContainer10
with
parameters.
public OneWireContainer10(DSPortAdapter sourceAdapter, byte[] newAddress)
OneWireContainer10
with the provided adapter
object and the address of this One-Wire device.
This is one of the methods to construct a OneWireContainer10
.
The others are through creating a OneWireContainer10
with
different parameters types.sourceAdapter
- adapter object required to communicate with
this One-Wire devicenewAddress
- address of this One-Wire deviceAddress
,
OneWireContainer10()
,
OneWireContainer10(DSPortAdapter,long)
,
OneWireContainer10(DSPortAdapter,String)
public OneWireContainer10(DSPortAdapter sourceAdapter, long newAddress)
OneWireContainer10
with the provided adapter
object and the address of this One-Wire device.
This is one of the methods to construct a OneWireContainer10
.
The others are through creating a OneWireContainer10
with
different parameters types.sourceAdapter
- adapter object required to communicate with
this One-Wire devicenewAddress
- address of this One-Wire deviceAddress
,
OneWireContainer10()
,
OneWireContainer10(DSPortAdapter,byte[])
,
OneWireContainer10(DSPortAdapter,String)
public OneWireContainer10(DSPortAdapter sourceAdapter, java.lang.String newAddress)
OneWireContainer10
with the provided adapter
object and the address of this One-Wire device.
This is one of the methods to construct a OneWireContainer10
.
The others are through creating a OneWireContainer10
with
different parameters types.sourceAdapter
- adapter object required to communicate with
this One-Wire devicenewAddress
- address of this One-Wire deviceAddress
,
OneWireContainer10()
,
OneWireContainer10(DSPortAdapter,byte[])
,
OneWireContainer10(DSPortAdapter,long)
public java.lang.String getName()
OneWireContainer10
as a String
.
For example 'DS1920'.getName
in class OneWireContainer
OneWireContainer10
namepublic java.lang.String getAlternateNames()
getAlternateNames
in class OneWireContainer
OneWireContainer10
alternate namespublic java.lang.String getDescription()
OneWireContainer10
type.getDescription
in class OneWireContainer
OneWireContainer10
functional descriptionpublic boolean hasTemperatureAlarms()
hasTemperatureAlarms
in interface TemperatureContainer
true
if this OneWireContainer10
has high/low trip alarmsgetTemperatureAlarm(int, byte[])
,
setTemperatureAlarm(int, double, byte[])
public boolean hasSelectableTemperatureResolution()
hasSelectableTemperatureResolution
in interface TemperatureContainer
true
if this OneWireContainer10
has selectable temperature resolutiongetTemperatureResolution(byte[])
,
getTemperatureResolutions()
,
setTemperatureResolution(double, byte[])
public double[] getTemperatureResolutions()
getTemperatureResolutions
in interface TemperatureContainer
OneWireContainer10
. The minimum resolution is
returned as the first element and maximum resolution as the last
element.hasSelectableTemperatureResolution()
,
getTemperatureResolution(byte[])
,
setTemperatureResolution(double, byte[])
public double getTemperatureAlarmResolution()
getTemperatureAlarmResolution
in interface TemperatureContainer
OneWireContainer10
hasTemperatureAlarms()
,
getTemperatureAlarm(int, byte[])
,
setTemperatureAlarm(int, double, byte[])
public double getMaxTemperature()
getMaxTemperature
in interface TemperatureContainer
OneWireContainer10
getMinTemperature()
public double getMinTemperature()
getMinTemperature
in interface TemperatureContainer
OneWireContainer10
getMaxTemperature()
public void doTemperatureConvert(byte[] state) throws OneWireIOException, OneWireException
state
information.doTemperatureConvert
in interface TemperatureContainer
state
- byte array with device state informationOneWireIOException
- on a 1-Wire communication error such as
reading an incorrect CRC from this OneWireContainer10
.
This could be caused by a physical interruption in the 1-Wire
Network due to shorts or a newly arriving 1-Wire device issuing a
'presence pulse'.OneWireException
- on a communication or setup error with the 1-Wire
adaptergetTemperature(byte[])
public double getTemperature(byte[] state) throws OneWireIOException
state
data retrieved from the readDevice()
method.getTemperature
in interface TemperatureContainer
state
- byte array with device state information for this
OneWireContainer10
doTemperatureConvert()
OneWireIOException
- on a 1-Wire communication error such as
reading an incorrect CRC from this OneWireContainer10
.
This could be caused by a physical interruption in the 1-Wire
Network due to shorts or a newly arriving 1-Wire device issuing a
'presence pulse'.doTemperatureConvert(byte[])
public double getTemperatureAlarm(int alarmType, byte[] state)
state
data retrieved from the readDevice()
method.getTemperatureAlarm
in interface TemperatureContainer
alarmType
- valid value: ALARM_HIGH
or
ALARM_LOW
state
- byte array with device state informationOneWireContainer10
hasTemperatureAlarms()
,
setTemperatureAlarm(int, double, byte[])
public double getTemperatureResolution(byte[] state)
state
data retrieved from the readDevice()
method.getTemperatureResolution
in interface TemperatureContainer
state
- byte array with device state informationOneWireContainer10
hasSelectableTemperatureResolution()
,
getTemperatureResolutions()
,
setTemperatureResolution(double, byte[])
public void setTemperatureAlarm(int alarmType, double alarmValue, byte[] state)
state
data.
Use the method writeDevice()
with
this data to finalize the change to the device.setTemperatureAlarm
in interface TemperatureContainer
alarmType
- valid value: ALARM_HIGH
or
ALARM_LOW
alarmValue
- alarm trip value in Celsiusstate
- byte array with device state informationhasTemperatureAlarms()
,
getTemperatureAlarm(int, byte[])
public void setTemperatureResolution(double resolution, byte[] state)
state
data. Use the method writeDevice()
with this data to finalize the change to the device.setTemperatureResolution
in interface TemperatureContainer
resolution
- temperature resolution in Celsius. Valid values are
RESOLUTION_NORMAL
and
RESOLUTION_MAXIMUM
.state
- byte array with device state informationRESOLUTION_NORMAL
,
RESOLUTION_MAXIMUM
,
hasSelectableTemperatureResolution()
,
getTemperatureResolution(byte[])
,
getTemperatureResolutions()
public byte[] readDevice() throws OneWireIOException, OneWireException
OneWireContainer10
state information.
The state information is returned as a byte array. Pass this byte
array to the 'get
' and 'set
' methods.
If the device state needs to be changed, then call the
writeDevice()
to finalize the changes.readDevice
in interface OneWireSensor
OneWireContainer10
state information.
Device state looks like this:
0 : temperature LSB 1 : temperature MSB 2 : trip high 3 : trip low 4 : reserved (put the resolution here, 0 for normal, 1 for max) 5 : reserved 6 : count remain 7 : count per degree Celsius 8 : an 8 bit CRC over the previous 8 bytes of data
OneWireIOException
- on a 1-Wire communication error such as
reading an incorrect CRC from this OneWireContainer10
.
This could be caused by a physical interruption in the 1-Wire
Network due to shorts or a newly arriving 1-Wire device issuing a
'presence pulse'.OneWireException
- on a communication or setup error with the 1-Wire
adapterwriteDevice(byte[])
public void writeDevice(byte[] state) throws OneWireIOException, OneWireException
OneWireContainer10
state
information that have been changed by 'set
' methods.
Only the state registers that changed are updated. This is done
by referencing a field information appended to the state data.writeDevice
in interface OneWireSensor
state
- byte array with device state informationOneWireIOException
- on a 1-Wire communication error such as
reading an incorrect CRC from this OneWireContainer10
.
This could be caused by a physical interruption in the 1-Wire
Network due to shorts or a newly arriving 1-Wire device issuing a
'presence pulse'.OneWireException
- on a communication or setup error with the 1-Wire
adapterreadDevice()
public static double convertToFahrenheit(double celsiusTemperature)
celsiusTemperature
- temperature value in CelsiusConvert.toFahrenheit(double)
public static double convertToCelsius(double fahrenheitTemperature)
fahrenheitTemperature
- temperature value in FahrenheitConvert.toCelsius(double)
Copyright © 1999-2012 Maxim Integrated Products. All Rights Reserved.