|
|||||||||
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.OneWireContainer12
iButton container for iButton family type 12 (hex). This family type is a 'dual addressible switch' iButton (DS2406). It contains 2 addressible switches and or sensors.
Field Summary | |
static byte |
CHANNEL_A_ONLY
channelMode for channelAccess(), channel A selection |
static byte |
CHANNEL_B_ONLY
channelMode for channelAccess(), channel B selection |
static byte |
CHANNEL_BOTH
channelMode for channelAccess(), channel A and B selection |
static byte |
CRC_DISABLE
CRCMode for channelAccess(), no CRC |
static byte |
CRC_EVERY_32_BYTES
CRCMode for channelAccess(), CRC after 32 bytes |
static byte |
CRC_EVERY_8_BYTES
CRCMode for channelAccess(), CRC after 8 bytes |
static byte |
CRC_EVERY_BYTE
CRCMode for channelAccess(), CRC after every byte |
Constructor Summary | |
OneWireContainer12()
Constructor OneWireContainer12 |
|
OneWireContainer12(DSPortAdapter sourceAdapter,
byte[] newAddress)
Create a container with a provided adapter object and the address of the iButton or 1-Wire device. |
|
OneWireContainer12(DSPortAdapter sourceAdapter,
long newAddress)
Create a container with a provided adapter object and the address of the iButton or 1-Wire device. |
|
OneWireContainer12(DSPortAdapter sourceAdapter,
java.lang.String newAddress)
Create a container with a provided adapter object and the address of the iButton or 1-Wire device. |
Method Summary | |
byte[] |
channelAccess(byte[] inbuffer,
boolean toggleRW,
boolean readInitially,
int CRCMode,
int channelMode,
boolean clearActivity,
boolean interleave)
Used to access the PIO channels to sense the logical status of the output node. |
void |
clearActivity()
Method clearActivity |
java.lang.String |
getAlternateNames()
Retrieve the alternate Dallas Semiconductor part numbers or names. |
java.lang.String |
getDescription()
Retrieve a short description of the function of the iButton type. |
boolean |
getLatchState(int channel,
byte[] state)
This method checks the latch state of the indicated channel from the provided state data retrieved from the 'readDevice()' method. |
boolean |
getLevel(int channel,
byte[] state)
This method checks the sensed level on the indicated channel from the provided state data retrieved from the 'readDevice()' method. |
java.util.Enumeration |
getMemoryBanks()
Return an enumeration of memory banks. |
java.lang.String |
getName()
Retrieve the Dallas Semiconductor part number of the iButton as a string. |
int |
getNumberChannels(byte[] state)
Query to get the number of channels supported by this switch. |
boolean |
getSensedActivity(int channel,
byte[] state)
This method checks if the indicated channel had activity from the provided state data retrieved from the 'readDevice()' method. |
boolean |
hasActivitySensing()
Query to see if the channels of this switch support activity sensing. |
boolean |
hasLevelSensing()
Query to see if the channels of this switch support level sensing. |
boolean |
hasSmartOn()
Query to see if the channels of this switch support smart on. |
boolean |
isHighSideSwitch()
Query to see if the channels of this switch are 'high side' switches. |
boolean |
isPowerSupplied(byte[] state)
Read the devices is getting supplied with power. |
boolean |
onlySingleChannelOn()
Query to see if the channels of this switch require that only channel is on at any one time. |
byte[] |
readDevice()
This method retrieves the 1-Wire device sensor state. |
void |
setLatchState(int channel,
boolean latchState,
boolean doSmart,
byte[] state)
This method sets the latch state of the indicated channel in the state data. |
void |
writeDevice(byte[] state)
This method write the 1-Wire device sensor state that have been changed by the 'set' methods. |
Methods inherited from class com.dalsemi.onewire.container.OneWireContainer |
doSpeed, getAdapter, getAddress, getAddressAsLong, getAddressAsString, getMaxSpeed, isAlarming, isPresent, setSpeed, setupContainer, setupContainer, setupContainer |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final byte CHANNEL_A_ONLY
public static final byte CHANNEL_B_ONLY
public static final byte CHANNEL_BOTH
public static final byte CRC_DISABLE
public static final byte CRC_EVERY_BYTE
public static final byte CRC_EVERY_8_BYTES
public static final byte CRC_EVERY_32_BYTES
Constructor Detail |
public OneWireContainer12()
public OneWireContainer12(DSPortAdapter sourceAdapter, byte[] newAddress)
sourceAdapter
- adapter object required to communicate with
this iButton.newAddress
- address of this 1-Wire devicepublic OneWireContainer12(DSPortAdapter sourceAdapter, long newAddress)
sourceAdapter
- adapter object required to communicate with
this iButton.newAddress
- address of this 1-Wire devicepublic OneWireContainer12(DSPortAdapter sourceAdapter, java.lang.String newAddress)
sourceAdapter
- adapter object required to communicate with
this iButton.newAddress
- address of this 1-Wire deviceMethod Detail |
public java.lang.String getName()
getName
in class OneWireContainer
String
representation of the iButton name.public java.lang.String getAlternateNames()
getAlternateNames
in class OneWireContainer
String
representation of the alternate names.public java.lang.String getDescription()
getDescription
in class OneWireContainer
String
representation of the function description.public java.util.Enumeration getMemoryBanks()
getMemoryBanks
in class OneWireContainer
com.dalsemi.onewire.container.OneWireContainer
public boolean isPowerSupplied(byte[] state)
state
- - byte array of device statetrue
if the device is getting supplied with
power and false
if the device is parasite powered.public int getNumberChannels(byte[] state)
getNumberChannels
in interface SwitchContainer
state
- - byte array of device statepublic boolean isHighSideSwitch()
isHighSideSwitch
in interface SwitchContainer
public boolean hasActivitySensing()
hasActivitySensing
in interface SwitchContainer
public boolean hasLevelSensing()
hasLevelSensing
in interface SwitchContainer
public boolean hasSmartOn()
hasSmartOn
in interface SwitchContainer
public boolean onlySingleChannelOn()
onlySingleChannelOn
in interface SwitchContainer
public boolean getLevel(int channel, byte[] state)
getLevel
in interface SwitchContainer
channel
- state
- - byte array of device stateboolean<\code> true if level sensed is 'high'
and false if level sensed is 'low'.
public boolean getLatchState(int channel, byte[] state)
getLatchState
in interface SwitchContainer
channel
- state
- - byte array of device stateboolean<\code> true if channel latch is 'on'
or conducting and false if channel latch is 'off' and not
conducting. Note that the actual output then the latch is 'on'
is returned from the 'isHighSideSwitch()' method.
public boolean getSensedActivity(int channel, byte[] state)
getSensedActivity
in interface SwitchContainer
channel
- state
- - byte array of device stateboolean<\code> true if activity was detected
and false if no activity was detected.
public void clearActivity()
clearActivity
in interface SwitchContainer
public void setLatchState(int channel, boolean latchState, boolean doSmart, byte[] state)
setLatchState
in interface SwitchContainer
channel
- - integer indicated channel to do operation on
in the range [0 to (getNumberChannels() - 1)]latchState
- doSmart
- - if latchState is 'on'/true then doSmart indicates
if a 'smart on' is to be done. To avoid an exception
check the cababilities of the device using the
'hasSmartOn()' method.state
- - byte array of device statepublic byte[] readDevice() throws OneWireIOException, OneWireException
readDevice
in interface OneWireSensor
byte[]<\code> 1-Wire device sensor state *- Throws:
OneWireIOException
- OneWireException
-
public void writeDevice(byte[] state) throws OneWireIOException, OneWireException
writeDevice
in interface OneWireSensor
state
- - byte array of clock register page contentsOneWireIOException
- OneWireException
- public byte[] channelAccess(byte[] inbuffer, boolean toggleRW, boolean readInitially, int CRCMode, int channelMode, boolean clearActivity, boolean interleave) throws OneWireException, OneWireIOException
inbuffer
- The input buffer. Depending on the other options chosen
to this method, this will contain data to be written to
the channels or it will have no interesting data in the
case of a read-only channel access.toggleRW
- By selecting toggleRW to be true, the part will alternately
read and write bytes from and to this channel. Setting
toggleRW to false means that only one operation will occur,
whichever operation is selected by readInitially.readInitially
- If readInitially is true, the first operation to occur will
be a read, else it will be a write. If toggleRW is false,
the operation chosen by this flag is the only operation that
will occur. If toggleRW is true, this operation is the one
that will occur first, then the other will occur. For example,
if toggleRW is true and readInitially is false (and you only
have one channel communication), 8 bits will be written to channel
A and then 8 bits will be read from channel A.CRCMode
- The 2406/7 supports 4 CRC generation modes for error detection
when performing channel access. This argument should have one
of the following values:
CRC_DISABLE Never generate a CRC
CRC_EVERY_BYTE Generate a CRC after every byte transmission.
CRC_EVERY_8_BYTES Generate a CRC after every 8 bytes.
CRC_EVERY_32_BYTES Generate a CRC after every 32 bytes.
Invalid values will be masked to valid values. The CRC is 16 bits,
and does not get passed back with the output. The function returns
null on a CRC failure.channelMode
- The 2406/7 supports 3 modes of channel communication. This
argument should take one of the following values:
CHANNEL_A_ONLY Only communicate with PIO A
CHANNEL_B_ONLY Only communicate with PIO B
CHANNEL_BOTH Communicate with both PIO's
If CHANNEL_BOTH is selected, data is written and read
alternatingly from the input buffer to the two channels.
See the datasheet for a description of operation in this
mode. If communicating with both channels, it is up to the
caller to format the data correctly in the input buffer
so the correct channel gets the correct data. Similarly,
any return data must be parsed by the user.clearActivity
- True to reset the activity latch.interleave
- The value for the Interleave Control bit. If true, operates
in synchronous mode. False operates in asynchronous mode.
See the datasheet for a discussion of asynchronous and
synchronous mode. This argument only matters if communicating
with both channels.OneWireException
- OneWireException
- OneWireIOException
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |