public class OneWireContainer26 extends OneWireContainer implements ADContainer, TemperatureContainer, ClockContainer, HumidityContainer
1-Wire® container that encapsulates the functionality of the 1-Wire family type 26 (hex), Maxim Integrated Products part number: DS2438, Smart Battery Monitor.
Sometimes the VAD input will report 10.23 V even if nothing is attached. This value is also the maximum voltage that part can report.
Modifier and Type | Field and Description |
---|---|
static byte |
AD_FLAG
Flag to set/check the voltage A/D Input Select Bit with setFlag/getFlag
When this bit is true the battery input is (VDD) is selected as input for
the voltage A/D input.
|
static byte |
ADB_FLAG
Flag to check whether or not the A/D converter is busy using getFlag().
|
static byte |
CA_FLAG
Flag to set/check the Current Accumulator bit with setFlag/getFlag.
|
static int |
CHANNEL_VAD
Channel selector for the VAD input.
|
static int |
CHANNEL_VDD
Channel selector for the VDD input.
|
static int |
CHANNEL_VSENSE
Channel selectro the the IAD input.
|
static byte |
EE_FLAG
Flag to set/check the Current Accumulator Shadow Selector bit with
setFlag/getFlag.
|
static byte |
IAD_FLAG
Flag to set/check the Current A/D Control bit with setFlag/getFlag.
|
static byte |
NVB_FLAG
Flag to check whether or not an operation is being performed on the
nonvolatile memory using getFlag.
|
static byte |
TB_FLAG
Flag to check whether or not a temperature conversion is in progress
using getFlag().
|
ALARM_HIGH, ALARM_LOW
ALARM_HIGH, ALARM_LOW
ALARM_HIGH, ALARM_LOW
Constructor and Description |
---|
OneWireContainer26()
Default constructor
|
OneWireContainer26(DSPortAdapter sourceAdapter,
byte[] newAddress)
Create a container with a provided adapter object
and the address of the 1-Wire device.
|
OneWireContainer26(DSPortAdapter sourceAdapter,
long newAddress)
Create a container with a provided adapter object
and the address of the 1-Wire device.
|
OneWireContainer26(DSPortAdapter sourceAdapter,
java.lang.String newAddress)
Create a container with a provided adapter object
and the address of the 1-Wire device.
|
Modifier and Type | Method and Description |
---|---|
void |
calibrateCurrentADC()
Calibrate the current ADC.
|
boolean |
canADMultiChannelRead()
Query to see if this A/D supports doing multiple voltage
conversions at the same time.
|
boolean |
canDisableClock()
Query to see if the clock can be disabled.
|
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 |
doHumidityConvert(byte[] state)
Performs a Humidity conversion.
|
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 Maxim Integrated Products part number or name.
|
int |
getCCA()
Retrieves the current CCA value in mVHr.
|
long |
getClock(byte[] state)
This method extracts the Clock Value in milliseconds from the
state data retrieved from the
readDevice() method. |
long |
getClockAlarm(byte[] state)
This method extracts the Clock Alarm Value from the provided
state data retrieved from the
readDevice()
method. |
long |
getClockResolution()
Query to get the clock resolution in milliseconds
|
double |
getCurrent(byte[] state)
Get the instantaneous current.
|
int |
getDCA()
Retrieves the value of the DCA in mVHr.
|
java.lang.String |
getDescription()
Return a short description of the function of this 1-Wire device type.
|
long |
getDisconnectTime(byte[] state)
This method extracts the Clock Value in milliseconds from the
state data retrieved from the
readDevice() method. |
long |
getEndOfChargeTime(byte[] state)
This method extracts the Clock Value in milliseconds from the
state data retrieved from the
readDevice() method. |
boolean |
getFlag(byte flagToGet)
Checks the specified flag in the status/configuration register
and returns its status as a boolean.
|
double |
getHumidity(byte[] state)
Gets the humidity expressed as a percent value (0.0 to 100.0) of humidity.
|
double |
getHumidityAlarm(int alarmType,
byte[] state)
Gets the specified Humidity alarm value in percent from the
state data retrieved from the
readDevice() method. |
double |
getHumidityAlarmResolution()
Gets the Humidity alarm resolution in percent.
|
double |
getHumidityResolution(byte[] state)
Gets the current Humidity resolution in percent from the
state data retrieved from the readDevice()
method. |
double[] |
getHumidityResolutions()
Get an array of available Humidity resolutions in percent humidity (0 to 100).
|
int |
getICA()
Retrieves the current ICA value in mVHr.
|
double |
getMaxTemperature()
Query to get the maximum temperature in degrees C.
|
java.util.Enumeration |
getMemoryBanks()
Gets an enumeration of memory bank instances that implement one or more
of the following interfaces:
MemoryBank ,
PagedMemoryBank ,
and OTPMemoryBank . |
double |
getMinTemperature()
Query to get the minimum temperature in degrees C.
|
java.lang.String |
getName()
Returns the Maxim Integrated Products part number of this 1-Wire device
as a string.
|
int |
getNumberADChannels()
Query to get the number of channels supported by this A/D.
|
double |
getRemainingCapacity()
Calculate the remaining capacity in mAH as outlined in the data sheet.
|
double |
getSenseResistor()
Get the value used for the sense resistor in the
getCurrent()
calculations. |
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 |
hasClockAlarm()
Query to see if the clock has an alarm feature.
|
boolean |
hasHumidityAlarms()
Checks to see if this Humidity measuring device has high/low
trip alarms.
|
boolean |
hasSelectableHumidityResolution()
Checks to see if this device has selectable Humidity resolution.
|
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 |
isCharging(byte[] state)
Determines if the battery is charging and returns a boolean.
|
boolean |
isClockAlarmEnabled(byte[] state)
This method checks if the Clock Alarm is enabled
from the provided state data retrieved from the
readDevice() method. |
boolean |
isClockAlarming(byte[] state)
This method checks if the Clock Alarm flag has been set
from the state data retrieved from the
readDevice() method. |
boolean |
isClockRunning(byte[] state)
This method checks if the device's oscilator is enabled.
|
boolean |
isRelative()
Checks to see if humidity value given is a 'relative' humidity value.
|
byte[] |
readDevice()
This method retrieves the 1-Wire device sensor state.
|
byte[] |
readPage(int page)
Reads the specified 8 byte page and returns the data in an array.
|
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 |
setCCA(int ccaValue)
Set the value of the CCA.
|
void |
setClock(long time,
byte[] state)
This method sets the Clock time in the provided state data
Use the method
writeDevice() with
this data to finalize the change to the device. |
void |
setClockAlarm(long time,
byte[] state)
This method sets the Clock Alarm in the provided state
data.
|
void |
setClockAlarmEnable(boolean alarmEnable,
byte[] state)
This method sets the Clock Alarm enable.
|
void |
setClockRunEnable(boolean runEnable,
byte[] state)
This method sets the oscillator enable to the specified
value.
|
void |
setDCA(int dcaValue)
Set the value of the DCA.
|
void |
setFlag(byte flagToSet,
boolean flagValue)
Set one of the flags in the STATUS/CONFIGURATION register.
|
void |
setHumidityAlarm(int alarmType,
double alarmValue,
byte[] state)
Sets the Humidity alarm value in percent in the provided
state data. |
void |
setHumidityResolution(double resolution,
byte[] state)
Sets the current Humidity resolution in percent in the provided
state data. |
void |
setICA(int icaValue)
Set the value of the ICA.
|
void |
setSenseResistor(double resistance)
Set the value of the sense resistor used to determine
battery current.
|
void |
setSpeedCheck(boolean doSpeedCheck)
Directs the container to avoid the calls to doSpeed() in methods that communicate
with the Thermocron.
|
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 |
setThreshold(byte thresholdValue)
Set the minimum current measurement magnitude for which the ICA/CCA/DCA
are incremented.
|
void |
writeDevice(byte[] state)
This method write the 1-Wire device sensor state that
have been changed by the 'set' methods.
|
void |
writePage(int page,
byte[] source,
int offset)
Writes a page of memory to this device.
|
doSpeed, equals, getAdapter, getAddress, getAddressAsLong, getAddressAsString, getMaxSpeed, hashCode, isAlarming, isPresent, setSpeed, setupContainer, setupContainer, setupContainer, toString
public static final int CHANNEL_VDD
public static final int CHANNEL_VAD
public static final int CHANNEL_VSENSE
public static final byte IAD_FLAG
public static final byte CA_FLAG
public static final byte EE_FLAG
public static final byte AD_FLAG
public static final byte TB_FLAG
public static final byte NVB_FLAG
public static final byte ADB_FLAG
public OneWireContainer26()
public OneWireContainer26(DSPortAdapter sourceAdapter, byte[] newAddress)
sourceAdapter
- adapter object required to communicate with
this 1-Wire devicenewAddress
- address of this 1-Wire devicepublic OneWireContainer26(DSPortAdapter sourceAdapter, long newAddress)
sourceAdapter
- adapter object required to communicate with
this 1-Wire devicenewAddress
- address of this 1-Wire devicepublic OneWireContainer26(DSPortAdapter sourceAdapter, java.lang.String newAddress)
sourceAdapter
- adapter object required to communicate with
this 1-Wire devicenewAddress
- address of this 1-Wire devicepublic java.util.Enumeration getMemoryBanks()
MemoryBank
,
PagedMemoryBank
,
and OTPMemoryBank
.getMemoryBanks
in class OneWireContainer
Enumeration
of memory banksMemoryBank
public java.lang.String getName()
getName
in class OneWireContainer
public java.lang.String getAlternateNames()
getAlternateNames
in class OneWireContainer
public java.lang.String getDescription()
getDescription
in class OneWireContainer
public void setSenseResistor(double resistance)
getCurrent()
calculation.
See the DS2438 datasheet for more information on sensing battery
current.resistance
- Value of the sense resistor in Ohms.public double getSenseResistor()
getCurrent()
calculations.public void setSpeedCheck(boolean doSpeedCheck)
doSpeed()
. However, this is an expensive operation.
If a user manages the bus speed in an
application, call this method with doSpeedCheck
as false
. The default behavior is
to call doSpeed()
.doSpeedCheck
- true
for doSpeed()
to be called before every
1-Wire bus access, false
to skip this expensive callOneWireContainer.doSpeed()
public byte[] readPage(int page) throws OneWireIOException, OneWireException, java.lang.IllegalArgumentException
page
- the page number to readOneWireIOException
- Error reading dataOneWireException
- Could not find partjava.lang.IllegalArgumentException
- Bad parameters passedpublic void writePage(int page, byte[] source, int offset) throws OneWireIOException, OneWireException
setFlag()
.page
- the page numbersource
- data to be written to pageoffset
- offset with page to begin writtingOneWireIOException
- Error reading dataOneWireException
- Could not find partjava.lang.IllegalArgumentException
- Bad parameters passedpublic boolean getFlag(byte flagToGet) throws OneWireIOException, OneWireException, java.lang.IllegalArgumentException
flagToGet
- flag bitmask.
Acceptable parameters: IAD_FLAG, CA_FLAG, EE_FLAG, AD_FLAG, TB_FLAG,
NVB_FLAG, ADB_FLAG
(may be ORed with | to check the status of more than one).OneWireIOException
- Error reading dataOneWireException
- Could not find partjava.lang.IllegalArgumentException
- Bad parameters passedpublic void setFlag(byte flagToSet, boolean flagValue) throws OneWireIOException, OneWireException, java.lang.IllegalArgumentException
bitmask
- of the flag to set
Acceptable parameters: IAD_FLAG, CA_FLAG, EE_FLAG, AD_FLAG, TB_FLAG,
NVB_FLAG, ADB_FLAG.flagValue
- value to set flag toOneWireIOException
- Error writting dataOneWireException
- Could not find partjava.lang.IllegalArgumentException
- Bad parameters passedpublic double getCurrent(byte[] state)
setSenseResitor(double)
.state
- current state of devicepublic double getRemainingCapacity() throws OneWireIOException, OneWireException, java.lang.IllegalArgumentException
OneWireIOException
- Error reading dataOneWireException
- Could not find partjava.lang.IllegalArgumentException
- Bad parameters passedpublic boolean isCharging(byte[] state) throws OneWireIOException, OneWireException, java.lang.IllegalArgumentException
state
- current state of deviceOneWireIOException
- Error reading dataOneWireException
- Could not find partjava.lang.IllegalArgumentException
- Bad parameters passedpublic void calibrateCurrentADC() throws OneWireIOException, OneWireException, java.lang.IllegalArgumentException
OneWireIOException
- Error calibratingOneWireException
- Could not find partjava.lang.IllegalArgumentException
- Bad parameters passedpublic void setThreshold(byte thresholdValue) throws OneWireIOException, OneWireException
threshold
- minimum number of bits a current measurement must have to be accumulated,
Only 0,2,4 and 8 are valid parametersOneWireIOException
- Error setting the thresholdOneWireException
- Could not find partjava.lang.IllegalArgumentException
- Bad parameters passedpublic int getICA() throws OneWireIOException, OneWireException, java.lang.IllegalArgumentException
OneWireIOException
- Error reading dataOneWireException
- Could not find partjava.lang.IllegalArgumentException
- Bad parameters passedpublic int getCCA() throws OneWireIOException, OneWireException, java.lang.IllegalArgumentException
OneWireIOException
- Error reading dataOneWireException
- Could not find partjava.lang.IllegalArgumentException
- Bad parameters passedpublic int getDCA() throws OneWireIOException, OneWireException, java.lang.IllegalArgumentException
OneWireIOException
- Error reading dataOneWireException
- Could not find partjava.lang.IllegalArgumentException
- Bad parameters passedpublic void setICA(int icaValue) throws OneWireIOException, OneWireException, java.lang.IllegalArgumentException
icaValue
- new ICA valueOneWireIOException
- Error writing dataOneWireException
- Could not find partjava.lang.IllegalArgumentException
- Bad parameters passedpublic void setCCA(int ccaValue) throws OneWireIOException, OneWireException, java.lang.IllegalArgumentException
ccaValue
- new CCA valueOneWireIOException
- Error writing dataOneWireException
- Could not find partjava.lang.IllegalArgumentException
- Bad parameters passedpublic void setDCA(int dcaValue) throws OneWireIOException, OneWireException, java.lang.IllegalArgumentException
dcaValue
- new DCA valueOneWireIOException
- Error writing dataOneWireException
- Could not find partjava.lang.IllegalArgumentException
- Bad parameters passedpublic long getDisconnectTime(byte[] state)
readDevice()
method.state
- device statepublic long getEndOfChargeTime(byte[] state)
readDevice()
method.state
- device statepublic int getNumberADChannels()
getNumberADChannels
in interface ADContainer
public boolean hasADAlarms()
hasADAlarms
in interface ADContainer
public double[] getADRanges(int channel)
getADRanges
in interface ADContainer
channel
- channel in the range
[0 to (getNumberChannels() - 1)]ADContainer.getNumberADChannels()
public double[] getADResolutions(int channel, double range)
getADResolutions
in interface ADContainer
channel
- channel in the range
[0 to (getNumberChannels() - 1)]range
- A/D rangeADContainer.getNumberADChannels()
,
ADContainer.getADRanges(int)
public boolean canADMultiChannelRead()
canADMultiChannelRead
in interface ADContainer
ADContainer.doADConvert(boolean[],byte[])
public void doADConvert(int channel, byte[] state) throws OneWireIOException, OneWireException
doADConvert
in interface ADContainer
channel
- channel in the range
[0 to (getNumberChannels() - 1)]
state
- current state of the
device returned from readDevice()
OneWireIOException
- Error writing dataOneWireException
- Could not find partOneWireSensor.readDevice()
,
ADContainer.getADVoltage(int,byte[])
public void doADConvert(boolean[] doConvert, byte[] state) throws OneWireIOException, OneWireException
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.doADConvert
in interface ADContainer
doConvert
- channels
to perform conversion onstate
- current state of the
device returned from readDevice()
OneWireIOException
- Error writing dataOneWireException
- Could not find partOneWireSensor.readDevice()
,
ADContainer.getADVoltage(byte[])
,
ADContainer.canADMultiChannelRead()
public double[] getADVoltage(byte[] state) throws OneWireIOException, OneWireException
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.getADVoltage
in interface ADContainer
state
- current state of the
device returned from readDevice()
OneWireIOException
- Error reading dataOneWireException
- Could not find partADContainer.doADConvert(boolean[],byte[])
public double getADVoltage(int channel, byte[] state) throws OneWireIOException, OneWireException
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.getADVoltage
in interface ADContainer
channel
- channel in the range
[0 to (getNumberChannels() - 1)]
state
- current state of the
device returned from readDevice()
OneWireIOException
- Error reading dataOneWireException
- Could not find partADContainer.doADConvert(int,byte[])
,
ADContainer.getADVoltage(byte[])
public double getADAlarm(int channel, int alarmType, byte[] state) throws OneWireException
readDevice()
method.getADAlarm
in interface ADContainer
channel
- channel in the range
[0 to (getNumberChannels() - 1)]
alarmType
- desired alarm, ALARM_HIGH (1)
or ALARM_LOW (0)
state
- current state of the
device returned from readDevice()
OneWireException
- Device does not support A/D alarmsOneWireSensor.readDevice()
,
ADContainer.hasADAlarms()
public boolean getADAlarmEnable(int channel, int alarmType, byte[] state) throws OneWireException
readDevice()
method.getADAlarmEnable
in interface ADContainer
channel
- channel in the range
[0 to (getNumberChannels() - 1)]
alarmType
- desired alarm, ALARM_HIGH (1)
or ALARM_LOW (0)
state
- current state of the state
returned from readDevice()
OneWireException
- Device does not support A/D alarmsOneWireSensor.readDevice()
,
ADContainer.hasADAlarms()
public boolean hasADAlarmed(int channel, int alarmType, byte[] state) throws OneWireException
readDevice()
method.hasADAlarmed
in interface ADContainer
channel
- channel in the range
[0 to (getNumberChannels() - 1)]
alarmType
- desired alarm, ALARM_HIGH (1)
or ALARM_LOW (0)
state
- current state of the state
returned from readDevice()
OneWireException
- Device does not support A/D alarmsOneWireSensor.readDevice()
,
ADContainer.hasADAlarms()
,
ADContainer.getADAlarmEnable(int,int,byte[])
,
ADContainer.setADAlarmEnable(int,int,boolean,byte[])
public double getADResolution(int channel, byte[] state)
readDevice()
method.getADResolution
in interface ADContainer
channel
- channel in the range
[0 to (getNumberChannels() - 1)]
state
- current state of the state
returned from readDevice()
ADContainer.getADResolutions(int,double)
,
ADContainer.setADResolution(int,double,byte[])
public double getADRange(int channel, byte[] state)
readDevice()
method.getADRange
in interface ADContainer
channel
- channel in the range
[0 to (getNumberChannels() - 1)]
state
- current state of the state
returned from readDevice()
ADContainer.getADRanges(int)
,
ADContainer.setADRange(int,double,byte[])
public void setADAlarm(int channel, int alarmType, double alarm, byte[] state) throws OneWireException
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()
.setADAlarm
in interface ADContainer
channel
- channel in the range
[0 to (getNumberChannels() - 1)]
alarmType
- desired alarm, ALARM_HIGH (1)
or ALARM_LOW (0)
alarm
- alarm value (will be reduced to 8 bit resolution)state
- current state of the
device returned from readDevice()
OneWireException
- Device does not support A/D alarmsOneWireSensor.writeDevice(byte[])
,
ADContainer.hasADAlarms()
,
ADContainer.getADAlarm(int,int,byte[])
,
ADContainer.getADAlarmEnable(int,int,byte[])
,
ADContainer.setADAlarmEnable(int,int,boolean,byte[])
,
ADContainer.hasADAlarmed(int,int,byte[])
public void setADAlarmEnable(int channel, int alarmType, boolean alarmEnable, byte[] state) throws OneWireException
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()
.setADAlarmEnable
in interface ADContainer
channel
- channel in the range
[0 to (getNumberChannels() - 1)]
alarmType
- desired alarm, ALARM_HIGH (1)
or ALARM_LOW (0)
alarmEnable
- alarm enable valuestate
- current state of the
device returned from readDevice()
OneWireException
- Device does not support A/D alarmsOneWireSensor.writeDevice(byte[])
,
ADContainer.hasADAlarms()
,
ADContainer.getADAlarm(int,int,byte[])
,
ADContainer.setADAlarm(int,int,double,byte[])
,
ADContainer.getADAlarmEnable(int,int,byte[])
,
ADContainer.hasADAlarmed(int,int,byte[])
public void setADResolution(int channel, double resolution, byte[] state)
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()
.setADResolution
in interface ADContainer
channel
- channel in the range
[0 to (getNumberChannels() - 1)]
resolution
- resolution to use in voltsstate
- current state of the
device returned from readDevice()
ADContainer.getADResolutions(int,double)
,
ADContainer.getADResolution(int,byte[])
public void setADRange(int channel, double range, byte[] state)
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()
.setADRange
in interface ADContainer
channel
- channel in the range
[0 to (getNumberChannels() - 1)]
range
- maximum volt range, use
getRanges()
method to get available rangesstate
- current state of the
device returned from readDevice()
ADContainer.getADRanges(int)
,
ADContainer.getADRange(int,byte[])
public byte[] readDevice() throws OneWireIOException, OneWireException
writeDevice()
to finalize the one or more change.readDevice
in interface OneWireSensor
OneWireIOException
- Error reading dataOneWireException
- Could not find partpublic void writeDevice(byte[] state) throws OneWireIOException, OneWireException
writeDevice
in interface OneWireSensor
state
- device's stateOneWireIOException
- Error writting dataOneWireException
- Could not find partpublic boolean hasTemperatureAlarms()
hasTemperatureAlarms
in interface TemperatureContainer
TemperatureContainer.getTemperatureAlarm(int, byte[])
,
TemperatureContainer.setTemperatureAlarm(int, double, byte[])
public boolean hasSelectableTemperatureResolution()
hasSelectableTemperatureResolution
in interface TemperatureContainer
TemperatureContainer.getTemperatureResolution(byte[])
,
TemperatureContainer.getTemperatureResolutions()
,
TemperatureContainer.setTemperatureResolution(double, byte[])
public double[] getTemperatureResolutions()
getTemperatureResolutions
in interface TemperatureContainer
TemperatureContainer.hasSelectableTemperatureResolution()
,
TemperatureContainer.getTemperatureResolution(byte[])
,
TemperatureContainer.setTemperatureResolution(double, byte[])
public double getTemperatureAlarmResolution() throws OneWireException
getTemperatureAlarmResolution
in interface TemperatureContainer
OneWireException
- Device does not have temperature alarmsTemperatureContainer.hasTemperatureAlarms()
,
TemperatureContainer.getTemperatureAlarm(int, byte[])
,
TemperatureContainer.setTemperatureAlarm(int, double, byte[])
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
- device stateOneWireIOException
- Error writting dataOneWireException
- Could not find partpublic double getTemperature(byte[] state)
readDevice()
method.getTemperature
in interface TemperatureContainer
state
- device statedoTemperature()
public double getTemperatureAlarm(int alarmType, byte[] state) throws OneWireException
readDevice()
method.getTemperatureAlarm
in interface TemperatureContainer
alarmType
- alarm trip type ALARM_HIGH (1)
or ALARM_LOW (0)
state
- device stateOneWireException
- Device does not have temperature alarmsTemperatureContainer.hasTemperatureAlarms()
,
TemperatureContainer.setTemperatureAlarm(int, double, byte[])
public double getTemperatureResolution(byte[] state)
readDevice()
method.getTemperatureResolution
in interface TemperatureContainer
state
- device stateTemperatureContainer.hasSelectableTemperatureResolution()
,
TemperatureContainer.getTemperatureResolutions()
,
TemperatureContainer.setTemperatureResolution(double, byte[])
public void setTemperatureAlarm(int alarmType, double alarmValue, byte[] state) throws OneWireException, OneWireIOException
writeDevice()
with
this data to finalize the change to the device.setTemperatureAlarm
in interface TemperatureContainer
alarmType
- alarm type ALARM_HIGH (1)
or ALARM_LOW (0)
alarmValue
- trip value in degrees Cstate
- device stateOneWireException
- Device does not have temperature alarmsOneWireIOException
TemperatureContainer.hasTemperatureAlarms()
,
TemperatureContainer.getTemperatureAlarm(int, byte[])
public void setTemperatureResolution(double resolution, byte[] state) throws OneWireException, OneWireIOException
writeDevice()
with
this data to finalize the change to the device.setTemperatureResolution
in interface TemperatureContainer
resolution
- temperature resolution in degrees Cstate
- device stateOneWireIOException
- Error writting dataOneWireException
- Could not find partTemperatureContainer.hasSelectableTemperatureResolution()
,
TemperatureContainer.getTemperatureResolution(byte[])
,
TemperatureContainer.getTemperatureResolutions()
public boolean hasClockAlarm()
hasClockAlarm
in interface ClockContainer
ClockContainer.getClockAlarm(byte[])
,
ClockContainer.isClockAlarmEnabled(byte[])
,
ClockContainer.isClockAlarming(byte[])
,
ClockContainer.setClockAlarm(long,byte[])
,
ClockContainer.setClockAlarmEnable(boolean,byte[])
public boolean canDisableClock()
isClockRunning()
and setClockRunEnable()
.canDisableClock
in interface ClockContainer
ClockContainer.isClockRunning(byte[])
,
ClockContainer.setClockRunEnable(boolean,byte[])
public long getClockResolution()
getClockResolution
in interface ClockContainer
public long getClock(byte[] state)
readDevice()
method.getClock
in interface ClockContainer
state
- device stateOneWireSensor.readDevice()
,
ClockContainer.setClock(long,byte[])
public long getClockAlarm(byte[] state) throws OneWireException
readDevice()
method.getClockAlarm
in interface ClockContainer
state
- device stateOneWireException
- Device does not have clock alarmOneWireSensor.readDevice()
,
ClockContainer.hasClockAlarm()
,
ClockContainer.isClockAlarmEnabled(byte[])
,
ClockContainer.isClockAlarming(byte[])
,
ClockContainer.setClockAlarm(long,byte[])
,
ClockContainer.setClockAlarmEnable(boolean,byte[])
public boolean isClockAlarming(byte[] state)
readDevice()
method.isClockAlarming
in interface ClockContainer
state
- device stateOneWireSensor.readDevice()
,
ClockContainer.hasClockAlarm()
,
ClockContainer.isClockAlarmEnabled(byte[])
,
ClockContainer.getClockAlarm(byte[])
,
ClockContainer.setClockAlarm(long,byte[])
,
ClockContainer.setClockAlarmEnable(boolean,byte[])
public boolean isClockAlarmEnabled(byte[] state)
readDevice()
method.isClockAlarmEnabled
in interface ClockContainer
state
- device stateOneWireSensor.readDevice()
,
ClockContainer.hasClockAlarm()
,
ClockContainer.isClockAlarming(byte[])
,
ClockContainer.getClockAlarm(byte[])
,
ClockContainer.setClockAlarm(long,byte[])
,
ClockContainer.setClockAlarmEnable(boolean,byte[])
public boolean isClockRunning(byte[] state)
readDevice()
method.isClockRunning
in interface ClockContainer
state
- device stateOneWireSensor.readDevice()
,
ClockContainer.canDisableClock()
,
ClockContainer.setClockRunEnable(boolean,byte[])
public void setClock(long time, byte[] state)
writeDevice()
with
this data to finalize the change to the device.setClock
in interface ClockContainer
time
- new clock setting in millisecondsstate
- device stateOneWireSensor.writeDevice(byte[])
,
ClockContainer.getClock(byte[])
public void setClockAlarm(long time, byte[] state) throws OneWireException
writeDevice()
with
this data to finalize the change to the device.setClockAlarm
in interface ClockContainer
time
- new clock setting in mllisecondsstate
- device stateOneWireException
- Device does not support clock alarmOneWireSensor.writeDevice(byte[])
,
ClockContainer.hasClockAlarm()
,
ClockContainer.isClockAlarmEnabled(byte[])
,
ClockContainer.getClockAlarm(byte[])
,
ClockContainer.isClockAlarming(byte[])
,
ClockContainer.setClockAlarmEnable(boolean,byte[])
public void setClockRunEnable(boolean runEnable, byte[] state) throws OneWireException
writeDevice()
with this
data to finalize the change to the device.setClockRunEnable
in interface ClockContainer
runEnable
- true to enable clock oscillatorstate
- device stateOneWireException
- Device does not support disabled clockOneWireSensor.writeDevice(byte[])
,
ClockContainer.canDisableClock()
,
ClockContainer.isClockRunning(byte[])
public void setClockAlarmEnable(boolean alarmEnable, byte[] state) throws OneWireException
writeDevice()
with this data to finalize the
change to the device.setClockAlarmEnable
in interface ClockContainer
alarmEnable
- - true to enable clock alarmstate
- device stateOneWireException
- Device does not support clock alarmOneWireSensor.writeDevice(byte[])
,
ClockContainer.hasClockAlarm()
,
ClockContainer.isClockAlarmEnabled(byte[])
,
ClockContainer.getClockAlarm(byte[])
,
ClockContainer.setClockAlarm(long,byte[])
,
ClockContainer.isClockAlarming(byte[])
public boolean isRelative()
isRelative
in interface HumidityContainer
true
if this HumidityContainer
provides a relative humidity readinggetHumidityResolution(byte[])
,
getHumidityResolutions()
,
setHumidityResolution(double, byte[])
public boolean hasHumidityAlarms()
hasHumidityAlarms
in interface HumidityContainer
true
if this HumidityContainer
has high/low trip alarmsgetHumidityAlarm(int, byte[])
,
setHumidityAlarm(int, double, byte[])
public boolean hasSelectableHumidityResolution()
hasSelectableHumidityResolution
in interface HumidityContainer
true
if this HumidityContainer
has selectable Humidity resolutiongetHumidityResolution(byte[])
,
getHumidityResolutions()
,
setHumidityResolution(double, byte[])
public double[] getHumidityResolutions()
getHumidityResolutions
in interface HumidityContainer
hasSelectableHumidityResolution()
,
getHumidityResolution(byte[])
,
setHumidityResolution(double, byte[])
public double getHumidityAlarmResolution() throws OneWireException
getHumidityAlarmResolution
in interface HumidityContainer
OneWireException
- Device does not support Humidity
alarmshasHumidityAlarms()
,
getHumidityAlarm(int, byte[])
,
setHumidityAlarm(int, double, byte[])
public void doHumidityConvert(byte[] state) throws OneWireIOException, OneWireException
doHumidityConvert
in interface HumidityContainer
state
- byte array with device state informationOneWireIOException
- on a 1-Wire communication error such as
reading an incorrect CRC from a 1-Wire device. 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
adapterpublic double getHumidity(byte[] state)
getHumidity
in interface HumidityContainer
state
- byte array with device state informationhasSelectableHumidityResolution()
,
getHumidityResolution(byte[])
,
setHumidityResolution(double, byte[])
public double getHumidityResolution(byte[] state)
state
data retrieved from the readDevice()
method.getHumidityResolution
in interface HumidityContainer
state
- byte array with device state informationhasSelectableHumidityResolution()
,
getHumidityResolutions()
,
setHumidityResolution(double, byte[])
public double getHumidityAlarm(int alarmType, byte[] state) throws OneWireException
state
data retrieved from the
readDevice()
method.getHumidityAlarm
in interface HumidityContainer
alarmType
- valid value: ALARM_HIGH
or
ALARM_LOW
state
- byte array with device state informationOneWireException
- Device does not support Humidity
alarmshasHumidityAlarms()
,
setHumidityAlarm(int, double, byte[])
public void setHumidityAlarm(int alarmType, double alarmValue, byte[] state) throws OneWireException
state
data.
Use the method writeDevice()
with
this data to finalize the change to the device.setHumidityAlarm
in interface HumidityContainer
alarmType
- valid value: ALARM_HIGH
or
ALARM_LOW
alarmValue
- alarm trip value in percentstate
- byte array with device state informationOneWireException
- Device does not support Humidity
alarmshasHumidityAlarms()
,
getHumidityAlarm(int, byte[])
public void setHumidityResolution(double resolution, byte[] state) throws OneWireException
state
data. Use the method writeDevice()
with this data to finalize the change to the device.setHumidityResolution
in interface HumidityContainer
resolution
- Humidity resolution in percentstate
- byte array with device state informationOneWireException
- Device does not support selectable
Humidity resolutionhasSelectableHumidityResolution()
,
getHumidityResolution(byte[])
,
getHumidityResolutions()
Copyright © 1999-2012 Maxim Integrated Products. All Rights Reserved.