com.dalsemi.onewire.container
Interface ADContainer

All Superinterfaces:
OneWireSensor
All Known Implementing Classes:
OneWireContainer30, OneWireContainer20, OneWireContainer26

public interface ADContainer
extends OneWireSensor

1-Wire A/D interface class for basic analog measuring operations. This class should be implemented for each A/D type 1-Wire device.

Version:
0.00, 27 August 2000

Field Summary
static int ALARM_HIGH
          High alarm
static int ALARM_LOW
          Low Alarm
 
Method Summary
 boolean canADMultiChannelRead()
          Query to see if this A/D supports doing multiple voltage conversions at the same time.
 void doADConvert(boolean[] doConvert, byte[] state)
          This method is used to perform voltage conversion on all specified channels.
 void doADConvert(int channel, byte[] state)
          This method is used to perform voltage conversion on all specified channels.
 double getADAlarm(int channel, int alarmType, byte[] state)
          This method is used to extract the alarm voltage value of the specified channel from the provided state buffer.
 boolean getADAlarmEnable(int channel, int alarmType, byte[] state)
          This method is used to extract the alarm enable value of the specified channel from the provided state buffer.
 double getADRange(int channel, byte[] state)
          This method is used to extract the input voltage range of the specified channel from the provided state buffer.
 double[] getADRanges(int channel)
          Query to get an array of available ranges for the specified A/D channel.
 double getADResolution(int channel, byte[] state)
          This method is used to extract the conversion resolution of the specified channel from the provided state buffer expressed in volts.
 double[] getADResolutions(int channel, double range)
          Query to get an array of available resolutions based on the specified range on the specified A/D channel.
 double[] getADVoltage(byte[] state)
          This method is used to read the voltage values.
 double getADVoltage(int channel, byte[] state)
          This method is used to read a channels voltage value.
 int getNumberADChannels()
          Query to get the number of channels supported by this A/D.
 boolean hasADAlarmed(int channel, int alarmType, byte[] state)
          This method is used to check the alarm event value of the specified channel from the provided state buffer.
 boolean hasADAlarms()
          Query to see if this A/D measuring device has high/low alarms.
 void setADAlarm(int channel, int alarmType, double alarm, byte[] state)
          This method is used to set the alarm voltage value of the specified channel in the provided state buffer.
 void setADAlarmEnable(int channel, int alarmType, boolean alarmEnable, byte[] state)
          This method is used to set the alarm enable value of the specified channel in the provided state buffer.
 void setADRange(int channel, double range, byte[] state)
          This method is used to set the input range for the specified channel in the provided state buffer.
 void setADResolution(int channel, double resolution, byte[] state)
          This method is used to set the conversion resolution value for the specified channel in the provided state buffer.
 
Methods inherited from interface com.dalsemi.onewire.container.OneWireSensor
readDevice, writeDevice
 

Field Detail

ALARM_HIGH

public static final int ALARM_HIGH
High alarm

ALARM_LOW

public static final int ALARM_LOW
Low Alarm
Method Detail

getNumberADChannels

public int getNumberADChannels()
Query to get the number of channels supported by this A/D. Channel specific methods will use a channel number specified by an integer from [0 to (getNumberChannels() - 1)].
Returns:
int containing the number of channels

hasADAlarms

public boolean hasADAlarms()
Query to see if this A/D measuring device has high/low alarms.
Returns:
boolean, true if has high/low trips

getADRanges

public double[] getADRanges(int channel)
Query to get an array of available ranges for the specified A/D channel.
Parameters:
channel - - integer specifying channel in the range [0 to (getNumberChannels() - 1)].
Returns:
array of double indicated the available ranges starting from the largest range to the smallest range.

getADResolutions

public double[] getADResolutions(int channel,
                                 double range)
Query to get an array of available resolutions based on the specified range on the specified A/D channel.
Parameters:
channel - - integer specifying channel in the range [0 to (getNumberChannels() - 1)].
range -  
Returns:
array of double, indicated the available resolutions

canADMultiChannelRead

public boolean canADMultiChannelRead()
Query to see if this A/D supports doing multiple voltage conversions at the same time.
Returns:
boolean, true if can do multi-channel voltage reads.

doADConvert

public void doADConvert(int channel,
                        byte[] state)
                 throws OneWireIOException,
                        OneWireException
This method is used to perform voltage conversion on all specified channels. The method 'getVoltage()' can be used to read the result of the conversion.
Parameters:
channel - - integer specifying channel in the range [0 to (getNumberChannels() - 1)].
state - - byte array of the current state of the device returned from 'readDevice()'.
Throws:
OneWireIOException -  
OneWireException -  

doADConvert

public void doADConvert(boolean[] doConvert,
                        byte[] state)
                 throws OneWireIOException,
                        OneWireException
This method is used to perform voltage conversion on all specified channels. The method 'getVoltage()' can be used to read the result of the conversion. This A/D must support multi-channel read 'canMultiChannelRead()' if there are more then 1 channel is specified.
Parameters:
doConvert - - boolean array representing which channels to perform conversion on.
state - - byte array of the current state of the device returned from 'readDevice()'.
Throws:
OneWireIOException -  
OneWireException -  

getADVoltage

public double[] getADVoltage(byte[] state)
                      throws OneWireIOException,
                             OneWireException
This method is used to read the voltage values. Must be used after a 'doADConvert()' method call. Also must include the last valid state from the 'readDevice()' method and this A/D must support multi-channel read 'canMultiChannelRead()' if there are more then 1 channel.
Parameters:
state - - byte array of the current state of the device returned from 'readDevice()'.
Returns:
- double[] representing the voltage values for all channels
Throws:
OneWireIOException -  
OneWireException -  

getADVoltage

