NetLinx Programming Overview
28
NetLinx Programming Language Reference Guide
Combining Devices, Channels and Levels
Axcess allows you to combine devices and levels within the DEFINE_COMBINE and
DEFINE_CONNECT_LEVEL sections. This method is static and is fixed when the program compiles. You
can combine functionality within mainline by stacking push and release statements. Stacking pushes
allows you the flexibility to conditionally change what elements of the program share functionality, but
the program can be more difficult to maintain over time than if the panels were combined using
DEFINE_COMBINE.
NetLinx provides several new methods for combining the functionality of devices, channels, and levels.
Using
DEV, DEVCHAN and DEVLEV accomplishes the same thing as stacking pushes in Axcess, and it
reduce the overall maintenance associated with stacking pushes; however, data sets are statically
implemented within the
DEFINE_EVENT section. When the program compiles, the references to the data
sets in the
DEFINE_EVENT are set and cannot change at run time.
Virtual devices, levels and device/channel sets
One of the drawbacks to combining devices and levels in Axcess is the way the central controller
handled the first device in the combine list going online and offline. This resulted in unexpected device
behavior and inconsistent feedback.
NetLinx uses virtual devices. Virtual devices carry a device number ranging from 32,768 to 36,863, a
port number of 1, and a system number of 0. Virtual Devices are devices that cannot be taken off the bus.
By listing a virtual device as the first device in a
DEFINE_COMBINE, COMBINE_DEVICES,
COMBINE_LEVELS, or COMBINE_CHANNELS statement, the abnormalities seen in Axcess
DEFINE_COMBINE statements are eliminated.
Combining and uncombining devices
NetLinx still recognizes the DEFINE_COMBINE section. This section still operates as it did in Axcess;
however, once the
DEFINE_COMBINE section has been compiled it remains static. NetLinx introduces
two functions:
COMBINE_DEVICES and UNCOMBINE_DEVICES. COMBINE_DEVICES and
UNCOMBINE_DEVICES dynamically change the devices combined together. When devices are
combined the combine list and
DEV set lists are reevaluated and updated during run time.
COMBINE_DEVICES and UNCOMBINE_DEVICES are used as stand-alone statements in an event,
mainline or in assignment statements.
COMBINE_DEVICES and UNCOMBINE_DEVICES will return a
value of 0 or -1, depending on the success or failure of the operation. The first device in a
COMBINE_DEVICES statement should be a virtual device. The devices, listed after the virtual device, are
either a list of individual device numbers,
DEV sets, or any combination of devices and DEV sets. The
UNCOMBINE_DEVICES statement requires only the first device in the COMBINE_DEVICES list, which
should be a virtual device. The format for
COMBINE_DEVICES and UNCOMBINE_DEVICES is:
COMBINE_DEVICES (<virtual device>, <device1>, <device2>…)
UNCOMBINE_DEVICES (<virtual device>)
Devices combined with COMBINE_DEVICES respond like devices combined using the
DEFINE_COMBINE section. The central controller recognizes any input from the devices in the combine
list as the first device in the list.
Combining and uncombining levels
The NetLinx functions COMBINE_LEVELS and UNCOMBINE_LEVELS work similar to the
DEFINE_CONNECT_LEVEL section in Axcess. For compatibility with Axcess code, the
DEFINE_CONNECT_LEVEL section is still valid. Like COMBINE_DEVICES, COMBINE_LEVELS and
UNCOMBINE_LEVELS can be used within events and mainline code to dynamically change what levels
are connected to each other. It is also recommended that a Virtual
DEVLEV set be used as the first
DEVLEV set in the COMBINE_LEVELS function. The format for COMBINE_LEVELS and
UNCOMBINE_LEVELS is: