com.dalsemi.onewire.container
Class OneWireContainer30

java.lang.Object
  |
  +--com.dalsemi.onewire.container.OneWireContainer
        |
        +--com.dalsemi.onewire.container.OneWireContainer30
All Implemented Interfaces:
ADContainer, OneWireSensor, TemperatureContainer

public class OneWireContainer30
extends OneWireContainer
implements ADContainer, TemperatureContainer

The DS2760 1-Cell Li-Ion Battery Monitor is a data acquisition, information storage, and safety protection device tailored for cost-sensitive battery pack applications. This low-power device integrates precise temperature, voltage, and current measurement, nonvolatile data storage, and Li-Ion protection into the small footprint of either a TSSOP package or flip-chip. The DS2760 is a key component in applications including adaptive charging, remaining capacity estimation, safety monitoring, and battery-specific data storage.

Version:
0.00, 28 Aug 2000

Field Summary
static byte CC_PIN_STATE_FLAG
          PROTECTION REGISTER FLAG: Mirrors the !CC output pin.
static byte CHARGE_ENABLE_FLAG
          PROTECTION REGISTER FLAG: Reseting this flag will disable charging regardless of cell or pack conditions.
static byte CHARGE_OVERCURRENT_FLAG
          PROTECTION REGISTER FLAG: When this flag is true the battery has experienced a charge-direction overcurrent condition.
static byte DC_PIN_STATE_FLAG
          PROTECTION REGISTER FLAG: Mirrors the !DC output pin.
static byte DISCHARGE_ENABLE_FLAG
          PROTECTION REGISTER FLAG: Reseting this flag will disable discharging.
static byte DISCHARGE_OVERCURRENT_FLAG
          PROTECTION REGISTER FLAG: When this flag is true the battery has experienced a discharge-direction overcurrent condition.
static byte EEPROM_BLOCK_0_LOCK_FLAG
          EEPROM REGISTER FLAG: When this flag is true, Block 0 of the EEPROM (addresses 32-47) is read-only.
static byte EEPROM_BLOCK_1_LOCK_FLAG
          EEPROM REGISTER FLAG: When this flag is true, Block 1 of the EEPROM (addresses 48-63) is read-only.
static byte EEPROM_COPY_FLAG
          EEPROM REGISTER FLAG: This flag will be true if the Copy Data Command is in progress.
static byte EEPROM_LOCK_ENABLE_FLAG
          EEPROM REGISTER FLAG: When this flag is true, the Lock Command is enabled.
static byte EEPROM_REGISTER
          Address of the EEPROM Register.
static byte OVERVOLTAGE_FLAG
          PROTECTION REGISTER FLAG: When this flag is true, it indicates that the battery pack has experienced an overvoltage condition.
static byte PIO_PIN_SENSE_AND_CONTROL_FLAG
          SPECIAL FEATURE REGISTER FLAG: Mirrors/sets the state of the PIO pin.
static byte PROTECTION_REGISTER
          Address of the Protection Register.
static byte PS_PIN_STATE_FLAG
          SPECIAL FEATURE REGISTER FLAG: Mirrors the state of the !PS pin.
static byte READ_NET_ADDRESS_OPCODE_FLAG
          STATUS REGISTER FLAG: If set, the opcode for the Read Net Address command will be set to 33h.
static byte SLEEP_MODE_ENABLE_FLAG
          STATUS REGISTER FLAG: Enables/disables the DS2760 to enter sleep mode when the DQ line goes low for greater than 2 seconds.
static byte SPECIAL_FEATURE_REGISTER
          Address of the Special Feature Register.
static byte STATUS_REGISTER
          Address of the Status Register.
static byte UNDERVOLTAGE_FLAG
          PROTECTION REGISTER FLAG: When this flag is true, the battery pack has experienced an undervoltage.
 
Fields inherited from interface com.dalsemi.onewire.container.ADContainer
ALARM_HIGH, ALARM_LOW
 
Fields inherited from interface com.dalsemi.onewire.container.TemperatureContainer
ALARM_HIGH, ALARM_LOW
 
Constructor Summary
OneWireContainer30()
          Default constructor
OneWireContainer30(DSPortAdapter sourceAdapter, byte[] newAddress)
          Create a container with a provided adapter object and the address of the iButton or 1-Wire device.
OneWireContainer30(DSPortAdapter sourceAdapter, long newAddress)
          Create a container with a provided adapter object and the address of the iButton or 1-Wire device.
