Facility Control

 View Only
  • 1.  rosstalk.sendBytesWithResponse

    Posted 06-30-2023 13:03

    Are there any examples of using rosstalk.sendBytesWithResponse() ?  I can get rosstalk.sendBytes() to work, but I need to get a response.

    (Actually, even rosstalk.sendBytes() is a little weird in that the callback function is never called, but that's a different issue...)



    ------------------------------
    rich helvey
    access hollywood, nbc
    ------------------------------


  • 2.  RE: rosstalk.sendBytesWithResponse

    Posted 08-28-2023 16:56

    Hello Rich,

    sorry for the delay.  I've tested this with DashBoard 9.6.1 and seems to be working fine.

    Here is a small example of a custom panel which communicates with a simple server I had running locally.

    Each button would send a different integer value to the server.
    You can see that the `sendAsBytesWithResponse` takes the provided value and a terminator; '0A' in this case.
    The server receives the integer value and then returns a series of bytes followed by a 0x0A.
    DashBoard then invokes the callback function where `result` is the data received from the server.

    <abs contexttype="opengear" id="_top" keepalive="false">
       <meta>
          <api immediate="true">function callback(success, sentData, result, exception)
          {
             var resultString = result.map(String);
             ogscript.debug('Got success: ' + success + ', sentData: ' + sentData + ', result: ' + resultString + ', exception: ' + exception);
          }
          function sendInt(value)
          {
             rosstalk.sendAsBytesWithResponse('127.0.0.1', 4442, value, '0A', callback);
          }</api>
       </meta>
       <button buttontype="push" height="108" left="21" name="Send 0" top="20" width="107">
          <task tasktype="ogscript">sendInt(0);</task>
       </button>
       <button buttontype="push" height="104" left="21" name="Send 1" top="141" width="103">
          <task tasktype="ogscript">sendInt(1);</task>
       </button>
       <button buttontype="push" height="94" left="150" name="Send 2" top="148" width="103">
          <task tasktype="ogscript">sendInt(2);</task>
       </button>
    </abs>

    Hope this helps.  Best regards,



    ------------------------------
    Marc-André Parent
    Ross Video
    ------------------------------



  • 3.  RE: rosstalk.sendBytesWithResponse

    Posted 12-03-2024 11:03

    Marc, I came across this post while trying to figure out some TCP connection functions.

    The code you had included the localhost 127.0.0.1 ip address and you mentioned you had a simple server running locally. What did you mean you had a simple server running locally? Was there something running on an Ultitrouch panel or something along those lines? Is there a way to load files on to a local device to setup as a simple server?



    ------------------------------
    Seth Haberman
    Associate Director of Live Broadcast Video
    Gateway Church
    United States
    ------------------------------



  • 4.  RE: rosstalk.sendBytesWithResponse

    Posted 12-03-2024 11:36
      |   view attached

    Hi Seth,

    You can set up a small server within a custom panel using the OGLML listener tag. It operates in two modes: listening for incoming connections (server mode) or establishing a connection (client mode). In both cases, the listener tag monitors incoming data from the remote system. I've included two panels in a zip file: one acts as a listener for incoming connections, while the other sends a message to it using the rosstalk.sendMessage command. You can also upload the panel to an Ultritouch device and run it directly from there.



    ------------------------------
    Cheers,

    Aury Rukazana
    Senior Software Developer
    Ross Video
    ------------------------------

    Attachment(s)

    zip
    TCPSender_Listener.zip   1 KB 1 version