|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.dalsemi.onewire.container.OneWireContainer | +--com.dalsemi.onewire.container.OneWireContainer28
1-Wire container for temperature iButton which measures temperatures from -55°C to +125°C, DS18B20. This container encapsulates the functionality of the iButton family type 28 (hex)
TemperatureContainer
for temperature specific operations.
TemperatureContainer
Field Summary | |
static byte |
CONVERT_TEMPERATURE_COMMAND
DS18B20 converts temperature command |
static byte |
COPY_SCRATCHPAD_COMMAND
DS18B20 copys data from scratchpad to E-squared memory command |
static byte |
READ_POWER_SUPPLY_COMMAND
DS18B20 reads power supply command. |
static byte |
READ_SCRATCHPAD_COMMAND
DS18B20 reads data from scratchpad command |
static byte |
RECALL_E2MEMORY_COMMAND
DS18B20 recalls E-squared memory command |
static byte |
RESOLUTION_10_BIT
DS18B20 10-bit resolution constant for CONFIG byte |
static byte |
RESOLUTION_11_BIT
DS18B20 11-bit resolution constant for CONFIG byte |
static byte |
RESOLUTION_12_BIT
DS18B20 12-bit resolution constant for CONFIG byte |
static byte |
RESOLUTION_9_BIT
DS18B20 9-bit resolution constant for CONFIG byte |
static byte |
WRITE_SCRATCHPAD_COMMAND
DS18B20 writes data to scratchpad command |
Fields inherited from interface com.dalsemi.onewire.container.TemperatureContainer |
ALARM_HIGH, ALARM_LOW |
Constructor Summary | |
OneWireContainer28()
Creates an empty OneWireContainer28 . |
|
OneWireContainer28(DSPortAdapter sourceAdapter,
byte[] newAddress)
Creates a OneWireContainer28 with the provided adapter
object and the address of this One-Wire device. |
|
OneWireContainer28(DSPortAdapter sourceAdapter,
long newAddress)
Creates a OneWireContainer28 with the provided adapter
object and the address of this One-Wire device. |
|
OneWireContainer28(DSPortAdapter sourceAdapter,
String newAddress)
Creates a OneWireContainer28 with the provided adapter
object and the address of this One-Wire device. |
Method Summary | |
float |
convertToFahrenheit(float celsiusTemperature)
Deprecated. Replace with call to com.dalsemi.onewire.utils.Convert.toFahrenheit() |
void |
copyScratchpad()
Copies the Scratchpad to the E-squared memory of the DS18B20. |
void |
doTemperatureConvert(byte[] state)
Performs a temperature conversion on state information. |
String |
getAlternateNames()
Retrieves the alternate Dallas Semiconductor part numbers or names. |
String |
getDescription()
Retrieves a short description of the function of this OneWireContainer28 type. |
double |
getMaxTemperature()
Gets the maximum temperature in Celsius. |
double |
getMinTemperature()
Gets the minimum temperature in Celsius. |
String |
getName()
Retrieves the Dallas Semiconductor part number of this OneWireContainer28 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. |
boolean |
isExternalPowerSupplied()
Reads the way power is supplied to the DS18B20. |
byte[] |
readDevice()
Retrieves this OneWireContainer28 state information. |
byte[] |
readScratchpad()
Reads the Scratchpad of the DS18B20. |
byte[] |
recallE2()
Recalls the DS18B20 temperature trigger values ( ALARM_HIGH
and ALARM_LOW ) and the configuration register to the
scratchpad and reads the scratchpad. |
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 OneWireContainer28 state
information that have been changed by 'set ' methods. |
void |
writeScratchpad(byte[] data)
Writes to the Scratchpad of the DS18B20. |
Methods inherited from class com.dalsemi.onewire.container.OneWireContainer |
doSpeed, equals, getAdapter, getAddress, getAddressAsLong, getAddressAsString, getMaxSpeed, getMemoryBanks, hashCode, isAlarming, isPresent, setSpeed, setupContainer, setupContainer, setupContainer, toString |
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final byte WRITE_SCRATCHPAD_COMMAND
public static final byte READ_SCRATCHPAD_COMMAND
public static final byte COPY_SCRATCHPAD_COMMAND
public static final byte CONVERT_TEMPERATURE_COMMAND
public static final byte RECALL_E2MEMORY_COMMAND
public static final byte READ_POWER_SUPPLY_COMMAND
public static final byte RESOLUTION_12_BIT
public static final byte RESOLUTION_11_BIT
public static final byte RESOLUTION_10_BIT
public static final byte RESOLUTION_9_BIT
Constructor Detail |
public OneWireContainer28()
OneWireContainer28
. Must call
setupContainer()
before using this new container.
This is one of the methods to construct a OneWireContainer28
.
The others are through creating a OneWireContainer28
with
parameters.
OneWireContainer28(DSPortAdapter,byte[])
,
OneWireContainer28(DSPortAdapter,long)
,
OneWireContainer28(DSPortAdapter,String)
public OneWireContainer28(DSPortAdapter sourceAdapter, byte[] newAddress)
OneWireContainer28
with the provided adapter
object and the address of this One-Wire device.
This is one of the methods to construct a OneWireContainer28
.
The others are through creating a OneWireContainer28
with
different parameters types.sourceAdapter
- adapter object required to communicate with
this One-Wire devicenewAddress
- address of this One-Wire deviceAddress
,
OneWireContainer28()
,
OneWireContainer28(DSPortAdapter,long)
,
OneWireContainer28(DSPortAdapter,String)
public OneWireContainer28(DSPortAdapter sourceAdapter, long newAddress)
OneWireContainer28
with the provided adapter
object and the address of this One-Wire device.
This is one of the methods to construct a OneWireContainer28
.
The others are through creating a OneWireContainer28
with
different parameters types.sourceAdapter
- adapter object required to communicate with
this One-Wire devicenewAddress
- address of this One-Wire deviceAddress
,
OneWireContainer28()
,
OneWireContainer28(DSPortAdapter,byte[])
,
OneWireContainer28(DSPortAdapter,String)
public OneWireContainer28(DSPortAdapter sourceAdapter, String newAddress)
OneWireContainer28
with the provided adapter
object and the address of this One-Wire device.
This is one of the methods to construct a OneWireContainer28
.
The others are through creating a OneWireContainer28
with
different parameters types.sourceAdapter
- adapter object required to communicate with
this One-Wire devicenewAddress
- address of this One-Wire deviceAddress
,
OneWireContainer28()
,
OneWireContainer28(DSPortAdapter,byte[])
,
OneWireContainer28(DSPortAdapter,long)
Method Detail |
public String getName()
OneWireContainer28
as a String
.
For example 'DS18B20'.getName
in class OneWireContainer
OneWireContainer28
namepublic String getAlternateNames()
getAlternateNames
in class OneWireContainer
OneWireContainer28
alternate namespublic String getDescription()
OneWireContainer28
type.getDescription
in class OneWireContainer
OneWireContainer28
functional descriptionpublic boolean hasTemperatureAlarms()
hasTemperatureAlarms
in interface TemperatureContainer
true
if this OneWireContainer28
has high/low trip alarmsgetTemperatureAlarm(int, byte[])
,
setTemperatureAlarm(int, double, byte[])
public boolean hasSelectableTemperatureResolution()
hasSelectableTemperatureResolution
in interface TemperatureContainer
true
if this OneWireContainer28
has selectable temperature resolutiongetTemperatureResolution(byte[])
,
getTemperatureResolutions()
,
setTemperatureResolution(double, byte[])
public double[] getTemperatureResolutions()
getTemperatureResolutions
in interface TemperatureContainer
OneWireContainer28
. 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
OneWireContainer28
hasTemperatureAlarms()
,
getTemperatureAlarm(int, byte[])
,
setTemperatureAlarm(int, double, byte[])
public double getMaxTemperature()
getMaxTemperature
in interface TemperatureContainer
OneWireContainer28
getMinTemperature()
public double getMinTemperature()
getMinTemperature
in interface TemperatureContainer
OneWireContainer28
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 OneWireContainer28
.
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
OneWireContainer28
doTemperatureConvert()
OneWireIOException
- on a 1-Wire communication error such as
reading an incorrect CRC from this OneWireContainer28
.
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 informationOneWireContainer28
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 informationOneWireContainer28
RESOLUTION_9_BIT
,
RESOLUTION_10_BIT
,
RESOLUTION_11_BIT
,
RESOLUTION_12_BIT
,
hasSelectableTemperatureResolution()
,
getTemperatureResolutions()
,
setTemperatureResolution(double, byte[])
public void setTemperatureAlarm(int alarmType, double alarmValue, byte[] state) throws OneWireException, OneWireIOException
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) throws OneWireException
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_9_BIT
,
RESOLUTION_10_BIT
,
RESOLUTION_11_BIT
and
RESOLUTION_12_BIT
.state
- byte array with device state informationRESOLUTION_9_BIT
,
RESOLUTION_10_BIT
,
RESOLUTION_11_BIT
,
RESOLUTION_12_BIT
,
hasSelectableTemperatureResolution()
,
getTemperatureResolution(byte[])
,
getTemperatureResolutions()
public byte[] readDevice() throws OneWireIOException, OneWireException
OneWireContainer28
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
OneWireContainer28
state information.
Device state looks like this:
0 : temperature LSB 1 : temperature MSB 2 : trip high 3 : trip low 4 : configuration register (for resolution) 5 : reserved 6 : reserved 7 : reserved 8 : an 8 bit CRC of the previous 8 bytes
OneWireIOException
- on a 1-Wire communication error such as
reading an incorrect CRC from this OneWireContainer28
.
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
OneWireContainer28
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 OneWireContainer28
.
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 byte[] readScratchpad() throws OneWireIOException, OneWireException
OneWireIOException
- on a 1-Wire communication error such as
reading an incorrect CRC from this OneWireContainer28
.
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
adapterpublic void writeScratchpad(byte[] data) throws OneWireIOException, OneWireException
data
- data to be written to the scratchpad. First
byte of data must be the temperature High Trip Point, the
second byte must be the temperature Low Trip Point, and
the third must be the Resolution (configuration register).OneWireIOException
- on a 1-Wire communication error such as
reading an incorrect CRC from this OneWireContainer28
.
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
adapterIllegalArgumentException
- when data is of invalid lengthpublic void copyScratchpad() throws OneWireIOException, OneWireException
OneWireIOException
- on a 1-Wire communication error such as
reading an incorrect CRC from this OneWireContainer28
.
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
adapterpublic byte[] recallE2() throws OneWireIOException, OneWireException
ALARM_HIGH
and ALARM_LOW
) and the configuration register to the
scratchpad and reads the scratchpad.OneWireIOException
- on a 1-Wire communication error such as
reading an incorrect CRC from this OneWireContainer28
.
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
adapterpublic boolean isExternalPowerSupplied() throws OneWireIOException, OneWireException
true
for external power, false
for parasite powerOneWireIOException
- on a 1-Wire communication error such as
reading an incorrect CRC from this OneWireContainer28
.
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
adapterpublic float convertToFahrenheit(float celsiusTemperature)
celsiusTemperature
- temperature value in CelsiusConvert.toFahrenheit(double)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |