com.dalsemi.onewire.container
Interface ClockContainer

All Superinterfaces:
OneWireSensor
All Known Implementing Classes:
OneWireContainer04, OneWireContainer21, OneWireContainer26

public interface ClockContainer
extends OneWireSensor

1-Wire clock interface class for basic real-time-clock operations. This class should be implemented for each clock type 1-Wire device.

Version:
0.00, 28 Aug 2000

Method Summary
 boolean canDisableClock()
          Query to see if the clock can be disabled.
 long getClock(byte[] state)
          This method extracts the Clock Value in milliseconds from the state data retrieved from the 'readDevice()' method.
 long getClockAlarm(byte[] state)
          This method extracts the Clock Alarm Value from the provided state data retrieved from the 'readDevice()' method.
 long getClockResolution()
          Query to get the clock resolution in milliseconds
 boolean hasClockAlarm()
          Query to see if the clock has an alarm feature.
 boolean isClockAlarmEnabled(byte[] state)
          This method checks if the Clock Alarm is enabled from the provided state data retrieved from the 'readDevice()' method.
 boolean isClockAlarming(byte[] state)
          This method checks if the Clock Alarm flag has been set from the state data retrieved from the 'readDevice()' method.
 boolean isClockRunning(byte[] state)
          This method checks if the device's oscilator is enabled.
 void setClock(long time, byte[] state)
          This method sets the Clock time in the provided state data Use the method 'writeDevice()' with this data to finalize the change to the device.
 void setClockAlarm(long time, byte[] state)
          This method sets the Clock Alarm in the provided state data.
 void setClockAlarmEnable(boolean alarmEnable, byte[] state)
          This method sets the Clock Alarm enable.
 void setClockRunEnable(boolean runEnable, byte[] state)
          This method sets the oscillator enable to the specified value.
 
Methods inherited from interface com.dalsemi.onewire.container.OneWireSensor
readDevice, writeDevice
 

Method Detail

hasClockAlarm

public boolean hasClockAlarm()
Query to see if the clock has an alarm feature.
Returns:
boolean, true if real-time-clock has an alarm

canDisableClock

public boolean canDisableClock()
Query to see if the clock can be disabled. See the methods 'isClockRunning()' and 'setClockRunEnable()'.
Returns:
boolean, true if the clock can be enabled and disabled.

getClockResolution

public long getClockResolution()
Query to get the clock resolution in milliseconds
Returns:
long, get the clock resolution in milliseconds.

getClock

public long getClock(byte[] state)
This method extracts the Clock Value in milliseconds from the state data retrieved from the 'readDevice()' method.
Parameters:
state - - byte array of device state
Returns:
long<\code> time - in milliseconds that have occured since 1970.

getClockAlarm

public long getClockAlarm(byte[] state)
                   throws OneWireException
This method extracts the Clock Alarm Value from the provided state data retrieved from the 'readDevice()' method.
Parameters:
state - - byte array of device state
Returns:
long<\code> time - in milliseconds that have the clock alarm is set to.

isClockAlarming

public boolean isClockAlarming(byte[] state)
This method checks if the Clock Alarm flag has been set from the state data retrieved from the 'readDevice()' method.
Parameters:
state - - byte array of device state
Returns:
boolean<\code> true if clock is alarming

isClockAlarmEnabled

public boolean isClockAlarmEnabled(byte[] state)
This method checks if the Clock Alarm is enabled from the provided state data retrieved from the 'readDevice()' method.
Parameters:
state - - byte array of device state
Returns:
boolean<\code> true if clock alarm is enabled

isClockRunning

public boolean isClockRunning(byte[] state)
This method checks if the device's oscilator is enabled. The clock will not increment if the clock is not enabled. This value is read from the provided state data retrieved from the 'readDevice()' method.
Parameters:
state - - byte array of device state
Returns:
boolean<\code> true

setClock

public void setClock(long time,
                     byte[] state)
This method sets the Clock time in the provided state data Use the method 'writeDevice()' with this data to finalize the change to the device.
Parameters:
time - - long<\code> milliseconds the user wants the Clock set to.
state - - byte array of device state

setClockAlarm

public void setClockAlarm(long time,
                          byte[] state)
                   throws OneWireException
This method sets the Clock Alarm in the provided state data. Use the method 'writeDevice()' with this data to finalize the change to the device.
Parameters:
time - - long<\code> milliseconds the user wants the Clock alarm set to.
state - - byte array of device state

setClockRunEnable

public void setClockRunEnable(boolean runEnable,
                              byte[] state)
                       throws OneWireException
This method sets the oscillator enable to the specified value. Use the method 'writeDevice()' with this data to finalize the change to the device.
Parameters:
runEnable - - boolean, true if want the clock oscillator to be enabled.
state - - byte array of device state

setClockAlarmEnable

public void setClockAlarmEnable(boolean alarmEnable,
                                byte[] state)
                         throws OneWireException
This method sets the Clock Alarm enable. Use the method 'writeDevice()' with this data to finalize the change to the device.
Parameters:
alarmEnable - - boolean, true to enable the clock alarm
state - - byte array of device state