com.dalsemi.onewire.container
Class OneWireContainer12

java.lang.Object
  |
  +--com.dalsemi.onewire.container.OneWireContainer
        |
        +--com.dalsemi.onewire.container.OneWireContainer12
All Implemented Interfaces:
OneWireSensor, SwitchContainer

public class OneWireContainer12
extends OneWireContainer
implements SwitchContainer

1-Wire® container for a Dual Addressable Switch, DS2406 or DS2407. This container encapsulates the functionality of the 1-Wire family type 12 (hex). The DS2406 replaces the DS2407, but does not have hidden mode or user programmable power-on settings.

Features

Memory

The memory can be accessed through the objects that are returned from the getMemoryBanks method.

The following is a list of the MemoryBank instances that are returned:

Usage

The DS2406 supports level sensing and activity sensing. The code below reports the flip-flop state, PIO level, and sensed activity while toggling every switch each time through the loop. It toggles every switch it finds, regardless if the device has one or two switches.

      // "ID" is a byte array of size 8 with an address of a part we
      // have already found with family code 12 hex
      // "access" is a DSPortAdapter

      OneWireContainer12 ds2406 = (OneWireContainer12) access.getDeviceContainer(ID);
      ds2406.setupContainer(access,ID);

      byte[] state = ds2406.readDevice();
      int numchannels = ds2406.getNumberChannels(state);
      System.out.println("Number of Channels: "+numchannels);
      boolean[] switches = new boolean[numchannels];

      ds2406.clearActivity();

      for (int j=0;j<10;j++)
      {
          //clear the activity latches halfway through the test
          if (j==5)
              ds2406.clearActivity();
          state = ds2406.readDevice();

          //first let's print out the status of all the latches
          for (int i=0;i < numchannels;i++)
          {
              System.out.println("---------------------------------------------------------\r\n");
              System.out.println("                       CHANNEL "+i);
              System.out.println("---------------------------------------------------------\r\n");

              System.out.println("           Latch state: "+ds2406.getLatchState(i,state));
              System.out.println("           Level      : "+ds2406.getLevel(i,state));
              System.out.println("           Activity   : "+ds2406.getSensedActivity(i, state));
              switches[i] = ds2406.getLatchState(i,state);
          }

          //now lets toggle the switch flip-flop
          for (int i=0;i < numchannels;i++)
          {
              ds2406.setLatchState(i,!switches[i],false,state);
          }
          ds2406.writeDevice(state);

          Thread.sleep(500);
      }

 

Also see the usage example in the SwithContainer interface.

For examples regarding memory operations,

DataSheet

http://pdfserv.maxim-ic.com/arpdf/DS2406.pdf for the DS2406
http://pdfserv.maxim-ic.com/arpdf/DS2407.pdf for the DS2407
Also see the DS2405, a single addressable switch (OneWireContainer05).

Version:
0.00, 28 Aug 2000
See Also:
OneWireSensor, SwitchContainer, OneWireContainer05

Field Summary
static byte CHANNEL_A_ONLY
          channelMode for the channelAccess method.
static byte CHANNEL_B_ONLY
          channelMode for the channelAccess method.
static byte CHANNEL_BOTH
          channelMode for the channelAccess method.
static byte CHANNEL_NONE
          Used to select neither channel as the source for alarm conditions in the setSearchConditions() method.
static byte CRC_DISABLE
          CRCMode for the channelAccess method.
static byte CRC_EVERY_32_BYTES
          CRCMode for the channelAccess method.
static byte CRC_EVERY_8_BYTES
          CRCMode for the channelAccess method.
static byte CRC_EVERY_BYTE
          CRCMode for the channelAccess method.
static byte DONT_CHANGE
          Used for options in the setSearchConditions() to make sure the specified option is not changes from its current value.
static byte POLARITY_ONE
          Used to set the polarity to logical '1' for conditional search checking in the setSearchConditions() method.
static byte POLARITY_ZERO
          Used to set the polarity to logical '0' for conditional search checking in the setSearchConditions() method.
static byte SOURCE_ACTIVITY_LATCH
          Used to set the source to the activity latch for conditional searches in the setSearchConditions() method.
static byte SOURCE_FLIP_FLOP
          Used to set the source to the flip-flop state for conditional searches in the setSearchConditions() method.
static byte SOURCE_PIO
          Used to set the source to the PIO status for conditional searches in the setSearchConditions() method.
 
Constructor Summary
OneWireContainer12()
          Creates a new OneWireContainer for communication with a DS2406/2407.
