Facility Control

 View Only
Expand all | Collapse all

BlackMagic VideoHub control via Dashboard

Joseph Adams

Joseph Adams04-24-2018 15:58

  • 1.  BlackMagic VideoHub control via Dashboard

    Posted 08-30-2017 23:49

    I wrote a panel today to send telnet commands to our VideoHub router to make simple routing changes. I needed something simple for volunteers where they could click a clear, distinct, labeled button and have it do the macro. Here it is in case anyone can use it. It's still a work in progress but it is functioning fine at this point. I couldn't get telnet to work without calling it via AppleScript, but it works fine doing that. If anyone has experience with the telnet side and wants to jump in, let me know!

    Thanks,

    Joseph

    Panel code:

    <abs contexttype="opengear" id="topLevel" name="VideoHubControl">
       <meta>
          <api>function runAppleScript(applescriptCommand)
    {
       var runtime = java.lang.Runtime.getRuntime();
       var args = ["osascript", "-e", applescriptCommand];
       var process = runtime.exec(args);
    }
    
    function tellVideoHub(destination, source)
             {
                  // everything is zero based including the array so we just go ahead and drop it down
                  params.setValue(0x3, (destination-1), (source-1));
             }
    
             function executeCommands()
             {
                var telnetScript = "VIDEO OUTPUT ROUTING:\n";
    
                for (var i = 0; i &lt; 72; i = i + 1)
                {
                   if (params.getValue(0x3,i) != -1)
                   {
                      telnetScript = telnetScript + i + ' ' + params.getValue(0x3,i) + "\n";
                   }
                }
    
                ogscript.debug(telnetScript);
    
                var telnetCommand = "telnet " + ogscript.getPrivateString('hosts', 'VideoHub.address') + " " + ogscript.getPrivateString('hosts', 'VideoHub.port')
                var appleScriptCommand = "set telnet to \"" + telnetCommand + "\n" + telnetScript + "\n" + "exit" + "\"\n" + 
                      "tell application \"Terminal\"\n" + 
                      "run\n" + 
                      "do script telnet\n" + 
                      "delay 1\n" + 
                      "quit \n" + 
                      "end tell";
    
                runAppleScript(appleScriptCommand);
    
               clearCommands();
             }
             function clearCommands()
             {
               for (var i = 0; i &lt; 72; i = i + 1)
               {
                   params.setValue(0x3,i,-1);
               }
             }</api>
          <params>
             <param access="1" maxlength="0" name="VideoHub_Address" oid="0x1" type="STRING" value="192.168.11.128" widget="default"/>
             <param access="1" maxlength="0" name="VideoHub_Port" oid="0x2" type="STRING" value="9990" widget="default"/>
             <param access="1" constrainttype="INT_NULL" name="VideoHub_Destinations" oid="0x3" precision="2" type="INT32_ARRAY" value="-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1" widget="default"/>
          </params>
          <lookup id="hosts">
             <entry key="VideoHub.address">192.168.11.128</entry>
             <entry key="VideoHub.port">9990</entry>
          </lookup>
          <ogscript handles="onload" id="tbSetup" name="onload" targetid="topLevel">params.setValue(0x1, 0, ogscript.getPrivateString('hosts', 'VideoHub.address'));
             params.setValue(0x2, 0, ogscript.getPrivateString('hosts', 'VideoHub.port'));
             ogscript.debug('tbSetup onload complete.');</ogscript>
          <ogscript handles="onload" id="tbProduction" name="onload" targetid="topLevel">ogscript.debug('tbProduction onload complete.');</ogscript>
       </meta>
       <abs height="227" left="50" style="bg-align:center;bg-fill:fit;bg-u:FG%20Logo.png;" top="0" width="600"/>
       <label height="40" left="50" name="VideoHub Macros" style="txt-align:west;size:Big;" top="185" width="200"/>
       <tab height="510" id="theControl" left="50" top="225" width="491">
          <abs id="tbProduction" name="Production">
             <meta/>
             <table>
                <tr>
                   <table style="bg#dark;bdr:etched;">
                      <tr>
                         <label anchor="center" height="32" id="lblMacros" left="3" name="&lt;html&gt;&lt;center&gt;Simulcast&lt;/center&gt;&lt;/html&gt;" top="2" width="90"/>
                         <button buttontype="push" height="80" id="btnMacro_01" left="0" name="&lt;html&gt;&lt;center&gt;Rear Projectors to Cameras for Simulcast&lt;/center&gt;&lt;/html&gt;" style="size:Normal;bg#66001D;txt-align:center;" top="30" width="150">
                            <task tasktype="ogscript">tellVideoHub(46,22);
                      tellVideoHub(64,21);
                      executeCommands();</task>
                         </button>
                         <button buttontype="push" height="80" id="btnMacro_02" left="165" name="&lt;html&gt;&lt;center&gt;Rear Projectors to Normal&lt;/center&gt;&lt;/html&gt;" style="size:Normal;bg#00660D;" top="30" width="120">
                            <task tasktype="ogscript">tellVideoHub(46,29);
                      tellVideoHub(64,67);
                      executeCommands();</task>
                         </button>
                      </tr>
                   </table>
                </tr>
                <tr>
                   <table style="bg#dark;bdr:etched;">
                      <tr>
                         <label height="32" id="lblMacros" left="3" name="&lt;html&gt;&lt;center&gt;Auditorium 1 Projectors&lt;/center&gt;&lt;/html&gt;" top="2" width="90"/>
                         <button buttontype="push" height="80" id="btnMacro_03" left="0" name="&lt;html&gt;&lt;center&gt;All Projectors to Aud 1 CG&lt;/center&gt;&lt;/html&gt;" style="size:Normal;bg#66001D;txt-align:center;" top="200" width="150">
                            <task tasktype="ogscript">tellVideoHub(44,27);
                      tellVideoHub(45,27);
                      tellVideoHub(46,27);
                      executeCommands();</task>
                         </button>
                         <button buttontype="push" height="80" id="btnMacro_04" left="165" name="&lt;html&gt;&lt;center&gt;Return Projectors to Normal&lt;/center&gt;&lt;/html&gt;" style="size:Normal;bg#00660D;" top="200" width="120">
                            <task tasktype="ogscript">tellVideoHub(44,10);
                      tellVideoHub(45,10);
                      tellVideoHub(46,29);
                      executeCommands();</task>
                         </button>
                      </tr>
                   </table>
                </tr>
                <tr>
                   <table style="bg#dark;bdr:etched;">
                      <tr>
                         <label height="32" id="lblMacros" left="3" name="&lt;html&gt;&lt;center&gt;Auditorium 1 Audio&lt;/center&gt;&lt;/html&gt;" top="2" width="90"/>
                         <button buttontype="push" height="80" id="btnMacro_05" left="0" name="&lt;html&gt;&lt;center&gt;DEMB1 to Aud 1 CG&lt;/center&gt;&lt;/html&gt;" style="size:Normal;bg#000066;txt-align:center;" top="200" width="150">
                            <task tasktype="ogscript">tellVideoHub(41,27);
                      executeCommands();</task>
                         </button>
                         <button buttontype="push" height="80" id="btnMacro_06" left="165" name="&lt;html&gt;&lt;center&gt;DEMB1 to Control Room 1 CG&lt;/center&gt;&lt;/html&gt;" style="size:Normal;bg#000066;" top="200" width="150">
                            <task tasktype="ogscript">tellVideoHub(41,30);
                      executeCommands();</task>
                         </button>
                      </tr>
                   </table>
                </tr>
                <tr>
                   <table style="bg#dark;bdr:etched;">
                      <tr>
                         <label height="32" id="lblMacros" left="3" name="&lt;html&gt;&lt;center&gt;Auditorium 2 Projectors&lt;/center&gt;&lt;/html&gt;" top="2" width="90"/>
                         <button buttontype="push" height="80" id="btnMacro_07" left="0" name="&lt;html&gt;&lt;center&gt;All Projectors to Aud 1 CG&lt;/center&gt;&lt;/html&gt;" style="size:Normal;bg#66001D;txt-align:center;" top="200" width="150">
                            <task tasktype="ogscript">tellVideoHub(62,66);
                      tellVideoHub(63,66);
                      tellVideoHub(64,66);
                      executeCommands();</task>
                         </button>
                         <button buttontype="push" height="80" id="btnMacro_08" left="165" name="&lt;html&gt;&lt;center&gt;Return Projectors to Normal&lt;/center&gt;&lt;/html&gt;" style="size:Normal;bg#00660D;" top="200" width="120">
                            <task tasktype="ogscript">tellVideoHub(62,20);
                      tellVideoHub(63,20);
                      tellVideoHub(64,67);
                      executeCommands();</task>
                         </button>
                      </tr>
                   </table>
                </tr>
                <tr>
                   <table style="bg#dark;bdr:etched;">
                      <tr>
                         <label height="32" id="lblMacros" left="3" name="&lt;html&gt;&lt;center&gt;Auditorium 2 Audio&lt;/center&gt;&lt;/html&gt;" top="2" width="90"/>
                         <button buttontype="push" height="80" id="btnMacro_09" left="0" name="&lt;html&gt;&lt;center&gt;DEMB1 to Aud 2 CG&lt;/center&gt;&lt;/html&gt;" style="size:Normal;bg#000066;txt-align:center;" top="200" width="150">
                            <task tasktype="ogscript">tellVideoHub(55,66);
                      executeCommands();</task>
                         </button>
                         <button buttontype="push" height="80" id="btnMacro_10d" left="165" name="&lt;html&gt;&lt;center&gt;DEMB1 to Control Room 2 CG&lt;/center&gt;&lt;/html&gt;" style="size:Normal;bg#000066;" top="200" width="150">
                            <task tasktype="ogscript">tellVideoHub(55,34);
                      executeCommands();</task>
                         </button>
                      </tr>
                   </table>
                </tr>
             </table>
          </abs>
          <abs id="tbSetup" name="Setup">
             <label name="VideoHub Settings"/>
             <table>
                <tr>
                   <label height="40" name="IP Address:" width="150"/>
                   <param oid="0x1" pheight="50" pwidth="250" style="size:Normal;" width="150"/>
                </tr>
                <tr>
                   <label height="40" name="Port:" width="150"/>
                   <param oid="0x2" pheight="50" pwidth="250" style="size:Normal;" width="50"/>
                </tr>
                <tr>
                   <button buttontype="push" colspan="1" fill="both" height="50" left="0" name="Set" pheight="38" pwidth="179" rowspan="1" style="size:Normal;" width="215">
                      <task tasktype="ogscript">ogscript.putPrivateString('hosts', 'VideoHub.address', params.getValue(0x1,0));
                   ogscript.putPrivateString('hosts', 'VideoHub.port', params.getValue(0x2,0));</task>
                   </button>
                </tr>
             </table>
             <label height="50" left="0" name="&lt;html&gt;&lt;center&gt;The panel is configured for a 72x72 router. If you need something higher, just add more rows to the array. There's probably a more elegant way to do this.&lt;/center&gt;&lt;/html&gt;" top="125" width="350"/>
          </abs>
       </tab>
    </abs>


  • 2.  RE: BlackMagic VideoHub control via Dashboard

    Posted 08-31-2017 20:40
    Hi Joseph.
    Thank you very much for contributing this back to the community.

    In terms of having difficulty with Telnet, do you know if the device accepts raw ASCII over a socket or if it requires a proper Telnet session?

    Can you give me an idea of what exactly you were trying to send?

    James
    #DashBoard


  • 3.  RE: BlackMagic VideoHub control via Dashboard

    Posted 08-31-2017 20:51
    Essentially, this panel builds a text string that looks like this:

    VIDEO OUTPUT ROUTING:
    0 1
    1 5


    The number on the left is a destination, the number on the right, a source. These are just examples.

    I can telnet to the VideoHub in terminal on a specific port, and then send paste in that text string. That is essentially what I am doing with AppleScript. It launches a Terminal instance, types "telnet 192.168.11.128 9990" (the ip address and port) and then the router automatically responds with the current state of settings and waits for your response.

    I saw on this thread where it was recommended to use rosstalk.sendmessage, but in my tests, it did nothing. I couldn't tell if it was failing out, but the router didn't change state.

    This was the code I tried in my panel:


    rosstalk.sendMessage(ogscript.getPrivateString('hosts', 'VideoHub.address'),ogscript.getPrivateString('hosts', 'VideoHub.port'),telnetScript);


    That essentially boils down to something like this:

    rosstalk.sendMessage('192.168.11.128',9990,'VIDEO OUTPUT ROUTING:\n0 1\n1 5\n');


    I tried even just typing in a manual, non-parameter based line of code like my example above and the router still didn't change state, so I couldn't tell what was going on. I already had it working great using AppleScript so I didn't press further, but if rosstalk.sendMessage would work, that seems like it would be a lot more elegant!

    Does that make sense?

    Joseph
    #DashBoard


  • 4.  RE: BlackMagic VideoHub control via Dashboard

    Posted 08-31-2017 21:00
    2 things you could try:
    1. It seems that Telnet technically expects both a CR (\r) and LF (\n) to terminate a line. Have you tried sending both?
    rosstalk.sendMessage('192.168.11.128',9990,'VIDEO OUTPUT ROUTING:\r\n0 1\r\n1 5\r\n');
    2. The application "Putty" has the ability to open a "Raw" socket connection. I would recommend trying this to see if it works. If it does, then we should definitely be able to trigger this directly within DashBoard. One possibility could be that it opens/closes the socket too quickly - but we have workarounds if that is the case.
    #DashBoard


  • 5.  RE: BlackMagic VideoHub control via Dashboard

    Posted 08-31-2017 21:03
    I'll try the first and do the callback method to return the output to the debugger, which may help us see what is going on. If that doesn't work, I'll look at the Putty route. Thanks!
    #DashBoard


  • 6.  RE: BlackMagic VideoHub control via Dashboard

    Posted 09-04-2017 12:26
    It works flawlessly the way I originally posted it, but it's using AppleScript to launch a terminal process to make it happen. I haven't been able to get it to work using rosstalk, but I also haven't had much time since Thursday to look at it. Feel free to take what I posted and work on it!
    #DashBoard


  • 7.  RE: BlackMagic VideoHub control via Dashboard

    Posted 09-05-2017 20:48

    Ok, it's working great now with rosstalk.sendMessage. The key was to add a final CRLF at the end (an extra one). I monitored it in telnet to figure that out but it should have been obvious.

    Anyway, here is the updated code:

    <abs contexttype="opengear" id="topLevel" name="VideoHubControl">
       <meta>
          <api>function tellVideoHub(destination, source)
             {
                  // everything is zero based including the array so we just go ahead and drop it down
                  params.setValue(0x3, (destination-1), (source-1));
             }
    
             function executeCommands()
             {
                var telnetScript = "VIDEO OUTPUT ROUTING:\r\n";
    
                for (var i = 0; i &lt; 72; i = i + 1)
                {
                   if (params.getValue(0x3,i) != -1)
                   {
                      telnetScript = telnetScript + i + ' ' + params.getValue(0x3,i) + "\r\n";
                   }
                }
                telnetScript = telnetScript + "\r\n";
    
                rosstalk.sendMessage(ogscript.getPrivateString('hosts', 'VideoHub.address'),ogscript.getPrivateString('hosts', 'VideoHub.port'),telnetScript,callback);
    
               clearCommands();
             }
             function clearCommands()
             {
               for (var i = 0; i &lt; 72; i = i + 1)
               {
                   params.setValue(0x3,i,-1);
               }
             }
             function callback(success, sentData, resultString, exception)
             {
                ogscript.debug('results:');
                ogscript.debug('success: ' + success);
                ogscript.debug('sentData: ' + sentData);
                ogscript.debug('resultString: ' + resultString);
                ogscript.debug('exception: ' + exception);
          }</api>
          <params>
             <param access="1" maxlength="0" name="VideoHub_Address" oid="0x1" type="STRING" value="192.168.11.128" widget="default"/>
             <param access="1" maxlength="0" name="VideoHub_Port" oid="0x2" type="STRING" value="9990" widget="default"/>
             <param access="1" constrainttype="INT_NULL" name="VideoHub_Destinations" oid="0x3" precision="2" type="INT32_ARRAY" value="-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1" widget="default"/>
          </params>
          <lookup id="hosts">
             <entry key="VideoHub.address">192.168.11.128</entry>
             <entry key="VideoHub.port">9990</entry>
          </lookup>
          <ogscript handles="onload" id="tbSetup" name="onload" targetid="topLevel">params.setValue(0x1, 0, ogscript.getPrivateString('hosts', 'VideoHub.address'));
             params.setValue(0x2, 0, ogscript.getPrivateString('hosts', 'VideoHub.port'));
             ogscript.debug('tbSetup onload complete.');</ogscript>
          <ogscript handles="onload" id="tbProduction" name="onload" targetid="topLevel">ogscript.debug('tbProduction onload complete.');</ogscript>
       </meta>
       <abs height="227" left="50" style="bg-align:center;bg-fill:fit;bg-u:FG%20Logo.png;" top="0" width="600"/>
       <label height="40" left="50" name="VideoHub Macros" style="txt-align:west;size:Big;" top="185" width="200"/>
       <tab height="600" id="theControl" left="50" top="225" width="513">
          <abs id="tbProduction" name="Production">
             <meta/>
             <table>
                <tr>
                   <table style="bg#dark;bdr:etched;">
                      <tr>
                         <label anchor="center" height="32" id="lblMacros" left="3" name="&lt;html&gt;&lt;center&gt;Simulcast&lt;/center&gt;&lt;/html&gt;" top="2" width="90"/>
                         <button buttontype="push" height="80" id="btnMacro_01" left="0" name="&lt;html&gt;&lt;center&gt;Rear Projectors to Cameras for Simulcast&lt;/center&gt;&lt;/html&gt;" style="size:Normal;bg#66001D;txt-align:center;" top="30" width="150">
                            <task tasktype="ogscript">tellVideoHub(46,22);
                      tellVideoHub(64,21);
                      executeCommands();</task>
                         </button>
                         <button buttontype="push" height="80" id="btnMacro_02" left="165" name="&lt;html&gt;&lt;center&gt;Rear Projectors to Normal&lt;/center&gt;&lt;/html&gt;" style="size:Normal;bg#00660D;" top="30" width="120">
                            <task tasktype="ogscript">tellVideoHub(46,29);
                      tellVideoHub(64,67);
                      executeCommands();</task>
                         </button>
                      </tr>
                   </table>
                </tr>
             </table>
          </abs>
          <abs id="tbSetup" name="Setup">
             <label name="VideoHub Settings"/>
             <table>
                <tr>
                   <label height="40" name="IP Address:" width="150"/>
                   <param oid="0x1" pheight="50" pwidth="250" style="size:Normal;" width="150"/>
                </tr>
                <tr>
                   <label height="40" name="Port:" width="150"/>
                   <param oid="0x2" pheight="50" pwidth="250" style="size:Normal;" width="50"/>
                </tr>
                <tr>
                   <button buttontype="push" colspan="1" fill="both" height="50" left="0" name="Set" pheight="38" pwidth="179" rowspan="1" style="size:Normal;" width="215">
                      <task tasktype="ogscript">ogscript.putPrivateString('hosts', 'VideoHub.address', params.getValue(0x1,0));
                   ogscript.putPrivateString('hosts', 'VideoHub.port', params.getValue(0x2,0));</task>
                   </button>
                </tr>
             </table>
             <label height="50" left="0" name="&lt;html&gt;&lt;center&gt;The panel is configured for a 72x72 router. If you need something higher, just add more rows to the array. There's probably a more elegant way to do this.&lt;/center&gt;&lt;/html&gt;" top="125" width="350"/>
          </abs>
       </tab>
    </abs>

    #DashBoard


  • 8.  RE: BlackMagic VideoHub control via Dashboard

    Posted 09-11-2017 17:42

    I've been continuing to modify my panel as I increase functionality. One of my goals is to create a "director's dashboard" where he/she can quickly invoke some changes during a service/show.

    I now have the panel polling the VideoHub using a Listener and callback function so that it dynamically pulls a list of all of the VideoHub inputs and puts them into a dropdown list. From there, the user can select an input and click "Go" and it will send a route command to send that input to a specific router output on the VideoHub. That particular router output is going into a spare BMD interface I had and is being converted to NDI via NDI Source software, and then I can view that input right on the dashboard panel. So, I essentially have a realtime viewer of any router input, which is very helpful. I plan on taking it one level higher and letting the user switch between VideoHub sources being sent to that one NDI interface and other NDI sources available on the network.

    If anyone would like the updated panel, just let me know.

    Joseph


    #DashBoard


  • 9.  RE: BlackMagic VideoHub control via Dashboard

    Posted 09-21-2017 02:25
    Hi Joseph, this is great, could you please share the updated panel with me?

    Thanks,

    -Jason
    #DashBoard


  • 10.  RE: BlackMagic VideoHub control via Dashboard

    Posted 09-21-2017 18:50
    Absolutely. I'll send you a PM tomorrow when I can get it to you. Thanks!
    #DashBoard


  • 11.  RE: BlackMagic VideoHub control via Dashboard

    Posted 04-16-2018 15:51
    Ok, it's working great now with rosstalk.sendMessage. The key was to add a final CRLF at the end (an extra one). I monitored it in telnet to figure that out but it should have been obvious.

    Anyway, here is the updated code:
    <abs contexttype="opengear" id="topLevel" name="VideoHubControl">
       <meta>
          <api>function tellVideoHub(destination, source)
             {
                  // everything is zero based including the array so we just go ahead and drop it down
                  params.setValue(0x3, (destination-1), (source-1));
             }
    
             function executeCommands()
             {
                var telnetScript = "VIDEO OUTPUT ROUTING:\r\n";
    
                for (var i = 0; i &lt; 72; i = i + 1)
                {
                   if (params.getValue(0x3,i) != -1)
                   {
                      telnetScript = telnetScript + i + ' ' + params.getValue(0x3,i) + "\r\n";
                   }
                }
                telnetScript = telnetScript + "\r\n";
    
                rosstalk.sendMessage(ogscript.getPrivateString('hosts', 'VideoHub.address'),ogscript.getPrivateString('hosts', 'VideoHub.port'),telnetScript,callback);
    
               clearCommands();
             }
             function clearCommands()
             {
               for (var i = 0; i &lt; 72; i = i + 1)
               {
                   params.setValue(0x3,i,-1);
               }
             }
             function callback(success, sentData, resultString, exception)
             {
                ogscript.debug('results:');
                ogscript.debug('success: ' + success);
                ogscript.debug('sentData: ' + sentData);
                ogscript.debug('resultString: ' + resultString);
                ogscript.debug('exception: ' + exception);
          }</api>
          <params>
             <param access="1" maxlength="0" name="VideoHub_Address" oid="0x1" type="STRING" value="192.168.11.128" widget="default"/>
             <param access="1" maxlength="0" name="VideoHub_Port" oid="0x2" type="STRING" value="9990" widget="default"/>
             <param access="1" constrainttype="INT_NULL" name="VideoHub_Destinations" oid="0x3" precision="2" type="INT32_ARRAY" value="-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1;-1" widget="default"/>
          </params>
          <lookup id="hosts">
             <entry key="VideoHub.address">192.168.11.128</entry>
             <entry key="VideoHub.port">9990</entry>
          </lookup>
          <ogscript handles="onload" id="tbSetup" name="onload" targetid="topLevel">params.setValue(0x1, 0, ogscript.getPrivateString('hosts', 'VideoHub.address'));
             params.setValue(0x2, 0, ogscript.getPrivateString('hosts', 'VideoHub.port'));
             ogscript.debug('tbSetup onload complete.');</ogscript>
          <ogscript handles="onload" id="tbProduction" name="onload" targetid="topLevel">ogscript.debug('tbProduction onload complete.');</ogscript>
       </meta>
       <abs height="227" left="50" style="bg-align:center;bg-fill:fit;bg-u:FG%20Logo.png;" top="0" width="600"/>
       <label height="40" left="50" name="VideoHub Macros" style="txt-align:west;size:Big;" top="185" width="200"/>
       <tab height="600" id="theControl" left="50" top="225" width="513">
          <abs id="tbProduction" name="Production">
             <meta/>
             <table>
                <tr>
                   <table style="bg#dark;bdr:etched;">
                      <tr>
                         <label anchor="center" height="32" id="lblMacros" left="3" name="&lt;html&gt;&lt;center&gt;Simulcast&lt;/center&gt;&lt;/html&gt;" top="2" width="90"/>
                         <button buttontype="push" height="80" id="btnMacro_01" left="0" name="&lt;html&gt;&lt;center&gt;Rear Projectors to Cameras for Simulcast&lt;/center&gt;&lt;/html&gt;" style="size:Normal;bg#66001D;txt-align:center;" top="30" width="150">
                            <task tasktype="ogscript">tellVideoHub(46,22);
                      tellVideoHub(64,21);
                      executeCommands();</task>
                         </button>
                         <button buttontype="push" height="80" id="btnMacro_02" left="165" name="&lt;html&gt;&lt;center&gt;Rear Projectors to Normal&lt;/center&gt;&lt;/html&gt;" style="size:Normal;bg#00660D;" top="30" width="120">
                            <task tasktype="ogscript">tellVideoHub(46,29);
                      tellVideoHub(64,67);
                      executeCommands();</task>
                         </button>
                      </tr>
                   </table>
                </tr>
             </table>
          </abs>
          <abs id="tbSetup" name="Setup">
             <label name="VideoHub Settings"/>
             <table>
                <tr>
                   <label height="40" name="IP Address:" width="150"/>
                   <param oid="0x1" pheight="50" pwidth="250" style="size:Normal;" width="150"/>
                </tr>
                <tr>
                   <label height="40" name="Port:" width="150"/>
                   <param oid="0x2" pheight="50" pwidth="250" style="size:Normal;" width="50"/>
                </tr>
                <tr>
                   <button buttontype="push" colspan="1" fill="both" height="50" left="0" name="Set" pheight="38" pwidth="179" rowspan="1" style="size:Normal;" width="215">
                      <task tasktype="ogscript">ogscript.putPrivateString('hosts', 'VideoHub.address', params.getValue(0x1,0));
                   ogscript.putPrivateString('hosts', 'VideoHub.port', params.getValue(0x2,0));</task>
                   </button>
                </tr>
             </table>
             <label height="50" left="0" name="&lt;html&gt;&lt;center&gt;The panel is configured for a 72x72 router. If you need something higher, just add more rows to the array. There's probably a more elegant way to do this.&lt;/center&gt;&lt;/html&gt;" top="125" width="350"/>
          </abs>
       </tab>
    </abs>




    Copying and pasting this code, and modifying it, I got it to work with our 20x20 Blackmagic Videohub as far as making buttons to trigger changes. I am wondering now if it is possible to use this to do some rudimentary automation. I've been playing around with the Visual Logic coding to try to get it to do something like "If the time is equal to ___, then set the source/destination". Haven't managed to get it to work yet, though. Essentially wondering if it can be set to where if Dashboard is open, it will automatically send a command at a certain time without having to be there to trigger anything manually.

    Anyone done anything like that?


    #DashBoard


  • 12.  RE: BlackMagic VideoHub control via Dashboard



  • 13.  RE: BlackMagic VideoHub control via Dashboard

    Posted 04-18-2018 15:41
    It does give me ideas, but unfortunately I just don't have the coding know-how to get it to work for my purposes.
    #DashBoard


  • 14.  RE: BlackMagic VideoHub control via Dashboard

    Posted 04-18-2018 16:01
    If you're on a Mac, you could trigger an AppleScript on a schedule to send the same telnet command. It doesn't have to be DashBoard doing the work. Send me a PM and I'd be happy to help.
    #DashBoard


  • 15.  RE: BlackMagic VideoHub control via Dashboard

    Posted 04-18-2018 19:24

    To adapt the example that your were linked to for use with the custom panel you posted, I would swap-out the calls to "doMemAtTime" to a new function we would create called "doRouteAtTime".

    "doRouteAtTime" would call the functions you already have in your panel to "tellVideoHub" and "executeCommands"

    <meta>
          <api>function doRouteAtTime(destination, source, time)
    {
       function recallRoute()
       {
          tellVideoHub(destination,source);
          executeCommands();
          scheduleTomorrow(destination, source, time); //Reschedule
       }
    
       var now = new Date();
       var delay = time.getTime() - now.getTime();
       if (delay &lt; 0)
       {
          delay = 0;
       }
      
       ogscript.asyncExecrecallRoute, delay);
    }
    
    function scheduleToday(destination, source, time)
    {
       var today = new Date();
       var newTime = new Date(today.getFullYear(), today.getMonth(), today.getDate(), time.getHours(), time.getMinutes(), time.getSeconds(), time.getMilliseconds());
       if (newTime.getTime() - today.getTime() &lt; 0) //IF we are too late for today
       {
          ogscript.debug("Too late for today.");
          scheduleTomorrow(destination, source,  time);
       }
       else
       {
          ogscript.debug("Scheduled task for today: " + newTime);
          doRouteAtTime(destination, source, newTime);
       }
    }
    
    function scheduleTomorrow(destination, source, time)
    {
       var today = new Date();
       var newTime = new Date(today.getFullYear(), today.getMonth(), today.getDate() + 1, time.getHours(), time.getMinutes(), time.getSeconds(), time.getMilliseconds());
       ogscript.debug("Scheduling for " + newTime);
       doRouteAtTime(destination, source, newTime);  
    }</api>
          <ogscript handles="onload">var task1Time = new Date();
    task1Time.setHours(6);
    task1Time.setMinutes(0);
    task1Time.setSeconds(0);
    task1Time.setMilliseconds(0);
    
    var task2Time = new Date();
    task2Time.setHours(7);
    task2Time.setMinutes(58);
    task2Time.setSeconds(0);
    task2Time.setMilliseconds(0);
    
    scheduleToday(1, 1, task1Time);
    scheduleToday(2, 1, task2Time);</ogscript>
       </meta>

    #DashBoard


  • 16.  RE: BlackMagic VideoHub control via Dashboard

    Posted 04-19-2018 18:01
    Been trying to play around with that and haven't got it to work yet. Am I supposed to change any of those "destination, source" to have the numbers I want, or does it get that from the "scheduleToday" at the bottom?
    #DashBoard


  • 17.  RE: BlackMagic VideoHub control via Dashboard

    Posted 04-19-2018 18:28
    It would also be good practice to modify the tellVideoHub function to send the message directly. The original intention of using the param array was to allow you to build up multiple routes and send the entire route command at once. With this scheduled function, it's going to send whatever the current state of the param array is, which could include some routes you don't want.


    function tellVideoHub(destination, source)
    {
    // everything is zero based including the array so we just go ahead and drop it down
    destination = destination - 1;
    source = source - 1;

    var telnetScript = "VIDEO OUTPUT ROUTING:\r\n";
    telnetScript = telnetScript + destination + ' ' + source + "\r\n";
    telnetScript = telnetScript + "\r\n";

    rosstalk.sendMessage(ogscript.getPrivateString('hosts', 'VideoHub.address'),ogscript.getPrivateString('hosts', 'VideoHub.port'),telnetScript,callback);
    }


    #DashBoard


  • 18.  RE: BlackMagic VideoHub control via Dashboard

    Posted 04-19-2018 21:43
    Getting the tellVideoHub command to work with the executeCommands was doable (when modifying your existing code, couldn't figure out how to do it on a fresh panel).

    Still couldn't get the scheduleToday automated code to work.

    I'm definitely trying to bite off more than I can chew with my current coding knowledge (next to nothing). I appreciate all the help you both have been giving. Don't strain yourselves, though. This isn't for anything essential. More like I was just asked the hypothetical possibility of it and then got my brain stuck on trying to see if I could solve the problem in my spare time.
    #DashBoard


  • 19.  RE: BlackMagic VideoHub control via Dashboard

    Posted 04-24-2018 15:29

    Built the telnet commands and tellVideoHub API from scratch, which really helped me to understand what I am doing as far as that part goes. I still can't get the automation to work, though. Here is the code I currently have:

    <meta>
          <api>function tellVideoHub(destination, source)
    {
         // everything is zero based including the array so we just go ahead and drop it down
         destination = destination - 1;
         source = source - 1;
    
         var telnetScript = "VIDEO OUTPUT ROUTING:\r\n";
         telnetScript = telnetScript + destination + ' ' + source + "\r\n";
         telnetScript = telnetScript + "\r\n";
        
         rosstalk.sendMessage('192.168.49.21', 9990, telnetScript);
    }</api>
          <api>function doRouteAtTime(destination, source, time)
    {
       function recallRoute()
       {
          tellVideoHub(destination, source);
          scheduleTomorrow(destination, source, time); //Reschedule
       }
    
       var now = new Date();
       var delay = time.getTime() - now.getTime();
       if (delay &lt; 0)
       {
          delay = 0;
       }
     
       ogscript.asyncExecrecallRoute, delay);
    }
    
    function scheduleToday(destination, source, time)
    {
       var today = new Date();
       var newTime = new Date(today.getFullYear(), today.getMonth(), today.getDate(), time.getHours(), time.getMinutes(), time.getSeconds(), time.getMilliseconds());
       if (newTime.getTime() - today.getTime() &lt; 0) //IF we are too late for today
       {
          ogscript.debug("Too late for today.");
          scheduleTomorrow(destination, source,  time);
       }
       else
       {
          ogscript.debug("Scheduled task for today: " + newTime);
          doRouteAtTime(destination, source, newTime);
       }
    }
    
    function scheduleTomorrow(destination, source, time)
    {
       var today = new Date();
       var newTime = new Date(today.getFullYear(), today.getMonth(), today.getDate() + 1, time.getHours(), time.getMinutes(), time.getSeconds(), time.getMilliseconds());
       ogscript.debug("Scheduling for " + newTime);
       doRouteAtTime(destination, source, newTime);</api>
          <ogscript handles="onload">var task1Time = new Date();
    task1Time.setHours(9);
    task1Time.setMinutes(32);
    task1Time.setSeconds(0);
    task1Time.setMilliseconds(0);
    
    scheduleToday(1, 1, task1Time);</ogscript>
       </meta>

    In the debug, I get the following message: "EXCEPTION: ReferenceError: "scheduleToday" is not defined. (on load#8)"


    #DashBoard


  • 20.  RE: BlackMagic VideoHub control via Dashboard

    Posted 04-24-2018 15:43

    There are some typos in your code that may be causing an issue.

    In particular, there is this:
    ogscript.asyncExecrecallRoute, delay);

    This should probably be:
    ogscript.asyncExec(recallRoute, delay);

    Also, no need to include multiple tags, just put them all in the same block.

    Take a look at this and see if it helps:

    <meta>
          <api>
    function tellVideoHub(destination, source)
    {
         // everything is zero based including the array so we just go ahead and drop it down
         destination = destination - 1;
         source = source - 1;
    
         var telnetScript = "VIDEO OUTPUT ROUTING:\r\n";
         telnetScript = telnetScript + destination + ' ' + source + "\r\n";
         telnetScript = telnetScript + "\r\n";
         
         rosstalk.sendMessage('192.168.49.21', 9990, telnetScript);
    }
    
    function doRouteAtTime(destination, source, time)
    {
       function recallRoute()
       {
          tellVideoHub(destination, source);
          scheduleTomorrow(destination, source, time); //Reschedule
       }
    
       var now = new Date();
       var delay = time.getTime() - now.getTime();
       if (delay &lt; 0)
       {
          delay = 0;
       }
     
       ogscript.asyncExec(recallRoute, delay);
    }
    
    function scheduleToday(destination, source, time)
    {
       var today = new Date();
       var newTime = new Date(today.getFullYear(), today.getMonth(), today.getDate(), time.getHours(), time.getMinutes(), time.getSeconds(), time.getMilliseconds());
       if (newTime.getTime() - today.getTime() &lt; 0) //IF we are too late for today
       {
          ogscript.debug("Too late for today.");
          scheduleTomorrow(destination, source,  time);
       }
       else
       {
          ogscript.debug("Scheduled task for today: " + newTime);
          doRouteAtTime(destination, source, newTime);
       }
    }
    
    function scheduleTomorrow(destination, source, time)
    {
       var today = new Date();
       var newTime = new Date(today.getFullYear(), today.getMonth(), today.getDate() + 1, time.getHours(), time.getMinutes(), time.getSeconds(), time.getMilliseconds());
       ogscript.debug("Scheduling for " + newTime);
       doRouteAtTime(destination, source, newTime);
    }
    </api>
    <ogscript handles="onload">
    var task1Time = new Date();
    task1Time.setHours(9);
    task1Time.setMinutes(32);
    task1Time.setSeconds(0);
    task1Time.setMilliseconds(0);
    
    scheduleToday(1, 1, task1Time);
    </ogscript>
    </meta>


    #DashBoard


  • 21.  RE: BlackMagic VideoHub control via Dashboard

    Posted 04-24-2018 15:56
    That worked! Seems like it was the matter of that typo!

    I had it in a separate API block because having it in the same one made the tellVideoHub command not work. I suppose that was due to the typo as well, though.

    I can see in the debug info that it has scheduled for tomorrow at the same time as well.

    Thanks a bunch for your help Joseph and James!
    #DashBoard


  • 22.  RE: BlackMagic VideoHub control via Dashboard

    Posted 04-24-2018 15:58
    My pleasure!
    #DashBoard


  • 23.  RE: BlackMagic VideoHub control via Dashboard

    Posted 06-19-2018 13:48

    Thought I would share my updated panel for controlling a BlackMagic VideoHub router. This version polls the router for current input and output labels, puts those values into a dropdownlist, and allows the user to pick a source and destination and click route.



    You can download the panel from my Github: https://github.com/josephdadams/RossDashboardPanels
    Or you can read more about it on my blog: https://techministry.blog/2018/06/14/controlling-blackmagic-videohub-from-ross-dashboard-part-2/

    I hope this is helpful to the community!

    Joseph


    #DashBoard