public double getADVoltage(int channel,
                           byte[] state)
                    throws OneWireIOException,
                           OneWireException
This method is used to read a channels voltage value. Must be used after a 'doADConvert()' method call. Also must include the last valid state from the 'readDevice()' method. Note, if more then one channel is to be read then it is more efficient to use the 'getVoltage()' method that returns all channel values.
Parameters:
channel - - integer specifying channel in the range [0 to (getNumberChannels() - 1)].
state - - byte array of the current state of the device returned from 'readDevice()'.
Returns:
- double representing the voltage value for the specified channel
Throws:
OneWireIOException -  
OneWireException -  

getADAlarm

public double getADAlarm(int channel,
                         int alarmType,
                         byte[] state)
                  throws OneWireException
This method is used to extract the alarm voltage value of the specified channel from the provided state buffer. The state buffer is retrieved from the 'readDevice()' method.
Parameters:
channel - - integer specifying channel in the range [0 to (getNumberChannels() - 1)].
alarmType - - int, representing the desired alarm, ALARM_HIGH (1) or ALARM_LOW (0)
state - - byte array of the current state of the device returned from 'readDevice()'.
Returns:
- double representing the alarm_value in volts

getADAlarmEnable

public boolean getADAlarmEnable(int channel,
                                int alarmType,
                                byte[] state)
                         throws OneWireException
This method is used to extract the alarm enable value of the specified channel from the provided state buffer. The state buffer is retrieved from the 'readDevice()' method.
Parameters:
channel - - integer specifying channel in the range [0 to (getNumberChannels() - 1)].
alarmType - - int, representing the desired alarm, ALARM_HIGH (1) or ALARM_LOW (0)
state - - byte array of the current state of the state returned from 'readDevice()'.
Returns:
- boolean, true if specified alarm is enabled

hasADAlarmed

public boolean hasADAlarmed(int channel,
                            int alarmType,
                            byte[] state)
                     throws OneWireException
This method is used to check the alarm event value of the specified channel from the provided state buffer. The state buffer is retrieved from the 'readDevice()' method.
Parameters:
channel - - integer specifying channel in the range [0 to (getNumberChannels() - 1)].
alarmType - - int, representing the desired alarm, ALARM_HIGH (1) or ALARM_LOW (0)
state - - byte array of the current state of the state returned from 'readDevice()'.
Returns:
- boolean, true if specified alarm occurred

getADResolution

public double getADResolution(int channel,
                              byte[] state)
This method is used to extract the conversion resolution of the specified channel from the provided state buffer expressed in volts. The state is retrieved from the 'readDevice()' method.
Parameters:
channel - - integer specifying channel in the range [0 to (getNumberChannels() - 1)].
state - - byte array of the current state of the state returned from 'readDevice()'.
Returns:
- double, resolution of channel in volts

getADRange

public double getADRange(int channel,
                         byte[] state)
This method is used to extract the input voltage range of the specified channel from the provided state buffer. The state buffer is retrieved from the 'readDevice()' method.
Parameters:
channel - - integer specifying channel in the range [0 to (getNumberChannels() - 1)].
state - - byte array of the current state of the state returned from 'readDevice()'.
Returns:
- double representing the input voltage range

setADAlarm

public void setADAlarm(int channel,
                       int alarmType,
                       double alarm,
                       byte[] state)
                throws OneWireException
This method is used to set the alarm voltage value of the specified channel in the provided state buffer. The state buffer is retrieved from the 'readDevice()' method. The method 'writeDevice()' must be called to finalize these changes to the device. Note that multiple 'set' methods can be called before one call to 'writeDevice()'.
Parameters:
channel - - integer specifying channel in the range [0 to (getNumberChannels() - 1)].
alarmType - - int, representing the desired alarm, ALARM_HIGH (1) or ALARM_LOW (0)
alarm - - double, alarm value (will be reduced to 8 bit resolution).
state - - byte array of the current state of the device returned from 'readDevice()'.

setADAlarmEnable

public void setADAlarmEnable(int channel,
                             int alarmType,
                             boolean alarmEnable,
                             byte[] state)
                      throws OneWireException
This method is used to set the alarm enable value of the specified channel in the provided state buffer. The state buffer is retrieved from the 'readDevice()' method. The method 'writeDevice()' must be called to finalize these changes to the device. Note that multiple 'set' methods can be called before one call to 'writeDevice()'.
Parameters:
channel - - integer specifying channel in the range [0 to (getNumberChannels() - 1)].
alarmType - - int, representing the desired alarm, ALARM_HIGH (1) or ALARM_LOW (0)
alarmEnable - - boolean, alarm enable value
state - - byte array of the current state of the device returned from 'readDevice()'.

setADResolution

public void setADResolution(int channel,
                            double resolution,
                            byte[] state)
This method is used to set the conversion resolution value for the specified channel in the provided state buffer. The state buffer is retrieved from the 'readDevice()' method. The method 'writeDevice()' must be called to finalize these changes to the device. Note that multiple 'set' methods can be called before one call to 'writeDevice()'.
Parameters:
channel - - integer specifying channel in the range [0 to (getNumberChannels() - 1)].
resolution - - double, resolution to use in volts
state - - byte array of the current state of the device returned from 'readDevice()'.

setADRange

public void setADRange(int channel,
                       double range,
                       byte[] state)
This method is used to set the input range for the specified channel in the provided state buffer. The state buffer is retrieved from the 'readDevice()' method. The method 'writeDevice()' must be called to finalize these changes to the device. Note that multiple 'set' methods can be called before one call to 'writeDevice()'.
Parameters:
channel - - integer specifying channel in the range [0 to (getNumberChannels() - 1)].
range - - double, representing the max volt range, use 'getRanges()' method to get available ranges
state - - byte array of the current state of the device returned from 'readDevice()'.