0

UDP/OSC Control



I have managed to use netcat on OS X to control my brightsign player but what i would love to do is to use Open Sound Control to control my player. Essentially OSC is simple a structured UDP message, but my problem is that the null characters that get sent in the OSC are not parsed by the brightsign player. Is there away of inputting HEX strings as UDP control for the brightsigns, this would allow me to input the raw message including null characters and hopefully the brightsign will then parse this. Cheers Steve

6 comments

  • 0
    Avatar
    RokuLyndon


    This would have to be done as a custom script. If you look at the object reference guide for BrightScript, you can recieve byte arrays over udp. But, you would have to write a script to receive byte arrays.
  • 0
    Avatar
    stevefromNewcastle


    Hi thanks for the reply where can I find the object reference guide for BrightScript?
    Thanks
    Steve
  • 0
    Avatar
    RokuLyndon


    On our support site, under documentation and resources.
  • 0
    Avatar
    stevefromNewcastle


    Hi Lyndon thanks for that I have read through the document, are there any basic code examples of udp byte array controling actions for me to get a jump off point from.
    Thanks for your help.
    Steve
  • 0
    Avatar
    RokuLyndon


    I think this covers it. I took this out of a more complicated piece of code but it looks correct.

    A. create a byte array
    B. Listen for stream byte events
    C. Add bytes to array
    D. Convert to string when finished

    This assumes you've created your roMessage objects, and you've created your UDP receiver and you're listening to that message object. Those parts you still have to do.  

    1. First, create  Byte Array somehwere in your script:


    response = CreateObject("roByteArray")
       
    response_bytes_left = 20




    2. Here we check to see if it's a streambyte event, which is what you receive whether you're listening over serial or ethernet. Now, we're listening for events.

    event = wait(0, p)

    if type(event) = "roStreamByteEvent" then


           response.Push(event.GetInt()) 'adds the new byte to the byte array
           response_bytes_left = response_bytes_left - 1
    if response_bytes_left = 0 then

    print response.HexString() 'converts byte array to string and prints results
    endif

    rem Checks if we've received the total # of expected bytes, and then prints if we have.

    else if type(event) = "roStreamEndEvent" then
    print "closed connection"
    print response.HexString() 'converts byte array to string and prints
    rem This bit of code checks if the event received is the end of stream event, and if it is, then it moves to process the array as well.

    endif





    The byte array object calls the ToHexSTring() function to covert the bytes in the array and returns a string. In this case, it was printed. But, you could say:

    ByteString$ = response.HexString()


    Then:


    If ByteString$ = "my expected reply" then
         <commands here>
    endif

  • 0
    Avatar
    Brian Alexander

    What application are you using to send UDP commands from a windows OS?  What about OS X?

    Thanks.

Please sign in to leave a comment.