Here's what works right now:
Microcontroller reads 2 touch surfaces, outputs them as a single OSC bundle (using this library) every 10ms over USB.
Chrome app receives these OSC bundles (using this library) over USB via chrome.serial
and displays them on a canvas element
So far, so good.
Next, I want to send these messages over UDP to a TUIO client. As a first step, I made sure I can send OSC messages over UDP (again using osc.js) and indeed this works.
Here's some example messages as seen by my Chrome app:
// console.log(JSON.stringify(msg)) gives results like this:
{"address":"/p0","args":[2369,1683,170]}
{"address":"/p1","args":[1906,1752,137]}
{"address":"/p1","args":[1906,1752,137]}
I've tried to connect this Chrome app to various example TUIO client implementations (Node, browser, Ruby, Python, Processing) and the results are either to crash on an exception due to a malformed message, or to simply do nothing at all.
Here are some message formats I've tried, with no success:
osc.send(msg);
osc.send({address:"/tuio/2Dcur", args:msg.args});
osc.send({address:"/tuio/2Dcur", args:["alive"].concat(msg.args)});
osc.send({address:"/tuio/2Dcur", args:["set"].concat(msg.args)});
What am I doing wrong here?
Finally discovered what I was missing. The TUIO clients I've used so far apparently expect OSC bundles, so my app should send a bundle like so:
my_osc.send({
timeTag: osc.timeTag(0),
packets: [
{address:'/tuio/2Dcur', args: ['alive'].concat(my_session_id)},
{address:'/tuio/2Dcur', args: ['set'].concat(my_session_id).concat(my_data)}
]
});