0

Send Touch to PC via UDP

I have got a setup, where a touch screen is connected to a brightsign xt1144. I want to send my touch position (x/y) to my PC via UDP over local network . Is this possible? I am struggling around with that for a while but could not find a solution yet. Has anybody experience with this? I would be thankful for any hint, Chris

7 comments

  • 0
    Avatar
    Bright Scripters

    Looks like the BrightScript roTouchEvent GetX(), and GetY() are your friends.

     

    https://docs.brightsign.biz/display/DOC/roTouchEvent%2C+roTouchCalibrationEvent

  • 0
    Avatar
    Chris

    Thank you for the fast reply. I already stumbled over this, but as far as I am not a programmer, i would really appreciate if you could post a little demo script for retrieving touch coordinates within just one fullscreen region. I will then be able to embed this via Brightauthor as a Script Plugin (in the autorun tab), right? My goal is to send the touch coordinates via UDP to a PC.

    This would really help me a lot.

    Thanks in advance, Chris

  • 0
    Avatar
    Bright Scripters

    This should work for you. There is a demo presentation that should help you get started.

    BrightAuthor plugin for capturing touchscreen events, and sending out UDP messages, containing the coordinates of the touch screen position. UDP message a JSON object. Example: {"x":1054,"y":474}

    https://github.com/brightscripters/Touch2UDP/archive/master.zip

  • 0
    Avatar
    Chris

    Thanks a lot. Sending a single touch position works like charm. But another question is, does sending drag touch positions work too?

    Cheers, Chris

  • 0
    Avatar
    Chris

    Hm... in my little project i want to drag a quad and send the current touch position to my pc via UDP... the touchscript above gets the touchcoordinates at the moment of touch. But when i start dragging no data is going to be sent. But this would be exactly what i need. Is that even possible with the brightsign player?
    I woukd appreciate your help very much. BIG thanks in advance, Chris

  • 0
    Avatar
    Bright Scripters

    Natively, with BrightScript, capturing a drag might not be possible, but you should be able to that with JavaScript.

     

  • 0
    Avatar
    Chris

    Hm... I tried to figure out how this might work but after days of troubleshooting i still stuck.

    I figured out how to get touchcoordinates via JS:

    https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_event_touch_touches2

    Because i am already using vvvvjs (nodebased) i used the js lib of this system. When i publish the html file to the brightsign player the touchcoordinates are going to be displayed. 

    Furthermore i found a thread where sending UDP to Brightsign over JS ( https://brightsign.zendesk.com/hc/en-us/community/posts/209965477-Send-UDP-from-a-HTML-interface)  has been discussed and i tried to combine both sources but i am not able to send UDP data to my PC. I really do not know how i can get that fixed. Can anybody help me PLEASE.

    I really would appreciate any help.Thanks in advance, Chris

    <!DOCTYPE html>
    <html><head>
    <script language="JavaScript" src="vvvvjs/lib/require.js"></script>
    <script language="JavaScript" src="vvvvjs/vvvv.js"></script>

    <script language="JavaScript">

    VVVVContext.init("vvvvjs/", 'full', function() {
    console.log('VVVV.js initialized');
    });
    </script>
    <meta name="viewport" content="width=device-width, height=device-height">
    <style>
    div.a{height:1080px; padding:0; margin:0; border: 1px solid black;}
    body{background-color:#E0E0E0;font-family: Verdana, sans-serif;margin:0;padding:0;}
    </style>
    </head>
    <body
    ontouchstart="showCoordinates(event)"
    ontouchmove="showCoordinates(event)">

    <div class="a">
    <h1>The TouchEvent's touches property</h1>

    <p>Touch somewhere in this document.</p>

    <p>The horizontal and vertical coordinates of the touchare: <span id="demo"></span></p>

    <p><strong>Note:</strong></p>

    <script>
    function showCoordinates(event){
    var x = event.touches[0].clientX;
    var y = event.touches[0].clientY;
    $.post("http://192.168.0.109:5000/SendUDP", {key: "demo "});
    document.getElementById("demo").innerHTML = x + "," +y;
    }

    </script>
    </div>
    </body>
    </html>

Please sign in to leave a comment.