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

ADContainer Interface Reference

Inherits com::dalsemi::onewire::container::OneWireSensor.

Inherited by OneWireContainer20, OneWireContainer30, and OneWireContainer41.

List of all members.

Public Member Functions

int getNumberADChannels ()
 Gets the number of channels supported by this A/D.
boolean hasADAlarms ()
 Checks to see if this A/D measuring device has high/low alarms.
double[] getADRanges (int channel)
 Gets an array of available ranges for the specified A/D channel.
double[] getADResolutions (int channel, double range)
 Gets an array of available resolutions based on the specified range on the specified A/D channel.
boolean canADMultiChannelRead ()
 Checks to see if this A/D supports doing multiple voltage conversions at the same time.
void doADConvert (int channel, byte[] state) throws OneWireIOException, OneWireException
 Performs a voltage conversion on one specified channel.
void doADConvert (boolean[] doConvert, byte[] state) throws OneWireIOException, OneWireException
 Performs voltage conversion on one or more specified channels.
double[] getADVoltage (byte[] state) throws OneWireIOException, OneWireException
 Reads the value of the voltages after a doADConvert(boolean[],byte[]) method call.
double getADVoltage (int channel, byte[] state) throws OneWireIOException, OneWireException
 Reads the value of the voltages after a doADConvert(int,byte[]) method call.
double getADAlarm (int channel, int alarmType, byte[] state) throws OneWireException
 Reads the value of the specified A/D alarm on the specified channel.
boolean getADAlarmEnable (int channel, int alarmType, byte[] state) throws OneWireException
 Checks to see if the specified alarm on the specified channel is enabled.
boolean hasADAlarmed (int channel, int alarmType, byte[] state) throws OneWireException
 Checks the state of the specified alarm on the specified channel.
double getADResolution (int channel, byte[] state)
 Returns the currently selected resolution for the specified channel.
double getADRange (int channel, byte[] state)
 Returns the currently selected range for the specified channel.
void setADAlarm (int channel, int alarmType, double alarm, byte[] state) throws OneWireException
 Sets the voltage value of the specified alarm on the specified channel.
void setADAlarmEnable (int channel, int alarmType, boolean alarmEnable, byte[] state) throws OneWireException
 Enables or disables the specified alarm on the specified channel.
void setADResolution (int channel, double resolution, byte[] state)
 Sets the conversion resolution value for the specified channel.
void setADRange (int channel, double range, byte[] state)
 Sets the input range for the specified channel.

Static Public Attributes

static final int ALARM_HIGH = 1
 Indicates the high AD alarm.
static final int ALARM_LOW = 0
 Indicates the low AD alarm.

Detailed Description

Interface class for 1-Wire® devices that perform analog measuring operations. This class should be implemented for each A/D type 1-Wire device.

Features

Usage

ADContainer extends OneWireSensor, so the general usage model applies to any ADContainer:

  1. readDevice()
  2. perform operations on the ADContainer
  3. writeDevice(byte[])

Consider this interaction with an ADContainer that reads from all of its A/D channels, then tries to set its high alarm on its first channel (channel 0):


     //adcontainer is a com.dalsemi.onewire.container.ADContainer
     byte[] state = adcontainer.readDevice();
     double[] voltages = new double[adcontainer.getNumberADChannels()];
     for (int i=0; i < adcontainer.getNumberADChannels(); i++)
     {
          adcontainer.doADConvert(i, state);         
          voltages[i] = adc.getADVoltage(i, state);
     }
     if (adcontainer.hasADAlarms())
     {
          double highalarm = adcontainer.getADAlarm(0, ADContainer.ALARM_HIGH, state);
          adcontainer.setADAlarm(0, ADContainer.ALARM_HIGH, highalarm + 1.0, state);
          adcontainer.writeDevice(state);
     }
 
See also:
OneWireSensor
ClockContainer
TemperatureContainer
PotentiometerContainer
SwitchContainer
Version:
0.00, 27 August 2000
Author:
DS, KLA

Member Function Documentation

boolean canADMultiChannelRead ( )

Checks to see if this A/D supports doing multiple voltage conversions at the same time.

Returns:
true if the device can do multi-channel voltage reads
See also:
doADConvert(boolean[],byte[])

Implemented in OneWireContainer20, OneWireContainer30, and OneWireContainer41.

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

Performs a voltage conversion on one specified channel.

Use the method getADVoltage(int,byte[]) to read the result of this conversion, using the same channel argument as this method uses.

Parameters:
channelchannel number in the range [0 to (getNumberADChannels() - 1)]
statecurrent state of the device returned from readDevice()
Exceptions:
OneWireIOExceptionon a 1-Wire communication error such as no 1-Wire device present. 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'. This is usually a recoverable error.
OneWireExceptionon a communication or setup error with the 1-Wire adapter. This is usually a non-recoverable error.
See also:
com.dalsemi.onewire.container.OneWireSensor.readDevice()
getADVoltage(int,byte[])

Implemented in OneWireContainer20, OneWireContainer30, and OneWireContainer41.

void doADConvert ( boolean[]  doConvert,
byte[]  state 
) throws OneWireIOException, OneWireException

Performs voltage conversion on one or more specified channels.

The method getADVoltage(byte[]) can be used to read the result of the conversion(s). This A/D must support multi-channel read, reported by canADMultiChannelRead(), if more then 1 channel is specified.

Parameters:
doConvertarray of size getNumberADChannels() representing which channels should perform conversions
statecurrent state of the device returned from readDevice()
Exceptions:
OneWireIOExceptionon a 1-Wire communication error such as no 1-Wire device present. 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'. This is usually a recoverable error.
OneWireExceptionon a communication or setup error with the 1-Wire adapter. This is usually a non-recoverable error.
See also:
com.dalsemi.onewire.container.OneWireSensor.readDevice()
getADVoltage(byte[])
canADMultiChannelRead()

Implemented in OneWireContainer20, OneWireContainer30, and OneWireContainer41.

double getADAlarm ( int  channel,
int  alarmType,
byte[]  state 
) throws OneWireException

Reads the value of the specified A/D alarm on the specified channel.

Not all A/D devices have alarms. Check to see if this device has alarms first by calling the hasADAlarms() method.

Parameters:
channelchannel number in the range [0 to (getNumberADChannels() - 1)]
alarmTypethe desired alarm, ALARM_HIGH or ALARM_LOW
statecurrent state of the device returned from readDevice()
Returns:
the alarm value in volts
Exceptions:
OneWireExceptionif this device does not have A/D alarms
See also:
com.dalsemi.onewire.container.OneWireSensor.readDevice()
hasADAlarms()

Implemented in OneWireContainer20, OneWireContainer30, and OneWireContainer41.

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

Checks to see if the specified alarm on the specified channel is enabled.

Not all A/D devices have alarms. Check to see if this device has alarms first by calling the hasADAlarms() method.

Parameters:
channelchannel number in the range [0 to (getNumberADChannels() - 1)]
alarmTypethe desired alarm, ALARM_HIGH or ALARM_LOW
statecurrent state of the device returned from readDevice()
Returns:
true if specified alarm is enabled
Exceptions:
OneWireExceptionif this device does not have A/D alarms
See also:
com.dalsemi.onewire.container.OneWireSensor.readDevice()
hasADAlarms()

Implemented in OneWireContainer20, OneWireContainer30, and OneWireContainer41.

double getADRange ( int  channel,
byte[]  state 
)

Returns the currently selected range for the specified channel.

This device may not have selectable ranges, though this method will return a valid value.

Parameters:
channelchannel number in the range [0 to (getNumberADChannels() - 1)]
statecurrent state of the device returned from readDevice()
Returns:
the input voltage range
See also:
getADRanges(int)
setADRange(int,double,byte[])

Implemented in OneWireContainer20, OneWireContainer30, and OneWireContainer41.

double [] getADRanges ( int  channel)

Gets an array of available ranges for the specified A/D channel.

Parameters:
channelchannel number in the range [0 to (getNumberADChannels() - 1)]
Returns:
array indicating the available ranges starting from the largest range to the smallest range
See also:
getNumberADChannels()

Implemented in OneWireContainer20, OneWireContainer30, and OneWireContainer41.

double getADResolution ( int  channel,
byte[]  state 
)

Returns the currently selected resolution for the specified channel.

This device may not have selectable resolutions, though this method will return a valid value.

Parameters:
channelchannel number in the range [0 to (getNumberADChannels() - 1)]
statecurrent state of the device returned from readDevice()
Returns:
the current resolution of channel in volts
See also:
getADResolutions(int,double)
setADResolution(int,double,byte[])

Implemented in OneWireContainer20, OneWireContainer30, and OneWireContainer41.

double [] getADResolutions ( int  channel,
double  range 
)

Gets an array of available resolutions based on the specified range on the specified A/D channel.

Parameters:
channelchannel number in the range [0 to (getNumberADChannels() - 1)]
rangeA/D range setting from the getADRanges(int) method
Returns:
array indicating the available resolutions on this channel for this range
See also:
getNumberADChannels()
getADRanges(int)

Implemented in OneWireContainer20, OneWireContainer30, and OneWireContainer41.

double [] getADVoltage ( byte[]  state) throws OneWireIOException, OneWireException

Reads the value of the voltages after a doADConvert(boolean[],byte[]) method call.

This A/D device must support multi-channel reading, reported by canADMultiChannelRead(), if more than 1 channel conversion was attempted by doADConvert().

Parameters:
statecurrent state of the device returned from readDevice()
Returns:
array with the voltage values for all channels
Exceptions:
OneWireIOExceptionon a 1-Wire communication error such as no 1-Wire device present. 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'. This is usually a recoverable error.
OneWireExceptionon a communication or setup error with the 1-Wire adapter. This is usually a non-recoverable error.
See also:
doADConvert(boolean[],byte[])

Implemented in OneWireContainer20, OneWireContainer30, and OneWireContainer41.

double getADVoltage ( int  channel,
byte[]  state 
) throws OneWireIOException, OneWireException

Reads the value of the voltages after a doADConvert(int,byte[]) method call.

