Facility Control

 View Only

Custom UDP Messages Via Visual Logic

  • 1.  Custom UDP Messages Via Visual Logic

    Posted 07-27-2023 12:37

    Hi,

    I was inspired to write this post by seeing another user mention issues with controlling their Christie Spyder(s). We have 4 Spyder X20s here, and when they were originally installed, Ross/Rocket Surgery gave us a CustomPanel that allowed us to control those devices within DashBoard simply by adding a custom function/device function block. We've since lost those original files from RocketSurgery, so I was forced to rebuild a working button from a picture I'd taken of the OGScript. This was to limited avail, as I was able to recreate the function with a strictly OGScript task, but I encounter errors whenever I build the function in Visual Logic.

    This is the script I used to make a working OGScript function:

    var myMessageBuilder = ogscript.createMessageBuilder();
    myMessageBuilder.writeString("spyder");
    myMessageBuilder.writeByte(0);
    myMessageBuilder.writeByte(0);
    myMessageBuilder.writeByte(0);
    myMessageBuilder.writeByte(0);
    myMessageBuilder.writeString("rsc " + (2-1) + " " + (1));
    myMessageBuilder.writeString(" r");
    //ogscript.sendUDPBytes('localhost', '7788', myMessageBuilder.toByteArray());
    ogscript.sendUDPBytes(params.getValueAsString('BellyCornerPrimary_IPAddress', 0), params.getValueAsString('BellyCornerPrimary_Port', 0), myMessageBuilder.toByteArray());
    ogscript.debug(myMessageBuilder.toByteArray());
    ogscript.debug('Message sent to ' + params.getValueAsString('BellyCornerPrimary_IPAddress', 0)  + ':' + params.getValueAsString('BellyCornerPrimary_Port', 0) + ' successfully.');

    and below is a couple of screenshots making up the visual logic function. Note that this is built only as a local function for now for ease of troubleshooting, and I would convert it to a custom Device once I got it working. The second screenshot is what the final visual logic block looks like.

    non-working visual logic-based custom function for controlling a Christie Spyder over UDP.
    I've tried this just about every way I can think of, but I must still be doing something wrong. When I try feeding the Create Message Builder block into the message of every receiving block, I get an error. I think usually the main issue has something to do with my Message Convert to ByteArray block, as when I delete that, the task works, but of course doesn't transmit to the Spyder. I've also tried sending the message through a Send UDP Messages (string) block, which makes the function work, but does not actually control the Spyder, either.
    Worst case scenario I could probably build this out as an OGScript custom device task, but I'd like to avoid that as I'd then have to add an input IP address and port as arguments, which I'd prefer to keep out of the individual buttons, even if they just point back to the host parameters.
    Thanks for any help!
    Sean Byrne


    ------------------------------
    Sean Byrne
    Broadcast Engineer
    Memphis Grizzlies
    Memphis United States
    ------------------------------