
Event Framework
The member function for setting an alarm is "setAlarm()" and that for starting a timer is "start- Timer()". The first argument is the callback function, the second argument is the absolute or relative time and the third argument is an optional identifier for that alarm or timer. Scheduling an alarm or timer with an identifier matching that of an alarm or timer which hasn’t yet expired will cause that un- expired alarm or timer to be cancelled.
Both types of events are one off events, with the registration being cancelled once the callback has been executed. The identifier may also be used to cancel an alarm or timer before it expires. To cancel an alarm use "cancelAlarm()" and to cancel a timer use "cancelTimer()". To cancel all pending alarms use "cancelAllAlarms()" and to cancel all pending timers use "cancelAllTim- ers()". If an identifier is not excplicitly provided, an internal identifier will be automatically created with it being returned as the result of the function being called to schedule the callback.
Recurring Actions
A recurring action is where a job is run at regular intervals. Precisely when the callback function asso- ciated with a job is executed is determined by a specification of the form used by the UNIX cron utility. The specification consists of five fields each separated by white space. The fields specify:
•minute
•hour
•day of the month
•month of the year
•day of the week
A field may be an asterisk "*", which always stands for
Lists are allowed. A list is a set of numbers (or ranges) separated by commas. For example,
"1,2,5,9" and
Names can also be used for the "month" and "day of week" fields. Use the first three letters of the par- ticular day or month (lower case, or first letter only uppercase).
The day that a callback function is to be executed can be specified by two fields, day of month and day of week. If both fields are restricted (ie., aren’t "*"), the callback function will be executed when either field matches the current time. For example, "30 4 1,15 * 5" would cause the callback function to be executed at 4:30 am on the 1st and 15th of each month, plus every Friday.
To schedule this type of job, the "scheduleAction()" function is used except that instead of spec- ifying the job type as the second argument, the specification string should be used.
30