OneWireContainer30(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
 boolean canADMultiChannelRead()
          Query to see if this A/D supports doing multiple voltage conversions at the same time.
 void clearConditions()
          Clears the overvoltage, undervoltage, charge overcurrent, and discharge overcurrent flags.
 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.
 void doTemperatureConvert(byte[] state)
          Perform an temperature conversion.
 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.
 java.lang.String getAlternateNames()
          Return the alternate Dallas Semiconductor part number or name.
 double getCurrent(byte[] state)
          Get the instantaneous current.
 java.lang.String getDescription()
          Return a short description of the function of the iButton type.
 boolean getFlag(int memAddr, byte flagToGet)
          Checks the specified flag in the specified registor.
 boolean getLatchState()
          Returns the latch state of the Programmable Input/Ouput pin on the DS2760.
 double getMaxTemperature()
          Query to get the maximum temperature in degrees C.
 double getMinTemperature()
          Query to get the minimum temperature in degrees C.
 java.lang.String getName()
          Returns the Dallas Semiconductor part number of the iButton as a string.
 int getNumberADChannels()
          Query to get the number of channels supported by this A/D.
 double getRemainingCapacity(byte[] state)
          Calculate the remaining capacity in mAHours from the current Accumulator.
 double getTemperature(byte[] state)
          This method extracts the Temperature Value in degrees C from the state data retrieved from the 'readDevice()' method.
 double getTemperatureAlarm(int alarmType, byte[] state)
          This method extracts the specified Alarm value in degrees C from the state data retrieved from the 'readDevice()' method.
 double getTemperatureAlarmResolution()
          Query to get the high/low resolution in degrees C.
 double getTemperatureResolution(byte[] state)
          This method extracts the current resolution in degrees C from the state data retrieved from the 'readDevice()' method.
 double[] getTemperatureResolutions()
          Query to get an array of available resolutions in degrees C.
 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.
 boolean hasSelectableTemperatureResolution()
          Query to see if this device has selectable resolution.
 boolean hasTemperatureAlarms()
          Query to see if this temperature measuring device has high/low trip alarms.
 void lockBlock(int blockNumber)
          Permanently write-protects one of the user blocks of EEPROM.
 byte readByte(int memAddr)
          Read a register byte from the memory of the DS2760.
 void readBytes(int memAddr, byte[] buffer, int start, int len)
          Reads bytes from the DS2760.
 byte[] readDevice()
          This method retrieves the 1-Wire device sensor state.
 byte[] readEEPROMBlock(int blockNumber)
          Read a 16 byte data block from one of the user EEPROM blocks.
 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.
 void setFlag(int memAddr, byte flagToSet, boolean flagValue)
          Set one of the flags in one of the registers.
 void setLatchState(boolean on)
          Sets the state for the Programmable Input/Output pin.
 void setRemainingCapacity(double remainingCapacity)
          Allows user to set the remaining capacity.
 void setResistorExternal(double Rsens)
          Set the DS2760 to use an external, user-selectable resistance.
 void setResistorInternal()
          Set the DS2760 to use its internal .025 ohm resistor for measurements.
 void setTemperatureAlarm(int alarmType, double alarmValue, byte[] state)
          This method sets the alarm value in degrees C in the provided state data.
 void setTemperatureResolution(double resolution, byte[] state)
          This method sets the current resolution in degrees C in the provided state data.
 void writeByte(int memAddr, byte data)
          Write a register byte to the memory of the DS2760.
 void writeDevice(byte[] state)
          This method write the 1-Wire device sensor state that have been changed by the 'set' methods.
 void writeEEPROMBlock(int blockNumber, byte[] data)
          Write a 16 byte data block to one of the user blocks.
 
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

PROTECTION_REGISTER

public static final byte PROTECTION_REGISTER
Address of the Protection Register. Used to set/check flags with setFlag/getFlag.

STATUS_REGISTER

public static final byte STATUS_REGISTER
Address of the Status Register. Used to set/check flags with setFlag/getFlag.

EEPROM_REGISTER

public static final byte EEPROM_REGISTER
Address of the EEPROM Register. Used to set/check flags with setFlag/getFlag.

SPECIAL_FEATURE_REGISTER

public static final byte SPECIAL_FEATURE_REGISTER
Address of the Special Feature Register. Used to check flags with getFlag.

OVERVOLTAGE_FLAG

public static final byte OVERVOLTAGE_FLAG
PROTECTION REGISTER FLAG: When this flag is true, it indicates that the battery pack has experienced an overvoltage condition. This flag must be reset! Accessed with getFlag().

UNDERVOLTAGE_FLAG

public static final byte UNDERVOLTAGE_FLAG
PROTECTION REGISTER FLAG: When this flag is true, the battery pack has experienced an undervoltage. This flag must be reset! Accessed with getFlag()

CHARGE_OVERCURRENT_FLAG

public static final byte CHARGE_OVERCURRENT_FLAG
PROTECTION REGISTER FLAG: When this flag is true the battery has experienced a charge-direction overcurrent condition. This flag must be reset! Accessed with getFlag()

DISCHARGE_OVERCURRENT_FLAG

public static final byte DISCHARGE_OVERCURRENT_FLAG
PROTECTION REGISTER FLAG: When this flag is true the battery has experienced a discharge-direction overcurrent condition. This flag must be reset()! Accessed with getFlag()

CC_PIN_STATE_FLAG

public static final byte CC_PIN_STATE_FLAG
PROTECTION REGISTER FLAG: Mirrors the !CC output pin. Accessed with getFlag()

DC_PIN_STATE_FLAG

public static final byte DC_PIN_STATE_FLAG
PROTECTION REGISTER FLAG: Mirrors the !DC output pin. Accessed with getFlag()

CHARGE_ENABLE_FLAG

public static final byte CHARGE_ENABLE_FLAG
PROTECTION REGISTER FLAG: Reseting this flag will disable charging regardless of cell or pack conditions. Accessed with getFlag/setFlag.

DISCHARGE_ENABLE_FLAG

public static final byte DISCHARGE_ENABLE_FLAG
PROTECTION REGISTER FLAG: Reseting this flag will disable discharging. Accessed with getFlag/setFlag.

SLEEP_MODE_ENABLE_FLAG

public static final byte SLEEP_MODE_ENABLE_FLAG
STATUS REGISTER FLAG: Enables/disables the DS2760 to enter sleep mode when the DQ line goes low for greater than 2 seconds. Accessed with getFlag/setFlag.

READ_NET_ADDRESS_OPCODE_FLAG

public static final byte READ_NET_ADDRESS_OPCODE_FLAG
STATUS REGISTER FLAG: If set, the opcode for the Read Net Address command will be set to 33h. If it is not set the opcode is set to 39h. Accessed with getFlag/setFlag.

EEPROM_COPY_FLAG

public static final byte EEPROM_COPY_FLAG
EEPROM REGISTER FLAG: This flag will be true if the Copy Data Command is in progress. Data may be written to EEPROM when this reads false. Accessed with getFlag/setFlag.

EEPROM_LOCK_ENABLE_FLAG

public static final byte EEPROM_LOCK_ENABLE_FLAG
EEPROM REGISTER FLAG: When this flag is true, the Lock Command is enabled. The lock command is used to make memory permanently read only. Accessed with getFlag/setFlag.

EEPROM_BLOCK_1_LOCK_FLAG

public static final byte EEPROM_BLOCK_1_LOCK_FLAG
EEPROM REGISTER FLAG: When this flag is true, Block 1 of the EEPROM (addresses 48-63) is read-only. Accessed with getFlag().

EEPROM_BLOCK_0_LOCK_FLAG

public static final byte EEPROM_BLOCK_0_LOCK_FLAG
EEPROM REGISTER FLAG: When this flag is true, Block 0 of the EEPROM (addresses 32-47) is read-only. Accessed with getFlag().

PS_PIN_STATE_FLAG

public static final byte PS_PIN_STATE_FLAG
SPECIAL FEATURE REGISTER FLAG: Mirrors the state of the !PS pin. Accessed with getFlag().

PIO_PIN_SENSE_AND_CONTROL_FLAG

public static final byte PIO_PIN_SENSE_AND_CONTROL_FLAG
SPECIAL FEATURE REGISTER FLAG: Mirrors/sets the state of the PIO pin. The PIO pin can be used as an output; resetting this flag disables the PIO output driver. Accessed with getFlag/setFlag.
Constructor Detail

OneWireContainer30

public OneWireContainer30()
Default constructor

OneWireContainer30

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

OneWireContainer30

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

OneWireContainer30

public OneWireContainer30(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()
Returns the Dallas Semiconductor part number of the iButton as a string.
Overrides:
getName in class OneWireContainer
Returns:
String representation of the iButton name

getAlternateNames

public java.lang.String getAlternateNames()
Return the alternate Dallas Semiconductor part number or name. ie. Smart Battery Monitor
Overrides:
getAlternateNames in class OneWireContainer
Returns:
String representation of the alternate names.

getDescription

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

setResistorInternal

public void setResistorInternal()
Set the DS2760 to use its internal .025 ohm resistor for measurements. This should only be enabled if there is NO external resistor physically attached to the device.

setResistorExternal

public void setResistorExternal(double Rsens)
Set the DS2760 to use an external, user-selectable resistance. This Resistance should be wired directly to the VSS (negative terminal of the cell).
Parameters:
double - represents the resistance in ohms.

readByte

public byte readByte(int memAddr)
              throws OneWireIOException,
                     OneWireException
Read a register byte from the memory of the DS2760. Note that there is no error checking as the DS2760 performs no CRC on the data.

Note: This function should only be used when reading the register memory of the 2760. The EEPROM blocks (addresses 32-64) should be accessed with writeBlock/readBlock.

Parameters:
memAddr - the address to read (0-255)
Returns:
byte holding the data read from memory.
Throws:
OneWireIOException - Error reading data [ recoverable ]
OneWireException - Could not find part [ fatal ]

readBytes

public void readBytes(int memAddr,
                      byte[] buffer,
                      int start,
                      int len)
               throws OneWireIOException,
                      OneWireException
Reads bytes from the DS2760. Note that there is no error-checking as the DS2760 does not perform a CRC on the data.

Note: This function should only be used when reading the register memory of the 2760. The EEPROM blocks (addresses 32-64) should be accessed with writeBlock/readBlock.

Parameters:
memAddr - the address to read (0-255)
buffer -  
start -  
len -  
Returns:
byte holding the data read from memory.
Throws:
OneWireIOException - Error reading data [ recoverable ]
OneWireException - Could not find part [ fatal ]

writeByte

public void writeByte(int memAddr,
                      byte data)
               throws OneWireIOException,
                      OneWireException
Write a register byte to the memory of the DS2760. Note that the DS2760 does not make any use of cyclic redundancy checks (error-checking). To ensure error free transmission, double check your write's.

Note: This method should only be used when writing to the register memory of the 2760. The EEPROM blocks (addresses 32-64) require special treatment and thus the writeBlock/readBlock functions should be used for those.

Parameters:
memAddr - the address to write (0-255).
data - the data byte to write to memory.
Throws:
OneWireIOException - Error writing data [ recoverable ]
OneWireException - Could not find part [ fatal ]

readEEPROMBlock

public byte[] readEEPROMBlock(int blockNumber)
                       throws OneWireIOException,
                              OneWireException
Read a 16 byte data block from one of the user EEPROM blocks. Note that there is no error-checking as the DS2760 performs no CRCs.
Parameters:
blockNumber - the EEPROM block number to read.

Acceptable parameters are 0 and 1.

Returns:
byte[] holding the 16 data bytes.
Throws:
OneWireIOException - Error reading data [ recoverable ]
OneWireException - Could not find part [ fatal ]

writeEEPROMBlock

public void writeEEPROMBlock(int blockNumber,
                             byte[] data)
                      throws OneWireIOException,
                             OneWireException
Write a 16 byte data block to one of the user blocks. The block may be rewritten at any time, except after it is locked with lockBlock(). This method performs error checking by verifying data written.
Parameters:
blockNumber - the block to write to.

Acceptable parameters are 0 and 1.

data - the 16 bytes of data to write.
Throws:
OneWireIOException - Error writing data [ recoverable ]
OneWireException - Could not find part [ fatal ]

lockBlock

public void lockBlock(int blockNumber)
               throws OneWireIOException,
                      OneWireException
Permanently write-protects one of the user blocks of EEPROM.
Parameters:
blockNumber - block number to permanently write protect.

Acceptable parameters are 0 and 1.

Throws:
OneWireIOException - Error locking block [ recoverable ]
OneWireException - Could not find part [ fatal ]

getFlag

public boolean getFlag(int memAddr,
                       byte flagToGet)
                throws OneWireIOException,
                       OneWireException
Checks the specified flag in the specified registor.

Valid registors are: PROTECTION_REGISTER, STATUS_REGISTER, EEPROM_REGISTER and SPECIAL_FEATURE_REGISTER.

Parameters:
memAddr - the registers address. Pre-defined fields for each register are defined above.
flagToGet - bitmask of desired flag. The acceptable parameters pertaining to each register are defined as constant fields above.
Returns:
Value of the flag: True if flag is set (==1)
Throws:
OneWireIOException - Error reading data [ recoverable ]
OneWireException - Could not find part [ fatal ]

setFlag

public void setFlag(int memAddr,
                    byte flagToSet,
                    boolean flagValue)
             throws OneWireIOException,
                    OneWireException
Set one of the flags in one of the registers.

Valid registers are: PROTECTION_REGISTER, STATUS_REGISTER, EEPROM_REGISTER and the infamous SPECIAL_FEATURE_REGISTER.

Parameters:
memAddr - the register address. These addresses are predefined above.
flagToSet - bitmask of flag to set. Valid parameters pertaining to each register are defined as constant fields above.
flagValue - status to set the flag at.
Throws:
OneWireIOException - Error setting flag [ recoverable ]
OneWireException - Could not find part [ fatal ]

getCurrent

public double getCurrent(byte[] state)
                  throws OneWireIOException,
                         OneWireException
Get the instantaneous current.
Parameters:
state -  
Returns:
double containing the current in Amperes.
Throws:
OneWireIOException - Error reading data [ recoverable ]
OneWireException - Could not find part [ fatal ]

setRemainingCapacity

public void setRemainingCapacity(double remainingCapacity)
                          throws OneWireIOException,
                                 OneWireException
Allows user to set the remaining capacity. Good for accurate capacity measurements using temperature and battery life.

By measuring your battery's current and voltage when it is fully charged and when it is empty, you can figure out the voltage corresponding to an empty battery and the current corresponding to a full one. These values can be detected in your program and the remaining capacity can be set to the empty/full levels accordingly for nice accuracy.

Parameters:
remainingCapacity - the remaining capacity IN mAHrs.
Throws:
OneWireIOException - Error reading data [ recoverable ]
OneWireException - Could not find part [ fatal ]

getRemainingCapacity

public double getRemainingCapacity(byte[] state)
                            throws OneWireIOException,
                                   OneWireException
Calculate the remaining capacity in mAHours from the current Accumulator. Accurate to +-.25 mAmp-hours.
Parameters:
state -  
Returns:
double containing the mAHours of battery capacity remaining.
Throws:
OneWireIOException - Error reading data [ recoverable ]
OneWireException - Could not find part [ fatal ]

setLatchState

public void setLatchState(boolean on)
                   throws OneWireIOException,
                          OneWireException
Sets the state for the Programmable Input/Output pin. In order to operate as a switch, PIO must be tied to a pull-up resistor to VDD.
Parameters:
on - State of the PIO pin to set
Throws:
OneWireIOException -  
OneWireException -  

getLatchState

public boolean getLatchState()
                      throws OneWireIOException,
                             OneWireException
Returns the latch state of the Programmable Input/Ouput pin on the DS2760.
Returns:
Latch state of the Programmable Input/Ouput pin
Throws:
OneWireIOException -  
OneWireException -  

clearConditions

public void clearConditions()
                     throws OneWireIOException,
                            OneWireException
Clears the overvoltage, undervoltage, charge overcurrent, and discharge overcurrent flags. Each time a violation occurs, these flags stay set until reset. This method resets all 4 flags.
Throws:
OneWireIOException -  
OneWireException -  

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)].
Specified by:
getNumberADChannels in interface ADContainer
Returns:
int containing the number of channels

hasADAlarms

public boolean hasADAlarms()
Query to see if this A/D measuring device has high/low alarms.
Specified by:
hasADAlarms in interface ADContainer
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.
Specified by:
getADRanges in interface ADContainer
Parameters:
channel - - integer specifying channel in the range [0 to (getNumberChannels() - 1)].
Returns:
array of double indicated the available ranges.

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.
Specified by:
getADResolutions in interface ADContainer
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.
Specified by:
canADMultiChannelRead in interface ADContainer
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.
Specified by:
doADConvert in interface ADContainer
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.
Specified by:
doADConvert in interface ADContainer
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.
Specified by:
getADVoltage in interface ADContainer
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.
Specified by:
getADVoltage in interface ADContainer
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.
Specified by:
getADAlarm in interface ADContainer
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.
Specified by:
getADAlarmEnable in interface ADContainer
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.
Specified by:
hasADAlarmed in interface ADContainer
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.
Specified by:
getADResolution in interface ADContainer
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.
Specified by:
getADRange in interface ADContainer
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()'.
Specified by:
setADAlarm in interface ADContainer
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()'.
Specified by:
setADAlarmEnable in interface ADContainer
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()'.
Specified by:
setADResolution in interface ADContainer
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()'.
Specified by:
setADRange in interface ADContainer
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()'.

hasTemperatureAlarms

public boolean hasTemperatureAlarms()
Query to see if this temperature measuring device has high/low trip alarms.
Specified by:
hasTemperatureAlarms in interface TemperatureContainer
Returns:
boolean, true if has high/low trip alarms

hasSelectableTemperatureResolution

public boolean hasSelectableTemperatureResolution()
Query to see if this device has selectable resolution.
Specified by:
hasSelectableTemperatureResolution in interface TemperatureContainer
Returns:
boolean, true if has selectable resolution

getTemperatureResolutions

public double[] getTemperatureResolutions()
Query to get an array of available resolutions in degrees C.
Specified by:
getTemperatureResolutions in interface TemperatureContainer
Returns:
double[], available of resolutions in degrees C

getTemperatureAlarmResolution

public double getTemperatureAlarmResolution()
                                     throws OneWireException
Query to get the high/low resolution in degrees C.
Specified by:
getTemperatureAlarmResolution in interface TemperatureContainer
Returns:
double, high/low resolution resolution in C

getMaxTemperature

public double getMaxTemperature()
Query to get the maximum temperature in degrees C.
Specified by:
getMaxTemperature in interface TemperatureContainer
Returns:
double, maximum temperature in C

getMinTemperature

public double getMinTemperature()
Query to get the minimum temperature in degrees C.
Specified by:
getMinTemperature in interface TemperatureContainer
Returns:
double, minimum temperature in C

doTemperatureConvert

public void doTemperatureConvert(byte[] state)
                          throws OneWireIOException,
                                 OneWireException
Perform an temperature conversion. Use this state information to calculate the conversion time.
Specified by:
doTemperatureConvert in interface TemperatureContainer
Parameters:
state - - byte array of device state
Throws:
OneWireIOException -  
OneWireException -  

getTemperature

public double getTemperature(byte[] state)
This method extracts the Temperature Value in degrees C from the state data retrieved from the 'readDevice()' method.
Specified by:
getTemperature in interface TemperatureContainer
Parameters:
state - - byte array of device state
Returns:
double, temperature in degrees C from the last 'doTemperature()'

getTemperatureAlarm

public double getTemperatureAlarm(int alarmType,
                                  byte[] state)
                           throws OneWireException
This method extracts the specified Alarm value in degrees C from the state data retrieved from the 'readDevice()' method.
Specified by:
getTemperatureAlarm in interface TemperatureContainer
Parameters:
alarmType - - integer, indicating trip type ALARM_HIGH (1) or ALARM_LOW (0)
state - - byte array of device state
Returns:
double, alarm trip temperature in degrees C

getTemperatureResolution

public double getTemperatureResolution(byte[] state)
This method extracts the current resolution in degrees C from the state data retrieved from the 'readDevice()' method.
Specified by:
getTemperatureResolution in interface TemperatureContainer
Parameters:
state - - byte array of device state
Returns:
double, temperature resolution in degrees C

setTemperatureAlarm

public void setTemperatureAlarm(int alarmType,
                                double alarmValue,
                                byte[] state)
                         throws OneWireException,
                                OneWireIOException
This method sets the alarm value in degrees C in the provided state data. Use the method 'writeDevice()' with this data to finalize the change to the device.
Specified by:
setTemperatureAlarm in interface TemperatureContainer
Parameters:
alarmType - - integer, indicating trip type ALARM_HIGH (1) or ALARM_LOW (0)
alarmValue - - double, high trip value in degrees C
state - - byte array of device state

setTemperatureResolution

public void setTemperatureResolution(double resolution,
                                     byte[] state)
                              throws OneWireException,
                                     OneWireIOException
This method sets the current resolution in degrees C in the provided state data. Use the method 'writeDevice()' with this data to finalize the change to the device.
Specified by:
setTemperatureResolution in interface TemperatureContainer
Parameters:
resolution - - double, temperature resolution in degrees C
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. With the DS2760, there are no CRC checks on data. To ensure the integrity of this data, call twice and make sure only fields expected to change have changed. This method returns bytes 0 to 31 of the memory. Many applications will not need to worry about the lack of CRC checks.
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 -