OneWireContainer12(DSPortAdapter sourceAdapter, byte[] newAddress)
          Creates a new OneWireContainer for communication with a DS2406/2407.
OneWireContainer12(DSPortAdapter sourceAdapter, long newAddress)
          Creates a new OneWireContainer for communication with a DS2406/2407.
OneWireContainer12(DSPortAdapter sourceAdapter, String newAddress)
          Creates a new OneWireContainer for communication with a DS2406/2407.
 
Method Summary
 byte[] channelAccess(byte[] inbuffer, boolean toggleRW, boolean readInitially, int CRCMode, int channelMode, boolean clearActivity, boolean interleave)
          Accesses the PIO channels to sense the logical status of the output node.
 void clearActivity()
          Clears the activity latches the next time possible.
 String getAlternateNames()
          Retrieves the alternate Dallas Semiconductor part numbers or names.
 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 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 isPowerSupplied(byte[] state)
          Checks to see how the DS2406 is being supplied with power.
 boolean onlySingleChannelOn()
          Checks 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 setLatchState(int channel, boolean latchState, boolean doSmart, byte[] state)
          Sets the latch state of the indicated channel.
 void setSearchConditions(byte channel, byte source, byte polarity, byte[] state)
          Programs the Conditional Search options for the DS2406/2407.
 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, 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

SOURCE_ACTIVITY_LATCH

public static final byte SOURCE_ACTIVITY_LATCH
Used to set the source to the activity latch for conditional searches in the setSearchConditions() method.
See Also:
setSearchConditions(byte,byte,byte,byte[])

SOURCE_FLIP_FLOP

public static final byte SOURCE_FLIP_FLOP
Used to set the source to the flip-flop state for conditional searches in the setSearchConditions() method.
See Also:
setSearchConditions(byte,byte,byte,byte[])

SOURCE_PIO

public static final byte SOURCE_PIO
Used to set the source to the PIO status for conditional searches in the setSearchConditions() method.
See Also:
setSearchConditions(byte,byte,byte,byte[])

POLARITY_ZERO

public static final byte POLARITY_ZERO
Used to set the polarity to logical '0' for conditional search checking in the setSearchConditions() method.
See Also:
setSearchConditions(byte,byte,byte,byte[])

POLARITY_ONE

public static final byte POLARITY_ONE
Used to set the polarity to logical '1' for conditional search checking in the setSearchConditions() method.
See Also:
setSearchConditions(byte,byte,byte,byte[])

CHANNEL_NONE

public static final byte CHANNEL_NONE
Used to select neither channel as the source for alarm conditions in the setSearchConditions() method.
See Also:
setSearchConditions(byte,byte,byte,byte[])

DONT_CHANGE

public static final byte DONT_CHANGE
Used for options in the setSearchConditions() to make sure the specified option is not changes from its current value.
See Also:
setSearchConditions(byte,byte,byte,byte[])

CHANNEL_A_ONLY

public static final byte CHANNEL_A_ONLY
channelMode for the channelAccess method. Selects Channel A (channel 0) for communication. Also used to select Channel A as the source for alarm conditions in the setSearchConditions() method.
See Also:
channelAccess(byte[],boolean,boolean,int,int,boolean,boolean), setSearchConditions(byte,byte,byte,byte[])

CHANNEL_B_ONLY

public static final byte CHANNEL_B_ONLY
channelMode for the channelAccess method. Selects Channel B (channel 1) for communication. Also used to select Channel B as the source for alarm conditions in the setSearchConditions() method.
See Also:
channelAccess(byte[],boolean,boolean,int,int,boolean,boolean), setSearchConditions(byte,byte,byte,byte[])

CHANNEL_BOTH

public static final byte CHANNEL_BOTH
channelMode for the channelAccess method. Selects both Channel A and B (channel 0 and 1) for communication. Also used to select both channels as the source for alarm conditions in the setSearchConditions() method.
See Also:
channelAccess(byte[],boolean,boolean,int,int,boolean,boolean), setSearchConditions(byte,byte,byte,byte[])

CRC_DISABLE

public static final byte CRC_DISABLE
CRCMode for the channelAccess method. Requests no CRC generation by the DS2406/2407.
See Also:
channelAccess(byte[],boolean,boolean,int,int,boolean,boolean)

CRC_EVERY_BYTE

public static final byte CRC_EVERY_BYTE
CRCMode for the channelAccess method. Requests CRC generation after every byte transmitted.
See Also:
channelAccess(byte[],boolean,boolean,int,int,boolean,boolean)

