|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.dalsemi.onewire.container.OneWireContainer | +--com.dalsemi.onewire.container.OneWireContainer04
1-Wire container for 512 byte memory iButton Plus Time, DS1994 and 1-Wire Chip, DS2404. This container encapsulates the functionality of the iButton family type 04 (hex)
This iButton is primarily used as a read/write portable memory device with real-time-clock, timer and experation features.
Appended to the clock page data retrieved with 'readDevice' are 4 bytes that represent a bitmap of changed bytes. These bytes are used in the 'writeDevice' method in conjuction with the 'set' methods to only write back the changed clock register bytes. The 'readDevice' method will clear any pending alarms.
WARNING: If write-protect alarm options have been set prior to a call to 'writeDevice' then the operation is non-reversable.
The memory can be accessed through the objects that are returned
from the getMemoryBanks
method.
MemoryBank
,
PagedMemoryBank
MemoryBank
,
PagedMemoryBank
MemoryBank
,
PagedMemoryBank
The clock methods can be organized into the following categories. Note that methods
that are implemented for the ClockContainer
interface are marked with (*):
ClockContainer
for basic clock operations.
OneWireContainer
to enumerate the MemoryBanks.
MemoryBank
and
PagedMemoryBank
for bank specific operations.
MemoryBank
,
PagedMemoryBank
,
ClockContainer
Constructor Summary | |
OneWireContainer04()
Create an empty container that is not complete until after a call to setupContainer . |
|
OneWireContainer04(DSPortAdapter sourceAdapter,
byte[] newAddress)
Create a container with the provided adapter instance and the address of the iButton or 1-Wire device. |
|
OneWireContainer04(DSPortAdapter sourceAdapter,
long newAddress)
Create a container with the provided adapter instance and the address of the iButton or 1-Wire device. |
|
OneWireContainer04(DSPortAdapter sourceAdapter,
String newAddress)
Create a container with the provided adapter instance and the address of the iButton or 1-Wire device. |
Method Summary | |
boolean |
canDisableClock()
Query to see if the clock can be disabled. |
boolean |
canReadAfterExpire(byte[] state)
Check if the device can be read after a write protected alarm has occured. |
String |
getAlternateNames()
Get the alternate Dallas Semiconductor 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()
Query to get the clock resolution in milliseconds |
long |
getCycleCounter(byte[] state)
Get the power cycle count value. |
long |
getCycleCounterAlarm(byte[] state)
Get the cycle count Alarm Value. |
String |
getDescription()
Get a short description of the function of this iButton or 1-Wire Device type. |
long |
getIntervalTimer(byte[] state)
Get the Interval Timer Value in milliseconds. |
long |
getIntervalTimerAlarm(byte[] state)
Get the Interval Timer Alarm Value. |
Enumeration |
getMemoryBanks()
Get an enumeration of memory bank instances that implement one or more of the following interfaces: MemoryBank ,
PagedMemoryBank ,
and OTPMemoryBank . |
String |
getName()
Get the Dallas Semiconductor part number of the iButton or 1-Wire Device as a string. |
boolean |
hasClockAlarm()
Query to see if the clock has an alarm feature. |
boolean |
isAutomaticDelayLong(byte[] state)
Checks if the automatic delay for the Inteval Timer and the Cycle counter is either 3.5ms (regular) or 123ms (long). |
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 |
isClockWriteProtected(byte[] state)
Check if the Real-Time clock/Alarm is write protected. |
boolean |
isCycleCounterAlarmEnabled(byte[] state)
Check if the Cycle Alarm is enabled. |
boolean |
isCycleCounterAlarming(byte[] state)
Check if the Cycle Alarm flag has been set. |
boolean |
isCycleCounterWriteProtected(byte[] state)
Check if the Cycle Counter and Alarm is write protected. |
boolean |
isIntervalTimerAlarmEnabled(byte[] state)
Check if the Interval Timer Alarm is enabled. |
boolean |
isIntervalTimerAlarming(byte[] state)
Check if the Interval Timer Alarm flag has been set. |
boolean |
isIntervalTimerAutomatic(byte[] state)
Checks if the Interval timer is automatic or manual. |
boolean |
isIntervalTimerStopped(byte[] state)
Check if the Interval timer is stopped. |
boolean |
isIntervalTimerWriteProtected(byte[] state)
Check if the Interval Timer and Interval Timer Alarm register is write protected. |
byte[] |
readDevice()
Retrieves the 1-Wire device sensor state. |
void |
setAutomaticDelayLong(boolean delayLong,
byte[] state)
Sets the automatic delay for the Inteval Timer and the Cycle counter to either 123ms (long) or 3.5ms (regular). |
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 |
setCycleCounter(long cycles,
byte[] state)
Sets power Cycle Counter. |
void |
setCycleCounterAlarm(long cycles,
byte[] state)
Sets the power Cycle Count Alarm. |
void |
setCycleCounterAlarmEnable(boolean alarmEnable,
byte[] state)
Sets the Cycle counter Alarm enable. |
void |
setIntervalTimer(long time,
byte[] state)
Sets the Interval Timer. |
void |
setIntervalTimerAlarm(long time,
byte[] state)
Sets the Interval Timer Alarm. |
void |
setIntervalTimerAlarmEnable(boolean alarmEnable,
byte[] state)
Sets the Interval Timer Alarm enable. |
void |
setIntervalTimerAutomatic(boolean autoTimer,
byte[] state)
Sets the Interval timer to automatic or manual mode. |
void |
setIntervalTimerRunState(boolean runState,
byte[] state)
Sets the Interval timer run/stop mode. |
void |
setReadAfterExpire(boolean readAfter,
byte[] state)
Sets the read state of the device after a write protected alarm has occured. |
void |
writeDevice(byte[] state)
Writes the 1-Wire device sensor state that have been changed by 'set' methods. |
void |
writeProtectClock(byte[] state)
Sets the write protect options for the Real-Time clock/Alarm. |
void |
writeProtectCycleCounter(byte[] state)
Sets the write protect options for the Cycle Counter and Alarm register. |
void |
writeProtectIntervalTimer(byte[] state)
Sets the write protect options for Interval Timer and Interval Timer Alarm register. |
Methods inherited from class com.dalsemi.onewire.container.OneWireContainer |
doSpeed, equals, getAdapter, getAddress, getAddressAsLong, getAddressAsString, getMaxSpeed, hashCode, isAlarming, isPresent, setSpeed, setupContainer, setupContainer, setupContainer, toString |
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public OneWireContainer04()
setupContainer
. This is one of the methods to construct a container. The others are through creating a OneWireContainer with parameters.
super.setupContainer()
public OneWireContainer04(DSPortAdapter sourceAdapter, byte[] newAddress)
This is one of the methods to construct a container. The other is through creating a OneWireContainer with NO parameters.
sourceAdapter
- adapter instance used to communicate with
this iButtonnewAddress
- Address
of this 1-Wire deviceOneWireContainer04
,
utils.Address
public OneWireContainer04(DSPortAdapter sourceAdapter, long newAddress)
This is one of the methods to construct a container. The other is through creating a OneWireContainer with NO parameters.
sourceAdapter
- adapter instance used to communicate with
this 1-Wire devicenewAddress
- Address
of this 1-Wire deviceOneWireContainer04
,
utils.Address
public OneWireContainer04(DSPortAdapter sourceAdapter, String newAddress)
This is one of the methods to construct a container. The other is through creating a OneWireContainer with NO parameters.
sourceAdapter
- adapter instance used to communicate with
this 1-Wire devicenewAddress
- Address
of this 1-Wire deviceOneWireContainer04
,
utils.Address
Method Detail |
public String getName()
getName
in class OneWireContainer
public String getAlternateNames()
getAlternateNames
in class OneWireContainer
public String getDescription()
getDescription
in class OneWireContainer
public Enumeration getMemoryBanks()
MemoryBank
,
PagedMemoryBank
,
and OTPMemoryBank
.getMemoryBanks
in class OneWireContainer
Enumeration
of memory bankspublic boolean hasClockAlarm()
hasClockAlarm
in interface ClockContainer
getClockAlarm(byte[])
,
isClockAlarmEnabled(byte[])
,
isClockAlarming(byte[])
,
setClockAlarm(long,byte[])
,
setClockAlarmEnable(boolean,byte[])
public boolean canDisableClock()
canDisableClock
in interface ClockContainer
isClockRunning(byte[])
,
setClockRunEnable(boolean,byte[])
public long getClockResolution()
getClockResolution
in interface ClockContainer
public byte[] readDevice() throws OneWireIOException, OneWireException
readDevice
in interface OneWireSensor
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
adapterpublic void writeDevice(byte[] state) throws OneWireIOException, OneWireException
writeDevice
in interface OneWireSensor
state
- 1-Wire device sensor stateOneWireIOException
- on a 1-Wire communication error such as
reading an incorrect CRC from a 1-Wire device. This could be
caused by a physical interruption in the 1-Wire Network due to
shorts or a newly arriving 1-Wire device issuing a 'presence pulse'.OneWireException
- on a communication or setup error with the 1-Wire
adapterpublic long getClock(byte[] state)
getClock
in interface ClockContainer
state
- current state of the device returned from readDevice()
OneWireSensor.readDevice()
,
setClock(long,byte[])
public long getClockAlarm(byte[] state) throws OneWireException
getClockAlarm
in interface ClockContainer
state
- current state of the device returned from readDevice()
OneWireException
- if this device does not have clock alarmsOneWireSensor.readDevice()
,
hasClockAlarm()
,
isClockAlarmEnabled(byte[])
,
isClockAlarming(byte[])
,
setClockAlarm(long,byte[])
,
setClockAlarmEnable(boolean,byte[])
public boolean isClockAlarming(byte[] state)
isClockAlarming
in interface ClockContainer
state
- current state of the device returned from readDevice()
OneWireSensor.readDevice()
,
hasClockAlarm()
,
isClockAlarmEnabled(byte[])
,
getClockAlarm(byte[])
,
setClockAlarm(long,byte[])
,
setClockAlarmEnable(boolean,byte[])
public boolean isClockAlarmEnabled(byte[] state)
isClockAlarmEnabled
in interface ClockContainer
state
- current state of the device returned from readDevice()
OneWireSensor.readDevice()
,
hasClockAlarm()
,
isClockAlarming(byte[])
,
getClockAlarm(byte[])
,
setClockAlarm(long,byte[])
,
setClockAlarmEnable(boolean,byte[])
public boolean isClockRunning(byte[] state)
isClockRunning
in interface ClockContainer
state
- current state of the device returned from readDevice()
OneWireSensor.readDevice()
,
canDisableClock()
,
setClockRunEnable(boolean,byte[])
public long getIntervalTimer(byte[] state)
state
- current state of the device returned from readDevice()
OneWireSensor.readDevice()
,
setIntervalTimer(long,byte[])
public long getCycleCounter(byte[] state)
state
- current state of the device returned from readDevice()
OneWireSensor.readDevice()
,
setCycleCounter
public long getIntervalTimerAlarm(byte[] state)
state
- current state of the device returned from readDevice()
OneWireSensor.readDevice()
,
setIntervalTimerAlarm
public long getCycleCounterAlarm(byte[] state)
state
- current state of the device returned from readDevice()
OneWireSensor.readDevice()
,
setCycleCounterAlarm
public boolean isIntervalTimerAlarming(byte[] state)
state
- current state of the device returned from readDevice()
true
if interval timer is alarmingOneWireSensor.readDevice()
,
isIntervalTimerAlarmEnabled
,
setIntervalTimerAlarmEnable
public boolean isCycleCounterAlarming(byte[] state)
state
- current state of the device returned from readDevice()
true
if cycle counter is alarmingOneWireSensor.readDevice()
,
isCycleCounterAlarmEnabled
,
setCycleCounterAlarmEnable
public boolean isIntervalTimerAlarmEnabled(byte[] state)
state
- current state of the device returned from readDevice()
true
if interval timer alarm is enabledOneWireSensor.readDevice()
,
isIntervalTimerAlarming
,
setIntervalTimerAlarmEnable
public boolean isCycleCounterAlarmEnabled(byte[] state)
state
- current state of the device returned from readDevice()
true
true if cycle counter alarm is enabledOneWireSensor.readDevice()
,
isCycleCounterAlarming
,
setCycleCounterAlarmEnable
public boolean isClockWriteProtected(byte[] state)
state
- current state of the device returned from readDevice()
true
if real time clock/alarm is write
protectedOneWireSensor.readDevice()
,
writeProtectClock
public boolean isIntervalTimerWriteProtected(byte[] state)
state
- current state of the device returned from readDevice()
true
if interval timer and interval timer alarm is
write protectedOneWireSensor.readDevice()
,
writeProtectIntervalTimer
public boolean isCycleCounterWriteProtected(byte[] state)
state
- current state of the device returned from readDevice()
true
if cycle counter/alarm is write
protectedOneWireSensor.readDevice()
,
writeProtectCycleCounter
public boolean canReadAfterExpire(byte[] state)
state
- current state of the device returned from readDevice()
true
if the device can be read after a
write protected alarm has occuredOneWireSensor.readDevice()
,
setReadAfterExpire
public boolean isIntervalTimerAutomatic(byte[] state)
state
- current state of the device returned from readDevice()
true
if the interval timer is set to automatic
modeOneWireSensor.readDevice()
,
setIntervalTimerAutomatic
public boolean isIntervalTimerStopped(byte[] state)
isIntervalTimerAutomatic
).state
- current state of the device returned from readDevice()
true
if the interval timer is stoppedOneWireSensor.readDevice()
,
isIntervalTimerAutomatic
,
setIntervalTimerAutomatic
,
setIntervalTimerRunState
public boolean isAutomaticDelayLong(byte[] state)
state
- current state of the device returned from readDevice()
true
if the automatic interval/cycle counter
delay is in the long (123ms) mode, else it is 3.5msOneWireSensor.readDevice()
,
setAutomaticDelayLong
public void setClock(long time, byte[] state)
writeDevice(byte[])
must be called to finalize
changes to the device. Note that multiple 'set' methods can
be called before one call to writeDevice(byte[])
.setClock
in interface ClockContainer
time
- new value for the Real-Time clock, in milliseconds
since January 1, 1970state
- current state of the device returned from readDevice()
OneWireSensor.writeDevice(byte[])
,
getClock(byte[])
public void setClockAlarm(long time, byte[] state) throws OneWireException
writeDevice(byte[])
must be called to finalize
changes to the device. Note that multiple 'set' methods can
be called before one call to writeDevice(byte[])
. Also note that
not all clock devices have alarms. Check to see if this device has
alarms first by calling the hasClockAlarm()
method.setClockAlarm
in interface ClockContainer
time
- - new value for the Real-Time clock alarm, in milliseconds
since January 1, 1970state
- current state of the device returned from readDevice()
OneWireException
- if this device does not have clock alarmsOneWireSensor.writeDevice(byte[])
,
hasClockAlarm()
,
isClockAlarmEnabled(byte[])
,
getClockAlarm(byte[])
,
isClockAlarming(byte[])
,
setClockAlarmEnable(boolean,byte[])
public void setClockRunEnable(boolean runEnable, byte[] state) throws OneWireException
writeDevice(byte[])
must be called to finalize
changes to the device. Note that multiple 'set' methods can
be called before one call to writeDevice(byte[])
. Also note that
not all clock devices can disable their oscillators. Check to see if this device can
disable its oscillator first by calling the canDisableClock()
method.setClockRunEnable
in interface ClockContainer
runEnable
- true to enable the clock oscillatorstate
- current state of the device returned from readDevice()
OneWireException
- if the clock oscillator cannot be disabledOneWireSensor.writeDevice(byte[])
,
canDisableClock()
,
isClockRunning(byte[])
public void setClockAlarmEnable(boolean alarmEnable, byte[] state) throws OneWireException
writeDevice(byte[])
must be called to finalize
changes to the device. Note that multiple 'set' methods can
be called before one call to writeDevice(byte[])
. Also note that
not all clock devices have alarms. Check to see if this device has
alarms first by calling the hasClockAlarm()
method.setClockAlarmEnable
in interface ClockContainer
alarmEnable
- true to enable the clock alarmstate
- current state of the device returned from readDevice()
OneWireException
- if this device does not have clock alarmsOneWireSensor.writeDevice(byte[])
,
hasClockAlarm()
,
isClockAlarmEnabled(byte[])
,
getClockAlarm(byte[])
,
setClockAlarm(long,byte[])
,
isClockAlarming(byte[])
public void setIntervalTimer(long time, byte[] state)
writeDevice(byte[])
must be called to finalize
changes to the device. Note that multiple 'set' methods can
be called before one call to writeDevice(byte[])
.time
- interval in milliseconds to set (truncated to 1/256th of second)state
- current state of the device returned from readDevice()
OneWireSensor.writeDevice(byte[])
,
getIntervalTimer
public void setCycleCounter(long cycles, byte[] state)
writeDevice(byte[])
must be called to finalize
changes to the device. Note that multiple 'set' methods can
be called before one call to writeDevice(byte[])
.cycles
- initialize cycle counter valuestate
- current state of the device returned from readDevice()
OneWireSensor.writeDevice(byte[])
,
getCycleCounter
public void setIntervalTimerAlarm(long time, byte[] state)
writeDevice(byte[])
must be called to finalize
changes to the device. Note that multiple 'set' methods can
be called before one call to writeDevice(byte[])
.time
- in milliseconds to set the inverval timerstate
- current state of the device returned from readDevice()
OneWireSensor.writeDevice(byte[])
,
getIntervalTimerAlarm
public void setCycleCounterAlarm(long cycles, byte[] state)
writeDevice(byte[])
must be called to finalize
changes to the device. Note that multiple 'set' methods can
be called before one call to writeDevice(byte[])
.cycles
- power Cycle Count alarmstate
- current state of the device returned from readDevice()
OneWireSensor.writeDevice(byte[])
,
getCycleCounterAlarm
public void writeProtectClock(byte[] state)
writeDevice(byte[])
must be called to finalize
changes to the device. Note that multiple 'set' methods can
be called before one call to writeDevice(byte[])
.
WARNING: after calling this method and then
writeDevice
the device will be permanently write
protected.
state
- current state of the device returned from readDevice()
OneWireSensor.writeDevice(byte[])
,
isClockWriteProtected
public void writeProtectIntervalTimer(byte[] state)
writeDevice(byte[])
must be called to finalize
changes to the device. Note that multiple 'set' methods can
be called before one call to writeDevice(byte[])
.
WARNING: after calling this method and then
writeDevice
the device will be permanently write
protected.
state
- current state of the device returned from readDevice()
OneWireSensor.writeDevice(byte[])
,
isIntervalTimerWriteProtected
public void writeProtectCycleCounter(byte[] state)
writeDevice(byte[])
must be called to finalize
changes to the device. Note that multiple 'set' methods can
be called before one call to writeDevice(byte[])
.
WARNING: after calling this method and then
writeDevice
the device will be permanently write
protected.
state
- current state of the device returned from readDevice()
OneWireSensor.writeDevice(byte[])
,
isCycleCounterWriteProtected
public void setReadAfterExpire(boolean readAfter, byte[] state)
writeDevice(byte[])
must be called to finalize
changes to the device. Note that multiple 'set' methods can
be called before one call to writeDevice(byte[])
.readAfter
- true
to read device after it
expires from a write protected alarm eventstate
- current state of the device returned from readDevice()
OneWireSensor.writeDevice(byte[])
,
canReadAfterExpire
public void setIntervalTimerAutomatic(boolean autoTimer, byte[] state)
isAutomaticDelayLong()
method).
The method writeDevice(byte[])
must be called to finalize
changes to the device. Note that multiple 'set' methods can
be called before one call to writeDevice(byte[])
.autoTimer
- true
for the interval timer to operate in
automatic modestate
- current state of the device returned from readDevice()
OneWireSensor.writeDevice(byte[])
,
isIntervalTimerAutomatic
public void setIntervalTimerRunState(boolean runState, byte[] state)
isIntervalTimerAutomatic()
).
The method writeDevice(byte[])
must be called to finalize
changes to the device. Note that multiple 'set' methods can
be called before one call to writeDevice(byte[])
.runState
- true
to set the interval timer to runstate
- current state of the device returned from readDevice()
OneWireSensor.writeDevice(byte[])
,
isIntervalTimerAutomatic
,
isIntervalTimerStopped
public void setAutomaticDelayLong(boolean delayLong, byte[] state)
writeDevice(byte[])
must be called to finalize
changes to the device. Note that multiple 'set' methods can
be called before one call to writeDevice(byte[])
.delayLong
- true
to set the interval timer to
cycle counter to increment after 123ms or false
for 3.5msstate
- current state of the device returned from readDevice()
OneWireSensor.writeDevice(byte[])
,
isAutomaticDelayLong
public void setIntervalTimerAlarmEnable(boolean alarmEnable, byte[] state)
writeDevice(byte[])
must be called to finalize
changes to the device. Note that multiple 'set' methods can
be called before one call to writeDevice(byte[])
.alarmEnable
- true
to enable the interval timer alarmstate
- current state of the device returned from readDevice()
OneWireSensor.writeDevice(byte[])
,
isIntervalTimerAlarmEnabled
public void setCycleCounterAlarmEnable(boolean alarmEnable, byte[] state)
writeDevice(byte[])
must be called to finalize
changes to the device. Note that multiple 'set' methods can
be called before one call to writeDevice(byte[])
.alarmEnable
- true
to enable the cycle counter alarmstate
- current state of the device returned from readDevice()
OneWireSensor.writeDevice(byte[])
,
isCycleCounterAlarmEnabled
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |