Facility Control

 View Only
  • 1.  Dashboard to send XML or JSON to a 3rd party device

    Posted 08-21-2020 00:03

    If I want to use a dashboard button to send a command to a 3rd party device, can I do this?

     

    Basically i want to program a button using the API provided by the vendor to send a command to a streaming box and have that streaming machine spin up this channel. The machine can accept HTTP requests by opening up a port for temporary communication. It communicates over port 1080.

     

    I would also like to create a feedback text box that would receive the messages back from the encoder.



  • 2.  RE: Dashboard to send XML or JSON to a 3rd party device

    Posted 08-25-2020 18:56

    If you download the example panels found here:

    https://support.rossvideo.com/hc/en-us/search/click?data=BAh7CjoHaWRsKwhMsJrVUwA6CXR5cGVJIhNjb21tdW5pdHlfcG9zdAY6BkVUOgh1cmxJInNodHRwczovL3N1cHBvcnQucm9zc3ZpZGVvLmNvbS9oYy9lbi11cy9jb21tdW5pdHkvcG9zdHMvMzYwMDY1OTcwMjUyLUZyZWUtRGFzaEJvYXJkLUV4YW1wbGUtUGFuZWxzLWZvci1FdmVyeW9uZQY7B1Q6DnNlYXJjaF9pZEkiKWRkYmY1YWQ0LThmNzktNDI0MS04ZmM4LTNhMWI0ZTBiMmYzMwY7B0Y6CXJhbmtpBg%3D%3D--102b047bebf6fd4e38903ec386b0f68d8c21a184

    you will find one called "HTTP Listener", under the "Communications" folder.   At the bottom, it shows how you can send an HTTP message, and handle a callback from the other end.

    For example:

      function callback(resultStr)
      {
        ogscript.debug("resultStr is " + resultStr);
        ogscript.rename("receivedBack", resultStr);
      }


      ogscript.asyncPost("http://localhost:1080/dosomething","", callback);

     

    You can also do other types of HTTP messages (like GET and POST) with this visual logic block.  

     

    It translates to:

      ogscript.asyncHTTP("http://localhost:1080/dosomething", "GET", "application/x-www-form-urlencoded", "", null);

    and also has a callback method.

    If you need more advanced communication between your device and your panel, you can create a listener that is listening for incoming messages from your device.   That is also in the example panel.

     


    #DashBoard


  • 3.  RE: Dashboard to send XML or JSON to a 3rd party device

    Posted 08-27-2020 14:55

    I haven't been able to get anything to work through DashBoard. I have been able to get the commands to work through PostMan. Basically we are trying to get an authorization code, and then pass that auth code to get the channel to start and stop. How would I interrupt the following commands to be commands in DashBoard?

    This is the JavaScript - jQueary example of the auth command.

    var settings = {
      "method": "POST",
      "timeout": 0,
      "headers": {
        "Content-Type": "application/json"
      },
      "data": JSON.stringify({"username":"#####","password":"######"}),
    };

    $.ajax(settings).done(function (response) {
      console.log(response);
    });
     
    Then the start channel command would be.
     
    var settings = {
      "method": "PUT",
      "timeout": 0,
      "headers": {
        "Authorization": "dCRo22TNk54OgYzjpKL3gCjPknc=",
        "Content-Type": "application/json"
      },
      "data": JSON.stringify({"invoke":{"command":"StartChannel"}}),
    };

    $.ajax(settings).done(function (response) {
      console.log(response);
    });

    #DashBoard