
Language Elements
42
NetLinx Programming Language Reference Guide
Device:Port:System (D:P:S): This notation is used to explicitly represent a device number,
port, and system. For example, 128:1:0 represents the first port of the device number 128 on
this system. The syntax:
NUMBER:PORT:SYSTEM
Parameters:
Device arrays
In order to specify a group of devices for a command or event handler, NetLinx provides the capability to
define an array of
DEV
s and treat it as a device array. A device array may be used anywhere a device
specification is required. The result provides a range of targets for the command or instruction where it is
used.
Device arrays are declared in the
DEFINE_VARIABLE
section of the program in one of two ways:
DEV DSName[ ] = {Dev1, Dev2, ..., Devn}
DEV DSName[MaxLen] = {Dev1, Dev2, ..., Devn}
Each device name appearing on the right-hand side of the declaration should be defined as a device in the
DEFINE_DEVICE
section; however, it can also be defined in the
DEFINE_VARIABLE
or
DEFINE_CONSTANT
section.
The first statement above declares a device array whose maximum length is determined by the number of
elements in the initialization array on the right-hand side.
The second form uses
MaxLen
to specify the maximum length of the device array. In either case, the
number of elements in the initialization array determines the effective length of the device array. That
value can be determined at run-time by calling
LENGTH_ARRAY
. The maximum length available for a
device array can be determined by calling
MAX_LENGTH_ARRAY
.
The following program fragment illustrates device array initialization:
DEFINE_DEVICE
panel3 = 130
DEFINE_CONSTANT
DEV panel1 = 128:1:0
integer panel2 = 129
DEFINE_VARIABLE
// dvs is an array of three devices:
// 128:1:0
// 129:1:0
// 130:1:0
DEV dvs[ ] = {panel1, panel2, panel3}
The individual elements of a device array can be referenced by their defined names (
Dev1
,
Dev2
, etc.)
or by using array notation with the device array name. For example, the 3rd device in the device array,
MyDeviceSet
, would be referenced by
MyDeviceSet[3]
.
Number
16-bit integer representing the Device number
Port
16-bit integer representing the Port number (in the range 1 through
the number of ports on the device)
System
16-bit integer representing the System number (0 = this system).
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...