OnEvent, UDP message

Ideas for new features & functions

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
Grovkillen
Automation Wizard
Posts: 480
Joined: Fri Aug 10, 2012 2:38 pm
Location: Hudiksvall, Sweden
Contact:

OnEvent, UDP message

Post by Grovkillen » Tue Mar 31, 2020 4:27 pm

Would it make sense to have an EventType of UDP_MESSAGE_RECIEVED that work like this:

Code: Select all

EVENT_UDP_PORT=<port to listen to>
EVENT_UDP_MESSAGE=<message contains>
OnEvent>UDP_MESSAGE_RECIEVED,EVENT_UDP_PORT,EVENT_UDP_MESSAGE,<sub routine>
So if I let's say broadcast the UDP message "[MSUDP:variable=123|start=hello]" I could have the following happen:

Code: Select all

OnEvent>UDP_MESSAGE_RECIEVED,123456,MSUDP,TRIGGER_FROM_UDP

SRT>TRIGGER_FROM_UDP
//sub routine var is set to the full received message
  Separate>TRIGGER_FROM_UDP_Var_1,:,TEMP
  Separate>TEMP_2,|,TEMP_COMMANDS
  Let>k=0
  Repeat>k
    Let>k=k+1
    Separate>TEMP_COMMANDS_%k%,=,TEMP
    Let>%TEMP_1%=%TEMP_2%
  Until>k=TEMP_COMMANDS_count
  //This would result in me having the following variables set:
  //%variable% ---> "123"
  //%start% ---> "hello"
END>TRIGGER_FROM_UDP
The nature of UDP is that a package missed is okay so no need to care about hand shakes etc. etc.

So in partnership with this event a SendToUDP>port,message[,ip] would be great. The IP could be set to X.Y.Z.255 by default to broadcast to all units.
Let>ME=%Script%

Running: 15.0.9
version history

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts