|
||||||||||
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.OneWireContainer24
1-Wire container for Real-Time-Clock (RTC) iButton, DS1904 and 1-Wire Chip, DS2415. This container encapsulates the functionality of the iButton family type 24 (hex)
This iButton is used as a portable real-time-clock.
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.
MemoryBank
,
PagedMemoryBank
,
ClockContainer
Constructor Summary | |
OneWireContainer24()
Create an empty container that is not complete until after a call to setupContainer . |
|
OneWireContainer24(DSPortAdapter sourceAdapter,
byte[] newAddress)
Create a container with the provided adapter instance and the address of the iButton or 1-Wire device. |
|
OneWireContainer24(DSPortAdapter sourceAdapter,
long newAddress)
Create a container with the provided adapter instance and the address of the iButton or 1-Wire device. |
|
OneWireContainer24(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. |
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 |
String |
getDescription()
Get a short description of the function of this iButton or 1-Wire Device type. |
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 |
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. |
byte[] |
readDevice()
Retrieves the five byte state over the 1-Wire bus. |
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 |
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, getMaxSpeed, getMemoryBanks, hashCode, isAlarming, isPresent, setSpeed, setupContainer, setupContainer, setupContainer, toString |
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public OneWireContainer24()
setupContainer
. This is one of the methods to construct a container. The others are through creating a OneWireContainer with parameters.
super.setupContainer()
public OneWireContainer24(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 deviceOneWireContainer24
,
utils.Address
public OneWireContainer24(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 deviceOneWireContainer24
,
utils.Address
public OneWireContainer24(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 deviceOneWireContainer24
,
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 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 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 some reference time (ie. 12:00am, January 1st, 1970)state
- 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 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 setClockRunEnable(boolean runEnable, 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[])
. 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()
OneWireSensor.writeDevice(byte[])
,
canDisableClock()
,
isClockRunning(byte[])
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |