public class OneWireContainer42 extends OneWireContainer implements TemperatureContainer, SwitchContainer
1-Wire® container for a 1-Wire programmable resolution digital thermometer with "sequence detect" and PIO, the DS28EA00. This container encapsulates the functionality of the iButton family type 42 (hex)
TemperatureContainer
for temperature specific operations.
SwitchContainer
for switch specific operations.
TemperatureContainer
Modifier and Type | Field and Description |
---|---|
static byte |
CONVERT_TEMPERATURE_COMMAND
DS28EA00 converts temperature command
|
static byte |
COPY_SCRATCHPAD_COMMAND
DS28EA00 copys data from scratchpad to E-squared memory command
|
static byte |
PIO_ACCESS_READ
PIO Access read command
|
static byte |
PIO_ACCESS_WRITE
PIO Access read command
|
static byte |
READ_POWER_SUPPLY_COMMAND
DS28EA00 read power supply command.
|
static byte |
READ_SCRATCHPAD_COMMAND
DS28EA00 reads data from scratchpad command
|
static byte |
RECALL_E2MEMORY_COMMAND
DS28EA00 recalls E-squared memory command
|
static byte |
RESOLUTION_10_BIT
DS28EA00 10-bit resolution constant for CONFIG byte
|
static byte |
RESOLUTION_11_BIT
DS28EA00 11-bit resolution constant for CONFIG byte
|
static byte |
RESOLUTION_12_BIT
DS28EA00 12-bit resolution constant for CONFIG byte
|
static byte |
RESOLUTION_9_BIT
DS28EA00 9-bit resolution constant for CONFIG byte
|
static byte |
WRITE_SCRATCHPAD_COMMAND
DS28EA00 writes data to scratchpad command
|
ALARM_HIGH, ALARM_LOW
Constructor and Description |
---|
OneWireContainer42()
Creates an empty
OneWireContainer42 . |
OneWireContainer42(DSPortAdapter sourceAdapter,
byte[] newAddress)
Creates a
OneWireContainer42 with the provided adapter
object and the address of this One-Wire device. |
OneWireContainer42(DSPortAdapter sourceAdapter,
long newAddress)
Creates a
OneWireContainer42 with the provided adapter
object and the address of this One-Wire device. |
OneWireContainer42(DSPortAdapter sourceAdapter,
java.lang.String newAddress)
Creates a
OneWireContainer42 with the provided adapter
object and the address of this One-Wire device. |
Modifier and Type | Method and Description |
---|---|
void |
clearActivity()
This method does nothing for the DS28EA00 (not needed).
|
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 DS28EA00.
|
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 device
OneWireContainer42 type. |
boolean |
getLatchState(int channel,
byte[] state)
Checks the latch state of the indicated channel.
|
boolean |
getLevel(int channel,
byte[] state)
Checks the sensed level on the indicated channel.
|
int |
getMaxSpeed()
Returns the maximum speed this iButton or 1-Wire device can
communicate at.
|
double |
getMaxTemperature()
Gets the maximum temperature in Celsius.
|
java.util.Enumeration |
getMemoryBanks()
Gets an enumeration of memory bank instances that implement one or more
of the following interfaces:
MemoryBank ,
PagedMemoryBank ,
and OTPMemoryBank . |
double |
getMinTemperature()
Gets the minimum temperature in Celsius.
|
java.lang.String |
getName()
Retrieves the Maxim Integrated Products part number of this
OneWireContainer42 as a String . |
int |
getNumberChannels(byte[] state)
Gets the number of channels supported by this switch.
|
boolean |
getSensedActivity(int channel,
byte[] state)
This method always returns false for the DS28EA00 (no activity sensing).
|
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 |
hasActivitySensing()
Checks if the channels of this switch support
activity sensing.
|
boolean |
hasLevelSensing()
Checks if the channels of this switch support
level sensing.
|
boolean |
hasSelectableTemperatureResolution()
Checks to see if this device has selectable temperature resolution.
|
boolean |
hasSmartOn()
Checks if the channels of this switch support
'smart on'.
|
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 DS28EA00.
|
boolean |
isHighSideSwitch()
Checks if the channels of this switch are 'high side'
switches.
|
boolean |
onlySingleChannelOn()
Checks if the channels of this switch require that only one
channel is on at any one time.
|
byte[] |
readDevice()
Retrieves this
OneWireContainer42 state information. |
byte[] |
readRegister()
This method does nothing for the DS28EA00.
|
byte[] |
readScratchpad()
Reads the Scratchpad of the DS28EA00.
|
byte[] |
recallE2()
Recalls the DS28EA00 temperature trigger values (
ALARM_HIGH
and ALARM_LOW ) and the configuration register to the
scratchpad and reads the scratchpad. |
void |
setLatchState(byte set,
byte[] state)
Sets the latch state for all of the channels.
|
void |
setLatchState(int channel,
boolean latchState,
boolean doSmart,
byte[] state)
Sets the latch state of the indicated channel.
|
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
OneWireContainer42 state
information that have been changed by 'set ' methods. |
void |
writeRegister(byte[] register)
This method does nothing for the DS28EA00.
|
void |
writeScratchpad(byte[] data)
Writes to the Scratchpad of the DS28EA00.
|
doSpeed, equals, getAdapter, getAddress, getAddressAsLong, getAddressAsString, hashCode, isAlarming, isPresent, setSpeed, setupContainer, setupContainer, setupContainer, toString
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
public static final byte PIO_ACCESS_READ
public static final byte PIO_ACCESS_WRITE
public OneWireContainer42()
OneWireContainer42
. Must call
setupContainer()
before using this new container.
This is one of the methods to construct a OneWireContainer42
.
The others are through creating a OneWireContainer42
with
parameters.
public OneWireContainer42(DSPortAdapter sourceAdapter, byte[] newAddress)
OneWireContainer42
with the provided adapter
object and the address of this One-Wire device.
This is one of the methods to construct a OneWireContainer42
.
The others are through creating a OneWireContainer42
with
different parameters types.sourceAdapter
- adapter object required to communicate with
this One-Wire devicenewAddress
- address of this One-Wire deviceAddress
,
OneWireContainer42()
,
OneWireContainer42(DSPortAdapter,long)
,
OneWireContainer42(DSPortAdapter,String)
public OneWireContainer42(DSPortAdapter sourceAdapter, long newAddress)
OneWireContainer42
with the provided adapter
object and the address of this One-Wire device.
This is one of the methods to construct a OneWireContainer42
.
The others are through creating a OneWireContainer42
with
different parameters types.sourceAdapter
- adapter object required to communicate with
this One-Wire devicenewAddress
- address of this One-Wire deviceAddress
,
OneWireContainer42()
,
OneWireContainer42(DSPortAdapter,byte[])
,
OneWireContainer42(DSPortAdapter,String)
public OneWireContainer42(DSPortAdapter sourceAdapter, java.lang.String newAddress)
OneWireContainer42
with the provided adapter
object and the address of this One-Wire device.
This is one of the methods to construct a OneWireContainer42
.
The others are through creating a OneWireContainer42
with
different parameters types.sourceAdapter
- adapter object required to communicate with
this One-Wire devicenewAddress
- address of this One-Wire deviceAddress
,
OneWireContainer42()
,
OneWireContainer42(DSPortAdapter,byte[])
,
OneWireContainer42(DSPortAdapter,long)
public java.util.Enumeration getMemoryBanks()
MemoryBank
,
PagedMemoryBank
,
and OTPMemoryBank
.getMemoryBanks
in class OneWireContainer
Enumeration
of memory banksMemoryBank
public java.lang.String getName()
OneWireContainer42
as a String
.
For example 'DS28EA00'.getName
in class OneWireContainer
OneWireContainer42
namepublic java.lang.String getAlternateNames()
getAlternateNames
in class OneWireContainer
OneWireContainer42
alternate namespublic java.lang.String getDescription()
OneWireContainer42
type.getDescription
in class OneWireContainer
OneWireContainer42
functional descriptionpublic int getMaxSpeed()
getMaxSpeed
in class OneWireContainer
DSPortAdapter.setSpeed(int)
public boolean hasTemperatureAlarms()
hasTemperatureAlarms
in interface TemperatureContainer
true
if this OneWireContainer42
has high/low trip alarmsgetTemperatureAlarm(int, byte[])
,
setTemperatureAlarm(int, double, byte[])
public boolean hasSelectableTemperatureResolution()
hasSelectableTemperatureResolution
in interface TemperatureContainer
true
if this OneWireContainer42
has selectable temperature resolutiongetTemperatureResolution(byte[])
,
getTemperatureResolutions()
,
setTemperatureResolution(double, byte[])
public double[] getTemperatureResolutions()
getTemperatureResolutions
in interface TemperatureContainer
OneWireContainer42
. 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
OneWireContainer42
hasTemperatureAlarms()
,
getTemperatureAlarm(int, byte[])
,
setTemperatureAlarm(int, double, byte[])
public double getMaxTemperature()
getMaxTemperature
in interface TemperatureContainer
OneWireContainer42
getMinTemperature()
public double getMinTemperature()
getMinTemperature
in interface TemperatureContainer
OneWireContainer42
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 OneWireContainer42
.
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
OneWireContainer42
doTemperatureConvert()
OneWireIOException
- on a 1-Wire communication error such as
reading an incorrect CRC from this OneWireContainer42
.
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 informationOneWireContainer42
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 informationOneWireContainer42
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 informationOneWireException
- Device does not support temperature
alarmsOneWireIOException
hasTemperatureAlarms()
,
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 informationOneWireException
- Device does not support selectable
temperature resolutionRESOLUTION_9_BIT
,
RESOLUTION_10_BIT
,
RESOLUTION_11_BIT
,
RESOLUTION_12_BIT
,
hasSelectableTemperatureResolution()
,
getTemperatureResolution(byte[])
,
getTemperatureResolutions()
public byte[] readDevice() throws OneWireIOException, OneWireException
OneWireContainer42
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
OneWireContainer42
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 9 : PIO Status bit assignment to write (this is a "don't care" for a read) 10: PIO Status bit assignment to read PIO Status Bit Assignment from PIO Access Write [A5H]: b7-b2 = all ones b1=PIOB Pin State b0=PIOA Pin State PIO Status Bit Assignment from PIO Access Read [F5H]: b7-b4 = Complement of b3 to b0 b3= PIOB Output Latch State b2=PIOB Pin State b1=PIOA Output Latch State b0= PIOA Pin State
OneWireIOException
- on a 1-Wire communication error such as
reading an incorrect CRC from this OneWireContainer42
.
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
OneWireContainer42
state
information that have been changed by 'set
' methods.
Only the device's "changed" state information is written to the part. This is done
by referencing a field information appended to the state data.writeDevice
in interface OneWireSensor
state
- byte array with device state information from a previous readDevice()OneWireIOException
- on a 1-Wire communication error such as
reading an incorrect CRC from this OneWireContainer42
.
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 OneWireContainer42
.
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 OneWireContainer42
.
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
adapterjava.lang.IllegalArgumentException
- 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 OneWireContainer42
.
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 OneWireContainer42
.
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 OneWireContainer42
.
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)
public int getNumberChannels(byte[] state)
getNumberChannels(byte[])
- 1)]. Note that
all devices of the same family will not necessarily have the
same number of channels.getNumberChannels
in interface SwitchContainer
state
- current state of the device returned from readDevice()
OneWireSensor.readDevice()
public boolean isHighSideSwitch()
true
, the switch output is
connect to the 1-Wire data. If this method returns false
then when the switch is 'on' or true
, the switch is connected
to ground.isHighSideSwitch
in interface SwitchContainer
true
if the switch is a 'high side' switch,
false
if the switch is a 'low side' switchgetLatchState(int,byte[])
public boolean hasActivitySensing()
true
then the
method getSensedActivity(int,byte[])
can be used.hasActivitySensing
in interface SwitchContainer
true
if channels support activity sensinggetSensedActivity(int,byte[])
,
clearActivity()
public boolean hasLevelSensing()
true
then the
method getLevel(int,byte[])
can be used.hasLevelSensing
in interface SwitchContainer
true
if channels support level sensinggetLevel(int,byte[])
public boolean hasSmartOn()
true
then the
method setLatchState(int,boolean,boolean,byte[])
can be used with the doSmart
parameter true
.hasSmartOn
in interface SwitchContainer
true
if channels support 'smart on'setLatchState(int,boolean,boolean,byte[])
public boolean onlySingleChannelOn()
true
then the
method setLatchState(int,boolean,boolean,byte[])
will not only affect the state of the given
channel but may affect the state of the other channels as well
to insure that only one channel is on at a time.onlySingleChannelOn
in interface SwitchContainer
true
if only one channel can be on at a time.setLatchState(int,boolean,boolean,byte[])
public boolean getLevel(int channel, byte[] state)
hasLevelSensing()
.
Level sensing means that the device can sense the logic
level on its PIO pin.getLevel
in interface SwitchContainer
channel
- channel to execute this operation, in the range [0 to (getNumberChannels(byte[])
- 1)]state
- current state of the device returned from readDevice()
true
if level sensed is 'high' and false
if level sensed is 'low'OneWireSensor.readDevice()
,
hasLevelSensing()
public boolean getLatchState(int channel, byte[] state)
getLatchState
in interface SwitchContainer
channel
- channel to execute this operation, in the range [0 to (getNumberChannels(byte[])
- 1)]state
- current state of the device returned from readDevice()
true
if channel latch is 'on'
or conducting and false
if channel latch is 'off' and not
conducting. Note that the actual output when the latch is 'on'
is returned from the isHighSideSwitch()
method.OneWireSensor.readDevice()
,
isHighSideSwitch()
,
setLatchState(int,boolean,boolean,byte[])
public boolean getSensedActivity(int channel, byte[] state) throws OneWireException
clearActivity()
.
To avoid an exception, verify that this device supports activity
sensing by calling the method hasActivitySensing()
.getSensedActivity
in interface SwitchContainer
channel
- channel to execute this operation, in the range [0 to (getNumberChannels(byte[])
- 1)]state
- current state of the device returned from readDevice()
true
if activity was detected and false
if no activity was detectedOneWireException
- if this device does not have activity sensinghasActivitySensing()
,
clearActivity()
public void clearActivity() throws OneWireException
readDevice()
.clearActivity
in interface SwitchContainer
OneWireException
- if this device does not support activity sensingOneWireSensor.readDevice()
,
getSensedActivity(int,byte[])
public void setLatchState(int channel, boolean latchState, boolean doSmart, byte[] state)
writeDevice()
must be called to finalize
changes to the device. Note that multiple 'set' methods can
be called before one call to writeDevice()
.setLatchState
in interface SwitchContainer
channel
- channel to execute this operation, in the range [0 to (getNumberChannels(byte[])
- 1)]latchState
- true
to set the channel latch 'on'
(conducting) and false
to set the channel latch 'off' (not
conducting). Note that the actual output when the latch is 'on'
is returned from the isHighSideSwitch()
method.doSmart
- If latchState is 'on'/true
then doSmart indicates
if a 'smart on' is to be done. To avoid an exception
check the capabilities of this device using the
hasSmartOn()
method.state
- current state of the device returned from readDevice()
hasSmartOn()
,
getLatchState(int,byte[])
,
OneWireSensor.writeDevice(byte[])
public void setLatchState(byte set, byte[] state)
writeDevice()
must be called to finalize
changes to the device. Note that multiple 'set' methods can
be called before one call to writeDevice()
.set
- the state to set all of the channels, in the range [0 to (getNumberChannels(byte[])
- 1)]state
- current state of the device returned from readDevice()
getLatchState(int,byte[])
,
OneWireSensor.writeDevice(byte[])
public byte[] readRegister() throws OneWireIOException, OneWireException
OneWireIOException
- on a 1-Wire communication error such as
reading an incorrect CRC from a 1-Wire device. 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 writeRegister(byte[] register) throws OneWireIOException, OneWireException
register
- 1-Wire device sensor stateOneWireIOException
- on a 1-Wire communication error such as
reading an incorrect CRC from a 1-Wire device. 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
adapterCopyright © 1999-2012 Maxim Integrated Products. All Rights Reserved.