How to send ucs2/utf16 over network with OF?

I’m writing a app that uses the CITP protocol to talk with lighting consoles. The protocol spec can be found here: http://www.citp-protocol.org/download/file.php?id=13

CITP allows a app to send previews of images/videos to a lighting console so the lighting designer can select clips vased on their image instead of just name.

My app is a mediaserver running on raspberry pi.

I have hacked together code in c++ to get a hang of how the protocol works. Eventually I hope to make this work with Openframeworks.

I’m stuck on how to send UCS2 names thru TCP.

Right now I have used basic char arrays. If I set a name to “camera1” it shows up as chinese letters in my lighting console (ucs2 stores the characters in two bytes so it is combining the hex values of ca me ra to three ucs2 characters).

Is there any simple way in openframeworks to work with ucs2/utf16? I only need it for a 2-3 fields in the whole protocol. I need to be able to read/write so conversion to/from utf8 should be easy but I just can’t figure it out.

you can use poco (which is included in OF) to convert to UTF-16:

http://pocoproject.org/docs/Poco.UnicodeConverter.html

Awesome! I will try it tonight.

Hi @Timoteus did you manage to progress much further with using oF and the CITP protocol? Currently looking at ways to use oF to communicate with Capture Argo and this seems like a good road. Just wondering if you made much progress before I start reinventing the wheel. Cheers.

Hi,

I also use Capture Argo.

How familiar are you with CITP? What is your goal?

My work was mainly in transfering preview images from a mediaserver to a
lighting console. I haven’t worked on it for a while because I ran into
hardwsre limitations on the raspberry pi.

I can share you my code and give you an overview of it over a chat session
if you want.

Hey I haven’t had any experience with using CITP yet just thought I’d ask you first before I dove in. My goal is to send video from an oF application to Capture in real-time so I can embed within a mocked up stage design with LED walls.

Would super appreciate it if your were willing to have a chat and share what ever code you managed to get together. my skype name is joshuaparisbatty or send me a PM if you had another idea.

Cheers!

I sent you a Skype invite. Here is a small overview of things that came to
mind. Do have time for Skype today?

Check out the CITP specification from

http://www.citp-protocol.org/viewtopic.php?f=1&t=3

Tools that help

  •   A working example. So have a software that sends a video stream to
    

capture and have capture display it in the model. This is a must!

  •   Use Wireshark to sniff the traffic so you can actually see what
    

you’re sending. https://www.wireshark.org

  •   Add the CITP dissector to wireshark
    
  •   Valgrind helps when making building the packets http://valgrind.org
    
  •   g++ -g program -o <program name> && valgrind --tool=memcheck
    

–trace-origins

Tips

  •   Watch out for non standard implementation. For example MagicQ only
    

responded to certain messages and it didn’t use the autofinding feature.
Watching the traffic between a working example and your code will help spot
these.

  •   2 threads: one for sending Ploc and StFr thru UDP, another one for
    

TCP connections

  •   Work by steps. First get one part working and build on that.
    

Further resources

https://code.google.com/p/puremediaserver/source/browse/#svn%2Ftrunk
https://code.google.com/p/puremediaserver/source/browse/%23svn%2Ftrunk

https://code.google.com/p/libremediaserver/source/browse?repo=video#git%2Fsrc
https://code.google.com/p/libremediaserver/source/browse?repo=video%23git%2Fsrc

Thanks for that @Timoteus some really great tips in there. I just double checked and realised that I wont be able to use CITP with Capture and I can only afford the Solo version at this stage which doesn’t support CITP. Think i’ll just use videos in place of live streaming for the mean time until I have my head around all of Capture and I can save up some money to afford the pro version. Will definitely coming back to investigate those resources then! Thanks again.