Facility Control

 View Only
Expand all | Collapse all

Declaring a parameter inside a TCP string to set clip name on Blackmagic recorder.

  • 1.  Declaring a parameter inside a TCP string to set clip name on Blackmagic recorder.

    Posted 01-17-2018 13:00

    Hi All,

    I am trying to declare a parameter inside a TCP string and think I must be doing something wrong.

    <task tasktype="ogscript">rosstalk.sendMessage("params.getValue('IP1', 0)", 9993, "record: name: “params.getValue('CLIPNAME1', 0)[0]”", null);</task>
             </button>
             <button buttontype="push" colspan="1" fill="both" id="STOP1" name="STOP" rowspan="1" weightx="1.0" weighty="1.0">
                <task tasktype="ogscript">rosstalk.sendMessage("param_DESTIP1 (IP1)[0]", 9993, "stop", null);</task>
             </button>

    When I use visual logic it creates it as

       <task tasktype="ogscript">rosstalk.sendMessage("param_DESTIP1 (IP1)[0]", 9993, "stop", null);</task>

    However I thought it should be more like

    <task tasktype="ogscript">rosstalk.sendMessage("params.getValue('IP1', 0)", 9993, "record: name: “params.getValue('CLIPNAME1', 0)[0]”", null);</task>

    Thanks,
    Kai



  • 2.  RE: Declaring a parameter inside a TCP string to set clip name on Blackmagic recorder.

    Posted 01-21-2018 11:06

    I think you need to escape your quotes and then concatenate your variables.

    Maybe something like this?

    <task tasktype="ogscript">
    rosstalk.sendMessage(params.getValue('IP1', 0), 9993, "record: name: \"" + params.getValue('ClipName1', 0)[0] + "\"", null);
    </task>

    Note how the IP parameter is not in quotes, and then the quotes for the clip name are escaped, which would produce a string like this:

    record: name: "myClip.mov"

    Does that help?


    #DashBoard


  • 3.  RE: Declaring a parameter inside a TCP string to set clip name on Blackmagic recorder.

    Posted 01-22-2018 18:33
    Hi Joseph.
    Thanks for stepping-in and answering the question - that's pretty much exactly what I would have suggested.

    Cheers.

    James
    #DashBoard


  • 4.  RE: Declaring a parameter inside a TCP string to set clip name on Blackmagic recorder.

    Posted 02-08-2018 12:22

    Hi there @KaiB, I am currently working on a remote sollution for the BMD HyperDeck (both pro and mini) as well.
    So far I have no issues getting the hyperdeck to respond to the TCP commands, however I'm having small luck in getting a response from it.

    Maybe you got a few tips @jamespeltzer?

    Currently I have the following:

    function callback(string1, string2, string3, string4, string5) {
       ogscript.debug("String 1: "+string1);
       ogscript.debug("String 2: "+string2);
       ogscript.debug("String 3: "+string3);
       ogscript.debug("String 4: "+string4);
       ogscript.debug("String 5: "+string5);
    }
    
    rosstalk.sendMessage("10.2.51.194", 9993, params.getValue('text', 0), callback);

    This gets me back the following:

    13:05:10:603: String 1: true
    
    13:05:10:619: String 2: help
    
    13:05:10:620: String 3: null
    
    13:05:10:620: String 4: null
    
    13:05:10:621: String 5: undefined

    I pretty much guess the string 1 is just an indicator to wether or not the command was accepted, and string 2 is basically just what command string I sent through (just "help" in this case).
    However, string 2 and 3 returns as "null", and string 5 is undefined (guess it has no 5th return value).
    However, reading the document from BMD about their API and the reponse it says:

    [QUOTE]Simple responses from the server consist of a three digit response code and descriptive text terminated by a new line:
    {Reponse Code} {Reponse text}

    If a response carries parameters, the response text is terminated with a colon, and a parameter name and value apirs follow on subsequent lines until a blank line is returned.

    {Reponse Code} {Response Text}
    {Parameter}: {Value}
    {Parameter}: {Value}
    {Parameter}: {Value}
    ...


    Never tried handling responses from a TCP connection before, so new to this one.
    Any tips? Or anyone have any experience with BMD HyperDeck and TCP responses?

    HypderDeck manual with Developer Information and syntax here:
    http://documents.blackmagicdesign.com/HyperDeck/20170711-bdb5d3/HyperDeck_Manual.pdf


    #DashBoard


  • 5.  RE: Declaring a parameter inside a TCP string to set clip name on Blackmagic recorder.

    Posted 02-08-2018 14:25

    You're using rosstalk.sendMessage.
    What you'll want to use if you care about waiting around for the server to respond is:
    rosstalk.sendMessageWithResponse

    function callback(success, sentData, resultString, exception)
    {
        
    }
    rosstalk.sendMessageWithResponse('[host]', [port], '[message]', '[end of message indicator]', callback);

    #DashBoard


  • 6.  RE: Declaring a parameter inside a TCP string to set clip name on Blackmagic recorder.

    Posted 02-09-2018 08:41
    You're using rosstalk.sendMessage.
    What you'll want to use if you care about waiting around for the server to respond is:
    rosstalk.sendMessageWithResponse

    function callback(success, sentData, resultString, exception)
    {

    }
    rosstalk.sendMessageWithResponse('[host]', [port], '[message]', '[end of message indicator]', callback);



    Ok, that makes sense. I left the [end of message indicator] just as a blank space, and I get a reponse.
    Now... I'm going further into uncharted territory for me here.

    In the documentation of the HyperDeck, it says:
    [QUOTE]The server may return asynchronus messages at any time. These responses are indicated with response codes in the range of 500 to 599.

    Or:

    [QUOTE]On connection, an asynchronus message will be delivered.

    Now I know I have my first parameter response, as the resultString comes back as 500, however I am not getting the rest of the message (I noticed by just clicking the button fast enough, I would end up getting more of the response I was supposed to get so I know it's there). How do I set up DashBoard so that it will get the rest of the response asynchronus?
    #DashBoard


  • 7.  RE: Declaring a parameter inside a TCP string to set clip name on Blackmagic recorder.

    Posted 02-09-2018 14:00
    Could you use a listener tag to connect to the deck? I used that with my BMD VideoHub and it works great.
    #DashBoard


  • 8.  RE: Declaring a parameter inside a TCP string to set clip name on Blackmagic recorder.

    Posted 02-09-2018 14:39

    If you have to deal with asynchronous messages at any time, then @josephadams is on the right track. A listener will probably be necessary.

    Here's an example that creates a listener and exposes it so you can send messages through it elsewhere in your code:

    <abs contexttype="opengear" style="">
       <meta>
          <listener autostart="true" connecthost="localhost" connectport="8765" delimitertype="newline" id="client">
             <task tasktype="ogscript">if (event.isConnectEvent())
    {
       ogscript.putObject("listener-connection", this);
    }
    else if (event.isMessageEvent())
    {
       ogscript.debug("CLIENT GOT BACK: " + event.getBytesAsString());
    }
    else if (event.isDisconnectEvent())
    {
       var lObj = ogscript.getObject("listener-connection");
       if (lObj == this)
       {
          ogscript.putObject("listener-connection", null);      
       }
    }
    </task>
          </listener>
          <listener autostart="true" delimitertype="newline" id="server" listenport="8765">
             <task tasktype="ogscript">/* A silly server that just reverses any string it was given and sends it back */
    if (event.isMessageEvent())
    {
       var myMessage = event.getBytesAsString().trim() + "";
       var response = "";
       for (var i = myMessage.length - 1; i &gt;= 0; i--)
       {
          response += myMessage.charAt(i);
       }
       this.writeString(response + "\n", false);
    }
    
    </task>
          </listener>
       </meta>
       <button buttontype="push" height="199" left="37" name="Send &quot;Hello&quot; Through Listener" top="38" width="317">
          <task tasktype="ogscript">var listener = ogscript.getObject("listener-connection");
    if (listener != null)
    {
       listener.writeString("HELLO\n", false);
    }</task>
       </button>
    </abs>

    #DashBoard


  • 9.  RE: Declaring a parameter inside a TCP string to set clip name on Blackmagic recorder.

    Posted 02-26-2018 21:27
    Thanks for that guys! I think I have it working now (just waiting to get one of the Hyperdeck mini's back to test it). @astalsberg I found that installing Wireshark and looking for the commands was the easiest way of checking the response from the blackmagic but until they add timecode over ip I have no real need to get any information back from it yet!
    #DashBoard


  • 10.  RE: Declaring a parameter inside a TCP string to set clip name on Blackmagic recorder.

    Posted 12-17-2018 14:32

    So... I'm taking a look at this one again...
    And there is just one thing here I cant wrap my head around...

    Setting up a listener as below:

    <listener autostart="false" buttontype="toggle" colspan="1" connecthost="158.36.157.225" connectport="9993" delimitertype="newline" fill="both" height="100" id="commandSender" left="0" name="Comms" pheight="168" pwidth="150" style="style:ToggleButtons;" top="0" width="150">
       <task tasktype="ogscript">if (event.isConnectEvent()) {
       var cmd = 'stop';
       if (cmd != '') {
          ogscript.debug('Command: ' + cmd);
          this.writeString(commandToSend + '\n', false);
       } else {
          ogscript.debug ('No command');
       }
    } else if (event.isMessageEvent()) {
       var message = event.getBytesAsString().trim();
       ogscript.debug(message);
    } else if (event.isDisconnectEvent()) {
       ogscript.debug('connection closed');
    } else {
       ogscript.debug('no event info');
    }</task>
    </listener>

    Ok, so this will set up a client connection between DashBoard and the BMD HyperDeck Mini (for that specified IP anyhow).
    And it works. I get the first command, wich is "stop" in this case to send, and I get all the replies I could want. But only when I start the listener. As in toogle the button ON.
    However, this also takes that connection, and wont let go! Meaning I cannot send any further commands to the device until I disconnect from it as a client...

    So, my question... How do I send more commands through the client connection?
    Cause if I've not connected to it through a client, just sending a TCP with a callback function will give me the info for that command.
    But if I request a bigger response, like say the device info, this is not included in the regular callback info, but is sent as extra information if I have a listener/client connection open.


    #DashBoard


  • 11.  RE: Declaring a parameter inside a TCP string to set clip name on Blackmagic recorder.

    Posted 12-18-2018 12:13
    Thanks again @jamespeltzer

    I've looked over the answer from 02-09-2018 and I've got it working somewhat at least!
    Still trying to wrap my head around all of it. Especially the panels global object registry, but I get the answers I want from the HyperDeck now at least.

    However!

    Now I am stuck back at the original question, how to set the record name parameter...
    What I've done is basically set up a listener for the HyperDeck Mini, with a string parameter where I write the command I want to send, and push the button next to it, and away it goes!
    It starts recording, and it gives me the reply "200 ok" wich is the reply you're supposed to get from the HyperDeck.

    Now for some reason, whenever I try to send the recording name with it it starts recording, but adds no name...
    The command to send according to the documentation is: record: name: {name}

    So I tried the following commands in the parameter that is the command I send to the HyperDeck:

    • record: name: test
    • record: name: 'test'
    • record: name: "test"
    • record: name: \'test\'
    • record: name: "test"
    • record: name: {test}
    And none of them will actually record the clip with the name test.
    It gives me the reply 200 ok, but when looking at the clips later, there's no names on any of them...

    Anyone on this post with similar experience?
    #DashBoard