CRC_EVERY_8_BYTES

public static final byte CRC_EVERY_8_BYTES
CRCMode for the channelAccess method. Requests CRC generation after every 8 bytes transmitted.
See Also:
channelAccess(byte[],boolean,boolean,int,int,boolean,boolean)

CRC_EVERY_32_BYTES

public static final byte CRC_EVERY_32_BYTES
CRCMode for the channelAccess method. Requests CRC generation after every 32 bytes transmitted.
See Also:
channelAccess(byte[],boolean,boolean,int,int,boolean,boolean)
Constructor Detail

OneWireContainer12

public OneWireContainer12()
Creates a new OneWireContainer for communication with a DS2406/2407. Note that the method setupContainer(com.dalsemi.onewire.adapter.DSPortAdapter,byte[]) must be called to set the correct DSPortAdapter device address.
See Also:
setupContainer(DSPortAdapter,byte[]), OneWireContainer12(DSPortAdapter,byte[]), OneWireContainer12(DSPortAdapter,long), OneWireContainer12(DSPortAdapter,String)

OneWireContainer12

public OneWireContainer12(DSPortAdapter sourceAdapter,
                          byte[] newAddress)
Creates a new OneWireContainer for communication with a DS2406/2407.
Parameters:
sourceAdapter - adapter object required to communicate with this 1-Wire device
newAddress - address of this DS2406/2407
See Also:
OneWireContainer12(), OneWireContainer12(DSPortAdapter,long), OneWireContainer12(DSPortAdapter,String)

OneWireContainer12

public OneWireContainer12(DSPortAdapter sourceAdapter,
                          long newAddress)
Creates a new OneWireContainer for communication with a DS2406/2407.
Parameters:
sourceAdapter - adapter object required to communicate with this 1-Wire device
newAddress - address of this DS2406/2407
See Also:
OneWireContainer12(), OneWireContainer12(DSPortAdapter,byte[]), OneWireContainer12(DSPortAdapter,String)

OneWireContainer12

public OneWireContainer12(DSPortAdapter sourceAdapter,
                          String newAddress)
Creates a new OneWireContainer for communication with a DS2406/2407.
Parameters:
sourceAdapter - adapter object required to communicate with this 1-Wire device
newAddress - address of this DS2406/2407
See Also:
OneWireContainer12(), OneWireContainer12(DSPortAdapter,byte[]), OneWireContainer12(DSPortAdapter,long)
Method Detail

getName

public String getName()
Gets the Dallas Semiconductor part number of the iButton or 1-Wire Device as a java.lang.String. For example "DS1992".
Overrides:
getName in class OneWireContainer
Returns:
iButton or 1-Wire device name

getAlternateNames

public String getAlternateNames()
Retrieves the alternate Dallas Semiconductor part numbers or names. A 'family' of MicroLAN devices may have more than one part number depending on packaging. There can also be nicknames such as "Crypto iButton".
Overrides:
getAlternateNames in class OneWireContainer
Returns:
the alternate names for this iButton or 1-Wire device

getDescription

public String getDescription()
Gets a short description of the function of this iButton or 1-Wire Device type.
Overrides:
getDescription in class OneWireContainer
Returns:
device description

getMemoryBanks

public Enumeration getMemoryBanks()
Gets an enumeration of memory bank instances that implement one or more of the following interfaces: MemoryBank, PagedMemoryBank, and OTPMemoryBank.
Overrides:
getMemoryBanks in class OneWireContainer
Returns:
Enumeration of memory banks

isPowerSupplied

public boolean isPowerSupplied(byte[] state)
Checks to see how the DS2406 is being supplied with power. The 6-pin (2 channel) package of the DS2406 can be powered by an outside source, but will still function on parasite power only.
Parameters:
state - current state of the device returned from readDevice()
Returns:
true if the device is getting supplied with power and false if the device is parasite powered
See Also:
OneWireSensor.readDevice()

getNumberChannels

public int getNumberChannels(byte[] state)
Gets the number of channels supported by this switch. Channel specific methods will use a channel number specified by an integer from [0 to (getNumberChannels(byte[]) - 1)]. Note that all devices of the same family will not necessarily have the same number of channels.
Specified by:
getNumberChannels in interface SwitchContainer
Parameters:
state - current state of the device returned from readDevice()
Returns:
the number of channels for this device
See Also:
OneWireSensor.readDevice()

isHighSideSwitch

