1-Wire API for .NET Version 4.00
Public Member Functions | Static Public Attributes | Static Protected Attributes

OneWireContainer1F Class Reference

Inherits com::dalsemi::onewire::container::OneWireContainer, and com::dalsemi::onewire::container::SwitchContainer.

List of all members.

Public Member Functions

 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.
String getName ()
 Gets the Maxim Integrated Products part number of the iButton or 1-Wire Device as a string.
String getAlternateNames ()
 Gets the alternate Maxim Integrated Products part numbers or names.
String getDescription ()
 Gets a short description of the function of this iButton or 1-Wire Device type.
synchronized void setSpeedCheck (boolean doSpeedCheck)
 Directs the container to avoid the calls to doSpeed() in methods that communicate with the Thermocron.
byte[] readDevice () throws OneWireIOException, OneWireException
 Retrieves the 1-Wire device sensor state.
void writeDevice (byte[] state) throws OneWireIOException, OneWireException
 Writes the 1-Wire device sensor state that have been changed by 'set' methods.
void dischargeLines (int time) throws OneWireIOException, OneWireException
boolean isHighSideSwitch ()
 Checks to see if the channels of this switch are 'high side' switches.
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 onlySingleChannelOn ()
 Checks to see if the channels of this switch require that only one channel is on at any one time.
int getNumberChannels (byte[] state)
 Query to get the number of channels supported by this switch.
boolean getLevel (int channel, byte[] state) throws OneWireException
 Checks the sensed level on the indicated channel.
boolean getLatchState (int channel, byte[] state)
 Checks the latch state of the indicated channel.
boolean getSensedActivity (int channel, byte[] state) throws OneWireException
 Checks if the indicated channel has experienced activity.
boolean isModeAuto (byte[] state)
 Checks if the control I/O pin mode is automatic (see DS2409 data sheet).
int getControlChannelAssociation (byte[] state)
 Checks the channel association of the control pin.
int getControlData (byte[] state)
 Checks the control data value.
boolean getLastSmartOnDeviceDetect ()
 Gets flag that indicates if a device was present when doing the last smart on.
void setLatchState (int channel, boolean latchState, boolean doSmart, byte[] state)
 Sets the latch state of the indicated channel.
void clearActivity () throws OneWireException
 Clears the activity latches the next time possible.
void setModeAuto (boolean makeAuto, byte[] state)
 Sets the control pin mode.
void setControlChannelAssociation (int channel, byte[] state) throws OneWireException
 Sets the control pin channel association.
void setControlData (boolean data, byte[] state) throws OneWireException
 Sets the control pin data to a value.

Static Public Attributes

static final int CHANNEL_MAIN = 0
 Main Channel number.
static final int CHANNEL_AUX = 1
 Aux Channel number.

Static Protected Attributes

static final int BITMAP_OFFSET = 3
 Offset of BITMAP in array returned from read state.
static final int STATUS_OFFSET = 0
 Offset of Status in array returned from read state.
static final int MAIN_OFFSET = 1
 Offset of Main channel flag in array returned from read state.
static final int AUX_OFFSET = 2
 Offset of Main channel flag in array returned from read state.
static final int SWITCH_OFF = 0
 Channel flag to indicate turn off.
static final int SWITCH_ON = 1
 Channel flag to indicate turn on.
static final int SWITCH_SMART = 2
 Channel flag to indicate smart on.
static final byte READ_WRITE_STATUS_COMMAND = ( byte ) 0x5A
 Read Write Status register commmand.
static final byte ALL_LINES_OFF_COMMAND = ( byte ) 0x66
 All lines off command.
static final byte DISCHARGE_COMMAND = ( byte ) 0x99
 Discharge command.
static final byte DIRECT_ON_MAIN_COMMAND = ( byte ) 0xA5
 Direct on main command.
static final byte SMART_ON_MAIN_COMMAND = ( byte ) 0xCC
 Smart on main command.
static final byte SMART_ON_AUX_COMMAND = ( byte ) 0x33
 Smart on aux command.

Detailed Description

1-Wire® container for 1-Wire(MicroLAN) Coupler, DS2409. This container encapsulates the functionality of the 1-Wire family type 1F (hex).

Features

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.

Usage

See the usage example in SwitchContainer for basic switch operations.

DataSheet

http://pdfserv.maxim-ic.com/arpdf/DS2409.pdf

See also:
com.dalsemi.onewire.container.OneWireSensor
com.dalsemi.onewire.container.SwitchContainer
com.dalsemi.onewire.container.OneWireContainer05
com.dalsemi.onewire.container.OneWireContainer12
Version:
0.00, 13 Sept 2000
Author:
DSS

Constructor & Destructor Documentation

Create an empty container that is not complete until after a call to setupContainer.

This is one of the methods to construct a container. The others are through creating a OneWireContainer with parameters.

See also:
setupContainer(com.dalsemi.onewire.adapter.DSPortAdapter,byte[]) super.setupContainer()
OneWireContainer1F ( DSPortAdapter  sourceAdapter,
byte[]  newAddress 
)

