The VCore, V4Pro and V16Pro are capable of receiving an incoming UDP packet from a third party device. The controller can take a pre-selected section of the message and store the value. With the stored value you can do things like start a sequence or display the value in a touch panel.
In this tutorial you are going to learn how to set up your system to receive a message and use that information to start a sequence
For this example, I'm using my computer to simulate an external device sending packets and a V16Pro.
Step 1: Create a product file
For the controller to be able to receive a custom external message and for it to be able to separate and store parts on the message in the controller, a product file is needed.
*The process of receiving a message and selecting parts of it is called parsing
1) Open WinScript4 and then go to Tools> Product File Creator
2) Select "New Product File". Fill in the information in the "Device information" tab. This is the information that you will see when you go to add your device in WS4:
-Make= The brand of your device
-Model = The model of your device
-Version = Usually in a x.x format 1.0, 1.1, 1.5 etc.... This is helpful to keep track of any changes you make.
-Protocol = UDP or TCP Packet
-Description = Any information that would help you remember details about it
3) Go to the "Ports" tab and fill in the information requested. In this section you will specify how the device is going to connect to the controller.
-Serial, Ethernet, Midi Check Boxes = Select how is the external device going to send the messsage to the Controller. In our case we are using Ethernet.
-Default IP = This is the default IP of your external device. This can be changed later on in WS4 when you add the device.
-Device port = This is the external device port where it will be receiving messages from the controller.
-Source Port = Leave it at 0
-Type= The communication protocol UDP or TCP
In our example the controller knows that messages going TO the external device are sent to IP 192.168.5.171 to port 10000
4) Go to the "Events" tab. In this tab you will define the syntax of the incoming message.
Click on the + sing on the bottom left corner of the screen, this will add a new event. Since we are processing an incoming message only a few of the fields are required.
Name = To help identify the particulate event
Description = Any details that will help remember what the event is for
Check Incoming Message = Tells the controller to listen for a message
Check Unsolicited = Tells the controller that the message will come at any time, it is not a response to a command
Check Hidden = Hides the event from the drop down list in WS4 on the event list.
5) Then click on the Incoming message (Unsolicited) tab. Here is where we define what the syntax is for the message and what parts of the message to store.
-In the Example Incoming Message box, type the message that the controller will be receiving. In our example the message will be playfile and then a number I.E playfile1, playfile2, etc... the goal is to store the number after playfile in the controller to use it to start a sequence later on.
Highlight the "playfile" section and click on add selection and choose constant. Then highlight the number and add it as a variable. Then select add variable and give it the name "Incomming_Value" (this is the name where the value is going to be stored in your script.
Lastly, check the box "operations" and type atoi(Incomming_Value). This will convert the number to an actual integer.
Finally save the product file in the folder Documents>Alcorn McBride>Winscript Live> My Product Files
Step 2: Add your device to the script set up a trigger from the "Incomming_Value" variable change.
In WS4 add your device to the devices list. Then on the "Set up the connection section fill in the settings.
All the settings will be filled in from your product file, but you will need to specify which port is the controller going to be listening to for the incoming messages. In this case we are sending the message to port 4545 of the controller.
After this, you will now see that the device has a Device Variable called "External Control.Incomming_Value" this is the variable where the number from "play1", "play2", etc will be stored. In other words if you send the message "play3", the variable value will change to the number 3.
Finally, all is left is to set up is a sequence that will be trigger by the change of the External Control.Incomming_Value Variable. In the sample script, when the variable changes, a sequence runs, performs some logic check and starts another sequence based on the current value of the Variable.
I used Hercules terminal to send the messages from my computer to the controller. it can be downloaded from the following link:
You can use Hercules to test your product file and syntax without having the third party device. * you will still need an Alcorn controller to test.
You can find the WS4 file and product file built for this tutorial here.