public boolean isHighSideSwitch()
Checks if the channels of this switch are 'high side' switches. This indicates that when 'on' or 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.
Specified by:
isHighSideSwitch in interface SwitchContainer
Returns:
true if the switch is a 'high side' switch, false if the switch is a 'low side' switch
See Also:
getLatchState(int,byte[])

hasActivitySensing

public boolean hasActivitySensing()
Checks if the channels of this switch support activity sensing. If this method returns true then the method getSensedActivity(int,byte[]) can be used.
Specified by:
hasActivitySensing in interface SwitchContainer
Returns:
true if channels support activity sensing
See Also:
getSensedActivity(int,byte[]), clearActivity()

hasLevelSensing

public boolean hasLevelSensing()
Checks if the channels of this switch support level sensing. If this method returns true then the method getLevel(int,byte[]) can be used.
Specified by:
hasLevelSensing in interface SwitchContainer
Returns:
true if channels support level sensing
See Also:
getLevel(int,byte[])

hasSmartOn

public boolean hasSmartOn()
Checks if the channels of this switch support 'smart on'. Smart on is the ability to turn on a channel such that only 1-Wire device on this channel are awake and ready to do an operation. This greatly reduces the time to discover the device down a branch. If this method returns true then the method setLatchState(int,boolean,boolean,byte[]) can be used with the doSmart parameter true.
Specified by:
hasSmartOn in interface SwitchContainer
Returns:
true if channels support 'smart on'
See Also:
setLatchState(int,boolean,boolean,byte[])

onlySingleChannelOn

public boolean onlySingleChannelOn()
Checks if the channels of this switch require that only one channel is on at any one time. If this method returns 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.
Specified by:
onlySingleChannelOn in interface SwitchContainer
Returns:
true if only one channel can be on at a time.
See Also:
setLatchState(int,boolean,boolean,byte[])

getLevel

public boolean getLevel(int channel,
                        byte[] state)
Checks the sensed level on the indicated channel. To avoid an exception, verify that this switch has level sensing with the hasLevelSensing(). Level sensing means that the device can sense the logic level on its PIO pin.
Specified by:
getLevel in interface SwitchContainer
Parameters:
channel - channel to execute this operation, in the range [0 to (getNumberChannels(byte[]) - 1)]
state - current state of the device returned from readDevice()
Returns:
true if level sensed is 'high' and false if level sensed is 'low'
See Also:
OneWireSensor.readDevice(), hasLevelSensing()

getLatchState

public boolean getLatchState(int channel,
                             byte[] state)
Checks the latch state of the indicated channel.
Specified by:
getLatchState in interface SwitchContainer
Parameters:
channel - channel to execute this operation, in the range [0 to (getNumberChannels(byte[]) - 1)]
state - current state of the device returned from readDevice()
Returns:
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.
See Also:
OneWireSensor.readDevice(), isHighSideSwitch(), setLatchState(int,boolean,boolean,byte[])

getSensedActivity

public boolean getSensedActivity(int channel,
                                 byte[] state)
Checks if the indicated channel has experienced activity. This occurs when the level on the PIO pins changes. To clear the activity that is reported, call clearActivity(). To avoid an exception, verify that this device supports activity sensing by calling the method hasActivitySensing().
Specified by:
getSensedActivity in interface SwitchContainer
Parameters:
channel - channel to execute this operation, in the range [0 to (getNumberChannels(byte[]) - 1)]
state - current state of the device returned from readDevice()
Returns:
true if activity was detected and false if no activity was detected
See Also:
hasActivitySensing(), clearActivity()

clearActivity

public void clearActivity()

Clears the activity latches the next time possible. For example, on a DS2406/07, this happens the next time the status is read with readDevice().

The activity latches will only be cleared once. With the DS2406/07, this means that only the first call to readDevice() will clear the activity latches. Subsequent calls to readDevice() will leave the activity latch states intact, unless this method has been invoked since the last call to readDevice().

Specified by:
clearActivity in interface SwitchContainer
See Also:
OneWireSensor.readDevice(), getSensedActivity(int,byte[])

setLatchState

public void setLatchState(int channel,
                          boolean latchState,
                          boolean doSmart,
                          byte[] state)
Sets the latch state of the indicated channel. The method writeDevice() must be called to finalize changes to the device. Note that multiple 'set' methods can be called before one call to writeDevice().
Specified by:
setLatchState in interface SwitchContainer
Parameters:
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()
See Also:
hasSmartOn(), getLatchState(int,byte[]), OneWireSensor.writeDevice(byte[])

readDevice

