Reserved Identifiers
114
NetLinx Programming Language Reference Guide
Keywords & Run-Time Library Functions (Cont.)
DEFINE_DEVICE
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
"
DEFINE_EVENT
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.
DEFINE_FUNCTION
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.
DEFINE_LATCHING
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
DEFINE_MODULE
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.
Summary of Contents for NETLINX PROGRAMMING LANGUAGE
Page 15: ...Table of Contents xiii NetLinx Programming Language Reference Guide...
Page 16: ...xiv NetLinx Programming Language Reference Guide Table of Contents...
Page 18: ...Introduction 2 NetLinx Programming Language Reference Guide...
Page 76: ...Language Elements 60 NetLinx Programming Language Reference Guide...
Page 106: ...Combining Devices Levels and Channels 90 NetLinx Programming Language Reference Guide...
Page 112: ...Master To Master M2M 96 NetLinx Programming Language Reference Guide...
Page 182: ...Reserved Identifiers 166 NetLinx Programming Language Reference Guide...
Page 204: ...NetLinx UniCode Functions 188 NetLinx Programming Language Reference Guide...
Page 244: ...Appendix B Glossary 228 NetLinx Programming Language Reference Guide...
Page 245: ...Appendix B Glossary 229 NetLinx Programming Language Reference Guide...