com.dalsemi.onewire.container
Class OneWireContainer1F

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

public class OneWireContainer1F
extends OneWireContainer
implements SwitchContainer

iButton container for iButton family type 1F (hex), DS2409

Version:
0.00, 13 Sept 2000

Field Summary
static byte ALL_LINES_OFF_COMMAND
          All lines off command.
static int AUX_OFFSET
          Offset of Main channel flag in array returned from read state
static int BITMAP_OFFSET
          Offset of BITMAP in array returned from read state
static int CHANNEL_AUX
          Aux Channel number
static int CHANNEL_MAIN
          Main Channel number
static byte DIRECT_ON_MAIN_COMMAND
          Direct on main command.
static byte DISCHARGE_COMMAND
          Discharge command.
static int MAIN_OFFSET
          Offset of Main channel flag in array returned from read state
static byte READ_WRITE_STATUS_COMMAND
          Read Write Status register commmand.
static byte SMART_ON_AUX_COMMAND
          Smart on aux command.
static byte SMART_ON_MAIN_COMMAND
          Smart on main command.
static int STATUS_OFFSET
          Offset of Status in array returned from read state
static int SWITCH_OFF
          Channel flag to indicate turn off
static int SWITCH_ON
          Channel flag to indicate turn on
static int SWITCH_SMART
          Channel flag to indicate smart on
 
Constructor Summary
OneWireContainer1F()
          Default constructor
OneWireContainer1F(DSPortAdapter sourceAdapter, byte[] newAddress)
          Create a container with a provided adapter object and the address of the iButton or 1-Wire device.
OneWireContainer1F(DSPortAdapter sourceAdapter, long newAddress)
          Create a container with a provided adapter object and the address of the iButton or 1-Wire device.
OneWireContainer1F(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.
 void dischargeLines(int time)
          This method is used to force a power-on reset for parasitically powered 1-Wire devices connected to the main or auziliary output of the DS2409.
 java.lang.String getAlternateNames()
          Retrieve the alternate Dallas Semiconductor part numbers or names.
 int getControlChannelAssociation(byte[] state)
          This method checks the channel association of the control pin from the provided state data retrieved from the 'readDevice()' method.
 int getControlData(byte[] state)
          This method checks the control data value from the provided state data retrieved from the 'readDevice()' method.
 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 isModeAuto(byte[] state)
          This method checks if the control mode from the provided state data retrieved from the 'readDevice()' method.
 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 setControlChannelAssociation(int channel, byte[] state)
          This method sets the control pin mode to the indicated value in the state data.
 void setControlData(boolean data, byte[] state)
          This method sets the control pin data to the indicated value in the state data.
 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 setModeAuto(boolean makeAuto, byte[] state)
          This method sets the control pin mode to the indicated value 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
 

Field Detail

BITMAP_OFFSET

public static final int BITMAP_OFFSET
Offset of BITMAP in array returned from read state

STATUS_OFFSET

public static final int STATUS_OFFSET
Offset of Status in array returned from read state

MAIN_OFFSET

public static final int MAIN_OFFSET
Offset of Main channel flag in array returned from read state

AUX_OFFSET

public static final int AUX_OFFSET
Offset of Main channel flag in array returned from read state

CHANNEL_MAIN

public static final int CHANNEL_MAIN
Main Channel number

CHANNEL_AUX

public static final int CHANNEL_AUX
Aux Channel number

SWITCH_OFF

public static final int SWITCH_OFF
Channel flag to indicate turn off

SWITCH_ON

public static final int SWITCH_ON
Channel flag to indicate turn on

SWITCH_SMART

public static final int SWITCH_SMART
Channel flag to indicate smart on

READ_WRITE_STATUS_COMMAND

public static final byte READ_WRITE_STATUS_COMMAND
Read Write Status register commmand.

ALL_LINES_OFF_COMMAND

public static final byte ALL_LINES_OFF_COMMAND
All lines off command.

DISCHARGE_COMMAND

public static final byte DISCHARGE_COMMAND
Discharge command.

DIRECT_ON_MAIN_COMMAND

public static final byte DIRECT_ON_MAIN_COMMAND
Direct on main command.

SMART_ON_MAIN_COMMAND

public static final byte SMART_ON_MAIN_COMMAND
Smart on main command.

SMART_ON_AUX_COMMAND

public static final byte SMART_ON_AUX_COMMAND
Smart on aux command.
Constructor Detail

OneWireContainer1F

public OneWireContainer1F()
Default constructor

OneWireContainer1F

public OneWireContainer1F(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

OneWireContainer1F

public OneWireContainer1F(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

OneWireContainer1F

public OneWireContainer1F(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 '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 represetation of the alternate names.

getDescription

public java.lang.String getDescription()
Retrieve a short description of the function of the iButton type.
Overrides:
getDescription in class OneWireContainer
Returns:
string represetation of the function description.

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. Format: BYTE[0] -> Status info byte, BYTE[1] -> Main switch flag, BYTE[2] -> Aux switch flag, BYTE[3] -> bitmap of changes
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 -  

dischargeLines

public void dischargeLines(int time)
                    throws OneWireIOException,
                           OneWireException
This method is used to 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.
Parameters:
time - - int This is the number of milliseconds the lines are to be discharged for, must be >= 100 ms.
Throws:
OneWireIOException -  
OneWireException -  

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.

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 - - byte array of device state
Returns:
int containing the number of channels

getLevel

public boolean getLevel(int channel,
                        byte[] state)
                 throws OneWireException
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.
Throws:
OneWireException -  

isModeAuto

public boolean isModeAuto(byte[] state)
This method checks if the control mode from the provided state data retrieved from the 'readDevice()' method.
Parameters:
state - - byte array of device state
Returns:
boolean<\code> true if control mode is automatic (see DS2409 data sheet).

getControlChannelAssociation

public int getControlChannelAssociation(byte[] state)
This method checks the channel association of the control pin from the provided state data retrieved from the 'readDevice()' method. This value only makes sense if the control mode is automatic (see isModeAuto()).
Parameters:
state - - byte array of device state
Returns:
int<\code> the channel number that is associated with the control pin (see DS2409 data sheet).

getControlData

public int getControlData(byte[] state)
This method checks the control data value from the provided state data retrieved from the 'readDevice()' method. This value only makes sense if the control mode is manual (see !isModeAuto()).
Parameters:
state - - byte array of device state
Returns:
int<\code> the channel number that is associated with the control pin (see DS2409 data sheet).

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

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. On the DS2409 this will happen on the next writeDevice().
Specified by:
clearActivity in interface SwitchContainer

setModeAuto

public void setModeAuto(boolean makeAuto,
                        byte[] state)
This method sets the control pin mode to the indicated value in the state data. Use the method 'writeDevice()' with this data to finalize the change to the device.
Parameters:
makeAuto - - true to set to auto mode, false for manual mode
state - - byte array of device state

setControlChannelAssociation

public void setControlChannelAssociation(int channel,
                                         byte[] state)
                                  throws OneWireException
This method sets the control pin mode to the indicated value in the state data. Use the method 'writeDevice()' with this data to finalize the change to the device.
Parameters:
channel - - integer indicated channel to do operation on in the range [0 to (getNumberChannels() - 1)]
state - - byte array of device state
Throws:
OneWireException -  

setControlData

public void setControlData(boolean data,
                           byte[] state)
                    throws OneWireException
This method sets the control pin data to the indicated value in the state data. Use the method 'writeDevice()' with this data to finalize the change to the device. Note this method works if the control pin is in manual mode.
Parameters:
data - - boolean indicated the contol data state, true for on and false for off
state - - byte array of device state
Throws:
OneWireException -