The timer device is a software-based "device" which allows CDJ and SlinkX control users to generate timed events. The timer device is simple but versatile. By setting "alarms" using the timer device, you can:
When used in conjunction with the mapping capabilities of CDJ, it possible to use timers to play music at certain times, add items to playlists for advertising, or search the players late at night.
Note that a single timer device can have multiple alarms, so you will never need more than one timer device. You can create a timer device by using a device file containing the single statement:
type = timer
and adding this device file with Ports = 0, IDNumber = 1. Using the AddDeviceText method makes this even simpler by not requiring an actual device file, only a text string "type = timer". Although there are no commands in this device file you have loaded, slinkeserv supports the following hard-coded command and response functions
alarmname is a text name which will be used when the alarm generates and event, or when you need to delete the alarm using clralarm.
alarmtime is the time at which the alarm will first go off. It can absolute or relative expression.
Absolute - some examples of absolute times
- 1/25/1996
- 1/25/1996 8:25:57
- 8:25:57 (defaults to current day, or the next day if this time has already passed)
Relative - these formats express time as an offset to the future from the current time. The default unit is the second, and the following units are supported:
- y - years
- o - months
- w - weeks
- d - days
- h - hours
- m - minutes
- s - seconds (default)
interval is the time between repetitions of the alarm event. This parameter is not necessary if your alarm does not repeat. The format is the same as that used for relative time in the alarmtime parameter.
repeat is the number of times the alarm event will be repeated at the specified interval. This parameter is optional. The following values are valid
- once or 0 - fire the alarm only once (default)
- (positive integer n) - fire the alarm n times after the first time at the set interval
- forever - fire the alarm forever after the first time at the set interval
format is a string which specifies the format in which you would like the current time presented when your alarm fires. This is an optional paramter. The string can contain the following elements:
%a - Abbreviated weekday name
%A - Full weekday name
%b - Abbreviated month name
%B - Full month name
%c - Date and time representation appropriate for locale
%d - Day of month as decimal number (01 31)
%H - Hour in 24-hour format (00 23)
%I - Hour in 12-hour format (01 12)
%j - Day of year as decimal number (001 366)
%m - Month as decimal number (01 12)
%M - Minute as decimal number (00 59)
%p - Current locales A.M./P.M. indicator for 12-hour clock
%S - Second as decimal number (00 59)
%U - Week of year as decimal number, with Sunday as first day of week (00 53)
%w - Weekday as decimal number (0 6; Sunday is 0)
%W - Week of year as decimal number, with Monday as first day of week (00 53)
%x - Date representation for current locale
%X - Time representation for current locale
%y - Year without century, as decimal number (00 99)
%Y - Year with century, as decimal number
%z, %Z - Time-zone name or abbreviation; no characters if time zone is unknown
%% - literal % sign
The default format is %H:%M, which expresses the time in hours and minutes separated by a colon.
setalarm[goodmorning,3/12/2002 08:17:23]
would result in the following output on the morning of 3/12/2002:
goodmorning[08:17]
setalarm[goodnight,23:30,1d,6,%a]
would result in the following output every night at 11:30pm for the next week:
goodnight[mon]
goodnight[tue]
goodnight[wed]
goodnight[thu]
goodnight[fri]
goodnight[sat]
goodnight[sun]
setalarm[chime,2h,1h,forever]
would result in the following output 2 hours later and repeating indefinitely once an hour:
chime[13:56]
chime[14:56]
chime[15:56]
chime[16:56]
chime[17:56]
chime[18:56]
chime[19:56]
chime[20:56]
chime[21:56]
. . .