Skip to content

Channel Events

Channel Events are similar to Button Events.

Channel Events are generated by ON, OFF, PULSE, TO, or MIN_TO.

The format for a Channel Event is shown below:

CHANNEL_EVENT[<device>,<channel>]
{
    ON:
    {
        (* on event handler code *)
    }
    OFF:
    {
        (* off event handler code *)
    }
}

Like Button Events, the [<device>, <channel>] declaration can contain a DEV device set, or a DEVCHAN device-channel set in addition to individual device and channel declarations.

The CHANNEL Object is available to the channel event handler as a local variable.

The following table lists the information contained in Channel Objects:

Channel Objects:

Property Name Type Description
Channel.Device DEV Device
Channel.Device.Number INTEGER Device number
Channel.Device.Port INTEGER Device port
Channel.Device.System INTEGER System number
Channel.Channel INTEGER Device channel
Channel.SourceDev DEV Source Device of Channel Event
Channel.SourceDev.Number INTEGER Source Device Number
Channel.SourceDev.Port INTEGER Source Device Port
Channel.SourceDev.System INTEGER Source Device System

If the event handler is specified using an array for DEV, CHANNEL, or a DEVCHAN array, GET_LAST can be used to determine which index in the array caused the event to run.

In the following example, a Channel Event is defined to turn off a video projector every time the projector lift is raised. In NetLinx, you define a Channel Event for the 'Projector Lift Up' relay and tell the system to turn off the projector every time this relay is turned on.

Since turning on or pulsing the relay does not produce a push, a Button Event is not generated.

Example

DEFINE_EVENT
.
.
BUTTON_EVENT[TP1,21]
(* LIFT UP BUTTON *)
{
    PUSH:
    {
        PULSE[RELAY,LIFT_UP]
    }
}

BUTTON_EVENT[TP1,22]
(* SYSTEM OFF BUTTON *)
{
    PUSH:
    {
        PULSE[RELAY,RACK_OFF]
        PULSE[RELAY,LIFT_UP]
    }
}

CHANNEL_EVENT[RELAY,LIFT_UP]
(* LIFT UP RELAY EVENT *)
{
    ON:
    {
        PULSE[VPROJ,VP_POWER_OFF]
    }
}

See Also