Class OneWireContainer41
- java.lang.Object
-
- com.dalsemi.onewire.container.OneWireContainer
-
- com.dalsemi.onewire.container.OneWireContainer41
-
- All Implemented Interfaces:
ADContainer
,ClockContainer
,HumidityContainer
,MissionContainer
,OneWireSensor
,PasswordContainer
,TemperatureContainer
public class OneWireContainer41 extends OneWireContainer implements PasswordContainer, MissionContainer, ClockContainer, TemperatureContainer, ADContainer, HumidityContainer
1-Wire® container for a Temperature and Humidity/A-D Logging iButton, DS1922. This container encapsulates the functionality of the 1-Wire family type 22 (hex).
Features
- Logs up to 8192 consecutive temperature/humidity/A-D measurements in nonvolatile, read-only memory
- Real-Time clock
- Programmable high and low temperature alarms
- Programmable high and low humidity/A-D alarms
- Automatically 'wakes up' and logs temperature at user-programmable intervals
- 4096 bits of general-purpose read/write nonvolatile memory
- 256-bit scratchpad ensures integrity of data transfer
- On-chip 16-bit CRC generator to verify read operations
Memory
The memory can be accessed through the objects that are returned from the
The following is a list of the MemoryBank instances that are returned:getMemoryBanks
method.- Scratchpad with CRC and Password support
- Implements
MemoryBank
,PagedMemoryBank
- Size 32 starting at physical address 0
- Features Read/Write not-general-purpose volatile
- Pages 1 page of length 32 bytes
- Page Features page-device-CRC
- Extra information for each page Target address, offset, length 3
- Supports Copy Scratchpad With Password command
- Implements
- Main Memory
- Implements
MemoryBank
,PagedMemoryBank
- Size 512 starting at physical address 0
- Features Read/Write general-purpose non-volatile
- Pages 16 pages of length 32 bytes giving 29 bytes Packet data payload
- Page Features page-device-CRC
- Read-Only and Read/Write password if enabled, passwords are required for reading from and writing to the device.
- Implements
- Register control
- Implements
MemoryBank
,PagedMemoryBank
- Size 64 starting at physical address 512
- Features Read/Write not-general-purpose non-volatile
- Pages 2 pages of length 32 bytes
- Page Features page-device-CRC
- Read-Only and Read/Write password if enabled, passwords are required for reading from and writing to the device.
- Implements
- Temperature/Humidity/A-D log
- Implements
MemoryBank
,PagedMemoryBank
- Size 8192 starting at physical address 4096
- Features Read-only not-general-purpose non-volatile
- Pages 256 pages of length 32 bytes
- Page Features page-device-CRC
- Read-Only and Read/Write password if enabled, passwords are required for reading from and writing to the device.
- Implements
Usage
The code below starts a mission with the following characteristics:
- Rollover flag enabled.
- Sets both channels (temperature and humidity) to low resolution
- High temperature alarm of 28.0@htmlonly °C @endhtmlonly and a low temperature alarm of 23.0@htmlonly °C @endhtmlonly.
- High humidity alarm of 70%RH and a low temperature alarm of 20%RH.
- Sets the Real-Time Clock to the host system's clock.
- The mission will start in 2 minutes.
- A sample rate of 1.5 minutes.
// "ID" is a byte array of size 8 with an address of a part we // have already found with family code 22 hex // "access" is a DSPortAdapter OneWireContainer41 ds1922 = (OneWireContainer41)access.getDeviceContainer(ID); ds1922.setupContainer(access,ID); // stop the currently running mission, if there is one ds1922.stopMission(); // clear the previous mission results ds1922.clearMemory(); // set the high temperature alarm to 28 C ds1922.setMissionAlarm(ds1922.TEMPERATURE_CHANNEL, ds1922.ALARM_HIGH, 28); ds1922.setMissionAlarmEnable(ds1922.TEMPERATURE_CHANNEL, ds1922.ALARM_HIGH, true); // set the low temperature alarm to 23 C ds1922.setMissionAlarm(ds1922.TEMPERATURE_CHANNEL, ds1922.ALARM_LOW, 23); ds1922.setMissionAlarmEnable(ds1922.TEMPERATURE_CHANNEL, ds1922.ALARM_LOW, true); // set the high humidity alarm to 70%RH ds1922.setMissionAlarm(ds1922.DATA_CHANNEL, ds1922.ALARM_HIGH, 70); ds1922.setMissionAlarmEnable(ds1922.DATA_CHANNEL, ds1922.ALARM_HIGH, true); // set the low humidity alarm to 20%RH ds1922.setMissionAlarm(ds1922.DATA_CHANNEL, ds1922.ALARM_LOW, 20); ds1922.setMissionAlarmEnable(ds1922.DATA_CHANNEL, ds1922.ALARM_LOW, true); // set both channels to low resolution. ds1922.setMissionResolution(ds1922.TEMPERATURE_CHANNEL, ds1922.getMissionResolutions()[0]); ds1922.setMissionResolution(ds1922.DATA_CHANNEL, ds1922.getMissionResolutions()[0]); // enable both channels boolean[] enableChannel = new boolean[ds1922.getNumberMissionChannels()]; enableChannel[ds1922.TEMPERATURE_CHANNEL] = true; enableChannel[ds1922.DATA_CHANNEL] = true; // now start the mission with a sample rate of 1 minute ds1922.startNewMission(90, 2, true, true, enableChannel);
The following code processes the mission log:
System.out.println("Temperature Readings"); if(ds1922.getMissionChannelEnable(owc.TEMPERATURE_CHANNEL)) { int dataCount = ds1922.getMissionSampleCount(ds1922.TEMPERATURE_CHANNEL); System.out.println("SampleCount = " + dataCount); for(int i=0; i<dataCount; i++) { System.out.println( ds1922.getMissionSample(ds1922.TEMPERATURE_CHANNEL, i)); } } System.out.println("Humidity Readings"); if(ds1922.getMissionChannelEnable(owc.DATA_CHANNEL)) { int dataCount = ds1922.getMissionSampleCount(ds1922.DATA_CHANNEL); System.out.println("SampleCount = " + dataCount); for(int i=0; i<dataCount; i++) { System.out.println( ds1922.getMissionSample(ds1922.DATA_CHANNEL, i)); } }
Also see the usage examples in the
For examples regarding memory operations,TemperatureContainer
andClockContainer
andADContainer
interfaces.- See the usage example in
OneWireContainer
to enumerate the MemoryBanks. - See the usage examples in
MemoryBank
andPagedMemoryBank
for bank specific operations.
DataSheet
DataSheet link is unavailable at time of publication. Please visit the website and search for DS1922 or DS2422 to find the current datasheet.
-
-
Field Summary
Fields Modifier and Type Field Description static int
ALARM_STATUS_REGISTER
Address of Alarm Status Registerstatic byte
ASR_BIT_BATTERY_ON_RESET
Alarm Status Register Bit: Battery On Resetstatic byte
ASR_BIT_DATA_HIGH_ALARM
Alarm Status Register Bit: Data High Alarmstatic byte
ASR_BIT_DATA_LOW_ALARM
Alarm Status Register Bit: Data Low Alarmstatic byte
ASR_BIT_TEMPERATURE_HIGH_ALARM
Alarm Status Register Bit: Temperature High Alarmstatic byte
ASR_BIT_TEMPERATURE_LOW_ALARM
Alarm Status Register Bit: Temperature Low Alarmstatic byte
CLEAR_MEMORY_PW_COMMAND
1-Wire command for Clear Memory With Passwordstatic byte
COPY_SCRATCHPAD_PW_COMMAND
1-Wire command for Copy Scratchpad With Passwordstatic int
DATA_CHANNEL
Refers to the Humidity/A-D Channel for this devicestatic int
DATA_CONTROL_REGISTER
Address of Data Control Registerstatic int
DATA_HIGH_ALARM_THRESHOLD
Address of the Data High Alarm Registerstatic int
DATA_LOW_ALARM_THRESHOLD
Address of the Data Low Alarm Registerstatic byte
DCB_DS1922E
Value of Device Configuration Register for DS1922Estatic byte
DCB_DS1922L
Value of Device Configuration Register for DS1922Lstatic byte
DCB_DS1922S
Value of Device Configuration Register for DS1922Sstatic byte
DCB_DS1922T
Value of Device Configuration Register for DS1922Tstatic byte
DCB_DS1923
Value of Device Configuration Register for DS1923static byte
DCB_DS2422
Value of Device Configuration Register for DS1922Sstatic byte
DCR_BIT_ENABLE_DATA_HIGH_ALARM
Data Control Register Bit: Enable Data High Alarmstatic byte
DCR_BIT_ENABLE_DATA_LOW_ALARM
Data Control Register Bit: Enable Data Low Alarmstatic int
DEVICE_CONFIGURATION_BYTE
Address of Device Configuration Registerstatic int
DEVICE_SAMPLE_COUNT
Address of the Device Sample Countstatic byte
FORCED_CONVERSION
1-Wire command for Forced Conversionstatic int
GENERAL_STATUS_REGISTER
Address of General Status Registerstatic byte
GSR_BIT_CONVERSION_IN_PROGRESS
General Status Register Bit: Conversion In Progressstatic byte
GSR_BIT_FORCED_CONVERSION_IN_PROGRESS
General Status Register Bit: Forced Conversion In Progressstatic byte
GSR_BIT_MEMORY_CLEARED
General Status Register Bit: Memory Clearedstatic byte
GSR_BIT_MISSION_IN_PROGRESS
General Status Register Bit: Mission In Progressstatic byte
GSR_BIT_SAMPLE_IN_PROGRESS
General Status Register Bit: Sample In Progressstatic byte
GSR_BIT_WAITING_FOR_TEMPERATURE_ALARM
General Status Register Bit: Waiting for Temperature Alarmstatic int
LAST_DATA_CONVERSION_LSB
Address of the last data conversion's LSBstatic int
LAST_DATA_CONVERSION_MSB
Address of the last data conversion's MSBstatic int
LAST_TEMPERATURE_CONVERSION_LSB
Address of the last temperature conversion's LSBstatic int
LAST_TEMPERATURE_CONVERSION_MSB
Address of the last temperature conversion's MSBstatic byte
MCR_BIT_DATA_RESOLUTION
Mission Control Register Bit: Set Data Resolutionstatic byte
MCR_BIT_ENABLE_DATA_LOGGING
Mission Control Register Bit: Enable Data Loggingstatic byte
MCR_BIT_ENABLE_ROLLOVER
Mission Control Register Bit: Enable Rolloverstatic byte
MCR_BIT_ENABLE_TEMPERATURE_LOGGING
Mission Control Register Bit: Enable Temperature Loggingstatic byte
MCR_BIT_START_MISSION_ON_TEMPERATURE_ALARM
Mission Control Register Bit: Start Mission on Temperature Alarmstatic byte
MCR_BIT_TEMPERATURE_RESOLUTION
Mission Control Register Bit: Set Temperature Resolutionstatic int
MISSION_CONTROL_REGISTER
Address of Mission Control Registerstatic int
MISSION_LOG_SIZE
maximum size of the mission logstatic int
MISSION_SAMPLE_COUNT
Address of the Mission Sample Countstatic int
MISSION_START_DELAY
Address of the Mission Start Delaystatic int
MISSION_TIMESTAMP_DATE
Address of the Mission Timestamp Date valuestatic int
MISSION_TIMESTAMP_TIME
Address of the Mission Timestamp Time valuestatic int
ODD_MISSION_LOG_SIZE
mission log size for odd combination of resolutions (i.e.static int
PASSWORD_CONTROL_REGISTER
Address of the Password Control Register.static byte
RCR_BIT_ENABLE_HIGH_SPEED_SAMPLE
Real-Time Clock Control Register Bit: Enable High Speed Samplestatic byte
RCR_BIT_ENABLE_OSCILLATOR
Real-Time Clock Control Register Bit: Enable Oscillatorstatic int
READ_ACCESS_PASSWORD
Address of Read Access Password.static byte
READ_MEMORY_CRC_PW_COMMAND
1-Wire command for Read Memory CRC With Passwordstatic byte
READ_SCRATCHPAD_COMMAND
1-Wire command for Read Scratchpadstatic int
READ_WRITE_ACCESS_PASSWORD
Address of the Read Write Access Password.static int
RTC_CONTROL_REGISTER
Address of Real-Time Clock Control Registerstatic int
RTC_DATE
Address of the Real-time Clock Date valuestatic int
RTC_TIME
Address of the Real-time Clock Time valuestatic int
SAMPLE_RATE
Address of the Sample Rate Registerstatic byte
START_MISSION_PW_COMMAND
1-Wire command for Start Mission With Passwordstatic byte
STOP_MISSION_PW_COMMAND
1-Wire command for Stop Mission With Passwordstatic byte
TCR_BIT_ENABLE_TEMPERATURE_HIGH_ALARM
Temperature Control Register Bit: Enable Data Low Alarmstatic byte
TCR_BIT_ENABLE_TEMPERATURE_LOW_ALARM
Temperature Control Register Bit: Enable Data Low Alarmstatic int
TEMPERATURE_CHANNEL
Refers to the Temperature Channel for this devicestatic int
TEMPERATURE_CONTROL_REGISTER
Address of Temperature Control Registerstatic int
TEMPERATURE_HIGH_ALARM_THRESHOLD
Address of the Temperature High Alarm Registerstatic int
TEMPERATURE_LOW_ALARM_THRESHOLD
Address of the Temperature Low Alarm Registerstatic byte
WRITE_SCRATCHPAD_COMMAND
1-Wire command for Write Scratchpad-
Fields inherited from class com.dalsemi.onewire.container.OneWireContainer
adapter, address, speed, speedFallBackOK
-
Fields inherited from interface com.dalsemi.onewire.container.ADContainer
ALARM_HIGH, ALARM_LOW
-
Fields inherited from interface com.dalsemi.onewire.container.HumidityContainer
ALARM_HIGH, ALARM_LOW
-
Fields inherited from interface com.dalsemi.onewire.container.MissionContainer
ALARM_HIGH, ALARM_LOW
-
Fields inherited from interface com.dalsemi.onewire.container.TemperatureContainer
ALARM_HIGH, ALARM_LOW
-
-
Constructor Summary
Constructors Constructor Description OneWireContainer41()
Creates a newOneWireContainer
for communication with a DS1922.OneWireContainer41(DSPortAdapter sourceAdapter, byte[] newAddress)
Creates a newOneWireContainer
for communication with a DS1922.OneWireContainer41(DSPortAdapter sourceAdapter, long newAddress)
Creates a newOneWireContainer
for communication with a DS1922.OneWireContainer41(DSPortAdapter sourceAdapter, java.lang.String newAddress)
Creates a newOneWireContainer
for communication with a DS1922.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canADMultiChannelRead()
Checks to see if this A/D supports doing multiple voltage conversions at the same time.boolean
canDisableClock()
Checks to see if the clock can be disabled.void
clearMemory()
Erases the log memory from this missioning device.void
clearMissionResults()
Clears the mission results and erases the log memory from this missioning device.void
doADConvert(boolean[] doConvert, byte[] state)
Performs voltage conversion on one or more specified channels.void
doADConvert(int channel, byte[] state)
Performs a voltage conversion on one specified channel.void
doHumidityConvert(byte[] state)
Performs a Humidity conversion.void
doTemperatureConvert(byte[] state)
Performs a temperature conversion.double
getADAlarm(int channel, int alarmType, byte[] state)
Reads the value of the specified A/D alarm on the specified channel.boolean
getADAlarmEnable(int channel, int alarmType, byte[] state)
Checks to see if the specified alarm on the specified channel is enabled.int
getADDeviceBitCount()
double
getADRange(int channel, byte[] state)
Returns the currently selected range for the specified channel.double[]
getADRanges(int channel)
Gets an array of available ranges for the specified A/D channel.double
getADReferenceVoltage()
double
getADResolution(int channel, byte[] state)
Returns the currently selected resolution for the specified channel.double[]
getADResolutions(int channel, double range)
Gets an array of available resolutions based on the specified range on the specified A/D channel.double[]
getADVoltage(byte[] state)
Reads the value of the voltages after adoADConvert(boolean[],byte[])
method call.double
getADVoltage(int channel, byte[] state)
Reads the value of the voltages after adoADConvert(int,byte[])
method call.java.lang.String
getAlternateNames()
Retrieves the alternate Maxim Integrated Products part numbers or names.long
getClock(byte[] state)
Extracts the Real-Time clock value in milliseconds.long
getClockAlarm(byte[] state)
Extracts the clock alarm value for the Real-Time clock.long
getClockResolution()
Gets the clock resolution in millisecondsvoid
getContainerReadOnlyPassword(byte[] password, int offset)
Gets the Read-Only password used by the API when reading from the device's memory.void
getContainerReadWritePassword(byte[] password, int offset)
Gets the Read/Write password used by the API when reading from or writing to the device's memory.void
getContainerWriteOnlyPassword(byte[] password, int offset)
Gets the Write-Only password used by the API when writing to the device's memory.MemoryBankNVCRCPW
getDataLogMemoryBank()
Returns instance of the memory bank representing this device's data log.java.lang.String
getDescription()
Gets a short description of the function of this iButton or 1-Wire Device type.byte
getDeviceConfigByte()
Returns the Device Configuration Byte, which specifies whether or not this device is a DS1922, DS1923, or DS2422.boolean
getDeviceReadOnlyPasswordEnable()
Returns true if the device's Read-Only password has been enabled.boolean
getDeviceReadWritePasswordEnable()
Returns true if the device's Read/Write password has been enabled.int
getDeviceSampleCount()
Reads the device and returns the total number of samples logged since the first power-on of this device.int
getDeviceSampleCount(byte[] state)
Returns the total number of samples logged since the first power-on of this device.boolean
getDeviceWriteOnlyPasswordEnable()
Returns true if the device's Write-Only password has been enabled.long
getFirstSampleOffset(int channel)
Returns the amount of time, in milliseconds, before the first sample occurred.boolean
getFlag(int register, byte bitMask)
Gets the status of the specified flag from the specified register.boolean
getFlag(int register, byte bitMask, byte[] state)
Gets the status of the specified flag from the specified register.boolean
getForceADResults()
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 thestate
data retrieved from thereadDevice()
method.double
getHumidityAlarmResolution()
Gets the Humidity alarm resolution in percent.double
getHumidityResolution(byte[] state)
Gets the current Humidity resolution in percent from thestate
data retrieved from thereadDevice()
method.double[]
getHumidityResolutions()
Get an array of available Humidity resolutions in percent humidity (0 to 100).int
getMaxSpeed()
Returns the maximum speed this iButton device can communicate at.double
getMaxTemperature()
Gets the maximum temperature in Celsius.java.util.Enumeration<MemoryBank>
getMemoryBanks()
Gets an enumeration of memory bank instances that implement one or more of the following interfaces:MemoryBank
,PagedMemoryBank
, andOTPMemoryBank
.double
getMinTemperature()
Gets the minimum temperature in Celsius.double
getMissionAlarm(int channel, int alarmType)
Returns the threshold value which will trigger the alarm of the specified type on the specified channel.boolean
getMissionAlarmEnable(int channel, int alarmType)
Returns true if the alarm of the specified type has been enabled for the specified channel.boolean
getMissionChannelEnable(int channel)
Returns true if the specified mission channel is enabled, indicating that the channel's readings will be recorded in the mission log.boolean
getMissionChannelEnable(int channel, byte[] state)
Returns true if the specified mission channel is enabled, indicating that the channel's readings will be recorded in the mission log.java.lang.String
getMissionLabel(int channel)
Returns a default friendly label for each channel supported by this Missioning device.double
getMissionResolution(int channel)
Returns the currently selected resolution for the specified channel.double[]
getMissionResolutions(int channel)
Returns all available resolutions for the specified mission channel.double
getMissionSample(int channel, int sampleNum)
Returns the sample as degrees celsius if temperature channel is specified or as percent relative humidity if data channel is specified.int
getMissionSampleAsInteger(int channel, int sampleNum)
Returns the sample as an integer value.int
getMissionSampleCount(int channel)
Returns the number of samples available for the specified channel during the current mission.int
getMissionSampleCountTotal(int channel)
Returns the total number of samples taken for the specified channel during the current mission.int
getMissionSampleRate(int channel)
Returns the amount of time, in seconds, between samples taken by this missioning device.long
getMissionSampleTimeStamp(int channel, int sampleNum)
Returns the time, in milliseconds, that each sample was taken by the current mission.long
getMissionTimeStamp(int channel)
Returns the time, in milliseconds, that the mission began.java.lang.String
getName()
Gets the Maxim Integrated Products part number of the iButton or 1-Wire Device as ajava.lang.String
.int
getNumberADChannels()
Gets the number of channels supported by this A/D.int
getNumberMissionChannels()
Gets the number of channels supported by this Missioning device.int
getReadOnlyPasswordAddress()
Returns the absolute address of the memory location where the Read-Only password is written.int
getReadOnlyPasswordLength()
Returns the length in bytes of the Read-Only password.int
getReadWritePasswordAddress()
Returns the absolute address of the memory location where the Read/Write password is written.int
getReadWritePasswordLength()
Returns the length in bytes of the Read/Write password.MemoryBankNVCRCPW
getRegisterMemoryBank()
Returns instance of the memory bank representing this device's special function registers.MemoryBankScratchCRCPW
getScratchpadMemoryBank()
Returns instance of the memory bank representing this device's scratchpad.double
getTemperature(byte[] state)
Gets the temperature value in Celsius from thestate
data retrieved from thereadDevice()
method.double
getTemperatureAlarm(int alarmType, byte[] state)
Gets the specified temperature alarm value in Celsius from thestate
data retrieved from thereadDevice()
method.double
getTemperatureAlarmResolution()
Gets the temperature alarm resolution in Celsius.double
getTemperatureResolution(byte[] state)
Gets the current temperature resolution in Celsius from thestate
data retrieved from thereadDevice()
method.double[]
getTemperatureResolutions()
Get an array of available temperature resolutions in Celsius.MemoryBankNVCRCPW
getUserDataMemoryBank()
Returns instance of the memory bank representing this device's general-purpose user data memory.int
getWriteOnlyPasswordAddress()
Returns the absolute address of the memory location where the Write-Only password is written.int
getWriteOnlyPasswordLength()
Returns the length in bytes of the Write-Only password.boolean
hasADAlarmed(int channel, int alarmType, byte[] state)
Checks the state of the specified alarm on the specified channel.boolean
hasADAlarms()
Checks to see if this A/D measuring device has high/low alarms.boolean
hasClockAlarm()
Checks 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
hasMissionAlarmed(int channel, int alarmType)
Returns true if the specified channel's alarm value of the specified type has been triggered during the mission.boolean
hasMissionAlarms(int channel)
Indicates whether or not the specified channel of this missioning device has mission alarm capabilities.boolean
hasMissionRolloverOccurred()
Returnstrue
if a mission has rolled over.boolean
hasReadOnlyPassword()
Returns true if this device has a Read-Only password.boolean
hasReadWritePassword()
Returns true if this device has a Read/Write password.boolean
hasSelectableHumidityResolution()
Checks to see if this device has selectable Humidity resolution.boolean
hasSelectableTemperatureResolution()
Checks to see if this device has selectable temperature resolution.boolean
hasSinglePasswordEnable()
Returns true if this device has the capability to enable one type of password while leaving another type disabled.boolean
hasTemperatureAlarms()
Checks to see if this temperature measuring device has high/low trip alarms.boolean
hasWriteOnlyPassword()
Returns true if this device has a Write-Only password.boolean
isClockAlarmEnabled(byte[] state)
Checks if the clock alarm is enabled.boolean
isClockAlarming(byte[] state)
Checks if the clock alarm flag has been set.boolean
isClockRunning(byte[] state)
Checks if the device's oscillator is enabled.boolean
isContainerReadOnlyPasswordSet()
Returns true if the password used by the API for reading from the device's memory has been set.boolean
isContainerReadWritePasswordSet()
Returns true if the password used by the API for reading from or writing to the device's memory has been set.boolean
isContainerWriteOnlyPasswordSet()
Returns true if the password used by the API for writing to the device's memory has been set.boolean
isMissionLoaded()
Returns true if the mission results have been loaded from the device.boolean
isMissionRolloverEnabled()
Returnstrue
if a rollover is enabled.boolean
isMissionRunning()
Returnstrue
if a mission is currently running.boolean
isMissionSUTA()
Returns true if the currently loaded mission results indicate that this mission has the SUTA bit enabled.boolean
isMissionWFTA()
Returns true if the currently loaded mission results indicate that this mission has the SUTA bit enabled and is still Waiting For Temperature Alarm (WFTA).boolean
isRelative()
Checks to see if humidity value given is a 'relative' humidity value.boolean
isStartUponTemperatureAlarmEnabled()
Returns true if the SUTA (Start Upon Temperature Alarm) bit in the Mission Control register is set.boolean
isStartUponTemperatureAlarmEnabled(byte[] state)
Returns true if the SUTA (Start Upon Temperature Alarm) bit in the Mission Control register is set.void
loadMissionResults()
Loads the results of the currently running mission.byte
readByte(int memAddr)
Reads a single byte from the DS1922.byte[]
readDevice()
Retrieves the 1-Wire device sensor state.void
setADAlarm(int channel, int alarmType, double alarm, byte[] state)
Sets the voltage value of the specified alarm on the specified channel.void
setADAlarmEnable(int channel, int alarmType, boolean alarmEnable, byte[] state)
Enables or disables the specified alarm on the specified channel.void
setADDeviceBitCount(int bits)
void
setADRange(int channel, double range, byte[] state)
Sets the input range for the specified channel.void
setADReferenceVoltage(double referenceVoltage)
void
setADResolution(int channel, double resolution, byte[] state)
Sets the conversion resolution value for the specified channel.void
setClock(long time, byte[] state)
Sets the Real-Time clock.void
setClockAlarm(long time, byte[] state)
Sets the clock alarm.void
setClockAlarmEnable(boolean alarmEnable, byte[] state)
Enables or disables the clock alarm.void
setClockRunEnable(boolean runEnable, byte[] state)
Enables or disables the oscillator, turning the clock 'on' and 'off'.void
setContainerReadOnlyPassword(byte[] password, int offset)
Sets the Read-Only password used by the API when reading from the device's memory.void
setContainerReadWritePassword(byte[] password, int offset)
Sets the Read/Write password used by the API when reading from or writing to the device's memory.void
setContainerWriteOnlyPassword(byte[] password, int offset)
Sets the Write-Only password used by the API when writing to the device's memory.void
setDefaultTemperatureCompensationValue(double temperatureValue, boolean override)
Sets the default temperature value for temperature compensation.void
setDevicePasswordEnable(boolean enableReadOnly, boolean enableReadWrite, boolean enableWriteOnly)
Enables/Disables passwords for this Device.void
setDevicePasswordEnableAll(boolean enableAll)
Enables/Disables passwords for this device.void
setDeviceReadOnlyPassword(byte[] password, int offset)
Writes the given password to the device's Read-Only password register.void
setDeviceReadWritePassword(byte[] password, int offset)
Writes the given password to the device's Read/Write password register.void
setDeviceWriteOnlyPassword(byte[] password, int offset)
Writes the given password to the device's Write-Only password register.void
setFlag(int register, byte bitMask, boolean flagValue)
Sets the status of the specified flag in the specified register.void
setFlag(int register, byte bitMask, boolean flagValue, byte[] state)
Sets the status of the specified flag in the specified register.void
setForceADResults(boolean force)
void
setHumidityAlarm(int alarmType, double alarmValue, byte[] state)
Sets the Humidity alarm value in percent in the providedstate
data.void
setHumidityCalibrationRegisterUsage(boolean use)
Enables/Disables the usage of the humidity calibration registers.void
setHumidityResolution(double resolution, byte[] state)
Sets the current Humidity resolution in percent in the providedstate
data.void
setMissionAlarm(int channel, int alarmType, double threshold)
Sets the threshold value which will trigger the alarm of the specified type on the specified channel.void
setMissionAlarmEnable(int channel, int alarmType, boolean enable)
Enables/disables the alarm of the specified type for the specified channelvoid
setMissionChannelEnable(int channel, boolean enable)
Enables/disables the specified mission channel, indicating whether or not the channel's readings will be recorded in the mission log.void
setMissionChannelEnable(int channel, boolean enable, byte[] state)
Enables/disables the specified mission channel, indicating whether or not the channel's readings will be recorded in the mission log.void
setMissionResolution(int channel, double resolution)
Sets the selected resolution for the specified channel.void
setSpeedCheck(boolean doSpeedCheck)
Directs the container to avoid the calls to doSpeed() in methods that communicate with the DS1922/DS2422.void
setStartUponTemperatureAlarmEnable(boolean enable)
Sets the SUTA (Start Upon Temperature Alarm) bit in the Mission Control register.void
setStartUponTemperatureAlarmEnable(boolean enable, byte[] state)
Sets the SUTA (Start Upon Temperature Alarm) bit in the Mission Control register.void
setTemperatureAlarm(int alarmType, double alarmValue, byte[] state)
Sets the temperature alarm value in Celsius in the providedstate
data.void
setTemperatureCalibrationRegisterUsage(boolean use)
Enables/Disables the usage of calibration registers.void
setTemperatureCompensationUsage(boolean use)
Enables/Disables the usage of temperature compensation.void
setTemperatureResolution(double resolution, byte[] state)
Sets the current temperature resolution in Celsius in the providedstate
data.void
setupContainer(DSPortAdapter sourceAdapter, byte[] newAddress)
Provides this container with the adapter object used to access this device and the address of the iButton or 1-Wire device.void
setupContainer(DSPortAdapter sourceAdapter, long newAddress)
Provides this container with the adapter object used to access this device and the address of the iButton or 1-Wire device.void
setupContainer(DSPortAdapter sourceAdapter, java.lang.String newAddress)
Provides this container with the adapter object used to access this device and the address of the iButton or 1-Wire device.void
startMission()
Starts a new mission.void
startNewMission(int sampleRate, int missionStartDelay, boolean rolloverEnabled, boolean syncClock, boolean[] channelEnabled)
Begins a new mission on this missioning device.void
stopMission()
Stops the currently running mission.void
writeDevice(byte[] state)
Writes the 1-Wire device sensor state that have been changed by 'set' methods.-
Methods inherited from class com.dalsemi.onewire.container.OneWireContainer
doSpeed, equals, getAdapter, getAddress, getAddressAsLong, getAddressAsString, hashCode, isAlarming, isPresent, setSpeed, toString
-
-
-
-
Field Detail
-
TEMPERATURE_CHANNEL
public static final int TEMPERATURE_CHANNEL
Refers to the Temperature Channel for this device- See Also:
- Constant Field Values
-
DATA_CHANNEL
public static final int DATA_CHANNEL
Refers to the Humidity/A-D Channel for this device- See Also:
- Constant Field Values
-
WRITE_SCRATCHPAD_COMMAND
public static final byte WRITE_SCRATCHPAD_COMMAND
1-Wire command for Write Scratchpad- See Also:
- Constant Field Values
-
READ_SCRATCHPAD_COMMAND
public static final byte READ_SCRATCHPAD_COMMAND
1-Wire command for Read Scratchpad- See Also:
- Constant Field Values
-
COPY_SCRATCHPAD_PW_COMMAND
public static final byte COPY_SCRATCHPAD_PW_COMMAND
1-Wire command for Copy Scratchpad With Password- See Also:
- Constant Field Values
-
READ_MEMORY_CRC_PW_COMMAND
public static final byte READ_MEMORY_CRC_PW_COMMAND
1-Wire command for Read Memory CRC With Password- See Also:
- Constant Field Values
-
CLEAR_MEMORY_PW_COMMAND
public static final byte CLEAR_MEMORY_PW_COMMAND
1-Wire command for Clear Memory With Password- See Also:
- Constant Field Values
-
START_MISSION_PW_COMMAND
public static final byte START_MISSION_PW_COMMAND
1-Wire command for Start Mission With Password- See Also:
- Constant Field Values
-
STOP_MISSION_PW_COMMAND
public static final byte STOP_MISSION_PW_COMMAND
1-Wire command for Stop Mission With Password- See Also:
- Constant Field Values
-
FORCED_CONVERSION
public static final byte FORCED_CONVERSION
1-Wire command for Forced Conversion- See Also:
- Constant Field Values
-
RTC_TIME
public static final int RTC_TIME
Address of the Real-time Clock Time value- See Also:
- Constant Field Values
-
RTC_DATE
public static final int RTC_DATE
Address of the Real-time Clock Date value- See Also:
- Constant Field Values
-
SAMPLE_RATE
public static final int SAMPLE_RATE
Address of the Sample Rate Register- See Also:
- Constant Field Values
-
TEMPERATURE_LOW_ALARM_THRESHOLD
public static final int TEMPERATURE_LOW_ALARM_THRESHOLD
Address of the Temperature Low Alarm Register- See Also:
- Constant Field Values
-
TEMPERATURE_HIGH_ALARM_THRESHOLD
public static final int TEMPERATURE_HIGH_ALARM_THRESHOLD
Address of the Temperature High Alarm Register- See Also:
- Constant Field Values
-
DATA_LOW_ALARM_THRESHOLD
public static final int DATA_LOW_ALARM_THRESHOLD
Address of the Data Low Alarm Register- See Also:
- Constant Field Values
-
DATA_HIGH_ALARM_THRESHOLD
public static final int DATA_HIGH_ALARM_THRESHOLD
Address of the Data High Alarm Register- See Also:
- Constant Field Values
-
LAST_TEMPERATURE_CONVERSION_LSB
public static final int LAST_TEMPERATURE_CONVERSION_LSB
Address of the last temperature conversion's LSB- See Also:
- Constant Field Values
-
LAST_TEMPERATURE_CONVERSION_MSB
public static final int LAST_TEMPERATURE_CONVERSION_MSB
Address of the last temperature conversion's MSB- See Also:
- Constant Field Values
-
LAST_DATA_CONVERSION_LSB
public static final int LAST_DATA_CONVERSION_LSB
Address of the last data conversion's LSB- See Also:
- Constant Field Values
-
LAST_DATA_CONVERSION_MSB
public static final int LAST_DATA_CONVERSION_MSB
Address of the last data conversion's MSB- See Also:
- Constant Field Values
-
TEMPERATURE_CONTROL_REGISTER
public static final int TEMPERATURE_CONTROL_REGISTER
Address of Temperature Control Register- See Also:
- Constant Field Values
-
TCR_BIT_ENABLE_TEMPERATURE_LOW_ALARM
public static final byte TCR_BIT_ENABLE_TEMPERATURE_LOW_ALARM
Temperature Control Register Bit: Enable Data Low Alarm- See Also:
- Constant Field Values
-
TCR_BIT_ENABLE_TEMPERATURE_HIGH_ALARM
public static final byte TCR_BIT_ENABLE_TEMPERATURE_HIGH_ALARM
Temperature Control Register Bit: Enable Data Low Alarm- See Also:
- Constant Field Values
-
DATA_CONTROL_REGISTER
public static final int DATA_CONTROL_REGISTER
Address of Data Control Register- See Also:
- Constant Field Values
-
DCR_BIT_ENABLE_DATA_LOW_ALARM
public static final byte DCR_BIT_ENABLE_DATA_LOW_ALARM
Data Control Register Bit: Enable Data Low Alarm- See Also:
- Constant Field Values
-
DCR_BIT_ENABLE_DATA_HIGH_ALARM
public static final byte DCR_BIT_ENABLE_DATA_HIGH_ALARM
Data Control Register Bit: Enable Data High Alarm- See Also:
- Constant Field Values
-
RTC_CONTROL_REGISTER
public static final int RTC_CONTROL_REGISTER
Address of Real-Time Clock Control Register- See Also:
- Constant Field Values
-
RCR_BIT_ENABLE_OSCILLATOR
public static final byte RCR_BIT_ENABLE_OSCILLATOR
Real-Time Clock Control Register Bit: Enable Oscillator- See Also:
- Constant Field Values
-
RCR_BIT_ENABLE_HIGH_SPEED_SAMPLE
public static final byte RCR_BIT_ENABLE_HIGH_SPEED_SAMPLE
Real-Time Clock Control Register Bit: Enable High Speed Sample- See Also:
- Constant Field Values
-
MISSION_CONTROL_REGISTER
public static final int MISSION_CONTROL_REGISTER
Address of Mission Control Register- See Also:
- Constant Field Values
-
MCR_BIT_ENABLE_TEMPERATURE_LOGGING
public static final byte MCR_BIT_ENABLE_TEMPERATURE_LOGGING
Mission Control Register Bit: Enable Temperature Logging- See Also:
- Constant Field Values
-
MCR_BIT_ENABLE_DATA_LOGGING
public static final byte MCR_BIT_ENABLE_DATA_LOGGING
Mission Control Register Bit: Enable Data Logging- See Also:
- Constant Field Values
-
MCR_BIT_TEMPERATURE_RESOLUTION
public static final byte MCR_BIT_TEMPERATURE_RESOLUTION
Mission Control Register Bit: Set Temperature Resolution- See Also:
- Constant Field Values
-
MCR_BIT_DATA_RESOLUTION
public static final byte MCR_BIT_DATA_RESOLUTION
Mission Control Register Bit: Set Data Resolution- See Also:
- Constant Field Values
-
MCR_BIT_ENABLE_ROLLOVER
public static final byte MCR_BIT_ENABLE_ROLLOVER
Mission Control Register Bit: Enable Rollover- See Also:
- Constant Field Values
-
MCR_BIT_START_MISSION_ON_TEMPERATURE_ALARM
public static final byte MCR_BIT_START_MISSION_ON_TEMPERATURE_ALARM
Mission Control Register Bit: Start Mission on Temperature Alarm- See Also:
- Constant Field Values
-
ALARM_STATUS_REGISTER
public static final int ALARM_STATUS_REGISTER
Address of Alarm Status Register- See Also:
- Constant Field Values
-
ASR_BIT_TEMPERATURE_LOW_ALARM
public static final byte ASR_BIT_TEMPERATURE_LOW_ALARM
Alarm Status Register Bit: Temperature Low Alarm- See Also:
- Constant Field Values
-
ASR_BIT_TEMPERATURE_HIGH_ALARM
public static final byte ASR_BIT_TEMPERATURE_HIGH_ALARM
Alarm Status Register Bit: Temperature High Alarm- See Also:
- Constant Field Values
-
ASR_BIT_DATA_LOW_ALARM
public static final byte ASR_BIT_DATA_LOW_ALARM
Alarm Status Register Bit: Data Low Alarm- See Also:
- Constant Field Values
-
ASR_BIT_DATA_HIGH_ALARM
public static final byte ASR_BIT_DATA_HIGH_ALARM
Alarm Status Register Bit: Data High Alarm- See Also:
- Constant Field Values
-
ASR_BIT_BATTERY_ON_RESET
public static final byte ASR_BIT_BATTERY_ON_RESET
Alarm Status Register Bit: Battery On Reset- See Also:
- Constant Field Values
-
GENERAL_STATUS_REGISTER
public static final int GENERAL_STATUS_REGISTER
Address of General Status Register- See Also:
- Constant Field Values
-
GSR_BIT_SAMPLE_IN_PROGRESS
public static final byte GSR_BIT_SAMPLE_IN_PROGRESS
General Status Register Bit: Sample In Progress- See Also:
- Constant Field Values
-
GSR_BIT_MISSION_IN_PROGRESS
public static final byte GSR_BIT_MISSION_IN_PROGRESS
General Status Register Bit: Mission In Progress- See Also:
- Constant Field Values
-
GSR_BIT_CONVERSION_IN_PROGRESS
public static final byte GSR_BIT_CONVERSION_IN_PROGRESS
General Status Register Bit: Conversion In Progress- See Also:
- Constant Field Values
-
GSR_BIT_MEMORY_CLEARED
public static final byte GSR_BIT_MEMORY_CLEARED
General Status Register Bit: Memory Cleared- See Also:
- Constant Field Values
-
GSR_BIT_WAITING_FOR_TEMPERATURE_ALARM
public static final byte GSR_BIT_WAITING_FOR_TEMPERATURE_ALARM
General Status Register Bit: Waiting for Temperature Alarm- See Also:
- Constant Field Values
-
GSR_BIT_FORCED_CONVERSION_IN_PROGRESS
public static final byte GSR_BIT_FORCED_CONVERSION_IN_PROGRESS
General Status Register Bit: Forced Conversion In Progress- See Also:
- Constant Field Values
-
MISSION_START_DELAY
public static final int MISSION_START_DELAY
Address of the Mission Start Delay- See Also:
- Constant Field Values
-
MISSION_TIMESTAMP_TIME
public static final int MISSION_TIMESTAMP_TIME
Address of the Mission Timestamp Time value- See Also:
- Constant Field Values
-
MISSION_TIMESTAMP_DATE
public static final int MISSION_TIMESTAMP_DATE
Address of the Mission Timestamp Date value- See Also:
- Constant Field Values
-
DEVICE_CONFIGURATION_BYTE
public static final int DEVICE_CONFIGURATION_BYTE
Address of Device Configuration Register- See Also:
- Constant Field Values
-
DCB_DS2422
public static final byte DCB_DS2422
Value of Device Configuration Register for DS1922S- See Also:
- Constant Field Values
-
DCB_DS1923
public static final byte DCB_DS1923
Value of Device Configuration Register for DS1923- See Also:
- Constant Field Values
-
DCB_DS1922L
public static final byte DCB_DS1922L
Value of Device Configuration Register for DS1922L- See Also:
- Constant Field Values
-
DCB_DS1922T
public static final byte DCB_DS1922T
Value of Device Configuration Register for DS1922T- See Also:
- Constant Field Values
-
DCB_DS1922E
public static final byte DCB_DS1922E
Value of Device Configuration Register for DS1922E- See Also:
- Constant Field Values
-
DCB_DS1922S
public static final byte DCB_DS1922S
Value of Device Configuration Register for DS1922S- See Also:
- Constant Field Values
-
PASSWORD_CONTROL_REGISTER
public static final int PASSWORD_CONTROL_REGISTER
Address of the Password Control Register.- See Also:
- Constant Field Values
-
READ_ACCESS_PASSWORD
public static final int READ_ACCESS_PASSWORD
Address of Read Access Password.- See Also:
- Constant Field Values
-
READ_WRITE_ACCESS_PASSWORD
public static final int READ_WRITE_ACCESS_PASSWORD
Address of the Read Write Access Password.- See Also:
- Constant Field Values
-
MISSION_SAMPLE_COUNT
public static final int MISSION_SAMPLE_COUNT
Address of the Mission Sample Count- See Also:
- Constant Field Values
-
DEVICE_SAMPLE_COUNT
public static final int DEVICE_SAMPLE_COUNT
Address of the Device Sample Count- See Also:
- Constant Field Values
-
MISSION_LOG_SIZE
public static final int MISSION_LOG_SIZE
maximum size of the mission log- See Also:
- Constant Field Values
-
ODD_MISSION_LOG_SIZE
public static final int ODD_MISSION_LOG_SIZE
mission log size for odd combination of resolutions (i.e. 8-bit temperature & 16-bit data or 16-bit temperature & 8-bit data- See Also:
- Constant Field Values
-
-
Constructor Detail
-
OneWireContainer41
public OneWireContainer41()
Creates a newOneWireContainer
for communication with a DS1922. Note that the methodsetupContainer(DSPortAdapter,byte[])
must be called to set the correctDSPortAdapter
device address.
-
OneWireContainer41
public OneWireContainer41(DSPortAdapter sourceAdapter, byte[] newAddress)
Creates a newOneWireContainer
for communication with a DS1922.- Parameters:
sourceAdapter
- adapter object required to communicate with this iButtonnewAddress
- address of this DS1922- See Also:
OneWireContainer41()
,OneWireContainer41(DSPortAdapter,long)
,OneWireContainer41(DSPortAdapter,String)
-
OneWireContainer41
public OneWireContainer41(DSPortAdapter sourceAdapter, long newAddress)
Creates a newOneWireContainer
for communication with a DS1922.- Parameters:
sourceAdapter
- adapter object required to communicate with this iButtonnewAddress
- address of this DS1922- See Also:
OneWireContainer41()
,OneWireContainer41(DSPortAdapter,byte[])
,OneWireContainer41(DSPortAdapter,String)
-
OneWireContainer41
public OneWireContainer41(DSPortAdapter sourceAdapter, java.lang.String newAddress)
Creates a newOneWireContainer
for communication with a DS1922.- Parameters:
sourceAdapter
- adapter object required to communicate with this iButtonnewAddress
- address of this DS1922- See Also:
OneWireContainer41()
,OneWireContainer41(DSPortAdapter,long)
,OneWireContainer41(DSPortAdapter,String)
-
-
Method Detail
-
setupContainer
public void setupContainer(DSPortAdapter sourceAdapter, byte[] newAddress)
Provides this container with the adapter object used to access this device and the address of the iButton or 1-Wire device.- Overrides:
setupContainer
in classOneWireContainer
- Parameters:
sourceAdapter
- adapter object required to communicate with this iButtonnewAddress
- address of this 1-Wire device- See Also:
Address
-
setupContainer
public void setupContainer(DSPortAdapter sourceAdapter, long newAddress)
Provides this container with the adapter object used to access this device and the address of the iButton or 1-Wire device.- Overrides:
setupContainer
in classOneWireContainer
- Parameters:
sourceAdapter
- adapter object required to communicate with this iButtonnewAddress
- address of this 1-Wire device- See Also:
Address
-
setupContainer
public void setupContainer(DSPortAdapter sourceAdapter, java.lang.String newAddress)
Provides this container with the adapter object used to access this device and the address of the iButton or 1-Wire device.- Overrides:
setupContainer
in classOneWireContainer
- Parameters:
sourceAdapter
- adapter object required to communicate with this iButtonnewAddress
- address of this 1-Wire device- See Also:
Address
-
readDevice
public byte[] readDevice() throws OneWireIOException, OneWireException
Retrieves the 1-Wire device sensor state. This state 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 interfaceOneWireSensor
- Returns:
- 1-Wire device sensor state
- Throws:
OneWireIOException
- 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 adapter
-
writeDevice
public void writeDevice(byte[] state) throws OneWireIOException, OneWireException
Writes the 1-Wire device sensor state 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 interfaceOneWireSensor
- Parameters:
state
- 1-Wire device sensor state- Throws:
OneWireIOException
- 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 adapter
-
readByte
public byte readByte(int memAddr) throws OneWireIOException, OneWireException
Reads a single byte from the DS1922. Note that the preferred manner of reading from the DS1922 Thermocron is through thereadDevice()
method or through theMemoryBank
objects returned in thegetMemoryBanks()
method.- Parameters:
memAddr
- the address to read from (in the range of 0x200-0x21F)- Returns:
- the data byte read
- Throws:
OneWireIOException
- 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 adapter- See Also:
readDevice()
,getMemoryBanks()
-
getFlag
public boolean getFlag(int register, byte bitMask) throws OneWireIOException, OneWireException
Gets the status of the specified flag from the specified register. This method actually communicates with the DS1922. To improve performance if you intend to make multiple calls to this method, first call
readDevice()
and use thegetFlag(int, byte, byte[])
method instead.The DS1922 has several sets of flags.
- Register:
TEMPERATURE_CONTROL_REGISTER
Flags:TCR_BIT_ENABLE_TEMPERATURE_LOW_ALARM
TCR_BIT_ENABLE_TEMPERATURE_HIGH_ALARM
- Register:
DATA_CONTROL_REGISTER
Flags:DCR_BIT_ENABLE_DATA_LOW_ALARM
DCR_BIT_ENABLE_DATA_HIGH_ALARM
- Register:
RTC_CONTROL_REGISTER
Flags:RCR_BIT_ENABLE_OSCILLATOR
RCR_BIT_ENABLE_HIGH_SPEED_SAMPLE
- Register:
MISSION_CONTROL_REGISTER
Flags:MCR_BIT_ENABLE_TEMPERATURE_LOGGING
MCR_BIT_ENABLE_DATA_LOGGING
MCR_BIT_TEMPERATURE_RESOLUTION
MCR_BIT_DATA_RESOLUTION
MCR_BIT_ENABLE_ROLLOVER
MCR_BIT_START_MISSION_UPON_TEMPERATURE_ALARM
- Register:
ALARM_STATUS_REGISTER
Flags:ASR_BIT_TEMPERATURE_LOW_ALARM
ASR_BIT_TEMPERATURE_HIGH_ALARM
ASR_BIT_DATA_LOW_ALARM
ASR_BIT_DATA_HIGH_ALARM
ASR_BIT_BATTERY_ON_RESET
- Register:
GENERAL_STATUS_REGISTER
Flags:GSR_BIT_SAMPLE_IN_PROGRESS
GSR_BIT_MISSION_IN_PROGRESS
GSR_BIT_MEMORY_CLEARED
GSR_BIT_WAITING_FOR_TEMPERATURE_ALARM
- Parameters:
register
- address of register containing the flag (see above for available options)bitMask
- the flag to read (see above for available options)- Returns:
- the status of the flag, where
true
signifies a "1" andfalse
signifies a "0" - Throws:
OneWireIOException
- 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 adapter- See Also:
getFlag(int,byte,byte[])
,readDevice()
,setFlag(int,byte,boolean)
- Register:
-
getFlag
public boolean getFlag(int register, byte bitMask, byte[] state)
Gets the status of the specified flag from the specified register. This method is the preferred manner of reading the control and status flags.
For more information on valid values for the
bitMask
parameter, see thegetFlag(int,byte)
method.- Parameters:
register
- address of register containing the flag (seegetFlag(int,byte)
for available options)bitMask
- the flag to read (seegetFlag(int,byte)
for available options)state
- current state of the device returned fromreadDevice()
- Returns:
- the status of the flag, where
true
signifies a "1" andfalse
signifies a "0" - See Also:
getFlag(int,byte)
,readDevice()
,setFlag(int,byte,boolean,byte[])
-
setFlag
public void setFlag(int register, byte bitMask, boolean flagValue) throws OneWireIOException, OneWireException
Sets the status of the specified flag in the specified register. If a mission is in progress a
OneWireIOException
will be thrown (one cannot write to the registers while a mission is commencing). This method actually communicates with the DS1922. To improve performance if you intend to make multiple calls to this method, first callreadDevice()
and use thesetFlag(int,byte,boolean,byte[])
method instead.For more information on valid values for the
bitMask
parameter, see thegetFlag(int,byte)
method.- Parameters:
register
- address of register containing the flag (seegetFlag(int,byte)
for available options)bitMask
- the flag to read (seegetFlag(int,byte)
for available options)flagValue
- new value for the flag (true
is logic "1")- Throws:
OneWireIOException
- 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'. In the case of the DS1922, this could also be due to a currently running mission.OneWireException
- on a communication or setup error with the 1-Wire adapter- See Also:
getFlag(int,byte)
,getFlag(int,byte,byte[])
,setFlag(int,byte,boolean,byte[])
,readDevice()
-
setFlag
public void setFlag(int register, byte bitMask, boolean flagValue, byte[] state)
Sets the status of the specified flag in the specified register. If a mission is in progress a
OneWireIOException
will be thrown (one cannot write to the registers while a mission is commencing). This method is the preferred manner of setting the DS1922 status and control flags. The methodwriteDevice()
must be called to finalize changes to the device. Note that multiple 'set' methods can be called before one call towriteDevice()
.For more information on valid values for the
bitMask
parameter, see thegetFlag(int,byte)
method.- Parameters:
register
- address of register containing the flag (seegetFlag(int,byte)
for available options)bitMask
- the flag to read (seegetFlag(int,byte)
for available options)flagValue
- new value for the flag (true
is logic "1")state
- current state of the device returned fromreadDevice()
- See Also:
getFlag(int,byte)
,getFlag(int,byte,byte[])
,setFlag(int,byte,boolean)
,readDevice()
,writeDevice(byte[])
-
getMemoryBanks
public java.util.Enumeration<MemoryBank> getMemoryBanks()
Gets an enumeration of memory bank instances that implement one or more of the following interfaces:MemoryBank
,PagedMemoryBank
, andOTPMemoryBank
.- Overrides:
getMemoryBanks
in classOneWireContainer
- Returns:
Enumeration
of memory banks- See Also:
MemoryBank
-
getScratchpadMemoryBank
public MemoryBankScratchCRCPW getScratchpadMemoryBank()
Returns instance of the memory bank representing this device's scratchpad.- Returns:
- scratchpad memory bank
-
getUserDataMemoryBank
public MemoryBankNVCRCPW getUserDataMemoryBank()
Returns instance of the memory bank representing this device's general-purpose user data memory.- Returns:
- user data memory bank
-
getDataLogMemoryBank
public MemoryBankNVCRCPW getDataLogMemoryBank()
Returns instance of the memory bank representing this device's data log.- Returns:
- data log memory bank
-
getRegisterMemoryBank
public MemoryBankNVCRCPW getRegisterMemoryBank()
Returns instance of the memory bank representing this device's special function registers.- Returns:
- register memory bank
-
getMaxSpeed
public int getMaxSpeed()
Returns the maximum speed this iButton device can communicate at.- Overrides:
getMaxSpeed
in classOneWireContainer
- Returns:
- maximum speed
- See Also:
DSPortAdapter.setSpeed(int)
-
getName
public java.lang.String getName()
Gets the Maxim Integrated Products part number of the iButton or 1-Wire Device as ajava.lang.String
. For example "DS1992".- Overrides:
getName
in classOneWireContainer
- Returns:
- iButton or 1-Wire device name
-
getAlternateNames
public java.lang.String getAlternateNames()
Retrieves the alternate Maxim Integrated Products part numbers or names. A 'family' of MicroLAN devices may have more than one part number depending on packaging. There can also be nicknames such as "Crypto iButton".- Overrides:
getAlternateNames
in classOneWireContainer
- Returns:
- the alternate names for this iButton or 1-Wire device
-
getDescription
public java.lang.String getDescription()
Gets a short description of the function of this iButton or 1-Wire Device type.- Overrides:
getDescription
in classOneWireContainer
- Returns:
- device description
-
getDeviceConfigByte
public byte getDeviceConfigByte() throws OneWireIOException, OneWireException
Returns the Device Configuration Byte, which specifies whether or not this device is a DS1922, DS1923, or DS2422.- Returns:
- the Device Configuration Byte
- Throws:
OneWireIOException
OneWireException
-
setSpeedCheck
public void setSpeedCheck(boolean doSpeedCheck)
Directs the container to avoid the calls to doSpeed() in methods that communicate with the DS1922/DS2422. To ensure that all parts can talk to the 1-Wire bus at their desired speed, each method contains a call todoSpeed()
. However, this is an expensive operation. If a user manages the bus speed in an application, call this method withdoSpeedCheck
asfalse
. The default behavior is to calldoSpeed()
.- Parameters:
doSpeedCheck
-true
fordoSpeed()
to be called before every 1-Wire bus access,false
to skip this expensive call- See Also:
OneWireContainer.doSpeed()
-
stopMission
public void stopMission() throws OneWireException, OneWireIOException
Stops the currently running mission.- Specified by:
stopMission
in interfaceMissionContainer
- Throws:
OneWireException
OneWireIOException
-
startMission
public void startMission() throws OneWireException, OneWireIOException
Starts a new mission. Assumes all parameters have been set by either writing directly to the device registers, or by calling other setup methods.- Throws:
OneWireException
OneWireIOException
-
clearMemory
public void clearMemory() throws OneWireException, OneWireIOException
Erases the log memory from this missioning device.- Throws:
OneWireException
OneWireIOException
-
getReadOnlyPasswordLength
public int getReadOnlyPasswordLength() throws OneWireException
Returns the length in bytes of the Read-Only password.- Specified by:
getReadOnlyPasswordLength
in interfacePasswordContainer
- Returns:
- the length in bytes of the Read-Only password.
- Throws:
OneWireException
-
getReadWritePasswordLength
public int getReadWritePasswordLength() throws OneWireException
Returns the length in bytes of the Read/Write password.- Specified by:
getReadWritePasswordLength
in interfacePasswordContainer
- Returns:
- the length in bytes of the Read/Write password.
- Throws:
OneWireException
-
getWriteOnlyPasswordLength
public int getWriteOnlyPasswordLength() throws OneWireException
Returns the length in bytes of the Write-Only password.- Specified by:
getWriteOnlyPasswordLength
in interfacePasswordContainer
- Returns:
- the length in bytes of the Write-Only password.
- Throws:
OneWireException
-
getReadOnlyPasswordAddress
public int getReadOnlyPasswordAddress() throws OneWireException
Returns the absolute address of the memory location where the Read-Only password is written.- Specified by:
getReadOnlyPasswordAddress
in interfacePasswordContainer
- Returns:
- the absolute address of the memory location where the Read-Only password is written.
- Throws:
OneWireException
-
getReadWritePasswordAddress
public int getReadWritePasswordAddress() throws OneWireException
Returns the absolute address of the memory location where the Read/Write password is written.- Specified by:
getReadWritePasswordAddress
in interfacePasswordContainer
- Returns:
- the absolute address of the memory location where the Read/Write password is written.
- Throws:
OneWireException
-
getWriteOnlyPasswordAddress
public int getWriteOnlyPasswordAddress() throws OneWireException
Returns the absolute address of the memory location where the Write-Only password is written.- Specified by:
getWriteOnlyPasswordAddress
in interfacePasswordContainer
- Returns:
- the absolute address of the memory location where the Write-Only password is written.
- Throws:
OneWireException
-
hasReadOnlyPassword
public boolean hasReadOnlyPassword()
Returns true if this device has a Read-Only password. If false, all other functions dealing with the Read-Only password will throw an exception if called.- Specified by:
hasReadOnlyPassword
in interfacePasswordContainer
- Returns:
true
always, since DS1922 has Read-Only password.
-
hasReadWritePassword
public boolean hasReadWritePassword()
Returns true if this device has a Read/Write password. If false, all other functions dealing with the Read/Write password will throw an exception if called.- Specified by:
hasReadWritePassword
in interfacePasswordContainer
- Returns:
true
always, since DS1922 has Read/Write password.
-
hasWriteOnlyPassword
public boolean hasWriteOnlyPassword()
Returns true if this device has a Write-Only password. If false, all other functions dealing with the Write-Only password will throw an exception if called.- Specified by:
hasWriteOnlyPassword
in interfacePasswordContainer
- Returns:
false
always, since DS1922 has no Write-Only password.
-
getDeviceReadOnlyPasswordEnable
public boolean getDeviceReadOnlyPasswordEnable() throws OneWireException
Returns true if the device's Read-Only password has been enabled.- Specified by:
getDeviceReadOnlyPasswordEnable
in interfacePasswordContainer
- Returns:
true
if the device's Read-Only password has been enabled.- Throws:
OneWireException
-
getDeviceReadWritePasswordEnable
public boolean getDeviceReadWritePasswordEnable() throws OneWireException
Returns true if the device's Read/Write password has been enabled.- Specified by:
getDeviceReadWritePasswordEnable
in interfacePasswordContainer
- Returns:
true
if the device's Read/Write password has been enabled.- Throws:
OneWireException
-
getDeviceWriteOnlyPasswordEnable
public boolean getDeviceWriteOnlyPasswordEnable() throws OneWireException
Returns true if the device's Write-Only password has been enabled.- Specified by:
getDeviceWriteOnlyPasswordEnable
in interfacePasswordContainer
- Returns:
true
if the device's Write-Only password has been enabled.- Throws:
OneWireException
-
hasSinglePasswordEnable
public boolean hasSinglePasswordEnable()
Returns true if this device has the capability to enable one type of password while leaving another type disabled. i.e. if the device has Read-Only password protection and Write-Only password protection, this method indicates whether or not you can enable Read-Only protection while leaving the Write-Only protection disabled.- Specified by:
hasSinglePasswordEnable
in interfacePasswordContainer
- Returns:
true
if the device has the capability to enable one type of password while leaving another type disabled.
-
setDevicePasswordEnable
public void setDevicePasswordEnable(boolean enableReadOnly, boolean enableReadWrite, boolean enableWriteOnly) throws OneWireException, OneWireIOException
Enables/Disables passwords for this Device. This method allows you to individually enable the different types of passwords for a particular device. If
hasSinglePasswordEnable()
returns true, you can selectively enable particular types of passwords. Otherwise, this method will throw an exception if all supported types are not enabled.For this to be successful, either write-protect passwords must be disabled, or the write-protect password(s) for this container must be set and must match the value of the write-protect password(s) in the device's register.
WARNING: Enabling passwords requires that both the read password and the read/write password be re-written to the part. Before calling this method, you should set the container read password and read/write password values. This will ensure that the correct value is written into the part.
- Specified by:
setDevicePasswordEnable
in interfacePasswordContainer
- Parameters:
enableReadOnly
- iftrue
Read-Only passwords will be enabled.enableReadWrite
- iftrue
Read/Write passwords will be enabled.enableWriteOnly
- iftrue
Write-Only passwords will be enabled.- Throws:
OneWireException
OneWireIOException
-
setDevicePasswordEnableAll
public void setDevicePasswordEnableAll(boolean enableAll) throws OneWireException, OneWireIOException
Enables/Disables passwords for this device. If the part has more than one type of password (Read-Only, Write-Only, or Read/Write), all passwords will be enabled. This function is equivalent to the following:
owc41.setDevicePasswordEnable( owc41.hasReadOnlyPassword(), owc41.hasReadWritePassword(), owc41.hasWriteOnlyPassword() );
For this to be successful, either write-protect passwords must be disabled, or the write-protect password(s) for this container must be set and must match the value of the write-protect password(s) in the device's register.
WARNING: Enabling passwords requires that both the read password and the read/write password be re-written to the part. Before calling this method, you should set the container read password and read/write password values. This will ensure that the correct value is written into the part.
- Specified by:
setDevicePasswordEnableAll
in interfacePasswordContainer
- Parameters:
enableAll
- iftrue
, all passwords are enabled. Otherwise, all passwords are disabled.- Throws:
OneWireException
OneWireIOException
-
setDeviceReadOnlyPassword
public void setDeviceReadOnlyPassword(byte[] password, int offset) throws OneWireException, OneWireIOException
Writes the given password to the device's Read-Only password register. Note that this function does not enable the password, just writes the value to the appropriate memory location.
For this to be successful, either write-protect passwords must be disabled, or the write-protect password(s) for this container must be set and must match the value of the write-protect password(s) in the device's register.
WARNING: Setting the read password requires that both the read password and the read/write password be written to the part. Before calling this method, you should set the container read/write password value. This will ensure that the correct value is written into the part.
- Specified by:
setDeviceReadOnlyPassword
in interfacePasswordContainer
- Parameters:
password
- the new password to be written to the device's Read-Only password register. Length must be(offset + getReadOnlyPasswordLength)
offset
- the starting point for copying from the given password array- Throws:
OneWireException
OneWireIOException
-
setDeviceReadWritePassword
public void setDeviceReadWritePassword(byte[] password, int offset) throws OneWireException, OneWireIOException
Writes the given password to the device's Read/Write password register. Note that this function does not enable the password, just writes the value to the appropriate memory location.
For this to be successful, either write-protect passwords must be disabled, or the write-protect password(s) for this container must be set and must match the value of the write-protect password(s) in the device's register.
- Specified by:
setDeviceReadWritePassword
in interfacePasswordContainer
- Parameters:
password
- the new password to be written to the device's Read-Write password register. Length must be(offset + getReadWritePasswordLength)
offset
- the starting point for copying from the given password array- Throws:
OneWireException
OneWireIOException
-
setDeviceWriteOnlyPassword
public void setDeviceWriteOnlyPassword(byte[] password, int offset) throws OneWireException, OneWireIOException
Writes the given password to the device's Write-Only password register. Note that this function does not enable the password, just writes the value to the appropriate memory location.
For this to be successful, either write-protect passwords must be disabled, or the write-protect password(s) for this container must be set and must match the value of the write-protect password(s) in the device's register.
- Specified by:
setDeviceWriteOnlyPassword
in interfacePasswordContainer
- Parameters:
password
- the new password to be written to the device's Write-Only password register. Length must be(offset + getWriteOnlyPasswordLength)
offset
- the starting point for copying from the given password array- Throws:
OneWireException
OneWireIOException
-
setContainerReadOnlyPassword
public void setContainerReadOnlyPassword(byte[] password, int offset) throws OneWireException
Sets the Read-Only password used by the API when reading from the device's memory. This password is not written to the device's Read-Only password register. It is the password used by the software for interacting with the device only.- Specified by:
setContainerReadOnlyPassword
in interfacePasswordContainer
- Parameters:
password
- the new password to be used by the API when reading from the device's memory. Length must be(offset + getReadOnlyPasswordLength)
offset
- the starting point for copying from the given password array- Throws:
OneWireException
-
setContainerReadWritePassword
public void setContainerReadWritePassword(byte[] password, int offset) throws OneWireException
Sets the Read/Write password used by the API when reading from or writing to the device's memory. This password is not written to the device's Read/Write password register. It is the password used by the software for interacting with the device only.- Specified by:
setContainerReadWritePassword
in interfacePasswordContainer
- Parameters:
password
- the new password to be used by the API when reading from or writing to the device's memory. Length must be(offset + getReadWritePasswordLength)
offset
- the starting point for copying from the given password array- Throws:
OneWireException
-
setContainerWriteOnlyPassword
public void setContainerWriteOnlyPassword(byte[] password, int offset) throws OneWireException
Sets the Write-Only password used by the API when writing to the device's memory. This password is not written to the device's Write-Only password register. It is the password used by the software for interacting with the device only.- Specified by:
setContainerWriteOnlyPassword
in interfacePasswordContainer
- Parameters:
password
- the new password to be used by the API when writing to the device's memory. Length must be(offset + getWriteOnlyPasswordLength)
offset
- the starting point for copying from the given password array- Throws:
OneWireException
-
isContainerReadOnlyPasswordSet
public boolean isContainerReadOnlyPasswordSet() throws OneWireException
Returns true if the password used by the API for reading from the device's memory has been set. The return value is not affected by whether or not the read password of the container actually matches the value in the device's password register- Specified by:
isContainerReadOnlyPasswordSet
in interfacePasswordContainer
- Returns:
true
if the password used by the API for reading from the device's memory has been set.- Throws:
OneWireException
-
isContainerReadWritePasswordSet
public boolean isContainerReadWritePasswordSet() throws OneWireException
Returns true if the password used by the API for reading from or writing to the device's memory has been set. The return value is not affected by whether or not the read/write password of the container actually matches the value in the device's password register.- Specified by:
isContainerReadWritePasswordSet
in interfacePasswordContainer
- Returns:
true
if the password used by the API for reading from or writing to the device's memory has been set.- Throws:
OneWireException
-
isContainerWriteOnlyPasswordSet
public boolean isContainerWriteOnlyPasswordSet() throws OneWireException
Returns true if the password used by the API for writing to the device's memory has been set. The return value is not affected by whether or not the write password of the container actually matches the value in the device's password register.- Specified by:
isContainerWriteOnlyPasswordSet
in interfacePasswordContainer
- Returns:
true
if the password used by the API for writing to the device's memory has been set.- Throws:
OneWireException
-
getContainerReadOnlyPassword
public void getContainerReadOnlyPassword(byte[] password, int offset) throws OneWireException
Gets the Read-Only password used by the API when reading from the device's memory. This password is not read from the device's Read-Only password register. It is the password used by the software for interacting with the device only and must have been set using thesetContainerReadOnlyPassword
method.- Specified by:
getContainerReadOnlyPassword
in interfacePasswordContainer
- Parameters:
password
- array for holding the password that is used by the API when reading from the device's memory. Length must be(offset + getWriteOnlyPasswordLength)
offset
- the starting point for copying into the given password array- Throws:
OneWireException
-
getContainerReadWritePassword
public void getContainerReadWritePassword(byte[] password, int offset) throws OneWireException
Gets the Read/Write password used by the API when reading from or writing to the device's memory. This password is not read from the device's Read/Write password register. It is the password used by the software for interacting with the device only and must have been set using thesetContainerReadWritePassword
method.- Specified by:
getContainerReadWritePassword
in interfacePasswordContainer
- Parameters:
password
- array for holding the password that is used by the API when reading from or writing to the device's memory. Length must be(offset + getReadWritePasswordLength)
offset
- the starting point for copying into the given password array- Throws:
OneWireException
-
getContainerWriteOnlyPassword
public void getContainerWriteOnlyPassword(byte[] password, int offset) throws OneWireException
Gets the Write-Only password used by the API when writing to the device's memory. This password is not read from the device's Write-Only password register. It is the password used by the software for interacting with the device only and must have been set using thesetContainerWriteOnlyPassword
method.- Specified by:
getContainerWriteOnlyPassword
in interfacePasswordContainer
- Parameters:
password
- array for holding the password that is used by the API when writing to the device's memory. Length must be(offset + getWriteOnlyPasswordLength)
offset
- the starting point for copying into the given password array- Throws:
OneWireException
-
getMissionLabel
public java.lang.String getMissionLabel(int channel) throws OneWireException, OneWireIOException
Returns a default friendly label for each channel supported by this Missioning device.- Specified by:
getMissionLabel
in interfaceMissionContainer
- Parameters:
channel
- the mission channel, between0
and(getNumberOfMissionChannels()-1)
- Returns:
- friendly label for the specified channel
- Throws:
OneWireException
OneWireIOException
-
setStartUponTemperatureAlarmEnable
public void setStartUponTemperatureAlarmEnable(boolean enable) throws OneWireException, OneWireIOException
Sets the SUTA (Start Upon Temperature Alarm) bit in the Mission Control register. This method will communicate with the device directly.- Parameters:
enable
- sets/clears the SUTA bit in the Mission Control register.- Throws:
OneWireException
OneWireIOException
-
setStartUponTemperatureAlarmEnable
public void setStartUponTemperatureAlarmEnable(boolean enable, byte[] state) throws OneWireException, OneWireIOException
Sets the SUTA (Start Upon Temperature Alarm) bit in the Mission Control register. This method will set the bit in the provided 'state' array, which should be acquired through a call toreadDevice()
. After updating the 'state', the methodwriteDevice(byte[])
should be called to commit your changes.- Parameters:
enable
- sets/clears the SUTA bit in the Mission Control register.state
- current state of the device returned fromreadDevice()
- Throws:
OneWireException
OneWireIOException
-
isStartUponTemperatureAlarmEnabled
public boolean isStartUponTemperatureAlarmEnabled() throws OneWireException, OneWireIOException
Returns true if the SUTA (Start Upon Temperature Alarm) bit in the Mission Control register is set. This method will communicate with the device to read the status of the SUTA bit.- Returns:
true
if the SUTA bit in the Mission Control register is set.- Throws:
OneWireException
OneWireIOException
-
isStartUponTemperatureAlarmEnabled
public boolean isStartUponTemperatureAlarmEnabled(byte[] state) throws OneWireException, OneWireIOException
Returns true if the SUTA (Start Upon Temperature Alarm) bit in the Mission Control register is set. This method will check for the bit in the provided 'state' array, which should be acquired through a call toreadDevice()
.- Parameters:
state
- current state of the device returned fromreadDevice()
- Returns:
true
if the SUTA bit in the Mission Control register is set.- Throws:
OneWireException
OneWireIOException
-
isMissionSUTA
public boolean isMissionSUTA() throws OneWireException, OneWireIOException
Returns true if the currently loaded mission results indicate that this mission has the SUTA bit enabled.- Returns:
true
if the currently loaded mission results indicate that this mission has the SUTA bit enabled.- Throws:
OneWireException
OneWireIOException
-
isMissionWFTA
public boolean isMissionWFTA() throws OneWireException, OneWireIOException
Returns true if the currently loaded mission results indicate that this mission has the SUTA bit enabled and is still Waiting For Temperature Alarm (WFTA).- Returns:
true
if the currently loaded mission results indicate that this mission has the SUTA bit enabled and is still Waiting For Temperature Alarm (WFTA).- Throws:
OneWireException
OneWireIOException
-
startNewMission
public void startNewMission(int sampleRate, int missionStartDelay, boolean rolloverEnabled, boolean syncClock, boolean[] channelEnabled) throws OneWireException, OneWireIOException
Begins a new mission on this missioning device.- Specified by:
startNewMission
in interfaceMissionContainer
- Parameters:
sampleRate
- indicates the sampling rate, in seconds, that this missioning device should log samples.missionStartDelay
- indicates the amount of time, in minutes, that should pass before the mission begins.rolloverEnabled
- iffalse
, this device will stop recording new samples after the data log is full. Otherwise, it will replace samples starting at the beginning.syncClock
- iftrue
, the real-time clock of this missioning device will be synchronized with the current time according to thisjava.util.Date
.- Throws:
OneWireException
OneWireIOException
-
loadMissionResults
public void loadMissionResults() throws OneWireException, OneWireIOException
Loads the results of the currently running mission. Must be called before all mission result/status methods.- Specified by:
loadMissionResults
in interfaceMissionContainer
- Throws:
OneWireException
OneWireIOException
-
isMissionLoaded
public boolean isMissionLoaded()
Returns true if the mission results have been loaded from the device.- Specified by:
isMissionLoaded
in interfaceMissionContainer
- Returns:
true
if the mission results have been loaded.
-
getNumberMissionChannels
public int getNumberMissionChannels()
Gets the number of channels supported by this Missioning device. Channel specific methods will use a channel number specified by an integer from [0 to (getNumberOfMissionChannels()
- 1)].- Specified by:
getNumberMissionChannels
in interfaceMissionContainer
- Returns:
- the number of channels
-
setMissionChannelEnable
public void setMissionChannelEnable(int channel, boolean enable) throws OneWireException, OneWireIOException
Enables/disables the specified mission channel, indicating whether or not the channel's readings will be recorded in the mission log.- Specified by:
setMissionChannelEnable
in interfaceMissionContainer
- Parameters:
channel
- the channel to enable/disableenable
- if true, the channel is enabled- Throws:
OneWireException
OneWireIOException
-
setMissionChannelEnable
public void setMissionChannelEnable(int channel, boolean enable, byte[] state) throws OneWireException, OneWireIOException
Enables/disables the specified mission channel, indicating whether or not the channel's readings will be recorded in the mission log.- Parameters:
channel
- the channel to enable/disableenable
- if true, the channel is enabledstate
- the state as returned from readDevice, for cached writes- Throws:
OneWireException
OneWireIOException
-
getMissionChannelEnable
public boolean getMissionChannelEnable(int channel) throws OneWireException, OneWireIOException
Returns true if the specified mission channel is enabled, indicating that the channel's readings will be recorded in the mission log.- Specified by:
getMissionChannelEnable
in interfaceMissionContainer
- Parameters:
channel
- the channel to enable/disableenable
- if true, the channel is enabled- Throws:
OneWireException
OneWireIOException
-
getMissionChannelEnable
public boolean getMissionChannelEnable(int channel, byte[] state) throws OneWireException, OneWireIOException
Returns true if the specified mission channel is enabled, indicating that the channel's readings will be recorded in the mission log.- Parameters:
channel
- the channel to enable/disableenable
- if true, the channel is enabled- Throws:
OneWireException
OneWireIOException
-
getMissionSampleRate
public int getMissionSampleRate(int channel) throws OneWireException, OneWireIOException
Returns the amount of time, in seconds, between samples taken by this missioning device.- Specified by:
getMissionSampleRate
in interfaceMissionContainer
- Parameters:
channel
- the mission channel, between0
and(getNumberOfMissionChannels()-1)
- Returns:
- time, in seconds, between sampling
- Throws:
OneWireException
OneWireIOException
-
getMissionSampleCount
public int getMissionSampleCount(int channel) throws OneWireException, OneWireIOException
Returns the number of samples available for the specified channel during the current mission.- Specified by:
getMissionSampleCount
in interfaceMissionContainer
- Parameters:
channel
- the mission channel, between0
and(getNumberOfMissionChannels()-1)
- Returns:
- number of samples available for the specified channel
- Throws:
OneWireException
OneWireIOException
-
getDeviceSampleCount
public int getDeviceSampleCount() throws OneWireException, OneWireIOException
Reads the device and returns the total number of samples logged since the first power-on of this device.- Returns:
- the total number of samples logged since the first power-on of this device.
- Throws:
OneWireException
OneWireIOException
-
getDeviceSampleCount
public int getDeviceSampleCount(byte[] state) throws OneWireException, OneWireIOException
Returns the total number of samples logged since the first power-on of this device.- Parameters:
state
- The current state of the device as return fromreadDevice()
- Returns:
- the total number of samples logged since the first power-on of this device.
- Throws:
OneWireException
OneWireIOException
-
getMissionSampleCountTotal
public int getMissionSampleCountTotal(int channel) throws OneWireException, OneWireIOException
Returns the total number of samples taken for the specified channel during the current mission. This number can be more than the actual sample count if rollover is enabled and the log has been filled.- Specified by:
getMissionSampleCountTotal
in interfaceMissionContainer
- Parameters:
channel
- the mission channel, between0
and(getNumberOfMissionChannels()-1)
- Returns:
- number of samples taken for the specified channel
- Throws:
OneWireException
OneWireIOException
-
getMissionSample
public double getMissionSample(int channel, int sampleNum) throws OneWireException, OneWireIOException
Returns the sample as degrees celsius if temperature channel is specified or as percent relative humidity if data channel is specified. If the device is a DS2422 configuration (or A-D results are forced on the DS1923), the data channel will return samples as the voltage measured.- Specified by:
getMissionSample
in interfaceMissionContainer
- Parameters:
channel
- the mission channel, between0
and(getNumberOfMissionChannels()-1)
sampleNum
- the sample number to return, between0
and(getMissionSampleCount(channel)-1)
- Returns:
- the sample's value in degrees Celsius or percent RH.
- Throws:
OneWireException
OneWireIOException
-
getMissionSampleAsInteger
public int getMissionSampleAsInteger(int channel, int sampleNum) throws OneWireException, OneWireIOException
Returns the sample as an integer value. This value is not converted to degrees Celsius for temperature or to percent RH for Humidity. It is simply the 8 or 16 bits of digital data written in the mission log for this sample entry. It is up to the user to mask off the unused bits and convert this value to it's proper units. This method is primarily for users of the DS2422 who are using an input device which is not an A-D or have an A-D wholly dissimilar to the one specified in the datasheet.- Specified by:
getMissionSampleAsInteger
in interfaceMissionContainer
- Parameters:
channel
- the mission channel, between0
and(getNumberOfMissionChannels()-1)
sampleNum
- the sample number to return, between0
and(getMissionSampleCount(channel)-1)
- Returns:
- the sample as a whole integer
- Throws:
OneWireException
OneWireIOException
-
getMissionSampleTimeStamp
public long getMissionSampleTimeStamp(int channel, int sampleNum) throws OneWireException, OneWireIOException
Returns the time, in milliseconds, that each sample was taken by the current mission.- Specified by:
getMissionSampleTimeStamp
in interfaceMissionContainer
- Parameters:
channel
- the mission channel, between0
and(getNumberOfMissionChannels()-1)
sampleNum
- the sample number to return, between0
and(getMissionSampleCount(channel)-1)
- Returns:
- the sample's timestamp, in milliseconds
- Throws:
OneWireException
OneWireIOException
-
isMissionRunning
public boolean isMissionRunning() throws OneWireException, OneWireIOException
Returnstrue
if a mission is currently running.- Specified by:
isMissionRunning
in interfaceMissionContainer
- Returns:
true
if a mission is currently running.- Throws:
OneWireException
OneWireIOException
-
isMissionRolloverEnabled
public boolean isMissionRolloverEnabled() throws OneWireException, OneWireIOException
Returnstrue
if a rollover is enabled.- Specified by:
isMissionRolloverEnabled
in interfaceMissionContainer
- Returns:
true
if a rollover is enabled.- Throws:
OneWireException
OneWireIOException
-
hasMissionRolloverOccurred
public boolean hasMissionRolloverOccurred() throws OneWireException, OneWireIOException
Returnstrue
if a mission has rolled over.- Specified by:
hasMissionRolloverOccurred
in interfaceMissionContainer
- Returns:
true
if a mission has rolled over.- Throws:
OneWireException
OneWireIOException
-
clearMissionResults
public void clearMissionResults() throws OneWireException, OneWireIOException
Clears the mission results and erases the log memory from this missioning device.- Specified by:
clearMissionResults
in interfaceMissionContainer
- Throws:
OneWireException
OneWireIOException
-
getMissionTimeStamp
public long getMissionTimeStamp(int channel) throws OneWireException, OneWireIOException
Returns the time, in milliseconds, that the mission began.- Specified by:
getMissionTimeStamp
in interfaceMissionContainer
- Parameters:
channel
- the mission channel, between0
and(getNumberOfMissionChannels()-1)
- Returns:
- time, in milliseconds, that the mission began
- Throws:
OneWireException
OneWireIOException
-
getFirstSampleOffset
public long getFirstSampleOffset(int channel) throws OneWireException, OneWireIOException
Returns the amount of time, in milliseconds, before the first sample occurred. If rollover disabled, or datalog didn't fill up, this will be 0.- Specified by:
getFirstSampleOffset
in interfaceMissionContainer
- Parameters:
channel
- the mission channel, between0
and(getNumberOfMissionChannels()-1)
- Returns:
- time, in milliseconds, before first sample occurred
- Throws:
OneWireException
OneWireIOException
-
getMissionResolutions
public double[] getMissionResolutions(int channel) throws OneWireException, OneWireIOException
Returns all available resolutions for the specified mission channel.- Specified by:
getMissionResolutions
in interfaceMissionContainer
- Parameters:
channel
- the mission channel, between0
and(getNumberOfMissionChannels()-1)
- Returns:
- all available resolutions for the specified mission channel.
- Throws:
OneWireException
OneWireIOException
-
getMissionResolution
public double getMissionResolution(int channel) throws OneWireException, OneWireIOException
Returns the currently selected resolution for the specified channel.- Specified by:
getMissionResolution
in interfaceMissionContainer
- Parameters:
channel
- the mission channel, between0
and(getNumberOfMissionChannels()-1)
- Returns:
- the currently selected resolution for the specified channel.
- Throws:
OneWireException
OneWireIOException
-
setMissionResolution
public void setMissionResolution(int channel, double resolution) throws OneWireException, OneWireIOException
Sets the selected resolution for the specified channel.- Specified by:
setMissionResolution
in interfaceMissionContainer
- Parameters:
channel
- the mission channel, between0
and(getNumberOfMissionChannels()-1)
resolution
- the new resolution for the specified channel.- Throws:
OneWireException
OneWireIOException
-
setTemperatureCalibrationRegisterUsage
public void setTemperatureCalibrationRegisterUsage(boolean use)
Enables/Disables the usage of calibration registers. Only applies to the DS1923 configuration. The calibration depends on an average error at 3 known reference points. This average error is written to 3 registers on the DS1922. The container use these values to calibrate the recorded humidity values and improve the accuracy of the device. This method allows you to turn off calibration so that you may download the actual data recorded to the device's memory and perform a manual calibration.- Parameters:
use
- iftrue
, all humidity values read from device will be calibrated.
-
setHumidityCalibrationRegisterUsage
public void setHumidityCalibrationRegisterUsage(boolean use)
Enables/Disables the usage of the humidity calibration registers. Only applies to the DS1923 configuration. The calibration depends on an average error at 3 known reference points. This average error is written to 3 registers on the DS1922. The container use these values to calibrate the recorded humidity values and improve the accuracy of the device. This method allows you to turn off calibration so that you may download the actual data recorded to the device's memory and perform a manual calibration.- Parameters:
use
- iftrue
, all humidity values read from device will be calibrated.
-
setTemperatureCompensationUsage
public void setTemperatureCompensationUsage(boolean use)
Enables/Disables the usage of temperature compensation. Only applies to the DS1923 configuration. The temperature compensation adjusts the humidity values based on the known effects of temperature on the humidity sensor. If this is a joint humidity and temperature mission, the temperature values used could (should?) come from the temperature log itself. If, however, there is no temperature log the default temperature value can be set for the mission using thesetDefaultTemperatureCompensationValue
method.- Parameters:
use
- iftrue
, all humidity values read from device will be compensated for temperature.- See Also:
setDefaultTemperatureCompensationValue(double, boolean)
-
setDefaultTemperatureCompensationValue
public void setDefaultTemperatureCompensationValue(double temperatureValue, boolean override)
Sets the default temperature value for temperature compensation. This value will be used if there is no temperature log data or if theoverride
parameter is true.- Parameters:
temperatureValue
- the default temperature value for temperature compensation.override
- iftrue
, the default temperature value will always be used (instead of the temperature log data).- See Also:
setDefaultTemperatureCompensationValue(double, boolean)
-
hasMissionAlarms
public boolean hasMissionAlarms(int channel)
Indicates whether or not the specified channel of this missioning device has mission alarm capabilities.- Specified by:
hasMissionAlarms
in interfaceMissionContainer
- Parameters:
channel
- the mission channel, between0
and(getNumberOfMissionChannels()-1)
- Returns:
- true if the device has mission alarms for the specified channel.
-
hasMissionAlarmed
public boolean hasMissionAlarmed(int channel, int alarmType) throws OneWireException, OneWireIOException
Returns true if the specified channel's alarm value of the specified type has been triggered during the mission.- Specified by:
hasMissionAlarmed
in interfaceMissionContainer
- Parameters:
channel
- the mission channel, between0
and(getNumberOfMissionChannels()-1)
alarmType
- valid value:ALARM_HIGH
orALARM_LOW
- Returns:
- true if the alarm was triggered.
- Throws:
OneWireException
OneWireIOException
-
getMissionAlarmEnable
public boolean getMissionAlarmEnable(int channel, int alarmType) throws OneWireException, OneWireIOException
Returns true if the alarm of the specified type has been enabled for the specified channel.- Specified by:
getMissionAlarmEnable
in interfaceMissionContainer
- Parameters:
channel
- the mission channel, between0
and(getNumberOfMissionChannels()-1)
alarmType
- valid value:ALARM_HIGH
orALARM_LOW
- Returns:
- true if the alarm of the specified type has been enabled for the specified channel.
- Throws:
OneWireException
OneWireIOException
-
setMissionAlarmEnable
public void setMissionAlarmEnable(int channel, int alarmType, boolean enable) throws OneWireException, OneWireIOException
Enables/disables the alarm of the specified type for the specified channel- Specified by:
setMissionAlarmEnable
in interfaceMissionContainer
- Parameters:
channel
- the mission channel, between0
and(getNumberOfMissionChannels()-1)
alarmType
- valid value:ALARM_HIGH
orALARM_LOW
enable
- if true, alarm is enabled.- Throws:
OneWireException
OneWireIOException
-
getMissionAlarm
public double getMissionAlarm(int channel, int alarmType) throws OneWireException, OneWireIOException
Returns the threshold value which will trigger the alarm of the specified type on the specified channel.- Specified by:
getMissionAlarm
in interfaceMissionContainer
- Parameters:
channel
- the mission channel, between0
and(getNumberOfMissionChannels()-1)
alarmType
- valid value:ALARM_HIGH
orALARM_LOW
- Returns:
- the threshold value which will trigger the alarm
- Throws:
OneWireException
OneWireIOException
-
setMissionAlarm
public void setMissionAlarm(int channel, int alarmType, double threshold) throws OneWireException, OneWireIOException
Sets the threshold value which will trigger the alarm of the specified type on the specified channel.- Specified by:
setMissionAlarm
in interfaceMissionContainer
- Parameters:
channel
- the mission channel, between0
and(getNumberOfMissionChannels()-1)
alarmType
- valid value:ALARM_HIGH
orALARM_LOW
threshold
- the threshold value which will trigger the alarm- Throws:
OneWireException
OneWireIOException
-
hasTemperatureAlarms
public boolean hasTemperatureAlarms()
Checks to see if this temperature measuring device has high/low trip alarms.- Specified by:
hasTemperatureAlarms
in interfaceTemperatureContainer
- Returns:
true
if thisTemperatureContainer
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 interfaceTemperatureContainer
- Returns:
true
if thisTemperatureContainer
has selectable temperature resolution- See Also:
getTemperatureResolution(byte[])
,getTemperatureResolutions()
,setTemperatureResolution(double, byte[])
-
getTemperatureResolutions
public double[] getTemperatureResolutions()
Get an array of available temperature resolutions in Celsius.- Specified by:
getTemperatureResolutions
in interfaceTemperatureContainer
- Returns:
- byte array of available temperature resolutions in Celsius with minimum resolution 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 interfaceTemperatureContainer
- Returns:
- temperature alarm resolution in Celsius for this 1-wire device
- See Also:
hasTemperatureAlarms()
,getTemperatureAlarm(int, byte[])
,setTemperatureAlarm(int, double, byte[])
-
getMaxTemperature
public double getMaxTemperature()
Gets the maximum temperature in Celsius.- Specified by:
getMaxTemperature
in interfaceTemperatureContainer
- Returns:
- maximum temperature in Celsius for this 1-wire device
- See Also:
getMinTemperature()
-
getMinTemperature
public double getMinTemperature()
Gets the minimum temperature in Celsius.- Specified by:
getMinTemperature
in interfaceTemperatureContainer
- Returns:
- minimum temperature in Celsius for this 1-wire device
- See Also:
getMaxTemperature()
-
doTemperatureConvert
public void doTemperatureConvert(byte[] state) throws OneWireIOException, OneWireException
Performs a temperature conversion. Use thestate
information to calculate the conversion time.- Specified by:
doTemperatureConvert
in interfaceTemperatureContainer
- Parameters:
state
- byte array with device state information- Throws:
OneWireIOException
- 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'. In the case of the DS1922 Thermocron, this could also be due to a currently running mission.OneWireException
- on a communication or setup error with the 1-Wire adapter
-
getTemperature
public double getTemperature(byte[] state)
Gets the temperature value in Celsius from thestate
data retrieved from thereadDevice()
method.- Specified by:
getTemperature
in interfaceTemperatureContainer
- Parameters:
state
- byte array with device state information- Returns:
- temperature in Celsius from the last
doTemperatureConvert()
-
getTemperatureAlarm
public double getTemperatureAlarm(int alarmType, byte[] state)
Gets the specified temperature alarm value in Celsius from thestate
data retrieved from thereadDevice()
method.- Specified by:
getTemperatureAlarm
in interfaceTemperatureContainer
- Parameters:
alarmType
- valid value:ALARM_HIGH
orALARM_LOW
state
- byte array with device state information- Returns:
- temperature alarm trip values in Celsius for this 1-wire device
- See Also:
hasTemperatureAlarms()
,setTemperatureAlarm(int, double, byte[])
-
getTemperatureResolution
public double getTemperatureResolution(byte[] state)
Gets the current temperature resolution in Celsius from thestate
data retrieved from thereadDevice()
method.- Specified by:
getTemperatureResolution
in interfaceTemperatureContainer
- Parameters:
state
- byte array with device state information- Returns:
- temperature resolution in Celsius for this 1-wire device
- 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 providedstate
data. Use the methodwriteDevice()
with this data to finalize the change to the device.- Specified by:
setTemperatureAlarm
in interfaceTemperatureContainer
- Parameters:
alarmType
- valid value:ALARM_HIGH
orALARM_LOW
alarmValue
- alarm trip value in Celsiusstate
- byte array with device state information- See Also:
hasTemperatureAlarms()
,getTemperatureAlarm(int, byte[])
-
setTemperatureResolution
public void setTemperatureResolution(double resolution, byte[] state) throws OneWireException
Sets the current temperature resolution in Celsius in the providedstate
data. Use the methodwriteDevice()
with this data to finalize the change to the device.- Specified by:
setTemperatureResolution
in interfaceTemperatureContainer
- Parameters:
resolution
- temperature resolution in Celsiusstate
- byte array with device state information- Throws:
OneWireException
- if the device does not support selectable temperature resolution- See Also:
hasSelectableTemperatureResolution()
,getTemperatureResolution(byte[])
,getTemperatureResolutions()
-
isRelative
public boolean isRelative()
Checks to see if humidity value given is a 'relative' humidity value.- Specified by:
isRelative
in interfaceHumidityContainer
- Returns:
true
if thisHumidityContainer
provides a relative humidity reading- See Also:
getHumidityResolution(byte[])
,getHumidityResolutions()
,setHumidityResolution(double, byte[])
-
hasHumidityAlarms
public boolean hasHumidityAlarms()
Checks to see if this Humidity measuring device has high/low trip alarms.- Specified by:
hasHumidityAlarms
in interfaceHumidityContainer
- Returns:
true
if thisHumidityContainer
has high/low trip alarms- See Also:
getHumidityAlarm(int, byte[])
,setHumidityAlarm(int, double, byte[])
-
hasSelectableHumidityResolution
public boolean hasSelectableHumidityResolution()
Checks to see if this device has selectable Humidity resolution.- Specified by:
hasSelectableHumidityResolution
in interfaceHumidityContainer
- Returns:
true
if thisHumidityContainer
has selectable Humidity resolution- See Also:
getHumidityResolution(byte[])
,getHumidityResolutions()
,setHumidityResolution(double, byte[])
-
getHumidityResolutions
public double[] getHumidityResolutions()
Get an array of available Humidity resolutions in percent humidity (0 to 100).- Specified by:
getHumidityResolutions
in interfaceHumidityContainer
- Returns:
- byte array of available Humidity resolutions in percent with minimum resolution as the first element and maximum resolution as the last element.
- See Also:
hasSelectableHumidityResolution()
,getHumidityResolution(byte[])
,setHumidityResolution(double, byte[])
-
getHumidityAlarmResolution
public double getHumidityAlarmResolution() throws OneWireException
Gets the Humidity alarm resolution in percent.- Specified by:
getHumidityAlarmResolution
in interfaceHumidityContainer
- Returns:
- Humidity alarm resolution in percent for this 1-wire device
- Throws:
OneWireException
- Device does not support Humidity alarms- See Also:
hasHumidityAlarms()
,getHumidityAlarm(int, byte[])
,setHumidityAlarm(int, double, byte[])
-
doHumidityConvert
public void doHumidityConvert(byte[] state) throws OneWireIOException, OneWireException
Performs a Humidity conversion.- Specified by:
doHumidityConvert
in interfaceHumidityContainer
- Parameters:
state
- byte array with device state information- Throws:
OneWireIOException
- 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 adapter
-
getHumidity
public double getHumidity(byte[] state)
Gets the humidity expressed as a percent value (0.0 to 100.0) of humidity.- Specified by:
getHumidity
in interfaceHumidityContainer
- Parameters:
state
- byte array with device state information- Returns:
- humidity expressed as a percent
- See Also:
hasSelectableHumidityResolution()
,getHumidityResolution(byte[])
,setHumidityResolution(double, byte[])
-
getHumidityResolution
public double getHumidityResolution(byte[] state)
Gets the current Humidity resolution in percent from thestate
data retrieved from thereadDevice()
method.- Specified by:
getHumidityResolution
in interfaceHumidityContainer
- Parameters:
state
- byte array with device state information- Returns:
- Humidity resolution in percent for this 1-wire device
- See Also:
hasSelectableHumidityResolution()
,getHumidityResolutions()
,setHumidityResolution(double, byte[])
-
getHumidityAlarm
public double getHumidityAlarm(int alarmType, byte[] state) throws OneWireException
Gets the specified Humidity alarm value in percent from thestate
data retrieved from thereadDevice()
method.- Specified by:
getHumidityAlarm
in interfaceHumidityContainer
- Parameters:
alarmType
- valid value:ALARM_HIGH
orALARM_LOW
state
- byte array with device state information- Returns:
- Humidity alarm trip values in percent for this 1-wire device
- Throws:
OneWireException
- Device does not support Humidity alarms- See Also:
hasHumidityAlarms()
,setHumidityAlarm(int, double, byte[])
-
setHumidityAlarm
public void setHumidityAlarm(int alarmType, double alarmValue, byte[] state) throws OneWireException
Sets the Humidity alarm value in percent in the providedstate
data. Use the methodwriteDevice()
with this data to finalize the change to the device.- Specified by:
setHumidityAlarm
in interfaceHumidityContainer
- Parameters:
alarmType
- valid value:ALARM_HIGH
orALARM_LOW
alarmValue
- alarm trip value in percentstate
- byte array with device state information- Throws:
OneWireException
- Device does not support Humidity alarms- See Also:
hasHumidityAlarms()
,getHumidityAlarm(int, byte[])
-
setHumidityResolution
public void setHumidityResolution(double resolution, byte[] state) throws OneWireException
Sets the current Humidity resolution in percent in the providedstate
data. Use the methodwriteDevice()
with this data to finalize the change to the device.- Specified by:
setHumidityResolution
in interfaceHumidityContainer
- Parameters:
resolution
- Humidity resolution in percentstate
- byte array with device state information- Throws:
OneWireException
- Device does not support selectable Humidity resolution- See Also:
hasSelectableHumidityResolution()
,getHumidityResolution(byte[])
,getHumidityResolutions()
-
getNumberADChannels
public int getNumberADChannels()
Gets the number of channels supported by this A/D. Channel specific methods will use a channel number specified by an integer from [0 to (getNumberADChannels()
- 1)].- Specified by:
getNumberADChannels
in interfaceADContainer
- Returns:
- the number of channels
-
hasADAlarms
public boolean hasADAlarms()
Checks to see if this A/D measuring device has high/low alarms.- Specified by:
hasADAlarms
in interfaceADContainer
- Returns:
- true if this device has high/low trip alarms
-
getADRanges
public double[] getADRanges(int channel)
Gets an array of available ranges for the specified A/D channel.- Specified by:
getADRanges
in interfaceADContainer
- Parameters:
channel
- channel number in the range [0 to (getNumberADChannels()
- 1)]- Returns:
- array indicating the available ranges starting from the largest range to the smallest range
- See Also:
getNumberADChannels()
-
getADResolutions
public double[] getADResolutions(int channel, double range)
Gets an array of available resolutions based on the specified range on the specified A/D channel.- Specified by:
getADResolutions
in interfaceADContainer
- Parameters:
channel
- channel number in the range [0 to (getNumberADChannels()
- 1)]range
- A/D range setting from thegetADRanges(int)
method- Returns:
- array indicating the available resolutions on this
channel
for thisrange
- See Also:
getNumberADChannels()
,getADRanges(int)
-
canADMultiChannelRead
public boolean canADMultiChannelRead()
Checks to see if this A/D supports doing multiple voltage conversions at the same time.- Specified by:
canADMultiChannelRead
in interfaceADContainer
- Returns:
- true if the device can do multi-channel voltage reads
- See Also:
doADConvert(boolean[],byte[])
-
doADConvert
public void doADConvert(int channel, byte[] state) throws OneWireIOException, OneWireException
Performs a voltage conversion on one specified channel. Use the methodgetADVoltage(int,byte[])
to read the result of this conversion, using the samechannel
argument as this method uses.- Specified by:
doADConvert
in interfaceADContainer
- Parameters:
channel
- channel number in the range [0 to (getNumberADChannels()
- 1)]state
- current state of the device returned fromreadDevice()
- Throws:
OneWireIOException
- on a 1-Wire communication error such as no 1-Wire device present. 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'. This is usually a recoverable error.OneWireException
- on a communication or setup error with the 1-Wire adapter. This is usually a non-recoverable error.- See Also:
OneWireSensor.readDevice()
,getADVoltage(int,byte[])
-
doADConvert
public void doADConvert(boolean[] doConvert, byte[] state) throws OneWireIOException, OneWireException
Performs voltage conversion on one or more specified channels. The methodgetADVoltage(byte[])
can be used to read the result of the conversion(s). This A/D must support multi-channel read, reported bycanADMultiChannelRead()
, if more then 1 channel is specified.- Specified by:
doADConvert
in interfaceADContainer
- Parameters:
doConvert
- array of sizegetNumberADChannels()
representing which channels should perform conversionsstate
- current state of the device returned fromreadDevice()
- Throws:
OneWireIOException
- on a 1-Wire communication error such as no 1-Wire device present. 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'. This is usually a recoverable error.OneWireException
- on a communication or setup error with the 1-Wire adapter. This is usually a non-recoverable error.- See Also:
OneWireSensor.readDevice()
,getADVoltage(byte[])
,canADMultiChannelRead()
-
getADVoltage
public double[] getADVoltage(byte[] state) throws OneWireIOException, OneWireException
Reads the value of the voltages after adoADConvert(boolean[],byte[])
method call. This A/D device must support multi-channel reading, reported bycanADMultiChannelRead()
, if more than 1 channel conversion was attempted bydoADConvert()
.- Specified by:
getADVoltage
in interfaceADContainer
- Parameters:
state
- current state of the device returned fromreadDevice()
- Returns:
- array with the voltage values for all channels
- Throws:
OneWireIOException
- on a 1-Wire communication error such as no 1-Wire device present. 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'. This is usually a recoverable error.OneWireException
- on a communication or setup error with the 1-Wire adapter. This is usually a non-recoverable error.- See Also:
doADConvert(boolean[],byte[])
-
getADVoltage
public double getADVoltage(int channel, byte[] state) throws OneWireIOException, OneWireException
Reads the value of the voltages after adoADConvert(int,byte[])
method call. If more than one channel has been read it is more efficient to use thegetADVoltage(byte[])
method that returns all channel voltage values.- Specified by:
getADVoltage
in interfaceADContainer
- Parameters:
channel
- channel number in the range [0 to (getNumberADChannels()
- 1)]state
- current state of the device returned fromreadDevice()
- Returns:
- the voltage value for the specified channel
- Throws:
OneWireIOException
- on a 1-Wire communication error such as no 1-Wire device present. 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'. This is usually a recoverable error.OneWireException
- on a communication or setup error with the 1-Wire adapter. This is usually a non-recoverable error.- See Also:
doADConvert(int,byte[])
,getADVoltage(byte[])
-
getADAlarm
public double getADAlarm(int channel, int alarmType, byte[] state) throws OneWireException
Reads the value of the specified A/D alarm on the specified channel. Not all A/D devices have alarms. Check to see if this device has alarms first by calling thehasADAlarms()
method.- Specified by:
getADAlarm
in interfaceADContainer
- Parameters:
channel
- channel number in the range [0 to (getNumberADChannels()
- 1)]alarmType
- the desired alarm,ALARM_HIGH
orALARM_LOW
state
- current state of the device returned fromreadDevice()
- Returns:
- the alarm value in volts
- Throws:
OneWireException
- if this device does not have A/D alarms- See Also:
OneWireSensor.readDevice()
,hasADAlarms()
-
getADAlarmEnable
public boolean getADAlarmEnable(int channel, int alarmType, byte[] state) throws OneWireException
Checks to see if the specified alarm on the specified channel is enabled. Not all A/D devices have alarms. Check to see if this device has alarms first by calling thehasADAlarms()
method.- Specified by:
getADAlarmEnable
in interfaceADContainer
- Parameters:
channel
- channel number in the range [0 to (getNumberADChannels()
- 1)]alarmType
- the desired alarm,ALARM_HIGH
orALARM_LOW
state
- current state of the device returned fromreadDevice()
- Returns:
- true if specified alarm is enabled
- Throws:
OneWireException
- if this device does not have A/D alarms- See Also:
OneWireSensor.readDevice()
,hasADAlarms()
-
hasADAlarmed
public boolean hasADAlarmed(int channel, int alarmType, byte[] state) throws OneWireException
Checks the state of the specified alarm on the specified channel. Not all A/D devices have alarms. Check to see if this device has alarms first by calling thehasADAlarms()
method.- Specified by:
hasADAlarmed
in interfaceADContainer
- Parameters:
channel
- channel number in the range [0 to (getNumberADChannels()
- 1)]alarmType
- the desired alarm,ALARM_HIGH
orALARM_LOW
state
- current state of the device returned fromreadDevice()
- Returns:
- true if specified alarm occurred
- Throws:
OneWireException
- if this device does not have A/D alarms- See Also:
OneWireSensor.readDevice()
,hasADAlarms()
,getADAlarmEnable(int,int,byte[])
,setADAlarmEnable(int,int,boolean,byte[])
-
getADResolution
public double getADResolution(int channel, byte[] state)
Returns the currently selected resolution for the specified channel. This device may not have selectable resolutions, though this method will return a valid value.- Specified by:
getADResolution
in interfaceADContainer
- Parameters:
channel
- channel number in the range [0 to (getNumberADChannels()
- 1)]state
- current state of the device returned fromreadDevice()
- Returns:
- the current resolution of
channel
in volts - See Also:
getADResolutions(int,double)
,setADResolution(int,double,byte[])
-
getADRange
public double getADRange(int channel, byte[] state)
Returns the currently selected range for the specified channel. This device may not have selectable ranges, though this method will return a valid value.- Specified by:
getADRange
in interfaceADContainer
- Parameters:
channel
- channel number in the range [0 to (getNumberADChannels()
- 1)]state
- current state of the device returned fromreadDevice()
- Returns:
- the input voltage range
- See Also:
getADRanges(int)
,setADRange(int,double,byte[])
-
setADAlarm
public void setADAlarm(int channel, int alarmType, double alarm, byte[] state) throws OneWireException
Sets the voltage value of the specified alarm on the specified channel. The methodwriteDevice()
must be called to finalize changes to the device. Note that multiple 'set' methods can be called before one call towriteDevice()
. Also note that not all A/D devices have alarms. Check to see if this device has alarms first by calling thehasADAlarms()
method.- Specified by:
setADAlarm
in interfaceADContainer
- Parameters:
channel
- channel number in the range [0 to (getNumberADChannels()
- 1)]alarmType
- the desired alarm,ALARM_HIGH
orALARM_LOW
alarm
- new alarm valuestate
- current state of the device returned fromreadDevice()
- Throws:
OneWireException
- if this device does not have A/D alarms- See Also:
OneWireSensor.writeDevice(byte[])
,hasADAlarms()
,getADAlarm(int,int,byte[])
,getADAlarmEnable(int,int,byte[])
,setADAlarmEnable(int,int,boolean,byte[])
,hasADAlarmed(int,int,byte[])
-
setADAlarmEnable
public void setADAlarmEnable(int channel, int alarmType, boolean alarmEnable, byte[] state) throws OneWireException
Enables or disables the specified alarm on the specified channel. The methodwriteDevice()
must be called to finalize changes to the device. Note that multiple 'set' methods can be called before one call towriteDevice()
. Also note that not all A/D devices have alarms. Check to see if this device has alarms first by calling thehasADAlarms()
method.- Specified by:
setADAlarmEnable
in interfaceADContainer
- Parameters:
channel
- channel number in the range [0 to (getNumberADChannels()
- 1)]alarmType
- the desired alarm,ALARM_HIGH
orALARM_LOW
alarmEnable
- true to enable the alarm, false to disablestate
- current state of the device returned fromreadDevice()
- Throws:
OneWireException
- if this device does not have A/D alarms- See Also:
OneWireSensor.writeDevice(byte[])
,hasADAlarms()
,getADAlarm(int,int,byte[])
,setADAlarm(int,int,double,byte[])
,getADAlarmEnable(int,int,byte[])
,hasADAlarmed(int,int,byte[])
-
setADResolution
public void setADResolution(int channel, double resolution, byte[] state)
Sets the conversion resolution value for the specified channel. The methodwriteDevice()
must be called to finalize changes to the device. Note that multiple 'set' methods can be called before one call towriteDevice()
. Also note that not all A/D devices have alarms. Check to see if this device has alarms first by calling thehasADAlarms()
method.- Specified by:
setADResolution
in interfaceADContainer
- Parameters:
channel
- channel number in the range [0 to (getNumberADChannels()
- 1)]resolution
- one of the resolutions returned bygetADResolutions(int,double)
state
- current state of the device returned fromreadDevice()
- See Also:
getADResolutions(int,double)
,getADResolution(int,byte[])
-
setADRange
public void setADRange(int channel, double range, byte[] state)
Sets the input range for the specified channel. The methodwriteDevice()
must be called to finalize changes to the device. Note that multiple 'set' methods can be called before one call towriteDevice()
. Also note that not all A/D devices have alarms. Check to see if this device has alarms first by calling thehasADAlarms()
method.- Specified by:
setADRange
in interfaceADContainer
- Parameters:
channel
- channel number in the range [0 to (getNumberADChannels()
- 1)]range
- one of the ranges returned bygetADRanges(int)
state
- current state of the device returned fromreadDevice()
- See Also:
getADRanges(int)
,getADRange(int,byte[])
-
setADReferenceVoltage
public void setADReferenceVoltage(double referenceVoltage)
-
getADReferenceVoltage
public double getADReferenceVoltage()
-
setADDeviceBitCount
public void setADDeviceBitCount(int bits)
-
getADDeviceBitCount
public int getADDeviceBitCount()
-
setForceADResults
public void setForceADResults(boolean force)
-
getForceADResults
public boolean getForceADResults()
-
hasClockAlarm
public boolean hasClockAlarm()
Checks to see if the clock has an alarm feature.- Specified by:
hasClockAlarm
in interfaceClockContainer
- Returns:
- false, since this device does not have clock alarms
- See Also:
getClockAlarm(byte[])
,isClockAlarmEnabled(byte[])
,isClockAlarming(byte[])
,setClockAlarm(long,byte[])
,setClockAlarmEnable(boolean,byte[])
-
canDisableClock
public boolean canDisableClock()
Checks to see if the clock can be disabled.- Specified by:
canDisableClock
in interfaceClockContainer
- Returns:
- true if the clock can be enabled and disabled
- See Also:
isClockRunning(byte[])
,setClockRunEnable(boolean,byte[])
-
getClockResolution
public long getClockResolution()
Gets the clock resolution in milliseconds- Specified by:
getClockResolution
in interfaceClockContainer
- Returns:
- the clock resolution in milliseconds
-
getClock
public long getClock(byte[] state)
Extracts the Real-Time clock value in milliseconds.- Specified by:
getClock
in interfaceClockContainer
- Parameters:
state
- current state of the device returned fromreadDevice()
- Returns:
- the time represented in this clock in milliseconds since 1970
- See Also:
OneWireSensor.readDevice()
,setClock(long,byte[])
-
getClockAlarm
public long getClockAlarm(byte[] state) throws OneWireException
Extracts the clock alarm value for the Real-Time clock.- Specified by:
getClockAlarm
in interfaceClockContainer
- Parameters:
state
- current state of the device returned fromreadDevice()
- Returns:
- milliseconds since 1970 that the clock alarm is set to
- Throws:
OneWireException
- if this device does not have clock alarms- See Also:
OneWireSensor.readDevice()
,hasClockAlarm()
,isClockAlarmEnabled(byte[])
,isClockAlarming(byte[])
,setClockAlarm(long,byte[])
,setClockAlarmEnable(boolean,byte[])
-
isClockAlarming
public boolean isClockAlarming(byte[] state)
Checks if the clock alarm flag has been set. This will occur when the value of the Real-Time clock equals the value of the clock alarm.- Specified by:
isClockAlarming
in interfaceClockContainer
- Parameters:
state
- current state of the device returned fromreadDevice()
- Returns:
- true if the Real-Time clock is alarming
- See Also:
OneWireSensor.readDevice()
,hasClockAlarm()
,isClockAlarmEnabled(byte[])
,getClockAlarm(byte[])
,setClockAlarm(long,byte[])
,setClockAlarmEnable(boolean,byte[])
-
isClockAlarmEnabled
public boolean isClockAlarmEnabled(byte[] state)
Checks if the clock alarm is enabled.- Specified by:
isClockAlarmEnabled
in interfaceClockContainer
- Parameters:
state
- current state of the device returned fromreadDevice()
- Returns:
- true if clock alarm is enabled
- See Also:
OneWireSensor.readDevice()
,hasClockAlarm()
,isClockAlarming(byte[])
,getClockAlarm(byte[])
,setClockAlarm(long,byte[])
,setClockAlarmEnable(boolean,byte[])
-
isClockRunning
public boolean isClockRunning(byte[] state)
Checks if the device's oscillator is enabled. The clock will not increment if the clock oscillator is not enabled.- Specified by:
isClockRunning
in interfaceClockContainer
- Parameters:
state
- current state of the device returned fromreadDevice()
- Returns:
- true if the clock is running
- See Also:
OneWireSensor.readDevice()
,canDisableClock()
,setClockRunEnable(boolean,byte[])
-
setClock
public void setClock(long time, byte[] state)
Sets the Real-Time clock. The methodwriteDevice()
must be called to finalize changes to the device. Note that multiple 'set' methods can be called before one call towriteDevice()
.- Specified by:
setClock
in interfaceClockContainer
- Parameters:
time
- new value for the Real-Time clock, in milliseconds since January 1, 1970state
- current state of the device returned fromreadDevice()
- See Also:
OneWireSensor.writeDevice(byte[])
,getClock(byte[])
-
setClockAlarm
public void setClockAlarm(long time, byte[] state) throws OneWireException
Sets the clock alarm. The methodwriteDevice()
must be called to finalize changes to the device. Note that multiple 'set' methods can be called before one call towriteDevice()
. Also note that not all clock devices have alarms. Check to see if this device has alarms first by calling thehasClockAlarm()
method.- Specified by:
setClockAlarm
in interfaceClockContainer
- Parameters:
time
- - new value for the Real-Time clock alarm, in milliseconds since January 1, 1970state
- current state of the device returned fromreadDevice()
- Throws:
OneWireException
- if this device does not have clock alarms- See Also:
OneWireSensor.writeDevice(byte[])
,hasClockAlarm()
,isClockAlarmEnabled(byte[])
,getClockAlarm(byte[])
,isClockAlarming(byte[])
,setClockAlarmEnable(boolean,byte[])
-
setClockRunEnable
public void setClockRunEnable(boolean runEnable, byte[] state)
Enables or disables the oscillator, turning the clock 'on' and 'off'. The methodwriteDevice()
must be called to finalize changes to the device. Note that multiple 'set' methods can be called before one call towriteDevice()
. Also note that not all clock devices can disable their oscillators. Check to see if this device can disable its oscillator first by calling thecanDisableClock()
method.- Specified by:
setClockRunEnable
in interfaceClockContainer
- Parameters:
runEnable
- true to enable the clock oscillatorstate
- current state of the device returned fromreadDevice()
- See Also:
OneWireSensor.writeDevice(byte[])
,canDisableClock()
,isClockRunning(byte[])
-
setClockAlarmEnable
public void setClockAlarmEnable(boolean alarmEnable, byte[] state) throws OneWireException
Enables or disables the clock alarm. The methodwriteDevice()
must be called to finalize changes to the device. Note that multiple 'set' methods can be called before one call towriteDevice()
. Also note that not all clock devices have alarms. Check to see if this device has alarms first by calling thehasClockAlarm()
method.- Specified by:
setClockAlarmEnable
in interfaceClockContainer
- Parameters:
alarmEnable
- true to enable the clock alarmstate
- current state of the device returned fromreadDevice()
- Throws:
OneWireException
- if this device does not have clock alarms- See Also:
OneWireSensor.writeDevice(byte[])
,hasClockAlarm()
,isClockAlarmEnabled(byte[])
,getClockAlarm(byte[])
,setClockAlarm(long,byte[])
,isClockAlarming(byte[])
-
-