Create a container with the provided adapter instance and the address of the iButton or 1-Wire device.

This is one of the methods to construct a container. The other is through creating a OneWireContainer with NO parameters.

Parameters:
sourceAdapteradapter instance used to communicate with this iButton
newAddressAddress of this 1-Wire device
See also:
OneWireContainer1F() OneWireContainer1F
com.dalsemi.onewire.utils.Address utils.Address
OneWireContainer1F ( DSPortAdapter  sourceAdapter,
long  newAddress 
)

Create a container with the provided adapter instance and the address of the iButton or 1-Wire device.

This is one of the methods to construct a container. The other is through creating a OneWireContainer with NO parameters.

Parameters:
sourceAdapteradapter instance used to communicate with this 1-Wire device
newAddressAddress of this 1-Wire device
See also:
OneWireContainer1F() OneWireContainer1F
com.dalsemi.onewire.utils.Address utils.Address
OneWireContainer1F ( DSPortAdapter  sourceAdapter,
String  newAddress 
)

Create a container with the provided adapter instance and the address of the iButton or 1-Wire device.

This is one of the methods to construct a container. The other is through creating a OneWireContainer with NO parameters.

Parameters:
sourceAdapteradapter instance used to communicate with this 1-Wire device
newAddressAddress of this 1-Wire device
See also:
OneWireContainer1F() OneWireContainer1F
com.dalsemi.onewire.utils.Address utils.Address

Member Function Documentation

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 with readDevice().

Exceptions:
OneWireExceptionif this device does not support activity sensing
See also:
com.dalsemi.onewire.container.OneWireSensor.readDevice()
getSensedActivity(int,byte[])

Implements SwitchContainer.

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.

Parameters:
timenumber of milliseconds the lines are to be discharged for (minimum 100)
Exceptions:
OneWireIOExceptionon 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'.
OneWireExceptionon a communication or setup error with the 1-Wire adapter
String getAlternateNames ( )

Gets the alternate Maxim Integrated Products part numbers or names.

A 'family' of 1-Wire Network devices may have more than one part number depending on packaging. There can also be nicknames such as 'Crypto iButton'.

Returns:
1-Wire device alternate names

Reimplemented from OneWireContainer.

int getControlChannelAssociation ( byte[]  state)

Checks the channel association of the control pin.

This value only makes sense if the control mode is automatic (see isModeAuto).

Parameters:
statecurrent state of the device returned from readDevice()
Returns:
int the channel number that is associated with the control pin
int getControlData ( byte[]  state)

Checks the control data value.

This value only makes sense if the control mode is manual (see isModeAuto). 0 = output transistor off, 1 = output transistor on

Parameters:
statecurrent state of the device returned from readDevice()
Returns:
int the control output transistor state
String getDescription ( )

Gets a short description of the function of this iButton or 1-Wire Device type.

Returns:
device description

Reimplemented from OneWireContainer.

boolean getLastSmartOnDeviceDetect ( )

Gets flag that indicates if a device was present when doing the last smart on.

Note that this flag is only valid if the DS2409 flag was cleared with an ALL_LINES_OFF command and the last writeDevice performed a 'smart-on' on one of the channels.

Returns:
true if device detected on branch
boolean getLatchState ( int  channel,
byte[]  state 
)

Checks the latch state of the indicated channel.

Parameters:
channelchannel to execute this operation, in the range [0 to (getNumberChannels(byte[]) - 1)]
statecurrent 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:
com.dalsemi.onewire.container.OneWireSensor.readDevice()
isHighSideSwitch()
setLatchState(int,boolean,boolean,byte[])

Implements SwitchContainer.

boolean getLevel ( int  channel,
byte[]  state 
) throws OneWireException

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.

Parameters:
channelchannel to execute this operation, in the range [0 to (getNumberChannels(byte[]) - 1)]
statecurrent state of the device returned from readDevice()
Returns:
true if level sensed is 'high' and false if level sensed is 'low'
See also:
com.dalsemi.onewire.container.OneWireSensor.readDevice()
hasLevelSensing()

Implements SwitchContainer.

String getName ( )

Gets the Maxim Integrated Products part number of the iButton or 1-Wire Device as a string.

For example 'DS1992'.

Returns:
iButton or 1-Wire device name

Reimplemented from OneWireContainer.

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(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.

Parameters:
statecurrent state of the device returned from readDevice()
Returns:
the number of channels for this device

Implements SwitchContainer.

boolean getSensedActivity ( int  channel,
byte[]  state 
) throws OneWireException

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().

Parameters:
channelchannel to execute this operation, in the range [0 to (getNumberChannels(byte[]) - 1)]
statecurrent state of the device returned from readDevice()
Returns:
true if activity was detected and false if no activity was detected
Exceptions:
OneWireExceptionif this device does not have activity sensing
See also:
hasActivitySensing()
clearActivity()

Implements SwitchContainer.

boolean hasActivitySensing ( )

Checks to see if the channels of this switch support activity sensing.

If this method returns true then the method getSensedActivity(int,byte[]) can be used.

Returns:
true if channels support activity sensing
See also:
getSensedActivity(int,byte[])
clearActivity()

Implements SwitchContainer.

boolean hasLevelSensing ( )

Checks to see if the channels of this switch support level sensing.

If this method returns true then the method getLevel(int,byte[]) can be used.

Returns:
true if channels support level sensing
See also:
getLevel(int,byte[])

Implements SwitchContainer.

boolean hasSmartOn ( )

Checks 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 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.

Returns:
true if channels support 'smart on'
See also:
setLatchState(int,boolean,boolean,byte[])

Implements SwitchContainer.

boolean isHighSideSwitch ( )

Checks 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.

Returns:
true if the switch is a 'high side' switch, false if the switch is a 'low side' switch
See also:
getLatchState(int,byte[])

Implements SwitchContainer.

boolean isModeAuto ( byte[]  state)

Checks if the control I/O pin mode is automatic (see DS2409 data sheet).

Parameters:
statecurrent state of the device returned from readDevice()
Returns:
true if control mode is automatic
boolean onlySingleChannelOn ( )

Checks to see 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.

Returns:
true if only one channel can be on at a time.
See also:
setLatchState(int,boolean,boolean,byte[])

Implements SwitchContainer.

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.

Returns:
1-Wire device sensor state
Exceptions:
OneWireIOExceptionon 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'.
OneWireExceptionon a communication or setup error with the 1-Wire adapter

Implements OneWireSensor.

void setControlChannelAssociation ( int  channel,
byte[]  state 
) throws OneWireException

Sets the control pin channel association.

This only makes sense if the contol pin is in automatic mode. The method 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[]).

Parameters:
channelchannel to associate with control pin
statecurrent state of the device returned from readDevice()
Exceptions:
OneWireExceptionwhen trying to set channel association in manual mode
void setControlData ( boolean  data,
byte[]  state 
) throws OneWireException

Sets the control pin data to a value.

Note this method only works if the control pin is in manual mode. The method 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[]).

Parameters:
datatrue for on and false for off
statecurrent state of the device returned from readDevice()
Exceptions:
OneWireExceptionwhen trying to set control data in automatic mode
void setLatchState ( int  channel,
boolean  latchState,
boolean  doSmart,
byte[]  state 
)

Sets the latch state of the indicated channel.

The method 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[]).

Parameters:
channelchannel to execute this operation, in the range [0 to (getNumberChannels(byte[]) - 1)]
latchStatetrue 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.
doSmartIf 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.
statecurrent state of the device returned from readDevice()
See also:
hasSmartOn()
getLatchState(int,byte[])
com.dalsemi.onewire.container.OneWireSensor.writeDevice(byte[])

Implements SwitchContainer.

void setModeAuto ( boolean  makeAuto,
byte[]  state 
)

Sets the control pin mode.

The method 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[]).

Parameters:
makeAutotrue to set to auto mode, false for manual mode
statecurrent state of the device returned from readDevice()
synchronized 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:
doSpeedChecktrue for doSpeed() to be called before every 1-Wire bus access, false to skip this expensive call
See also:
OneWireContainer.doSpeed()
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.

Parameters:
state1-Wire device sensor state
Exceptions:
OneWireIOExceptionon 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'.
OneWireExceptionon a communication or setup error with the 1-Wire adapter

Implements OneWireSensor.


Member Data Documentation

final byte ALL_LINES_OFF_COMMAND = ( byte ) 0x66 [static, protected]

All lines off command.

final int AUX_OFFSET = 2 [static, protected]

Offset of Main channel flag in array returned from read state.

final int BITMAP_OFFSET = 3 [static, protected]

Offset of BITMAP in array returned from read state.

final int CHANNEL_AUX = 1 [static]

Aux Channel number.

final int CHANNEL_MAIN = 0 [static]

Main Channel number.

final byte DIRECT_ON_MAIN_COMMAND = ( byte ) 0xA5 [static, protected]

Direct on main command.

final byte DISCHARGE_COMMAND = ( byte ) 0x99 [static, protected]

Discharge command.

final int MAIN_OFFSET = 1 [static, protected]

Offset of Main channel flag in array returned from read state.

final byte READ_WRITE_STATUS_COMMAND = ( byte ) 0x5A [static, protected]

Read Write Status register commmand.

final byte SMART_ON_AUX_COMMAND = ( byte ) 0x33 [static, protected]

Smart on aux command.

final byte SMART_ON_MAIN_COMMAND = ( byte ) 0xCC [static, protected]

Smart on main command.

final int STATUS_OFFSET = 0 [static, protected]

Offset of Status in array returned from read state.

final int SWITCH_OFF = 0 [static, protected]

Channel flag to indicate turn off.

final int SWITCH_ON = 1 [static, protected]

Channel flag to indicate turn on.

final int SWITCH_SMART = 2 [static, protected]

Channel flag to indicate smart on.


The documentation for this class was generated from the following file: