com.dalsemi.onewire.container
Class OneWireContainer05

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

public class OneWireContainer05
extends OneWireContainer
implements SwitchContainer

DS2405 container class with part specific commands.

Version:
0.00, 28 Aug 2000

Constructor Summary
OneWireContainer05()
          Default constructor
OneWireContainer05(DSPortAdapter sourceAdapter, byte[] newAddress)
          Create a container with a provided adapter object and the address of the iButton or 1-Wire device.
OneWireContainer05(DSPortAdapter sourceAdapter, long newAddress)
          Create a container with a provided adapter object and the address of the iButton or 1-Wire device.
OneWireContainer05(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
 void clearActivity()
          Clears the activity latches the next time possible.
 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.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 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, getMemoryBanks, isAlarming, isPresent, setSpeed, setupContainer, setupContainer, setupContainer
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OneWireContainer05

public OneWireContainer05()
Default constructor

OneWireContainer05

public OneWireContainer05(DSPortAdapter sourceAdapter,
                          byte[] newAddress)
Create a container with a provided adapter object and the address of the iButton or 1-Wire device.
Parameters:
sourceAdapter - adapter object required to communicate with this iButton.
newAddress - address of this 1-Wire device

OneWireContainer05

public OneWireContainer05(DSPortAdapter sourceAdapter,
                          long newAddress)
Create a container with a provided adapter object and the address of the iButton or 1-Wire device.
Parameters:
sourceAdapter - adapter object required to communicate with this iButton.
newAddress - address of this 1-Wire device

OneWireContainer05

public OneWireContainer05(DSPortAdapter sourceAdapter,
                          java.lang.String newAddress)
Create a container with a provided adapter object and the address of the iButton or 1-Wire device.
Parameters:
sourceAdapter - adapter object required to communicate with this iButton.
newAddress - address of this 1-Wire device
Method Detail

getName

public java.lang.String getName()
Retrieve the Dallas Semiconductor part number of the iButton as a string. For example 'Crypto iButton' or 'DS1992'.
Overrides:
getName in class OneWireContainer
Returns:
string represetation of the iButton name.

getAlternateNames

public java.lang.String getAlternateNames()
Retrieve 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:
String representation of the alternate names.

getDescription

public java.lang.String getDescription()
Retrieve a short description of the function of the iButton type. Plagerized from the Auto ID Data Book.
Overrides:
getDescription in class OneWireContainer
Returns:
String representation of the function description.

getNumberChannels

public int getNumberChannels(byte[] state)
Query to get the number of channels supported by this switch. Channel specific methods will use a channel number specified by an integer from [0 to (getNumberChannels() - 1)].
Specified by:
getNumberChannels in interface SwitchContainer
Parameters:
state -  
Returns:
int containing the number of channels

isHighSideSwitch

public boolean isHighSideSwitch()
Query to see 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:
boolean, true if switch is a 'high side' switch. false if switch is a 'low side' switch.

hasActivitySensing

public boolean hasActivitySensing()
Query to see if the channels of this switch support activity sensing. If this method returns true then the method 'getActivity()' can be used.
Specified by:
hasActivitySensing in interface SwitchContainer
Returns:
boolean, true if channels support activity sensing

hasLevelSensing

public boolean hasLevelSensing()
Query to see if the channels of this switch support level sensing. If this method returns true then the method 'getLevel()' can be used.
Specified by:
hasLevelSensing in interface SwitchContainer
Returns:
boolean, true if channels support level sensing

hasSmartOn

public boolean hasSmartOn()
Query to see 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 the time to discover the device down a branch. If this method returns true then the method 'setSwitch()' can be used with the 'doSmart' parameter true.
Specified by:
hasSmartOn in interface SwitchContainer
Returns:
boolean, true if channels support smart on

onlySingleChannelOn

public boolean onlySingleChannelOn()
Query to see if the channels of this switch require that only channel is on at any one time. If this method returns true then the method 'setSwitch(channel)' will effect the state of the given channel but may effect 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:
boolean, true if only 1 channel can be on at a time.

getLevel

public 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. Note, to avoid an exception, verify the features of this switch with the method 'hasLevelSensing()'.
Specified by:
getLevel in interface SwitchContainer
Parameters:
channel -  
state - - byte array of device state
Returns:
boolean<\code> true if level sensed is 'high' and false if level sensed is 'low'.

getLatchState

public 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.
Specified by:
getLatchState in interface SwitchContainer
Parameters:
channel -  
state - - byte array of device state
Returns:
boolean<\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.

getSensedActivity

public boolean getSensedActivity(int channel,
                                 byte[] state)
                          throws OneWireException
This method checks if the indicated channel had activity from the provided state data retrieved from the 'readDevice()' method. Note, to avoid an exception, verify the features of this switch with the method 'hasActivitySensing()'.
Specified by:
getSensedActivity in interface SwitchContainer
Parameters:
channel -  
state - - byte array of device state
Returns:
boolean<\code> true if activity was detected and false if no activity was detected.

clearActivity

public void clearActivity()
                   throws OneWireException
Clears the activity latches the next time possible. For example, on a DS2406/07, this happens the next time the status is read.
Specified by:
clearActivity in interface SwitchContainer

setLatchState

public void setLatchState(int channel,
                          boolean latchState,
                          boolean doSmart,
                          byte[] state)
This method sets the latch state of the indicated channel in the state data. Use the method 'writeDevice()' with this data to finalize the change to the device.
Specified by:
setLatchState in interface SwitchContainer
Parameters:
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 state

readDevice

public byte[] readDevice()
                  throws OneWireIOException,
                         OneWireException
This method retrieves the 1-Wire device sensor state. This state is returned as a byte array. Pass this byte array to the static query and set methods. If the device state needs to be changed then call the 'writeDevice' to finalize the one or more change.
Specified by:
readDevice in interface OneWireSensor
Returns:
byte[]<\code> 1-Wire device sensor state *
Throws:
OneWireIOException -  
OneWireException -  

writeDevice

public void writeDevice(byte[] state)
                 throws OneWireIOException,
                        OneWireException
This method write the 1-Wire device sensor state that have been changed by the 'set' methods. It knows which registers have changed by looking at the bitmap fields appended to the state data.
Specified by:
writeDevice in interface OneWireSensor
Parameters:
state - - byte array of clock register page contents
Throws:
OneWireIOException -  
OneWireException -