Dallas Semiconductor 1-Wire API 1.00 Alpha: Class OneWireContainer10

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.dalsemi.onewire.container
Class OneWireContainer10

    java.lang.Object
      |
      +--com.dalsemi.onewire.container.OneWireContainer
            |
            +--com.dalsemi.onewire.container.OneWireContainer10

All Implemented Interfaces:
  OneWireSensor, TemperatureContainer

public class OneWireContainer10
extends OneWireContainer
implements TemperatureContainer

1-Wire container for temperature iButton which measures temperatures from -55°C to +100°C, DS1920 or DS18S20. This container encapsulates the functionality of the iButton family type 10 (hex)

### Features

- Measures temperatures from -55°C to +100°C in typically 0.2 seconds
- Zero standby power
- 0.5°C resolution, digital temperature reading in two’s complement
- Increased resolution through interpolation in internal counters
- 8-bit device-generated CRC for data integrity
- Special command set allows user to skip ROM section and do temperature measurements simultaneously for all devices on the bus
- 2 bytes of EEPROM to be used either as alarm triggers or user memory
- Alarm search directly indicates which device senses alarming temperatures

### Usage

  See the usage example in `TemperatureContainer` for temperature specific operations.

### DataSheet

  http://pdfserv.maxim-ic.com/arpdf/DS1920.pdf
  http://pdfserv.maxim-ic.com/arpdf/DS18S20.pdf

Version:
  1.00, 1 Sep 2000
See Also:
  `TemperatureContainer`

Field Summary
`static double` | `RESOLUTION_MAXIMUM` maximum temperature resolution for this `OneWireContainer10` device.
`static double` | `RESOLUTION_NORMAL` default temperature resolution for this `OneWireContainer10` device.

Fields inherited from interface com.dalsemi.onewire.container.TemperatureContainer
`ALARM_HIGH, ALARM_LOW`

Constructor Summary
`OneWireContainer10()` Creates an empty `OneWireContainer10`.
`OneWireContainer10(DSPortAdapter sourceAdapter, byte[] newAddress)` Creates a `OneWireContainer10` with the provided adapter object and the address of this One-Wire device.
`OneWireContainer10(DSPortAdapter sourceAdapter, long newAddress)` Creates a `OneWireContainer10` with the provided adapter object and the address of this One-Wire device.
`OneWireContainer10(DSPortAdapter sourceAdapter, String newAddress)` Creates a `OneWireContainer10` with the provided adapter object and the address of this One-Wire device.

Method Summary
`static double` | `convertToCelsius(double fahrenheitTemperature)` Converts a temperature reading from Fahrenheit to Celsius.
`static double` | `convertToFahrenheit(double celsiusTemperature)` Converts a temperature reading from Celsius to Fahrenheit.
`void` | `doTemperatureConvert(byte[] state)` Performs a temperature conversion on `state` information.
`String` | `getAlternateNames()` Retrieves the alternate Dallas Semiconductor part numbers or names.
`String` | `getDescription()` Retrieves a short description of the function of this `OneWireContainer10` type.
`double` | `getMaxTemperature()` Gets the maximum temperature in Celsius.
`double` | `getMinTemperature()` Gets the minimum temperature in Celsius.
`String` | `getName()` Retrieves the Dallas Semiconductor part number of this `OneWireContainer10` as a `String`.
`double` | `getTemperature(byte[] state)` Gets the temperature value in Celsius from the `state` data retrieved from the `readDevice()` method.
`double` | `getTemperatureAlarm(int alarmType, byte[] state)` Gets the specified temperature alarm value in Celsius from the `state` data retrieved from the `readDevice()` method.
`double` | `getTemperatureAlarmResolution()` Gets the temperature alarm resolution in Celsius.
`double` | `getTemperatureResolution(byte[] state)` Gets the current temperature resolution in Celsius from the `state` data retrieved from the `readDevice()` method.
`double[]` | `getTemperatureResolutions()` Gets an array of available temperature resolutions in Celsius.
`boolean` | `hasSelectableTemperatureResolution()` Checks to see if this device has selectable temperature resolution.
`boolean` | `hasTemperatureAlarms()` Checks to see if this temperature measuring device has high/low trip alarms.
`byte[]` | `readDevice()` Retrieves this `OneWireContainer10` state information.
`void` | `setTemperatureAlarm(int alarmType, double alarmValue, byte[] state)` Sets the temperature alarm value in Celsius in the provided `state` data.
`void` | `setTemperatureResolution(double resolution, byte[] state)` Sets the current temperature resolution in Celsius in the provided `state` data.
`void` | `writeDevice(byte[] state)` Writes to this `OneWireContainer10` `state` information that have been changed by '`set`' methods.

