|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.dalsemi.onewire.container.OneWireContainer | +--com.dalsemi.onewire.container.OneWireContainer28
iButton container for iButton family type 28 (hex). This family type is a 'temperature' 1-Wire chip device DS18B20 (plastic)).
Field Summary | |
static byte |
CONVERT_TEMPERATURE_COMMAND
DS18B20 convert temperature command |
static byte |
COPY_SCRATCHPAD_COMMAND
DS18B20 copy scratchpad command |
static byte |
READ_POWER_SUPPLY_COMMAND
DS18B20 write scratchpad command |
static byte |
READ_SCRATCHPAD_COMMAND
DS18B20 read scratchpad command |
static byte |
RECALL_E2MEMORY_COMMAND
DS18B20 recall E-squared memory command |
static byte |
RESOLUTION_10_BIT
DS18B20 10-bit resolution constant for CONFIG byte |
static byte |
RESOLUTION_11_BIT
DS18B20 11-bit resolution constant for CONFIG byte |
static byte |
RESOLUTION_12_BIT
DS18B20 12-bit resolution constant for CONFIG byte |
static byte |
RESOLUTION_9_BIT
DS18B20 9-bit resolution constant for CONFIG byte |
static byte |
WRITE_SCRATCHPAD_COMMAND
DS18B20 write scratchpad command |
Fields inherited from interface com.dalsemi.onewire.container.TemperatureContainer |
ALARM_HIGH, ALARM_LOW |
Constructor Summary | |
OneWireContainer28()
Constructor OneWireContainer28 |
|
OneWireContainer28(DSPortAdapter sourceAdapter,
byte[] newAddress)
Create a container with a provided adapter object and the address of the iButton or 1-Wire device. |
|
OneWireContainer28(DSPortAdapter sourceAdapter,
long newAddress)
Create a container with a provided adapter object and the address of the iButton or 1-Wire device. |
|
OneWireContainer28(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 | |
float |
convertToFahrenheit(float celsiusTemperature)
Convert a temperature from celsius to fahrenheit. |
void |
copyScratchpad()
Copy the Scratchpad to the Esquared memory of the DS18B20. |
void |
doTemperatureConvert(byte[] state)
Perform a temperature conversion. |
java.lang.String |
getAlternateNames()
Retrieve the alternate Dallas Semiconductor part numbers or names. |
java.lang.String |
getDescription()
Retrieve a short description of the function of the iButton type. |
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()
Retrieve the Dallas Semiconductor part number of the iButton as a string. |
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 Temperature 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 |
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. |
boolean |
isExternalPowerSupplied()
Reads the way power is supplied to the DS18B20. |
byte[] |
readDevice()
This method retrieves the 1-Wire device sensor state. |
byte[] |
readScratchpad()
Read the Scratchpad of the DS18B20. |
byte[] |
recallE2()
Recalls the DS18B20 temperature trigger values (th & tl) and the configuration register to the scratchpad and reads the scratchpad. |
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 |
writeDevice(byte[] state)
This method writes the 1-Wire device sensor state that has been changed by the 'set' methods. |
void |
writeScratchpad(byte[] data)
Write to the Scratchpad of the DS18B20. |
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 |
public static final byte WRITE_SCRATCHPAD_COMMAND
public static final byte READ_SCRATCHPAD_COMMAND
public static final byte COPY_SCRATCHPAD_COMMAND
public static final byte CONVERT_TEMPERATURE_COMMAND
public static final byte RECALL_E2MEMORY_COMMAND
public static final byte READ_POWER_SUPPLY_COMMAND
public static final byte RESOLUTION_12_BIT
public static final byte RESOLUTION_11_BIT
public static final byte RESOLUTION_10_BIT
public static final byte RESOLUTION_9_BIT
Constructor Detail |
public OneWireContainer28()
public OneWireContainer28(DSPortAdapter sourceAdapter, byte[] newAddress)
sourceAdapter
- adapter object required to communicate with
this iButton.newAddress
- address of this 1-Wire devicepublic OneWireContainer28(DSPortAdapter sourceAdapter, long newAddress)
sourceAdapter
- adapter object required to communicate with
this iButton.newAddress
- address of this 1-Wire devicepublic OneWireContainer28(DSPortAdapter sourceAdapter, java.lang.String newAddress)
sourceAdapter
- adapter object required to communicate with
this iButton.newAddress
- address of this 1-Wire deviceMethod Detail |
public java.lang.String getName()
getName
in class OneWireContainer
public java.lang.String getAlternateNames()
getAlternateNames
in class OneWireContainer
String
representation of the alternate names.public java.lang.String getDescription()
getDescription
in class OneWireContainer
public boolean hasTemperatureAlarms()
hasTemperatureAlarms
in interface TemperatureContainer
public boolean hasSelectableTemperatureResolution()
hasSelectableTemperatureResolution
in interface TemperatureContainer
public double[] getTemperatureResolutions()
getTemperatureResolutions
in interface TemperatureContainer
public double getTemperatureAlarmResolution()
getTemperatureAlarmResolution
in interface TemperatureContainer
public double getMaxTemperature()
getMaxTemperature
in interface TemperatureContainer
public double getMinTemperature()
getMinTemperature
in interface TemperatureContainer
public void doTemperatureConvert(byte[] state) throws OneWireIOException, OneWireException
doTemperatureConvert
in interface TemperatureContainer
state
- - byte array of device state
device state looks like this:
0 : temperature LSB
1 : temperature MSB
2 : trip high
3 : trip low
4 : configuration register (for resolution)
5 : reserved
6 : reserved
7 : reserved
8 : the final byte is an 8 bit CRCOneWireIOException
- OneWireException
- public double getTemperature(byte[] state)
getTemperature
in interface TemperatureContainer
state
- - byte array of device statepublic double getTemperatureAlarm(int alarmType, byte[] state)
getTemperatureAlarm
in interface TemperatureContainer
alarmType
- - integer, indicating trip type ALARM_HIGH (1)
or ALARM_LOW (0)state
- - byte array of device statepublic double getTemperatureResolution(byte[] state)
getTemperatureResolution
in interface TemperatureContainer
state
- - byte array of device statepublic void setTemperatureAlarm(int alarmType, double alarmValue, byte[] state) throws OneWireException, OneWireIOException
setTemperatureAlarm
in interface TemperatureContainer
alarmType
- - integer, indicating trip type ALARM_HIGH (1)
or ALARM_LOW (0)alarmValue
- - double, high trip value in degrees Cstate
- - byte array of device statepublic void setTemperatureResolution(double resolution, byte[] state) throws OneWireException, OneWireIOException
setTemperatureResolution
in interface TemperatureContainer
resolution
- - double, temperature resolution in degrees Cstate
- - byte array of device statepublic byte[] readDevice() throws OneWireIOException, OneWireException
readDevice
in interface OneWireSensor
byte[]<\code> 1-Wire device sensor state *- Throws:
OneWireIOException
- OneWireException
-
public void writeDevice(byte[] state) throws OneWireIOException, OneWireException
writeDevice
in interface OneWireSensor
state
- - byte array to write to the DS18B20OneWireIOException
- OneWireException
- public byte[] readScratchpad() throws OneWireIOException, OneWireException
OneWireIOException
- OneWireException
- public void writeScratchpad(byte[] data) throws OneWireIOException, OneWireException
data
- byte[]<\code> this is the data to be written to the
scratchpad. First byte of data must be the temperature
High Trip Point, the second byte must be the temperature
Low Trip Point, and the third must be the Resolution
(configuration register).- Throws:
OneWireIOException
- OneWireException
-
public void copyScratchpad() throws OneWireIOException, OneWireException
OneWireIOException
- OneWireException
- public byte[] recallE2() throws OneWireIOException, OneWireException
OneWireIOException
- OneWireException
- public boolean isExternalPowerSupplied() throws OneWireIOException, OneWireException
OneWireIOException
- OneWireException
- public float convertToFahrenheit(float celsiusTemperature)
celsiusTemperature
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |