Define_Device; Define_Event; Define_Function; Define_Latching - AMX NETLINX PROGRAMMING LANGUAGE Manual

Programming language
Table of Contents

Advertisement

Reserved Identifiers
Keywords & Run-Time Library Functions (Cont.)

DEFINE_DEVICE

DEFINE_EVENT

DEFINE_FUNCTION

DEFINE_LATCHING

DEFINE_MODULE

114
This keyword defines the devices referenced in the program.
DEFINE_DEVICE
TP1 = 128:1:0// device number = 128, port = 1, system = 0
TP2 = 129:1:0// device number = 129, port = 1, system = 0
TP3 = 130:1:0// device number = 130, port = 1, system = 0
VCR1 = 10:1:0 // device number = 10, port = 1, system = 0
VCR2 = 11:1:0 // device number = 11, port = 1, system = 0
Devices can be specified by a single device number such as "TP = 128" or as
a fully-qualified device specification such as "TP = 128:1:0"
This keyword provides the basis for the construction of the event table, which is
where event-handling code is placed. When NetLinx receives an incoming
event, the event table is searched for a handler for that event. A handler is a
block of code that performs the necessary processing for an event notification
received from a given device (and possibly associated with a particular chan-
nel).
See the Event Handlers section on page 61 for more information.
This keyword defines the implementation of a NetLinx function.
DEFINE_FUNCTION [<return type>] FnName(P1,P2,...)
{
// function statements
}
The return type is optional and can be any intrinsic data type or array of intrinsic
types that NetLinx supports except a structure or an array of structures. The
function name must not be a previously defined constant or variable or a name
assigned to a buffer, a wait, DEFINE_CALL, or Function. Function names are
not case sensitive.
This keyword section is where latching channels and variables are defined. A
latching channel is one that changes its state once per activation. If a latching
channel is activated by a TO keyword, it changes its state. When the TO is
stopped by releasing the button that started it, the channel does not go back to
its previous state. The status of a latching channel (that is not part of a mutually
exclusive group) will always reflect the on/off state of the channel.
In the following example, the device-channel [RELAY, SYSTEM_POWER] is
defined as latching. The next statement uses the double periods (..) to define
a range of VCR channels as latching. In the last statement, the variable VAR1 is
defined as latching.
DEFINE_LATCHING
[RELAY, SYSTEM_POWER]
[VCR, PLAY]..[VCR, REWIND]
VAR1
This keyword declares a module that will be used by either the main program or
another module. It is the counterpart to the MODULE_NAME entry that appears as
part of the implementation of the module.
DEFINE_MODULE '<module name>' InstanceName(<parameter
list>)
Parameters:
• <module name>: The name of the module as specified in the MODULE_NAME
statement in the module implementation file.
• InstanceName: The name to assign to the instance of the module.
• <parameter list>: The list of parameters available to the module.
NetLinx Programming Language Reference Guide

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Netlinx studio 2

Table of Contents