Your Digital Media Has Never Looked So Good

 
stevefromNewcastle
Topic Author
Posts: 3
Joined: Mon Jan 23, 2012 4:09 am

UDP/OSC Control

Mon Jan 23, 2012 4:15 am

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
 
RokuLyndon

Re: UDP/OSC Control

Mon Jan 23, 2012 8:16 am

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.
 
stevefromNewcastle
Topic Author
Posts: 3
Joined: Mon Jan 23, 2012 4:09 am

Re: UDP/OSC Control

Mon Jan 23, 2012 10:48 am

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

Re: UDP/OSC Control

Mon Jan 23, 2012 2:02 pm

On our support site, under documentation and resources.
 
stevefromNewcastle
Topic Author
Posts: 3
Joined: Mon Jan 23, 2012 4:09 am

Re: UDP/OSC Control

Tue Jan 24, 2012 4:55 am

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
 
RokuLyndon

Fri Jan 27, 2012 6:36 pm

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

Who is online

Users browsing this forum: No registered users and 2 guests