### NetLinx Level Combine Setup (Conceptual)
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
Illustrates the conceptual setup for combining levels in NetLinx, referencing the Axcess example and highlighting the use of virtual devices for NetLinx compatibility.
```NetLinx
DEFINE_CONNECT_LEVEL
DEFINE_DEVICE
VIRTUAL1 = 33000
TP1 = 128
TP2 = 129
TP3 = 130
```
--------------------------------
### NetLinx Virtual Device Combine Example
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
Demonstrates the basic setup and usage of virtual devices for combining multiple physical devices in NetLinx. It shows how to define devices, create a virtual device, and then combine physical devices with the virtual one.
```NetLinx
DEFINE_DEVICE
VIRTUAL1 = 33000
TP1 = 128
TP2 = 129
TP3 = 130
DEFINE_COMBINE
(VIRTUAL1, TP1, TP2, TP3)
DEFINE_PROGRAM
RELEASE[VIRTUAL1,1]
{
(*Do Something*)
}
```
--------------------------------
### Axcess Level Combine Example (for comparison)
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
Shows an example of combining levels in the Axcess language. This is provided for comparison to illustrate the differences and the need for virtual devices in NetLinx.
```Axcess
DEFINE_DEVICE
TP1 = 128
TP2 = 129
TP3 = 130
DEFINE_CONNECT_LEVEL
(TP1,1, TP2,1, TP3,1)
```
--------------------------------
### NetLinx Constants Example
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
Provides examples of constant definitions within a NetLinx module, including button states and timing parameters for device control.
```NetLinx
DEFINE_CONSTANT
NO_BUTTON = 0
NO_FUNCTION = 256
PLAY = 1
STOP = 2
PAUSE = 3
FFWD = 4
REW = 5
SFWD = 6
SREV = 7
REC = 8
PLAY_FB = 241
STOP_FB = 242
PAUSE_FB = 243
FFWD_FB = 244
REW_FB = 245
SFWD_FB = 246
SREV_FB = 247
REC_FB = 248
(* vcr will go into stop after rewinding for a certain time *)
VCR1_REW_TO_STOP = 1800 (* 3 min *)
(* vcr will go into stop after search rewinding for a certain time *)
VCR1_SREV_TO_STOP = 12000 (* 20 min *)
(* vcr will go into stop after being paused for a certain time *)
VCR1_PAUSE_TO_STOP = 6000 (* 10 min *)
(* button feedback flag *)
VCR1_DEFEAT_FEEDBACK = 0
```
--------------------------------
### NetLinx FOR Loop Example with Initialization and Increment
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
A practical example of a FOR loop in NetLinx, showing how to initialize a counter, define a loop condition, and specify an increment operation.
```NetLinx
FOR (COUNT=0 ; COUNT<10 ; COUNT++)
{
(* loop statements *)
}
```
--------------------------------
### Tracking a Touch Panel Page Example
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
Provides a basic NetLinx code example for tracking a touch panel page, demonstrating buffer creation and data event evaluation.
```NetLinx
DEFINE_START
CREATE_BUFFER TP1, TP1_BUFFER
.
.
DEFINE_EVENT
..
DATA_EVENT[TP1](* EVALUATE TP1 DATA *)
```
--------------------------------
### NetLinx Device Array Initialization Example
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
Provides a practical example of initializing a device array named 'dvs' with three devices: panel1, panel2, and panel3. This showcases the DEFINE_DEVICE, DEFINE_CONSTANT, and DEFINE_VARIABLE sections.
```NetLinx
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}
```
--------------------------------
### NetLinx Cluster Topology URL List Configuration (Example 2)
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
A second example of URL List configurations for a NetLinx Cluster Topology, demonstrating different connection patterns for traffic optimization.
```APIDOC
System Number URL Entry Master 1 Master 2 Master 3 Master 4 Master 5 Master 6 Master 7 Master 8 Master 9 Master 10 Master 11 Master 12 Master 13 Master 14 Master 15 Master 16
1^2 7 12
2^3 8 13
3^4 9 14
4^5 10 15
5^6 16
6^11
```
--------------------------------
### NetLinx Star Topology URL List Configuration
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
Example configuration for URL Lists in a NetLinx Star Topology. In this setup, a central master connects to multiple other masters.
```APIDOC
URL Entry Master 1 Master 2 Master 3 Master 4 Master 5 Master 6 Master 7 Master 8 Master 9 Master 10 Master 11 Master 12 Master 13 Master 14 Master 15 Master 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
```
--------------------------------
### Axcess String Comparison Example
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
Illustrates a string comparison in Axcess using the wildcard character '?'. This example shows how Axcess evaluates a time string, considering the wildcard for flexible matching.
```axcess
IF (TIME = '12:00:??')
(* Do something at noon - evaluation is valid for an entire minute *)
```
--------------------------------
### NetLinx Channel Event Example (Lift Up Relay)
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
An example of a Channel Event handler for the 'Lift Up' relay. When the relay turns ON, it pulses the VP_POWER_OFF command.
```NetLinx
CHANNEL_EVENT[RELAY,LIFT_UP] (* LIFT UP RELAY EVENT *)
{
ON:
{
PULSE[VPROJ,VP_POWER_OFF]
}
}
```
--------------------------------
### DEFINE_CALL Syntax Example
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
Shows the correct syntax for the DEFINE_CALL statement, emphasizing that it must be followed by a name.
```NetLinx
DEFINE_CALL 'VHS'.
```
--------------------------------
### Combine Individual DEVCHANs to a Virtual [DEV,CHAN] Pair (Example 1)
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
This example demonstrates combining individual DEVCHANs (dvIO10, dvREL10, dvTP) into a virtual [DEV,CHAN] pair (vdvControl, 2). The COMBINE_CHANNELS command links these individual channels, and the associated BUTTON_EVENTs trigger these actions.
```NetLinx
DEFINE_VARIABLE
DEVCHAN dc2[] = {{dvIO10,2},{dvREL10,2},{dvTP,2}}
DEFINE_EVENT
BUTTON_EVENT[dvTP,13] // COMBINE_CHANNELS 2
{
RELEASE:
{
COMBINE_CHANNELS (vdvControl,2,dc2[1],dc2[2],dc2[3])
}
}
BUTTON_EVENT[dvTP,14] // UNCOMBINE_CHANNELS 2
{
RELEASE:
{
UNCOMBINE_CHANNELS (vdvControl,2)
}
}
BUTTON_EVENT[vdvControl,2] // this will work when the COMBINE_CHANNELS above is invoked
{
PUSH:
{
TO[BUTTON.INPUT]
}
}
```
--------------------------------
### NetLinx Cluster Topology URL List Configuration (Example 1)
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
Example URL List configurations for a NetLinx Cluster Topology, which combines elements of other topologies to optimize traffic.
```APIDOC
System Number URL Entry Master 1 Master 2 Master 3 Master 4 Master 5 Master 6 Master 7 Master 8 Master 9 Master 10 Master 11 Master 12 Master 13 Master 14 Master 15 Master 16
1^2
2^3
3^4
4^5
5^6
6^7
7^8
8^9
9^10
10^11
11^12
12^13
13^14
14^15
15^16
```
--------------------------------
### NetLinx Program Execution Example
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
An example of how to call a defined function within a NetLinx program. It shows pushing a value onto the stack and then calling the CUBEIT function.
```NetLinx
DEFINE_PROGRAM
PUSH[TP1, 1]
{
CUBED_VAL = CUBEIT ( 3 )
(* CUBED_VAL = 27 *)
}
```
--------------------------------
### DEFINE_DEVICE Examples
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
Defines devices referenced in the program, allowing specification by device number or a fully-qualified device string.
```NetLinx
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
```
--------------------------------
### NetLinx Button Event Example (Lift Up)
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
An example of a Button Event handler for a 'Lift Up' button (TP1, 21). It triggers a PULSE command to the LIFT_UP relay.
```NetLinx
BUTTON_EVENT[TP1,21] (* LIFT UP BUTTON *)
{
PUSH:
{
PULSE[RELAY,LIFT_UP]
}
}
```
--------------------------------
### Combine Individual [DEV,CHAN] Pairs to a Virtual DEVCHAN (Example 5)
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
This example demonstrates combining individual [DEV,CHAN] pairs into a virtual DEVCHAN (vdc6). It explicitly references the DEVICE and CHANNEL properties of each pair when calling COMBINE_CHANNELS.
```NetLinx
DEFINE_VARIABLE
DEVCHAN vdc6 = {vdvControl,6}
DEVCHAN dc6[] = {{dvIO10,6},{dvREL10,6},{dvTP,6}}
DEFINE_EVENT
BUTTON_EVENT[dvTP,21] // COMBINE_CHANNELS 6
{
RELEASE:
{
COMBINE_CHANNELS (vdc6,
dc6[1].DEVICE,
dc6[1].CHANNEL,
dc6[2].DEVICE,
dc6[2].CHANNEL,
dc6[3].DEVICE,
dc6[3].CHANNEL)
}
}
BUTTON_EVENT[dvTP,16] // UNCOMBINE_CHANNELS 6
{
RELEASE:
{
UNCOMBINE_CHANNELS (vdc6)
}
}
BUTTON_EVENT[vdc6] // this will work when the COMBINE_CHANNELS above is invoked
{
PUSH:
{
TO[BUTTON.INPUT]
}
}
```
--------------------------------
### DEFINE_CONSTANT Examples
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
Defines program constants whose values cannot be changed during execution. Examples show integer and string constants.
```NetLinx
PLAY = 1
STOP = 2
STRING='HELLO'
```
--------------------------------
### NetLinx IP Example Program Structure
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
Demonstrates the basic structure of a NetLinx program for IP communication, including device definitions, constants, variables, startup code, and event handlers for IP server and client.
```netlinx
PROGRAM_NAME='IPExample'
(***********************************************************)
(* DEVICE NUMBER DEFINITIONS GO BELOW *)
(***********************************************************)
DEFINE_DEVICE
dvIPServer = 0:2:0
dvIPClient = 0:3:0
(***********************************************************)
(* CONSTANT DEFINITIONS GO BELOW *)
(***********************************************************)
DEFINE_CONSTANT
nIPPort = 8000
(***********************************************************)
(* VARIABLE DEFINITIONS GO BELOW *)
(***********************************************************)
DEFINE_VARIABLE
IP_ADDRESS_STRUCT MyIPAddress (* .Flags *)
(* .HostName *)
(* .IPAddress *)
(* .SubnetMask *)
(* .Gateway *)
(***********************************************************)
(* STARTUP CODE GOES BELOW *)
(***********************************************************)
DEFINE_START
(* Get My IP Address *)
GET_IP_ADDRESS(0:0:0,MyIPAddress)
(* Open The Server *)
IP_SERVER_OPEN(dvIPServer.Port,nIPPort,IP_TCP)
(* Open The Client *)
IP_CLIENT_OPEN(dvIPClient.Port,MyIPAddress.IPAddress,nIPPort,IP_TCP)
(***********************************************************)
(* THE EVENTS GO BELOW *)
(***********************************************************)
DEFINE_EVENT
(* Server Data Handler *)
DATA_EVENT[dvIPServer]
{
ONERROR:
{
SEND_STRING 0,"'error: server=',ITOA(Data.Number)"
}
ONLINE:
{
SEND_STRING 0,"'online: server'"
}
OFFLINE:
{
SEND_STRING 0,"'offline: server'"
}
STRING:
{
SEND_STRING 0,"'string: client=',Data.Text"
IF (FIND_STRING(Data.Text,'ping',1))
SEND_STRING 0:2:0,"'pong',13"
}
}
(* Client Data Handler *)
DATA_EVENT[dvIPClient]
{
ONERROR:
{
SEND_STRING 0,"'error: client=',ITOA(Data.Number)"
}
ONLINE:
{
SEND_STRING 0,"'online: client'"
}
OFFLINE:
{
SEND_STRING 0,"'offline: client'"
}
STRING:
{
SEND_STRING 0,"'string: client=',Data.Text"
}
}
(***********************************************************)
(* THE ACTUAL PROGRAM GOES BELOW *)
(***********************************************************)
DEFINE_PROGRAM
(* Send Ping To Server *)
WAIT 50
SEND_STRING dvIPClient,"'ping',13"
(***********************************************************)
(* END OF PROGRAM *)
(* DO NOT PUT ANY CODE BELOW THIS COMMENT *)
```
--------------------------------
### Netlinx Online Command Example
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
Demonstrates sending an 'TPAGEON' command to a device named TP1 in an 'ONLINE' context.
```Netlinx
ONLINE:
{
SEND_COMMAND TP1, 'TPAGEON'
}
```
--------------------------------
### NetLinx M2M Topology Examples
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
Illustrates different M2M topologies, including cascading and clustered configurations, showing specific master-to-master communication paths.
```APIDOC
M2M Topology Examples:
**Cascading Master Topology (FIG. 13):**
- Describes a topology where masters are linked in a chain or hierarchy.
**Clustered Master Topology (FIG. 14):
- Uses the Cluster concept and direct mode to link specific masters while remaining isolated from others.
- Communication connections are specific, masters only communicate with masters that have an arrow between them.
**Example URL List Configuration (FIG. 14):**
- Master 1 connects to: 2, 7, 16, 12
- Master 2 connects to: 3, 8, 13
- Master 3 connects to: 4, 9, 14
- Master 4 connects to: 5, 10, 15
- Master 5 connects to: 6, 16
- Master 6 connects to: 11
**Routing Behavior:**
- Using route mode direct avoids routing loops even with connections like Master 10 to Master 16.
- Masters only connect to explicitly defined masters in their URL List.
```
--------------------------------
### Combine Individual DEVCHANs to a Virtual DEVCHAN (Example 4)
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
This example shows combining individual DEVCHANs into a virtual DEVCHAN (vdc5). The COMBINE_CHANNELS command allows passing individual DEVCHAN elements directly to the virtual DEVCHAN.
```NetLinx
DEFINE_VARIABLE
DEVCHAN vdc5 = {vdvControl,5}
DEVCHAN dc5[] = {{dvIO10,5},{dvREL10,5},{dvTP,5}}
DEFINE_EVENT
BUTTON_EVENT[dvTP,19] // COMBINE_CHANNELS 5
{
RELEASE:
{
COMBINE_CHANNELS (vdc5,dc5[1],dc5[2],dc5[3])
}
}
BUTTON_EVENT[dvTP,20] // UNCOMBINE_CHANNELS 5
{
RELEASE:
{
UNCOMBINE_CHANNELS (vdc5)
}
}
BUTTON_EVENT[vdc5] // this will work when the COMBINE_CHANNELS above is invoked
{
PUSH:
{
TO[BUTTON.INPUT]
}
}
```
--------------------------------
### Timeline Event Handling Example
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
Demonstrates how to define and handle timeline events using the TIMELINE_EVENT directive and a switch-case structure based on the Timeline.Sequence.
```Netlinx
DEFINE_EVENT
TIMELINE_EVENT[TL1] // capture all events for Timeline 1
{
switch(Timeline.Sequence) // which time was it?
{
case 1: { SEND_COMMAND dvPanel,"'TEXT1-1 1'" }
case 2: { SEND_COMMAND dvPanel,"'TEXT1-1 2'" }
case 3: { SEND_COMMAND dvPanel,"'TEXT1-1 3'" }
case 4: { SEND_COMMAND dvPanel,"'TEXT1-1 4'" }
case 5: { SEND_COMMAND dvPanel,"'TEXT1-1 5'" }
}
}
TIMELINE_EVENT[TL2]
{
switch(Timeline.Sequence)
{
case 1: { SEND_COMMAND dvPanel,"'TEXT2-2 1'" }
case 2: { SEND_COMMAND dvPanel,"'TEXT2-2 2'" }
case 3: { SEND_COMMAND dvPanel,"'TEXT2-2 3'" }
case 4: { SEND_COMMAND dvPanel,"'TEXT2-2 4'" }
case 5: { SEND_COMMAND dvPanel,"'TEXT2-2 5'" }
}
}
```
--------------------------------
### DEFINE_LATCHING Example
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
Defines latching channels and variables, which change state once per activation and retain their state after the activation stops.
```NetLinx
DEFINE_LATCHING
[RELAY, SYSTEM_POWER]
[VCR, PLAY]..[VCR, REWIND]
VAR1
```
--------------------------------
### Combine a DEVCHAN Set to a Virtual DEVCHAN (Example 3)
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
This example demonstrates combining a DEVCHAN set (dc4) to a virtual DEVCHAN (vdc4). The COMBINE_CHANNELS command takes the virtual DEVCHAN and the DEVCHAN array as arguments, simplifying the combination process.
```NetLinx
DEFINE_VARIABLE
DEVCHAN vdc4 = {vdvControl,4}
DEVCHAN dc4[] = {{dvIO10,4},{dvREL10,4},{dvTP,4}}
DEFINE_EVENT
BUTTON_EVENT[dvTP,17] // COMBINE_CHANNELS 4
{
RELEASE:
{
COMBINE_CHANNELS (vdc4,dc4)
}
}
BUTTON_EVENT[dvTP,18] // UNCOMBINE_CHANNELS 4
{
RELEASE:
{
UNCOMBINE_CHANNELS (vdc4)
}
}
BUTTON_EVENT[vdc4] // this will work when the COMBINE_CHANNELS above is invoked
{
PUSH:
{
TO[BUTTON.INPUT]
}
}
```
--------------------------------
### NetLinx DATA_EVENT Example
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
Demonstrates capturing strings from multiple devices using a DeviceSet and DATA_EVENT, which is the recommended alternative to CREATE_MULTI_BUFFER and GET_MULTI_BUFFER_STRING. It shows how to process incoming data, extract the device index, and the string content.
```NetLinx
DEFINE_DEVICE
Dev1 = 1:1:0
Dev2 = 1:2:0
Dev3 = 1:3:0
DEFINE_VARIABLE
DEV DeviceSet[] = {Dev1, Dev2, Dev3}
INTEGER DeviceIndex
CHAR DeviceString[1000]
DEFINE_EVENT
DATA_EVENT[DeviceSet]
{
STRING:
{
DeviceIndex = GET_LAST(DeviceSet)
DeviceString = DATA.TEXT
}
}
```
--------------------------------
### Timeline Creation Example
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
Illustrates the creation of two timelines (TL1 and TL2) using the TIMELINE_CREATE function, specifying different modes (absolute/relative) and repetition behaviors (repeat/once).
```Netlinx
DEFINE_VARIABLE
LONG TimeArray[100]
DEFINE_CONSTANT
TL1 = 1
TL2 = 2
DEFINE_PROGRAM
PUSH[dvPanel,1]
{
TimeArray[1] = 1000
TimeArray[2] = 2000
TimeArray[3] = 3000
TimeArray[4] = 4000
TimeArray[5] = 5000
TIMELINE_CREATE(TL1, TimeArray, 5, TIMELINE_ABSOLUTE,TIMELINE_REPEAT)
}
PUSH[dvPanel,2]
{
TimeArray[1] = 1000
TimeArray[2] = 1000
TimeArray[3] = 1000
TimeArray[4] = 1000
TimeArray[5] = 1000
TIMELINE_CREATE(TL2, TimeArray, 5, TIMELINE_RELATIVE, TIMELINE_ONCE)
}
```
--------------------------------
### NetLinx Button Event Example (System Off)
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
An example of a Button Event handler for a 'System Off' button (TP1, 22). It triggers PULSE commands to RACK_OFF and LIFT_UP relays.
```NetLinx
BUTTON_EVENT[TP1,22] (* SYSTEM OFF BUTTON *)
{
PUSH:
{
PULSE[RELAY,RACK_OFF]
PULSE[RELAY,LIFT_UP]
}
}
```
--------------------------------
### Combine Individual [DEV,CHAN] Pairs to a Virtual [DEV,CHAN] Pair (Example 2)
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
This example shows how to combine individual [DEV,CHAN] pairs into a virtual [DEV,CHAN] pair. It uses a DEVCHAN array (dc3) and explicitly references the DEVICE and CHANNEL properties for combining into the virtual pair (vdvControl, 3).
```NetLinx
DEFINE_VARIABLE
DEVCHAN dc3[] = {{dvIO10,3},{dvREL10,3},{dvTP,3}}
DEFINE_EVENT
BUTTON_EVENT[dvTP,15] // COMBINE_CHANNELS 3
{
RELEASE:
{
COMBINE_CHANNELS (vdvControl,3,
dc3[1].DEVICE,
dc3[1].CHANNEL,
dc3[2].DEVICE,
dc3[2].CHANNEL,
dc3[3].DEVICE,
dc3[3].CHANNEL)
}
}
BUTTON_EVENT[dvTP,16] // UNCOMBINE_CHANNELS 3
{
RELEASE:
{
UNCOMBINE_CHANNELS (vdvControl,3)
}
}
BUTTON_EVENT[vdvControl,3] // this will work when the COMBINE_CHANNELS above is invoked
{
PUSH:
{
TO[BUTTON.INPUT]
}
}
```
--------------------------------
### NetLinx Timeline Control Example
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
Demonstrates pausing and restarting timelines in NetLinx. It shows how to pause specific timelines, set their positions to the beginning, and then restart them.
```NetLinx
PUSH[dvPanel,8]
{
TIMELINE_PAUSE(MY_LINE_1)
TIMELINE_PAUSE(MY_LINE_2)
TIMELINE_SET(MY_LINE_1,0)
TIMELINE_SET(MY_LINE_2,0)
TIMELINE_RESTART(MY_LINE_1)
TIMELINE_RESTART(MY_LINE_2)
}
```
--------------------------------
### NetLinx Operator Keyword Explanations
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
Provides detailed explanations for various NetLinx operator keywords, including their functionality and usage examples.
```NetLinx
AND (&&) This logical operator evaluates two logical conditions. Both conditions must be true for the entire expression to be true.
BAND (&) This operator performs a bitwise AND on two data items, which can be constants or variables.
BNOT (~) This operator performs a bitwise NOT on a constant or variable.
BOR (|) This operator performs a bitwise OR on two data items, which can be constants or variables.
BXOR (^) This operator performs a bitwise XOR operation between two data items, which can be constants or variables.
LSHIFT This keyword causes the bits in the associated integer f ield to be shifted left. This has the effect of multiplying by 2n, where n is the number of bit positions to shift. The symbol << is equivalent to LSHIFT.
For example:
INT2 = INT1 LSHIFT 2
is equivalent to:
INT2 = INT1 << 2
Both statements shift INT1 left two positions. Either statement could be replaced with the following:
INT2 = INT1 * 4
MOD (%) This keyword is used to generate the remainder of a division function. You cannot take the mod of an integer without first loading the value into a variable.
For example:
VRAM_LSB = ((2 % 16)+$30) (* does not work *)
However,
ID = 2
OTHER = 16
VRAM_LSB = ((ID % OTHER) + $30) (* works *)
NOT (!) This keyword is used to negate a given expression.
###### IF (NOT (X > 10))
###### {
```
// statements to execute if X <= 10
}
OR (||) This keyword evaluates two conditions. If one or both conditions are true, the entire expression evaluates to true.
RSHIFT This keyword causes the bits in the associated value f ield to be shifted right. This has the effect of dividing by 2n where n is the number of bit positions to shift. The symbol >> is equivalent to RSHIFT.
For example:
INT2 = INT1 RSHIFT 2
is equivalent to:
INT2 = INT1 >> 2
Both statements shift INT1 right two positions.
Either statement could be replaced with:
INT2 = INT1 / 4
XOR (^^) This keyword evaluates two conditions. One and only one condition can be true for the entire expression to be true.
```
--------------------------------
### Axcess Device Combining Example
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
Illustrates how to combine multiple touch panels in Axcess to function as a single device. Input changes on any combined device are seen as originating from the first device in the list. Output changes sent to one device are broadcast to all.
```Axcess
DEFINE_DEVICE
TP1 = 128
TP2 = 129
TP3 = 130
DEFINE_COMBINE
(TP1, TP2, TP3)
DEFINE_PROGRAM
RELEASE[TP1,1]
{
(*Do Something*)
}
```
--------------------------------
### NetLinx String Comparison
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
Provides an example of string comparison within NetLinx code, a feature that extends Axcess capabilities.
```NetLinx
(* NetLinx code - string comparison *)
```
--------------------------------
### Handling Button Events in NetLinx
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
Demonstrates how to handle button press events in NetLinx. It shows an example of a BUTTON_EVENT structure and how to define actions for the PUSH state. It also illustrates how unhandled events can cause DEFINE_PROGRAM to run more frequently.
```NetLinx
BUTTON_EVENT[dvTP,123]
{
PUSH:
{
PULSE[dvRelay,1]
}
}
```
```NetLinx
BUTTON_EVENT[dvTP,0]
{
PUSH:{}
RELEASE:{}
}
```
```NetLinx
CHANNEL_EVENT[dvRelay,0]
{
ON:{}
OFF:{}
}
```
--------------------------------
### NetLinx SWITCH...CASE Statement Example with BREAK
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
An example demonstrating the use of the BREAK statement within a SWITCH...CASE structure in NetLinx. Unlike C/C++, cases do not fall through, making BREAK optional between cases.
```NetLinx
SWITCH (var)
{
CASE 1:
{
(*statements go here*)
BREAK
}
CASE 3:
{
(*statements go here*)
BREAK
}
CASE 5:
{
(*statements go here*)
BREAK
}
DEFAULT:
{
(*statements go here*)
BREAK
}
}
```
--------------------------------
### Local Variable Declaration Examples
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
Demonstrates the correct and incorrect ways to declare local variables within statement blocks in NetLinx, highlighting scope and re-declaration rules.
```NetLinx
DEFINE_CALL 'My Subroutine' (INTEGER INT1)
LOCAL_VAR INTEGER INT2
{
(* body of subroutine *)
}
```
```NetLinx
DEFINE_CALL 'My Subroutine' (INTEGER INT1)
{
LOCAL_VAR INTEGER INT2
(* body of subroutine *)
}
```
```NetLinx
WAIT 10, 'My Wait Name'
{
LOCAL_VAR CHAR TempBuf[80]
(* statements *)
}
```
```NetLinx
DEFINE_FUNCTION integer MyFunc(INTEGER nFlag)
{
LOCAL_VAR INTEGER n // static (permanent)
IF (nFlag > 0)
{
LOCAL_VAR INTEGER n // illegal declaration
.. }
}
DEFINE_FUNCTION integer MyFunc(INTEGER nFlag)
{
IF (nFlag > 0)
{
LOCAL_VAR INTEGER n
}
else
{
LOCAL_VAR INTEGER n // legal declaration
}
}
```
--------------------------------
### NetLinx DEFINE_COMBINE Syntax
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
Demonstrates how to define a combination of functionally identical devices in NetLinx. When one device in the combine is referenced, all others are also referenced. The example shows combining individual devices and using a device array.
```NetLinx
DEFINE_COMBINE(VDevice, Panel1, Panel2, Panel3)
DEFINE_COMBINE(VDevice, DEV[ ])
```
--------------------------------
### COMPARE_STRING for Recurring Events
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
An example demonstrating the use of COMPARE_STRING with wildcards for scheduling recurring events, specifically showing how to match any hour with a fixed minute and second.
```NetLinx
// Example for recurring event: match any hour, specific minute and second
// COMPARE_STRING(time_string, '??;00;00')
```
--------------------------------
### NetLinx Get Keywords
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
Lists keywords used to retrieve system information and configuration in NetLinx. This includes details like available flash disk space, DNS lists, IP addresses, serial numbers, and timer values.
```NetLinx
GET_AVAILABLE_FLASH_DISK_SPACE
GET_DNS_LIST
GET_IP_ADDRESS
GET_LAST
GET_MAX_FLASH_DISK_SPACE
GET_PULSE_TIME
GET_SERIAL_NUMBER
GET_SYSTEM_NUMBER
GET_TIMER
GET_UNIQUE_ID
GET_URL_LIST
```
--------------------------------
### NetLinx Timeline Event Capture Example
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
Illustrates how to capture and process events from timelines in NetLinx. It shows how to define timeline IDs, create timelines, and then define event handlers to send messages when events occur.
```NetLinx
CONSTANT LONG TimelineID_1 = 1
CONSTANT LONG TimelineID_2 = 2
CONSTANT LONG TimelineID_3 = 3
CONSTANT LONG TimelineID_4 = 4
LONG TimeArray[4] =
{
1000, // 1 second
2000, // 2 seconds
3000, // 3 seconds
4000 // 4 seconds
}
DEFINE_START
TIMELINE_CREATE (TimelineID_2,TimeArray,LENGTH_ARRAY(TimeArray),TIMELINE_RELATIVE,TIMELINE_REPEAT)
TIMELINE_CREATE (TimelineID_3,TimeArray,LENGTH_ARRAY(TimeArray),TIMELINE_RELATIVE,TIMELINE_REPEAT)
TIMELINE_CREATE (TimelineID_4,TimeArray,LENGTH_ARRAY(TimeArray),TIMELINE_RELATIVE,TIMELINE_REPEAT)
DEFINE_EVENT
// typical TIMELINE_EVENT statement
TIMELINE_EVENT[TimelineID_1] // capture all events for Timeline 1
{
SEND_STRING 0,"'TL ID = ', itoa(timeline.id),', sequence = ',itoa(timeline.sequence)"
}
// example of "stacked" TIMELINE_EVENT statements
TIMELINE_EVENT[TimelineID_2] // capture all events for Timeline 2
TIMELINE_EVENT[TimelineID_3] // capture all events for Timeline 3
TIMELINE_EVENT[TimelineID_4] // capture all events for Timeline 4
{
SEND_STRING 0,"'TL ID = ', itoa(timeline.id),', sequence = ',itoa(timeline.sequence)"
}
// end
```
--------------------------------
### NetLinx DEFINE_START Section
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
Illustrates the DEFINE_START section in NetLinx for setting initialization parameters, including buffer creation, level settings, communication parameters, and event handling.
```NetLinx
DEFINE_START
CREATE_BUFFER TP, TP_BUFFER
CREATE_LEVEL VOL, 1, VOL_LEVEL1
SEND_COMMAND SWT,
'SET BAUD 9600,N,8,1,DISABLE'
ON[CLEAR_TO_SEND]
```
--------------------------------
### NetLinx Keyword Usage Example
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
Demonstrates the usage of a NetLinx keyword, 'CALL', in a statement to invoke a subroutine named 'Read Data' with a 'Buffer' argument. Keywords are case-insensitive.
```NetLinx
CALL 'Read Data' (Buffer)
```
--------------------------------
### NetLinx Chain Topology URL List Configuration
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
Example configuration for URL Lists in a NetLinx Chain Topology. This topology connects masters sequentially, where messages pass through intermediate masters.
```APIDOC
URL Entry Master 1 Master 2 Master 3 Master 4 Master 5 Master 6 Master 7 Master 8 Master 9 Master 10 Master 11 Master 12 Master 13 Master 14 Master 15 Master 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
```
--------------------------------
### Get Device ID String (DEVICE_ID_STRING)
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
The DEVICE_ID_STRING keyword returns a string description or model number for a specified device. The example demonstrates retrieving the string description for device 55:1:0 and assigning it to a variable.
```NetLinx
DeviceString = DEVICE_ID_STRING(55:1:0)
```
--------------------------------
### NetLinx Dynamic Device Combine and Uncombine
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
Illustrates how to dynamically combine and un-combine devices using NetLinx. This example shows activating a combine operation and then later removing it, demonstrating the lifecycle of a dynamic combine.
```NetLinx
DEFINE_DEVICE
VIRTUAL1 = 33000
TP1 = 128
TP2 = 129
TP3 = 130
TP4 = 131
DEFINE_PROGRAM
(* Activate dynamic device combine*)
RELEASE[TP4,1]
{
COMBINE_DEVICES(VIRTUAL1, TP1, TP2, TP3)
}
(*Remove dynamic device combine*)
RELEASE[TP4,1]
{
UNCOMBINE_DEVICES(VIRTUAL1)
}
(*Pushes come here when a combine is active*)
RELEASE[VIRTUAL1,1]
{
(*Do Something*)
}
(*This will only see pushes when combine is NOT active*)
RELEASE[TP1,1]
{
(*Do Something*)
}
```
--------------------------------
### Tracking Online/Offline State in a Remote Master (NetLinx)
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
This NetLinx code example demonstrates how to define a device, declare a variable to track its status, and set up an event to monitor its online and offline states, updating the status variable accordingly.
```NetLinx
DEFINE_DEVICE
SYSTEM4 = 33001:1:4
DEFINE_VARIABLE
INTEGER SYSTEM4_STATUS
DEFINE_EVENT
DATA_EVENT[SYSTEM4]
{
ONLINE:
{
SYSTEM4_STATUS = 1
}
OFFLINE:
{
SYSTEM4_STATUS = 0
}
}
```
--------------------------------
### DEFINE_PROGRAM and DEFINE_START Keywords
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
Explains the DEFINE_PROGRAM keyword for continuous mainline code execution and DEFINE_START for program startup instructions.
```NetLinx
DEFINE_PROGRAM
See the Mainline on page 17 for more information. Also refer to the Understanding When DEFINE_PROGRAM
Runs section on page 18 for details on using DEFINE_PROGRAM effectively.
```
```NetLinx
DEFINE_START
This keyword contains instructions that are executed once at program startup; in other words, at power-up or after a
system reset.
```
--------------------------------
### Get Device ID (DEVICE_ID)
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
The DEVICE_ID keyword returns the unique ID number for a specified device in the NetLinx system. If the device does not exist, it returns zero. This is commonly used to check for device presence. The example shows assigning the ID of device 55:1:0 to a variable and checking if it's non-zero.
```NetLinx
DeviceID = DEVICE_ID(Device)
IF (DEVICE_ID(55:1:0) <> 0)
{
// device 55 exists in the system
}
```
--------------------------------
### NetLinx Statements and Expressions
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
Examples of basic NetLinx programming statements and expressions. This includes variable assignment, arithmetic operations, conditional statements (IF), and feedback statements used to interact with hardware or display information.
```NetLinx
Y = X (* Variable Assignment Statement *)
X = X + 1 (* Arithmetic Assignment Statement *)
IF (Y < 10) Y = Y + 1 (* IF Statement *)
[TP, 5] = [VCR, 1] (* Feedback Statement *)
```
--------------------------------
### Subroutine Calls: Axcess vs. NetLinx
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
Shows how subroutines are called in Axcess and NetLinx. Both support DEFINE_CALL for internal subroutines with parameter passing and SYSTEM_CALL for external library functions. NetLinx provides examples of both types of calls.
```Axcess
DEFINE_CALL 'SWITCH' (CARD,IN,OUT)
{
SEND_STRING CARD,
"ITOA(IN),'*',ITOA(OUT),'!'"
}
DEFINE_CALL 'MULTIPLY' (X,Y,RESULT)
{
RESULT = X * Y
}
DEFINE_PROGRAM
PUSH[TP,11]
{
CALL 'SWITCH' (SWITCHER,4,1)
}
PUSH[TP,12]
{
CALL 'MULTIPLY' (3,4,VALUE)
}
SYSTEM_CALL [1] 'VCR1'
(VCR,TP,21,22,23,24,25,26,27,28,0)
```
```NetLinx
DEFINE_CALL 'SWITCH' (CARD,IN,OUT)
{
SEND_STRING CARD,
"ITOA(IN),'*',ITOA(OUT),'!'"
}
DEFINE_CALL 'MULTIPLY' (X,Y,RESULT)
{
RESULT = X * Y
}
DEFINE_PROGRAM
PUSH[TP,11]
{
CALL 'SWITCH' (SWITCHER,4,1)
}
PUSH[TP,12]
{
CALL 'MULTIPLY' (3,4,VALUE)
}
SYSTEM_CALL [1] 'VCR1'
(VCR,TP,21,22,23,24,25,26,27,28,0)
```
--------------------------------
### XML Encoding Result Example
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
Demonstrates the XML encoding of a data structure, including nested arrays and variables, representing system data like title IDs, artist names, and release dates.
```XML
0
1
LTITLEID
11101000
SARTIST
13
Buffet, Jimmy
STITLE
26
Living & Dying in 3/4 Time
SCOPYRIGHT
3
MCA
SLABEL
3
MCA
SRELEASEDATE
4
1974
NNUMTRACKS
11
SCODE
10
3132333435
NDISCNUMBER
91
2
LTITLEID
17248229
....
NDISCNUMBER
105
3
LTITLEID
12328612
...
NDISCNUMBER
189
```
--------------------------------
### NetLinx Wait Keywords
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
This section covers NetLinx keywords used for managing wait conditions, including starting, pausing, restarting, and canceling waits, as well as timed waits.
```NetLinx
CANCEL_ALL_WAIT
CANCEL_ALL_WAIT_UNTIL
CANCEL_WAIT
CANCEL_WAIT_UNTIL
PAUSE_ALL_WAIT
PAUSE_WAIT
RESTART_ALL_WAIT
RESTART_WAIT
WAIT
WAIT_UNTIL
TIMED_WAIT_UNTIL
```
--------------------------------
### NetLinx Module Definition and Usage
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
Details the syntax for defining and referencing NetLinx Modules. Modules are reusable code blocks that can contain various program elements and accept parameters for customization. The examples show the MODULE_NAME definition and the DEFINE_MODULE statement for instantiation.
```netlinx
MODULE_NAME = '' [(, , ... , )]
DEFINE_MODULE '' [(, , ... , )]
```
--------------------------------
### WC_GET_BUFFER_STRING Function Example
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
An example of using the WC_GET_BUFFER_STRING function to extract the first 3 characters from a WIDECHAR array. This function operates similarly to its CHAR array counterpart.
```NetLinx
wcRemoved = WC_GET_BUFFER_STRING(wcMyString,3)
```
--------------------------------
### NetLinx Cascade Topology URL List Configuration
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
Example configuration for URL Lists in a NetLinx Cascade Topology using route mode direct. This topology allows each master to connect to all others with a single hop.
```APIDOC
URL Entry Master 1 Master 2 Master 3 Master 4 Master 5 Master 6 Master 7 Master 8 Master 9 Master 10 Master 11 Master 12 Master 13 Master 14 Master 15 Master 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
```
--------------------------------
### Startup Code and Variable Assignments
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
Initializes variables during program startup. This includes assigning values to the members of the `AlbumStruct` array, populating fields like title ID, artist, title, and release date.
```NetLinx
DEFINE_START
(* assign some values *)
AlbumStruct[1].lTitleID = 11101000
AlbumStruct[1].sArtist = 'Buffet, Jimmy'
AlbumStruct[1].sTitle = 'Living & Dying in 3/4 Time'
AlbumStruct[1].sCopyright = 'MCA'
AlbumStruct[1].sLabel = 'MCA'
AlbumStruct[1].sReleaseDate = '1974'
AlbumStruct[1].nNumTracks = 11
AlbumStruct[1].sCode = '3132333435'
AlbumStruct[1].nDiscNumber = 91
AlbumStruct[2].lTitleID = 17248229
AlbumStruct[2].sArtist = 'Buffet, Jimmy'
AlbumStruct[2].sTitle = 'Off to See the Lizard'
AlbumStruct[2].sCopyright = 'MCA'
AlbumStruct[2].sLabel = 'MCA'
AlbumStruct[2].sReleaseDate = '1989'
AlbumStruct[2].nNumTracks = 11
AlbumStruct[2].sCode = '3132333436'
AlbumStruct[2].nDiscNumber = 105
AlbumStruct[3].lTitleID = 12328612
AlbumStruct[3].sArtist = 'Buffet, Jimmy'
AlbumStruct[3].sTitle = 'A-1-A'
AlbumStruct[3].sCopyright = 'MCA'
AlbumStruct[3].sLabel = 'MCA'
AlbumStruct[3].sReleaseDate = '1974'
AlbumStruct[3].nNumTracks = 11
AlbumStruct[3].sCode = '3132333437'
AlbumStruct[3].nDiscNumber = 189
```
--------------------------------
### NetLinx Data Set Arrays Initialization
Source: https://github.com/souky-byte/netlinx/blob/main/readme.md
Shows how to initialize arrays of NetLinx data set structures, including DEV, DEVCHAN, and DEVLEV, with multiple device, channel, or level configurations.
```netlinx
DEV PANEL_GROUP1[] = { 128:1:0, 129:1:0, 130:1:0 }
DEV MSP_GROUP[5] = { MSP1, MSP2, MSP3 }
DEVCHAN PRESET1_BUTTONS[5] = { {TP1, 21}, {MSP1, 1}, {134:1:0, 1} }
DEVLEV VOL1_LEVEL[] = { {TP1, 1}, {MSP1, 1}, {192:1:0, 1} }
```