|
||||||||||
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.OneWireContainer1F
1-Wire® container for 1-Wire(MicroLAN) Coupler, DS2409. This container encapsulates the functionality of the 1-Wire family type 1F (hex).
Setting the latch on the DS2409 to 'on'
(see seLatchState
)
connects the channel [Main(0) or Auxillary(1)] to the 1-Wire data line. Note
that this is the opposite of the
DS2406
and
DS2405
which connect thier I/O lines to ground.
SwitchContainer
for basic switch operations.
OneWireSensor
,
SwitchContainer
,
OneWireContainer05
,
OneWireContainer12
Field Summary | |
static int |
CHANNEL_AUX
Aux Channel number. |
static int |
CHANNEL_MAIN
Main Channel number. |
Constructor Summary | |
OneWireContainer1F()
Create an empty container that is not complete until after a call to setupContainer . |
|
OneWireContainer1F(DSPortAdapter sourceAdapter,
byte[] newAddress)
Create a container with the provided adapter instance and the address of the iButton or 1-Wire device. |
|
OneWireContainer1F(DSPortAdapter sourceAdapter,
long newAddress)
Create a container with the provided adapter instance and the address of the iButton or 1-Wire device. |
|
OneWireContainer1F(DSPortAdapter sourceAdapter,
String newAddress)
Create a container with the provided adapter instance and the address of the iButton or 1-Wire device. |
Method Summary | |
void |
clearActivity()
Clears the activity latches the next time possible. |
void |
dischargeLines(int time)
Force a power-on reset for parasitically powered 1-Wire devices connected to the main or auziliary output of the DS2409. |
String |
getAlternateNames()
Gets the alternate Dallas Semiconductor part numbers or names. |
int |
getControlChannelAssociation(byte[] state)
Checks the channel association of the control pin. |
int |
getControlData(byte[] state)
Checks the control data value. |
String |
getDescription()
Gets a short description of the function of this iButton or 1-Wire Device type. |
boolean |
getLastSmartOnDeviceDetect()
Gets flag that indicates if a device was present when doing the last smart on. |
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. |
String |
getName()
Gets the Dallas Semiconductor part number of the iButton or 1-Wire Device as a string. |
int |
getNumberChannels(byte[] state)
Query to get the number of channels supported by this switch. |
boolean |
getSensedActivity(int channel,
byte[] state)
Checks if the indicated channel has experienced activity. |
boolean |
hasActivitySensing()
Checks to see if the channels of this switch support activity sensing. |
boolean |
hasLevelSensing()
Checks to see if the channels of this switch support level sensing. |
boolean |
hasSmartOn()
Checks to see if the channels of this switch support 'smart on'. |
boolean |
isHighSideSwitch()
Checks to see if the channels of this switch are 'high side' switches. |
boolean |
isModeAuto(byte[] state)
Checks if the control I/O pin mode is automatic (see DS2409 data sheet). |
boolean |
onlySingleChannelOn()
Checks to see if the channels of this switch require that only one channel is on at any one time. |
byte[] |
readDevice()
Retrieves the 1-Wire device sensor state. |
void |
setControlChannelAssociation(int channel,
byte[] state)
Sets the control pin channel association. |
void |
setControlData(boolean data,
byte[] state)
Sets the control pin data to a value. |
void |
setLatchState(int channel,
boolean latchState,
boolean doSmart,
byte[] state)
Sets the latch state of the indicated channel. |
void |
setModeAuto(boolean makeAuto,
byte[] state)
Sets the control pin mode. |
void |
setSpeedCheck(boolean doSpeedCheck)
Directs the container to avoid the calls to doSpeed() in methods that communicate with the Thermocron. |
void |
writeDevice(byte[] state)
Writes the 1-Wire device sensor state that have been changed by 'set' methods. |
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 int CHANNEL_MAIN
public static final int CHANNEL_AUX
Constructor Detail |
public OneWireContainer1F()
setupContainer
. This is one of the methods to construct a container. The others are through creating a OneWireContainer with parameters.
super.setupContainer()
public OneWireContainer1F(DSPortAdapter sourceAdapter, byte[] newAddress)
This is one of the methods to construct a container. The other is through creating a OneWireContainer with NO parameters.
sourceAdapter
- adapter instance used to communicate with
this iButtonnewAddress
- Address
of this 1-Wire deviceOneWireContainer1F
,
utils.Address
public OneWireContainer1F(DSPortAdapter sourceAdapter, long newAddress)
This is one of the methods to construct a container. The other is through creating a OneWireContainer with NO parameters.
sourceAdapter
- adapter instance used to communicate with
this 1-Wire devicenewAddress
- Address
of this 1-Wire deviceOneWireContainer1F
,
utils.Address
public OneWireContainer1F(DSPortAdapter sourceAdapter, String newAddress)
This is one of the methods to construct a container. The other is through creating a OneWireContainer with NO parameters.
sourceAdapter
- adapter instance used to communicate with
this 1-Wire devicenewAddress
- Address
of this 1-Wire deviceOneWireContainer1F
,
utils.Address
Method Detail |
public String getName()
getName
in class OneWireContainer
public String getAlternateNames()
getAlternateNames
in class OneWireContainer
public String getDescription()
getDescription
in class OneWireContainer
public void setSpeedCheck(boolean doSpeedCheck)
doSpeed()
. However, this is an expensive operation.
If a user manages the bus speed in an
application, call this method with doSpeedCheck
as false
. The default behavior is
to call doSpeed()
.doSpeedCheck
- true
for doSpeed()
to be called before every
1-Wire bus access, false
to skip this expensive callOneWireContainer.doSpeed()
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 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 dischargeLines(int time) throws OneWireIOException, OneWireException
Force a power-on reset for parasitically powered 1-Wire devices connected to the main or auziliary output of the DS2409.
IMPORTANT: the duration of the discharge time should be 100ms minimum.
time
- number of milliseconds the lines are
to be discharged for (minimum 100)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 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 int getNumberChannels(byte[] state)
getNumberChannels(byte[])
- 1)]. Note that
all devices of the same family will not necessarily have the
same number of channels. The DS2406 comes in two packages--one that
has a single channel, and one that has two channels.getNumberChannels
in interface SwitchContainer
state
- current state of the device returned from readDevice()
public boolean getLevel(int channel, byte[] state) throws OneWireException
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 boolean isModeAuto(byte[] state)
state
- current state of the device returned from readDevice()
true
if control mode is automaticpublic int getControlChannelAssociation(byte[] state)
isModeAuto
).state
- current state of the device returned from readDevice()
int
the channel number that is associated
with the control pinpublic int getControlData(byte[] state)
isModeAuto
).
0 = output transistor off, 1 = output transistor onstate
- current state of the device returned from readDevice()
int
the control output transistor statepublic boolean getLastSmartOnDeviceDetect()
true
if device detected on branchpublic void setLatchState(int channel, boolean latchState, boolean doSmart, byte[] state)
writeDevice(byte[])
must be called to finalize
changes to the device. Note that multiple 'set' methods can
be called before one call to writeDevice(byte[])
.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 clearActivity() throws OneWireException
readDevice()
.clearActivity
in interface SwitchContainer
OneWireException
- if this device does not support activity sensingOneWireSensor.readDevice()
,
getSensedActivity(int,byte[])
public void setModeAuto(boolean makeAuto, byte[] state)
writeDevice(byte[])
must be called to finalize
changes to the device. Note that multiple 'set' methods can
be called before one call to writeDevice(byte[])
.makeAuto
- true
to set to auto mode, false for manual modestate
- current state of the device returned from readDevice()
public void setControlChannelAssociation(int channel, byte[] state) throws OneWireException
writeDevice(byte[])
must be called to finalize
changes to the device. Note that multiple 'set' methods can
be called before one call to writeDevice(byte[])
.channel
- channel to associate with control pinstate
- current state of the device returned from readDevice()
OneWireException
- when trying to set channel association in manual modepublic void setControlData(boolean data, byte[] state) throws OneWireException
writeDevice(byte[])
must be called to finalize
changes to the device. Note that multiple 'set' methods can
be called before one call to writeDevice(byte[])
.data
- true
for on and false
for offstate
- current state of the device returned from readDevice()
OneWireException
- when trying to set control data in automatic mode
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |