java.lang.Object | +--com.dalsemi.onewire.container.OneWireContainer | +--com.dalsemi.onewire.container.OneWireContainer1C
1-Wire® container for a Addressable 1-Wire 4K-bit EEPROM, DS28E04. This container encapsulates the functionality of the 1-Wire family type 1C (hex)
OneWireSensor
,
SwitchContainer
,
OneWireContainer
Field Summary | |
static byte |
PIO_ACCESS_PULSE
Generates a pulse on the selected PIOs |
static byte |
PIO_ACCESS_READ
Reads the PIO logical status in an endless loops |
static byte |
PIO_ACCESS_WRITE
Writes the PIO output latch |
static byte |
RESET_ACTIVITY_LATCHES
Generates a pulse on the selected PIOs |
static byte |
WRITE_REGISTER
Writes the value to the Conditional Search registers or Control/Status register |
Constructor Summary | |
OneWireContainer1C()
Creates a new OneWireContainer for communication with a DS28E04. |
|
OneWireContainer1C(DSPortAdapter sourceAdapter,
byte[] newAddress)
Creates a new OneWireContainer for communication with a DS28E04. |
|
OneWireContainer1C(DSPortAdapter sourceAdapter,
long newAddress)
Creates a new OneWireContainer for communication with a DS28E04. |
|
OneWireContainer1C(DSPortAdapter sourceAdapter,
String newAddress)
Creates a new OneWireContainer for communication with a DS28E04. |
Method Summary | |
void |
andConditionalSearch(byte[] register)
Checks if the 'and' Conditional Search is set and if not sets it. |
void |
clearActivity()
Clears the activity latches the next time possible. |
void |
clearPowerOnReset(byte[] register)
Checks if the Power On Reset if on and if so clears it. |
String |
getAlternateNames()
Retrieves the alternate Dallas Semiconductor part numbers or names. |
boolean |
getChannelMask(int channel,
byte[] register)
Retrieves the information if the channel is masked for the Conditional Search. |
boolean |
getChannelPolarity(int channel,
byte[] register)
Retrieves the polarity of the channel for the Conditional Search. |
boolean |
getDefaultPolarity(byte[] register)
|
String |
getDescription()
Gets a short description of the function of this iButton or 1-Wire Device 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. |
Enumeration |
getMemoryBanks()
Gets an enumeration of memory bank instances that implement one or more of the following interfaces: MemoryBank ,
PagedMemoryBank ,
and OTPMemoryBank . |
String |
getName()
Gets the Dallas Semiconductor part number of the iButton or 1-Wire Device as a java.lang.String . |
int |
getNumberChannels(byte[] state)
Gets the number of channels supported by this switch. |
boolean |
getPowerOnResetLatch(byte[] register)
|
boolean |
getSensedActivity(int channel,
byte[] state)
Checks if the indicated channel has experienced activity. |
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 |
hasSmartOn()
Checks if the channels of this switch support 'smart on'. |
boolean |
isHighSideSwitch()
Checks if the channels of this switch are 'high side' switches. |
boolean |
isVccPowered(byte[] register)
Retrieves the state of the VCC pin. |
boolean |
onlySingleChannelOn()
Checks if the channels of this switch require that only one channel is on at any one time. |
void |
orConditionalSearch(byte[] register)
Checks if the 'or' Condition Search is set and if not sets it. |
byte[] |
readDevice()
Retrieves the 1-Wire device sensor state. |
byte[] |
readRegister()
Retrieves the 1-Wire device register mask. |
void |
setChannelMask(int channel,
boolean set,
byte[] register)
Sets the channel passed to the proper state depending on the set parameter for responding to the Conditional Search. |
void |
setChannelPolarity(int channel,
boolean set,
byte[] register)
Sets the channel passed to the proper state depending on the set parameter for the correct polarity in the Conditional Search. |
void |
setConditionalSearchActivity(byte[] register)
Checks if the 'PIO Activity latches' are set for Conditional Search and if not sets it. |
void |
setConditionalSearchLogicLevel(byte[] register)
Checks if the 'PIO Level' Conditional Search is set for input and if not sets it. |
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 |
writeDevice(byte[] state)
Updates the latch state for the 2 general purpose PIO pins. |
void |
writeRegister(byte[] register)
Writes the 1-Wire device register mask that have been changed by 'set' methods. |
Methods inherited from class com.dalsemi.onewire.container.OneWireContainer |
doSpeed, equals, getAdapter, getAddress, getAddressAsLong, getAddressAsString, getMaxSpeed, 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 PIO_ACCESS_READ
public static final byte PIO_ACCESS_WRITE
public static final byte PIO_ACCESS_PULSE
public static final byte RESET_ACTIVITY_LATCHES
public static final byte WRITE_REGISTER
Constructor Detail |
public OneWireContainer1C()
OneWireContainer
for communication with a DS28E04.
Note that the method setupContainer(com.dalsemi.onewire.adapter.DSPortAdapter,byte[])
must be called to set the correct DSPortAdapter
device address.setupContainer(DSPortAdapter,byte[])
,
OneWireContainer1C(DSPortAdapter,byte[])
,
OneWireContainer1C(DSPortAdapter,long)
,
OneWireContainer1C(DSPortAdapter,String)
public OneWireContainer1C(DSPortAdapter sourceAdapter, byte[] newAddress)
OneWireContainer
for communication with a DS28E04.sourceAdapter
- adapter object required to communicate with
this 1-Wire devicenewAddress
- address of this DS28E04OneWireContainer1C()
,
OneWireContainer1C(DSPortAdapter,long)
,
OneWireContainer1C(DSPortAdapter,String)
public OneWireContainer1C(DSPortAdapter sourceAdapter, long newAddress)
OneWireContainer
for communication with a DS28E04.sourceAdapter
- adapter object required to communicate with
this 1-Wire devicenewAddress
- address of this DS28E04OneWireContainer1C()
,
OneWireContainer1C(DSPortAdapter,byte[])
,
OneWireContainer1C(DSPortAdapter,String)
public OneWireContainer1C(DSPortAdapter sourceAdapter, String newAddress)
OneWireContainer
for communication with a DS28E04.sourceAdapter
- adapter object required to communicate with
this 1-Wire devicenewAddress
- address of this DS28E04OneWireContainer1C()
,
OneWireContainer1C(DSPortAdapter,byte[])
,
OneWireContainer1C(DSPortAdapter,long)
Method Detail |
public String getName()
java.lang.String
.getName
in class OneWireContainer
public Enumeration getMemoryBanks()
MemoryBank
,
PagedMemoryBank
,
and OTPMemoryBank
.getMemoryBanks
in class OneWireContainer
Enumeration
of memory bankspublic String getAlternateNames()
getAlternateNames
in class OneWireContainer
public String getDescription()
getDescription
in class OneWireContainer
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[] readDevice() throws OneWireIOException, OneWireException
readDevice
in interface OneWireSensor
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 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 writeDevice(byte[] state) throws OneWireIOException, OneWireException
writeDevice
in interface OneWireSensor
state
- 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
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
adapterpublic boolean isVccPowered(byte[] register) throws OneWireIOException, OneWireException
true
if VCC is powered and false
if it is
grounded.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 boolean getDefaultPolarity(byte[] register)
public boolean getPowerOnResetLatch(byte[] register)
public void clearPowerOnReset(byte[] register)
register
- current register for conditional search, which
if returned from readRegister()
public void orConditionalSearch(byte[] register)
register
- current register for conditional search, which
if returned from readRegister()
public void andConditionalSearch(byte[] register)
register
- current register for conditional search, which
if returned from readRegister()
public void setConditionalSearchLogicLevel(byte[] register)
pinActivity
- if true, the activity latch for the pin is used for the
conditional search. Otherwise, the sensed level of the
pin is used for the conditional search.register
- current register for conditional search, which
if returned from readRegister()
public void setConditionalSearchActivity(byte[] register)
register
- current register for conditional search, which
if returned from readRegister()
public void setChannelMask(int channel, boolean set, byte[] register)
channel
- current channel to setset
- whether to turn the channel on/off for Conditional Searchregister
- current register for conditional search, which
if returned from readRegister()
public void setChannelPolarity(int channel, boolean set, byte[] register)
channel
- current channel to setset
- whether to turn the channel on/off for polarity
Conditional Searchregister
- current register for conditional search, which
if returned from readRegister()
public boolean getChannelMask(int channel, byte[] register)
channel
- current channel to setregister
- current register for conditional search, which
if returned from readRegister()
true
if the channel is masked and false
other wise.public boolean getChannelPolarity(int channel, byte[] register)
channel
- current channel to setregister
- current register for conditional search, which
if returned from readRegister()
true
if the channel is masked and false
other wise.