If more than one channel has been read it is more efficient to use the getADVoltage(byte[]) method that returns all channel voltage values.

Parameters:
channelchannel number in the range [0 to (getNumberADChannels() - 1)]
statecurrent state of the device returned from readDevice()
Returns:
the voltage value for the specified channel
Exceptions:
OneWireIOExceptionon a 1-Wire communication error such as no 1-Wire device present. 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'. This is usually a recoverable error.
OneWireExceptionon a communication or setup error with the 1-Wire adapter. This is usually a non-recoverable error.
See also:
doADConvert(int,byte[])
getADVoltage(byte[])

Implemented in OneWireContainer20, OneWireContainer30, and OneWireContainer41.

int getNumberADChannels ( )

Gets the number of channels supported by this A/D.

Channel specific methods will use a channel number specified by an integer from [0 to (getNumberADChannels() - 1)].

Returns:
the number of channels

Implemented in OneWireContainer20, OneWireContainer30, and OneWireContainer41.

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

Checks the state of the specified alarm on the specified channel.

Not all A/D devices have alarms. Check to see if this device has alarms first by calling the hasADAlarms() method.

Parameters:
channelchannel number in the range [0 to (getNumberADChannels() - 1)]
alarmTypethe desired alarm, ALARM_HIGH or ALARM_LOW
statecurrent state of the device returned from readDevice()
Returns:
true if specified alarm occurred
Exceptions:
OneWireExceptionif this device does not have A/D alarms
See also:
com.dalsemi.onewire.container.OneWireSensor.readDevice()
hasADAlarms()
getADAlarmEnable(int,int,byte[])
setADAlarmEnable(int,int,boolean,byte[])

Implemented in OneWireContainer20, OneWireContainer30, and OneWireContainer41.

boolean hasADAlarms ( )

Checks to see if this A/D measuring device has high/low alarms.

Returns:
true if this device has high/low trip alarms

Implemented in OneWireContainer20, OneWireContainer30, and OneWireContainer41.

void setADAlarm ( int  channel,
int  alarmType,
double  alarm,
byte[]  state 
) throws OneWireException

Sets the voltage value of the specified alarm on the specified 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(). Also note that not all A/D devices have alarms. Check to see if this device has alarms first by calling the hasADAlarms() method.

Parameters:
channelchannel number in the range [0 to (getNumberADChannels() - 1)]
alarmTypethe desired alarm, ALARM_HIGH or ALARM_LOW
alarmnew alarm value
statecurrent state of the device returned from readDevice()
Exceptions:
OneWireExceptionif this device does not have A/D alarms
See also:
com.dalsemi.onewire.container.OneWireSensor.writeDevice(byte[])
hasADAlarms()
getADAlarm(int,int,byte[])
getADAlarmEnable(int,int,byte[])
setADAlarmEnable(int,int,boolean,byte[])
hasADAlarmed(int,int,byte[])

Implemented in OneWireContainer20, OneWireContainer30, and OneWireContainer41.

void setADAlarmEnable ( int  channel,
int  alarmType,
boolean  alarmEnable,
byte[]  state 
) throws OneWireException

Enables or disables the specified alarm on the specified 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(). Also note that not all A/D devices have alarms. Check to see if this device has alarms first by calling the hasADAlarms() method.

Parameters:
channelchannel number in the range [0 to (getNumberADChannels() - 1)]
alarmTypethe desired alarm, ALARM_HIGH or ALARM_LOW
alarmEnabletrue to enable the alarm, false to disable
statecurrent state of the device returned from readDevice()
Exceptions:
OneWireExceptionif this device does not have A/D alarms
See also:
com.dalsemi.onewire.container.OneWireSensor.writeDevice(byte[])
hasADAlarms()
getADAlarm(int,int,byte[])
setADAlarm(int,int,double,byte[])
getADAlarmEnable(int,int,byte[])
hasADAlarmed(int,int,byte[])

Implemented in OneWireContainer20, OneWireContainer30, and OneWireContainer41.

void setADRange ( int  channel,
double  range,
byte[]  state 
)

Sets the input range for the specified 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(). Also note that not all A/D devices have alarms. Check to see if this device has alarms first by calling the hasADAlarms() method.

Parameters:
channelchannel number in the range [0 to (getNumberADChannels() - 1)]
rangeone of the ranges returned by getADRanges(int)
statecurrent state of the device returned from readDevice()
See also:
getADRanges(int)
getADRange(int,byte[])

Implemented in OneWireContainer20, OneWireContainer30, and OneWireContainer41.

void setADResolution ( int  channel,
double  resolution,
byte[]  state 
)

Sets the conversion resolution value for the specified 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(). Also note that not all A/D devices have alarms. Check to see if this device has alarms first by calling the hasADAlarms() method.

Parameters:
channelchannel number in the range [0 to (getNumberADChannels() - 1)]
resolutionone of the resolutions returned by getADResolutions(int,double)
statecurrent state of the device returned from readDevice()
See also:
getADResolutions(int,double)
getADResolution(int,byte[])

Implemented in OneWireContainer20, OneWireContainer30, and OneWireContainer41.


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