public byte[] readDevice()
                  throws OneWireIOException,
                         OneWireException
Retrieves the 1-Wire device sensor state. This state 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.
Specified by:
readDevice in interface OneWireSensor
Returns:
1-Wire device sensor state
Throws:
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 adapter

writeDevice

public void writeDevice(byte[] state)
                 throws OneWireIOException,
                        OneWireException
Writes the 1-Wire device sensor state 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.
Specified by:
writeDevice in interface OneWireSensor
Parameters:
state - 1-Wire device sensor state
Throws:
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 adapter

setSpeedCheck

public void setSpeedCheck(boolean doSpeedCheck)
Directs the container to avoid the calls to doSpeed() in methods that communicate with the Thermocron. To ensure that all parts can talk to the 1-Wire bus at their desired speed, each method contains a call to 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().
Parameters:
doSpeedCheck - true for doSpeed() to be called before every 1-Wire bus access, false to skip this expensive call
See Also:
OneWireContainer.doSpeed()

setSearchConditions

public void setSearchConditions(byte channel,
                                byte source,
                                byte polarity,
                                byte[] state)

Programs the Conditional Search options for the DS2406/2407.

The DS2406/2407 supports Conditional Searches with user programmable search conditions. This means that the part can alarm on several kinds of conditions, programmable by the user.

The user can select a channel and a source to compare to a polarity. If the source's logical value is equal to the polarity, the device alarms (responds to a Conditional Search). For instance, if channel is CHANNEL_A, source is SOURCE_ACTIVITY_LATCH, and polarity is POLARITY_ONE, then the device will respond to a Conditional Search when the activity latch on channel A is 1 (when activity has been detected on channel A). When channel is CHANNEL_BOTH, the selected source signals are ORed for comparison with the polarity. When channel is CHANNEL_NONE, the selected source signal is considered a logical '0'. In other words, if channel is CHANNEL_NONE, if polarity is POLARITY_ZERO, the device always responds to a Conditional Search. If polarity is POLARITY_ONE, the device never responds to a Conditional Search.

Note that for any of these options, the value DONT_CHANGE will insure that the value previously used by the DS2406/2407 will not be altered.

The method writeDevice() must be called to finalize changes to the device. Note that multiple 'set' methods can be called before one call to writeDevice().

Also note that the Hidden Mode of the DS2407 is not supported in this implementation as an option for source selection. Hidden Mode was phased out for the newer DS2406. See the datasheet for the DS2407 for more information on Hidden Mode.

Parameters:
channel - the channel of interest for the source of the conditional check (valid values are CHANNEL_NONE, CHANNEL_A_ONLY, CHANNEL_B_ONLY, CHANNEL_BOTH, and DONT_CHANGE)
source - the source selection for the conditional check (valid values are SOURCE_ACTIVITY_LATCH, SOURCE_FLIP_FLOP, SOURCE_PIO, and DONT_CHANGE)
polarity - the polarity selection for the conditional check (valid values are POLARITY_ZERO, POLARITY_ONE, and DONT_CHANGE)
state - current state of the device returned from readDevice()
See Also:
OneWireSensor.readDevice(), OneWireSensor.writeDevice(byte[]), CHANNEL_NONE, CHANNEL_A_ONLY, CHANNEL_B_ONLY, CHANNEL_BOTH, SOURCE_ACTIVITY_LATCH, SOURCE_PIO, SOURCE_FLIP_FLOP, POLARITY_ONE, POLARITY_ZERO, DONT_CHANGE

channelAccess

public byte[] channelAccess(byte[] inbuffer,
                            boolean toggleRW,
                            boolean readInitially,
                            int CRCMode,
                            int channelMode,
                            boolean clearActivity,
                            boolean interleave)
                     throws OneWireException,
                            OneWireIOException

Accesses the PIO channels to sense the logical status of the output node. This method supports all the modes of communication with the part as described in the datasheet for the DS2406/2407.

Parameters:
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 hold space for data that will be read.
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.
NOTE: When toggleRW is true the 'read' bytes are automatically provided and only the results of the read bytes are returned.
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. This method 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 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. If 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.
Returns:
If any bytes were read, this returns a byte array of data read from the channel access. If no bytes were read, it will return the input buffer that was to be written.
Throws:
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 adapter
See Also:
CHANNEL_A_ONLY, CHANNEL_B_ONLY, CHANNEL_BOTH, CRC_DISABLE, CRC_EVERY_BYTE, CRC_EVERY_8_BYTES, CRC_EVERY_32_BYTES