ClockContainer Interface Reference

Inherits com::dalsemi::onewire::container::OneWireSensor.

Inherited by MissionContainer, OneWireContainer04, OneWireContainer21, OneWireContainer24, OneWireContainer27, and OneWireContainer41.

List of all members.


Detailed Description

Interface class for 1-Wire® devices that contain Real-Time clocks. This class should be implemented for each Clock type 1-Wire device.

Features

Usage

ClockContainer extends com.dalsemi.onewire.container.OneWireSensor, so the general usage model applies to any ClockContainer:

  1. readDevice()
  2. perform operations on the ClockContainer
  3. writeDevice(byte[])

Consider this interaction with a ClockContainer that reads from the Real-Time clock, then tries to set it to the system's current clock setting before disabling the oscillator:


     //clockcontainer is a com.dalsemi.onewire.container.ClockContainer
     byte[] state = clockcontainer.readDevice();
     long current_time = clockcontainer.getClock(state);
     System.out.println("Current time is :"+(new Date(current_time)));

     long system_time = System.currentTimeMillis();
     clockcontainer.setClock(system_time,state);
     clockcontainer.writeDevice(state);

     //now try to disable to clock oscillator
     if (clockcontainer.canDisableClock())
     {
          state = clockcontainer.readDevice();
          clockcontainer.setClockRunEnable(false,state);
          clockcontainer.writeDevice(state);
     }

 

See also:
OneWireSensor

ADContainer

TemperatureContainer

PotentiometerContainer

SwitchContainer

Version:
0.00, 28 Aug 2000
Author:
DS, KLA

Public Member Functions

boolean hasClockAlarm ()
 Checks to see if the clock has an alarm feature.
boolean canDisableClock ()
 Checks to see if the clock can be disabled.
long getClockResolution ()
 Gets the clock resolution in milliseconds.
long getClock (byte[] state)
 Extracts the Real-Time clock value in milliseconds.
long getClockAlarm (byte[] state) throws OneWireException
 Extracts the clock alarm value for the Real-Time clock.
boolean isClockAlarming (byte[] state)
 Checks if the clock alarm flag has been set.
boolean isClockAlarmEnabled (byte[] state)
 Checks if the clock alarm is enabled.
boolean isClockRunning (byte[] state)
 Checks if the device's oscillator is enabled.
void setClock (long time, byte[] state)
 Sets the Real-Time clock.
void setClockAlarm (long time, byte[] state) throws OneWireException
 Sets the clock alarm.
void setClockRunEnable (boolean runEnable, byte[] state) throws OneWireException
 Enables or disables the oscillator, turning the clock 'on' and 'off'.
void setClockAlarmEnable (boolean alarmEnable, byte[] state) throws OneWireException
 Enables or disables the clock alarm.

Member Function Documentation

boolean hasClockAlarm (  ) 

Checks to see if the clock has an alarm feature.

Returns:
true if the Real-Time clock has an alarm
See also:
getClockAlarm(byte[])

isClockAlarmEnabled(byte[])

isClockAlarming(byte[])

setClockAlarm(long,byte[])

setClockAlarmEnable(boolean,byte[])

Implemented in OneWireContainer04, OneWireContainer21, OneWireContainer24, and OneWireContainer41.

boolean canDisableClock (  ) 

Checks to see if the clock can be disabled.

Returns:
true if the clock can be enabled and disabled
See also:
isClockRunning(byte[])

setClockRunEnable(boolean,byte[])

Implemented in OneWireContainer04, OneWireContainer21, OneWireContainer24, and OneWireContainer41.

long getClockResolution (  ) 

Gets the clock resolution in milliseconds.

Returns:
the clock resolution in milliseconds

Implemented in OneWireContainer04, OneWireContainer21, OneWireContainer24, and OneWireContainer41.

long getClock ( byte[]  state  ) 

Extracts the Real-Time clock value in milliseconds.

Parameters:
state current state of the device returned from readDevice()
Returns:
the time represented in this clock in milliseconds since 1970
See also:
com.dalsemi.onewire.container.OneWireSensor.readDevice()

setClock(long,byte[])

Implemented in OneWireContainer04, OneWireContainer21, OneWireContainer24, and OneWireContainer41.

long getClockAlarm ( byte[]  state  )  throws OneWireException

Extracts the clock alarm value for the Real-Time clock.

Parameters:
state current state of the device returned from readDevice()
Returns:
the set value of the clock alarm in milliseconds since 1970
Exceptions:
OneWireException if this device does not have clock alarms
See also:
com.dalsemi.onewire.container.OneWireSensor.readDevice()

hasClockAlarm()

isClockAlarmEnabled(byte[])

isClockAlarming(byte[])

setClockAlarm(long,byte[])

setClockAlarmEnable(boolean,byte[])

Implemented in OneWireContainer04, OneWireContainer21, OneWireContainer24, and OneWireContainer41.

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.

Parameters:
state current state of the device returned from readDevice()
Returns:
true if the Real-Time clock is alarming
See also:
com.dalsemi.onewire.container.OneWireSensor.readDevice()

hasClockAlarm()

isClockAlarmEnabled(byte[])

getClockAlarm(byte[])

setClockAlarm(long,byte[])

setClockAlarmEnable(boolean,byte[])

Implemented in OneWireContainer04, OneWireContainer21, OneWireContainer24, and OneWireContainer41.

boolean isClockAlarmEnabled ( byte[]  state  ) 

Checks if the clock alarm is enabled.

Parameters:
state current state of the device returned from readDevice()
Returns:
true if clock alarm is enabled
See also:
com.dalsemi.onewire.container.OneWireSensor.readDevice()

hasClockAlarm()

isClockAlarming(byte[])

getClockAlarm(byte[])

setClockAlarm(long,byte[])

setClockAlarmEnable(boolean,byte[])

Implemented in OneWireContainer04, OneWireContainer21, OneWireContainer24, and OneWireContainer41.

boolean isClockRunning ( byte[]  state  ) 

Checks if the device's oscillator is enabled.

The clock will not increment if the clock oscillator is not enabled.

Parameters:
state current state of the device returned from readDevice()
Returns:
true if the clock is running
See also:
com.dalsemi.onewire.container.OneWireSensor.readDevice()

canDisableClock()

setClockRunEnable(boolean,byte[])

Implemented in OneWireContainer04, OneWireContainer21, OneWireContainer24, and OneWireContainer41.

void setClock ( long  time,
byte[]  state 
)

Sets the Real-Time clock.

The method writeDevice() must be called to finalize changes to the device. Note that multiple 'set' methods can be called before one call to writeDevice().

Parameters:
time new value for the Real-Time clock, in milliseconds since January 1, 1970
state current state of the device returned from readDevice()
See also:
com.dalsemi.onewire.container.OneWireSensor.writeDevice(byte[])

getClock(byte[])

Implemented in OneWireContainer04, OneWireContainer21, OneWireContainer24, and OneWireContainer41.

void setClockAlarm ( long  time,
byte[]  state 
) throws OneWireException

Sets the clock alarm.

The method writeDevice() must be called to finalize changes to the device. Note that multiple 'set' methods can be called before one call to writeDevice(). Also note that not all clock devices have alarms. Check to see if this device has alarms first by calling the hasClockAlarm() method.

Parameters:
time - new value for the Real-Time clock alarm, in milliseconds since January 1, 1970
state current state of the device returned from readDevice()
Exceptions:
OneWireException if this device does not have clock alarms
See also:
com.dalsemi.onewire.container.OneWireSensor.writeDevice(byte[])

hasClockAlarm()

isClockAlarmEnabled(byte[])

getClockAlarm(byte[])

isClockAlarming(byte[])

setClockAlarmEnable(boolean,byte[])

Implemented in OneWireContainer04, OneWireContainer21, OneWireContainer24, and OneWireContainer41.

void setClockRunEnable ( boolean  runEnable,
byte[]  state 
) throws OneWireException

Enables or disables the oscillator, turning the clock 'on' and 'off'.

The method writeDevice() must be called to finalize changes to the device. Note that multiple 'set' methods can be called before one call to writeDevice(). 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.

Parameters:
runEnable true to enable the clock oscillator
state current state of the device returned from readDevice()
Exceptions:
OneWireException if the clock oscillator cannot be disabled
See also:
com.dalsemi.onewire.container.OneWireSensor.writeDevice(byte[])

canDisableClock()

isClockRunning(byte[])

Implemented in OneWireContainer04, OneWireContainer21, OneWireContainer24, and OneWireContainer41.

void setClockAlarmEnable ( boolean  alarmEnable,
byte[]  state 
) throws OneWireException

Enables or disables the clock alarm.

The method writeDevice() must be called to finalize changes to the device. Note that multiple 'set' methods can be called before one call to writeDevice(). Also note that not all clock devices have alarms. Check to see if this device has alarms first by calling the hasClockAlarm() method.

Parameters:
alarmEnable true to enable the clock alarm
state current state of the device returned from readDevice()
Exceptions:
OneWireException if this device does not have clock alarms
See also:
com.dalsemi.onewire.container.OneWireSensor.writeDevice(byte[])

hasClockAlarm()

isClockAlarmEnabled(byte[])

getClockAlarm(byte[])

setClockAlarm(long,byte[])

isClockAlarming(byte[])

Implemented in OneWireContainer04, OneWireContainer21, OneWireContainer24, and OneWireContainer41.


The documentation for this interface was generated from the following file:

Generated on Thu Aug 28 15:42:32 2008 for 1-Wire API for .NET by  doxygen 1.5.6