Methods inherited from class com.dalsemi.onewire.container.OneWireContainer
`doSpeed, getAdapter, getAddress, getAddressAsLong, getAddressAsString, getMaxSpeed, getMemoryBanks, isAlarming, isPresent, setSpeed, setupContainer, setupContainer, setupContainer`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### RESOLUTION_NORMAL

    public static final double RESOLUTION_NORMAL

  default temperature resolution for this `OneWireContainer10` device.

### RESOLUTION_MAXIMUM

    public static final double RESOLUTION_MAXIMUM

  maximum temperature resolution for this `OneWireContainer10` device. Use `RESOLUTION_MAXIMUM` in `setResolution()` if higher resolution is desired.

Constructor Detail

### OneWireContainer10

    public OneWireContainer10()

  Creates an empty `OneWireContainer10`. Must call `setupContainer()` before using this new container.

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

  See Also:
    `OneWireContainer10(DSPortAdapter,byte[])`, `OneWireContainer10(DSPortAdapter,long)`, `OneWireContainer10(DSPortAdapter,String)`

### OneWireContainer10

    public OneWireContainer10(DSPortAdapter sourceAdapter,
                              byte[] newAddress)

  Creates a `OneWireContainer10` with the provided adapter object and the address of this One-Wire device. This is one of the methods to construct a `OneWireContainer10`. The others are through creating a `OneWireContainer10` with different parameters types.
  Parameters:
    `sourceAdapter` - adapter object required to communicate with this One-Wire device
    `newAddress` - address of this One-Wire device
  See Also:
    `Address`, `OneWireContainer10()`, `OneWireContainer10(DSPortAdapter,long)`, `OneWireContainer10(DSPortAdapter,String)`

### OneWireContainer10

    public OneWireContainer10(DSPortAdapter sourceAdapter,
                              long newAddress)

  Creates a `OneWireContainer10` with the provided adapter object and the address of this One-Wire device. This is one of the methods to construct a `OneWireContainer10`. The others are through creating a `OneWireContainer10` with different parameters types.
  Parameters:
    `sourceAdapter` - adapter object required to communicate with this One-Wire device
    `newAddress` - address of this One-Wire device
  See Also:
    `Address`, `OneWireContainer10()`, `OneWireContainer10(DSPortAdapter,byte[])`, `OneWireContainer10(DSPortAdapter,String)`

### OneWireContainer10

    public OneWireContainer10(DSPortAdapter sourceAdapter,
                              String newAddress)

  Creates a `OneWireContainer10` with the provided adapter object and the address of this One-Wire device. This is one of the methods to construct a `OneWireContainer10`. The others are through creating a `OneWireContainer10` with different parameters types.
  Parameters:
    `sourceAdapter` - adapter object required to communicate with this One-Wire device
    `newAddress` - address of this One-Wire device
  See Also:
    `Address`, `OneWireContainer10()`, `OneWireContainer10(DSPortAdapter,byte[])`, `OneWireContainer10(DSPortAdapter,long)`

Method Detail

### getName

    public String getName()

  Retrieves the Dallas Semiconductor part number of this `OneWireContainer10` as a `String`. For example 'DS1920'.
  Overrides:
    `getName` in class `OneWireContainer`
  Returns:
    this `OneWireContainer10` name

### getAlternateNames

    public String getAlternateNames()

  Retrieves the alternate Dallas Semiconductor 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'.
  Overrides:
    `getAlternateNames` in class `OneWireContainer`
  Returns:
    this `OneWireContainer10` alternate names

### getDescription

    public String getDescription()

  Retrieves a short description of the function of this `OneWireContainer10` type.
  Overrides:
    `getDescription` in class `OneWireContainer`
  Returns:
    `OneWireContainer10` functional description

### hasTemperatureAlarms

    public boolean hasTemperatureAlarms()

  Checks to see if this temperature measuring device has high/low trip alarms.
  Specified by:
    `hasTemperatureAlarms` in interface `TemperatureContainer`
  Returns:
    `true` if this `OneWireContainer10` has high/low trip alarms
  See Also:
    `getTemperatureAlarm(int, byte[])`, `setTemperatureAlarm(int, double, byte[])`

### hasSelectableTemperatureResolution

    public boolean hasSelectableTemperatureResolution()

  Checks to see if this device has selectable temperature resolution.
  Specified by:
    `hasSelectableTemperatureResolution` in interface `TemperatureContainer`
  Returns:
    `true` if this `OneWireContainer10` has selectable temperature resolution
  See Also:
    `getTemperatureResolution(byte[])`, `getTemperatureResolutions()`, `setTemperatureResolution(double, byte[])`

### getTemperatureResolutions

    public double[] getTemperatureResolutions()

  Gets an array of available temperature resolutions in Celsius.
  Specified by:
    `getTemperatureResolutions` in interface `TemperatureContainer`
  Returns:
    byte array of available temperature resolutions in Celsius for this `OneWireContainer10`. The minimum resolution is returned as the first element and maximum resolution as the last element.
  See Also:
    `hasSelectableTemperatureResolution()`, `getTemperatureResolution(byte[])`, `setTemperatureResolution(double, byte[])`

### getTemperatureAlarmResolution

    public double getTemperatureAlarmResolution()

  Gets the temperature alarm resolution in Celsius.
  Specified by:
    `getTemperatureAlarmResolution` in interface `TemperatureContainer`
  Returns:
    temperature alarm resolution in Celsius for this `OneWireContainer10`
  See Also:
    `hasTemperatureAlarms()`, `getTemperatureAlarm(int, byte[])`, `setTemperatureAlarm(int, double, byte[])`

### getMaxTemperature

    public double getMaxTemperature()

  Gets the maximum temperature in Celsius.
  Specified by:
    `getMaxTemperature` in interface `TemperatureContainer`
  Returns:
    maximum temperature in Celsius for this `OneWireContainer10`
  See Also:
    `getMinTemperature()`

### getMinTemperature

    public double getMinTemperature()

  Gets the minimum temperature in Celsius.
  Specified by:
    `getMinTemperature` in interface `TemperatureContainer`
  Returns:
    minimum temperature in Celsius for this `OneWireContainer10`
  See Also:
    `getMaxTemperature()`

### doTemperatureConvert

    public void doTemperatureConvert(byte[] state)
                              throws OneWireIOException,
                                     OneWireException

  Performs a temperature conversion on `state` information.
  Specified by:
    `doTemperatureConvert` in interface `TemperatureContainer`
  Parameters:
    `state` - byte array with device state information
  Throws:
    `OneWireIOException` - on a 1-Wire communication error such as reading an incorrect CRC from this `OneWireContainer10`. 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'.
    `OneWireException` - on a communication or setup error with the 1-Wire adapter
  See Also:
    `getTemperature(byte[])`

### getTemperature

    public double getTemperature(byte[] state)
                          throws OneWireIOException

  Gets the temperature value in Celsius from the `state` data retrieved from the `readDevice()` method.
  Specified by:
    `getTemperature` in interface `TemperatureContainer`
  Parameters:
    `state` - byte array with device state information for this `OneWireContainer10`
  Returns:
    temperature in Celsius from the last `doTemperatureConvert()`
  Throws:
    `OneWireIOException` - on a 1-Wire communication error such as reading an incorrect CRC from this `OneWireContainer10`. 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'.
  See Also:
    `doTemperatureConvert(byte[])`

### getTemperatureAlarm

    public double getTemperatureAlarm(int alarmType,
                                      byte[] state)

  Gets the specified temperature alarm value in Celsius from the `state` data retrieved from the `readDevice()` method.
  Specified by:
    `getTemperatureAlarm` in interface `TemperatureContainer`
  Parameters:
    `alarmType` - valid value: `ALARM_HIGH` or `ALARM_LOW`
    `state` - byte array with device state information
  Returns:
    temperature alarm trip values in Celsius for this `OneWireContainer10`
  See Also:
    `hasTemperatureAlarms()`, `setTemperatureAlarm(int, double, byte[])`

### getTemperatureResolution

    public double getTemperatureResolution(byte[] state)

  Gets the current temperature resolution in Celsius from the `state` data retrieved from the `readDevice()` method.
  Specified by:
    `getTemperatureResolution` in interface `TemperatureContainer`
  Parameters:
    `state` - byte array with device state information
  Returns:
    temperature resolution in Celsius for this `OneWireContainer10`
  See Also:
    `hasSelectableTemperatureResolution()`, `getTemperatureResolutions()`, `setTemperatureResolution(double, byte[])`

### setTemperatureAlarm

    public void setTemperatureAlarm(int alarmType,
                                    double alarmValue,
                                    byte[] state)

  Sets the temperature alarm value in Celsius 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` - valid value: `ALARM_HIGH` or `ALARM_LOW`
    `alarmValue` - alarm trip value in Celsius
    `state` - byte array with device state information
  See Also:
    `hasTemperatureAlarms()`, `getTemperatureAlarm(int, byte[])`

### setTemperatureResolution

    public void setTemperatureResolution(double resolution,
                                         byte[] state)

  Sets the current temperature resolution in Celsius 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` - temperature resolution in Celsius. Valid values are `RESOLUTION_NORMAL` and `RESOLUTION_MAXIMUM`.
    `state` - byte array with device state information
  See Also:
    `RESOLUTION_NORMAL`, `RESOLUTION_MAXIMUM`, `hasSelectableTemperatureResolution()`, `getTemperatureResolution(byte[])`, `getTemperatureResolutions()`

### readDevice

    public byte[] readDevice()
                      throws OneWireIOException,
                             OneWireException

  Retrieves this `OneWireContainer10` state information. The state information 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.
  Specified by:
    `readDevice` in interface `OneWireSensor`
  Returns:
    `OneWireContainer10` state information. Device state looks like this:

           0 : temperature LSB
           1 : temperature MSB
           2 : trip high
           3 : trip low
           4 : reserved (put the resolution here, 0 for normal, 1 for max)
           5 : reserved
           6 : count remain
           7 : count per degree Celsius
           8 : an 8 bit CRC over the previous 8 bytes of data

  Throws:
    `OneWireIOException` - on a 1-Wire communication error such as reading an incorrect CRC from this `OneWireContainer10`. 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'.
    `OneWireException` - on a communication or setup error with the 1-Wire adapter
  See Also:
    `writeDevice(byte[])`

### writeDevice

    public void writeDevice(byte[] state)
                     throws OneWireIOException,
                            OneWireException

  Writes to this `OneWireContainer10` `state` information 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.
  Specified by:
    `writeDevice` in interface `OneWireSensor`
  Parameters:
    `state` - byte array with device state information
  Throws:
    `OneWireIOException` - on a 1-Wire communication error such as reading an incorrect CRC from this `OneWireContainer10`. 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'.
    `OneWireException` - on a communication or setup error with the 1-Wire adapter
  See Also:
    `readDevice()`

### convertToFahrenheit

    public static double convertToFahrenheit(double celsiusTemperature)

  Converts a temperature reading from Celsius to Fahrenheit.
  Parameters:
    `celsiusTemperature` - temperature value in Celsius
  Returns:
    the Fahrenheit conversion of the supplied temperature

### convertToCelsius

    public static double convertToCelsius(double fahrenheitTemperature)

  Converts a temperature reading from Fahrenheit to Celsius.
  Parameters:
    `fahrenheitTemperature` - temperature value in Fahrenheit
  Returns:
    the Celsius conversion of the supplied temperature

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD