Event Handlers
61
NetLinx Programming Language Reference Guide
Event Handlers
The NetLinx language provides a special program section called DEFINE_EVENT to define handlers for
incoming events/notifications. These handlers are stored in an event table providing quick access to code
that must be executed when an event is received. There are handlers to support five types of events:
 Button events include pushes, releases, and holds, which are associated with a push or release
on a particular device-channel.
 Channel events occur when an output change (On/Off) is detected on a device-channel.
 Data events include commands, strings, status, and error messages.
 Level events are received as a result of a level change on a particular device.
 Timeline events trigger events based on a sequence of times.
All incoming events are stored in a queue pending processing. Messages are processed in the order they
are received. The steps to processing an event are:
1. Check all events for a handler matching the specified event. If a handler is found, run it.
2. If there is no event handler, run MAINLINE.
The event handler descriptions are:
 DEVICE refers to a device specification:
The processing of an event associated with a given member of a device, channel,
device-channel, level, or device-level array must be completed before processing can
begin on another event associated with the same array.
FIG. 1 Steps involved in processing an event
Run Mainline
Event
handler
available?
Start
Stop
Run event
handler
NO
YES
More than one handler can be defined for the same event. In this case, the handlers
are executed in the order in which they are defined in the program.
DEVICE A single device number constant
D:P:S A constant device specification such as 128:1:0
DEV[ ] A device array