jcontrol.system
Class RTC

java.lang.Object
  extended by jcontrol.system.RTC

public class RTC
extends Object

Controls JControls real time clock (RTC).

If the RTC is available as hardware on a battery powered device there are special options:


Field Summary
static int DAILY
          Alarm mode.
static int DATED
          Alarm mode.
static int OFF
          Alarm mode.
 
Method Summary
static int getAlarm(Time time)
          Gets the alarm time and mode.
static void getTime(Time time)
          Gets the current time.
static boolean isAlarm()
          Checks if an alarm is pending.
static void resetAlarm()
          Resets a pending alarm.
static void setAlarm(Time time, int mode)
          Sets the alarm time and mode.
static void setTime(Time time)
          Sets the current time.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, notifyAll, toString, wait
 

Field Detail

OFF

public static final int OFF
Alarm mode. Turn the alarm off.

See Also:
setAlarm(Time, int), Constant Field Values

DAILY

public static final int DAILY
Alarm mode. Turn the alarm on for daily events (day, month and year are ignored).

See Also:
setAlarm(Time, int), Constant Field Values

DATED

public static final int DATED
Alarm mode. Turn the alarm on for single events.

See Also:
setAlarm(Time, int), Constant Field Values
Method Detail

setTime

public static void setTime(Time time)
Sets the current time. From the point of setting the value, the RTC is counting seconds. This doesn't affect the Time object in the parameter.

Parameters:
time - contains the specification of the point of time the RTC should run from.

getTime

public static void getTime(Time time)
Gets the current time.

Parameters:
time - this object is filled with the values of now (takes a snapshot).

setAlarm

public static void setAlarm(Time time,
                            int mode)
Sets the alarm time and mode.

Parameters:
time - contains the specification of the point of time the RTC should trigger alarm, time may be null, then the previous value won't be touched. Note: seconds are ignored for alarm settings by the hardware RTC.
mode - the alarmmode to use, one of OFF, DAILY or DATED.

getAlarm

public static int getAlarm(Time time)
Gets the alarm time and mode.

Parameters:
time - this object is filled with the values of the point of time the RTC triggers alarm,
Returns:
mode the alarmmode currently set, one of OFF, DAILY or DATED.

isAlarm

public static boolean isAlarm()
Checks if an alarm is pending.

Returns:
true if somewhere in the past the RTC passed the alarm time, this flag remains true until resetAlarm() was invoked.

resetAlarm

public static void resetAlarm()
Resets a pending alarm. The RTC will be ready for the next alarm trigger.