Facility Control

 View Only
Expand all | Collapse all

Sending TCP commands to Sharp Television monitor

  • 1.  Sending TCP commands to Sharp Television monitor

    Posted 09-19-2017 18:33
    Hi there,

    I am looking to use dashboard to send TCP commands to turn on 9 television monitors in our studio.

    Each screen has a dedicated ip address -- 172.168.22.41 is an example. all data should be on port 10008.

    I have used hyperterminal to connect and send command POWR0000 for off and POWR0001 for on, but i cant get it to work in dashboard.

    Basically, i'd like to have one button that sends the ON and OFF command to all 9 screens at one time.

    Any help would be much appreciated!!!


  • 2.  RE: Sending TCP commands to Sharp Television monitor

    Posted 09-19-2017 18:43
    You should be able to use rosstalk.sendMessage('172.168.22.41', 10008, 'POWR0001'); inside of a button task to turn that single screen on - does this not work?
    Was there a username or password involved?
    #DashBoard


  • 3.  RE: Sending TCP commands to Sharp Television monitor

    Posted 09-19-2017 18:48
    Hi James, thanks for the quick reply. Yes, username is blank and password is blank.

    Any way to get around that?
    #DashBoard


  • 4.  RE: Sending TCP commands to Sharp Television monitor

    Posted 09-19-2017 18:49
    It depends on how your device reacts but I would try:
    rosstalk.sendMessage('172.168.22.41', 10008, '\r\n\r\nPOWR0001\r\n');
    #DashBoard


  • 5.  RE: Sending TCP commands to Sharp Television monitor

    Posted 09-19-2017 19:03
    No dice!
    #DashBoard


  • 6.  RE: Sending TCP commands to Sharp Television monitor

    Posted 09-19-2017 19:19
    If you use an application like Putty, you can open what they call a "Raw" socket as the connection type. This is basically what DashBoard is opening to your device with rosstalk.sendMessage.
    If you use Putty in raw mode, type POWR0001 and hit "Enter" does it do what you expect?

    If you aren't familiar with Putty, you can find it here:
    https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
    #DashBoard


  • 7.  RE: Sending TCP commands to Sharp Television monitor

    Posted 09-19-2017 19:31
    Putty worked great in raw socket mode. Strange its not working in dashboard?
    #DashBoard


  • 8.  RE: Sending TCP commands to Sharp Television monitor

    Posted 09-19-2017 19:39

    Just to confirm: in Putty, you only typed POWR0001 and did not have a username or password prompt, correct?

    Next, we would want to see if DashBoard believes it is successfully connecting and writing that command over the wire:

     function callback(success, sendData, result, exception)
      {
        if (success)
        {
      ogscript.debug("MESSAGE SENT");
        }
        else
        {
          ogscript.debug("MESSAGE NOT SENT: " + exception);
        }
      }
      rosstalk.sendMessage('172.168.22.41', 10008, 'POWR0001\r\n', callback);

    Make sure you go to View->openGear Debug Information to have DashBoard's debug window open when you run the above script.


    #DashBoard


  • 9.  RE: Sending TCP commands to Sharp Television monitor

    Posted 09-19-2017 19:49
    I did have a user/password prompt in putty. i pressed enter to get past each prompt. then POWR0000 shut the screen off.
    #DashBoard


  • 10.  RE: Sending TCP commands to Sharp Television monitor

    Posted 09-19-2017 19:57

    Interesting. If it did have a password prompt then I suspect it either a) requires a pause between entering the credentials and sending he command or b) requires the application to read any information it has attempted to write before sending additional data.

    We can try the pause version first - we will wait 200ms between each command:

    function runLater()
    {
       rosstalk.sendMessage('172.168.22.41', 10008, '\r\n');
       ogscript.pause(200);
       rosstalk.sendMessage('172.168.22.41', 10008, '\r\n');
       ogscript.pause(200);
       rosstalk.sendMessage('172.168.22.41', 10008, 'POWR0001\r\n');
    }
    ogscript.asyncExec(runLater);

     


    #DashBoard


  • 11.  RE: Sending TCP commands to Sharp Television monitor

    Posted 09-19-2017 20:26
    James, thanks for your diligence on this. I have tried this version of the script, and still nothing. I even tried modifying the delay to 800 with no results.
    #DashBoard


  • 12.  RE: Sending TCP commands to Sharp Television monitor

    Posted 09-19-2017 20:42

    Okay, last thing I have time to try today but let's give this a shot.
    We can try opening a persistent connection to the television, when we connect, we will publish the connection as an object so we can use it elsewhere in the custom panel.
    We will then wait for a message (terminated by a newline) to come in before attempting to send a command. First, we will send a newline, then we will send a second newline. Once those have been sent, we should be able to send the POWR0001 or POWR0000 commands.

    Here is a custom panel that demonstrates this. Note: it will not work if the television does not send a newline character after each prompt.

    <abs contexttype="opengear" style="">
       <meta>
          <api>function sendNextMessage()
    {
       var sender = ogscript.getObject('listener');
       var messages = ogscript.getObject('messages');
       if (sender != null &amp;&amp; messages != null &amp;&amp; messages.length &gt; 0)
       {
          var message = messages.splice(0, 1);
          sender.writeString(message, false);
          return true;
       }
       return false;
    }</api>
       </meta>
       <listener autostart="true" blockingpause="true" buttontype="toggle" connecthost="172.168.22.41" connectport="10008" delimitertype="newline" height="60" id="TVConnection" left="28" name="Connection" style="style:toggleButton;" top="62" width="150">
          <task tasktype="ogscript">if (event.isConnectEvent())
    {
       ogscript.putObject("listener", this);
       ogscript.putObject("messages", ["\r\n", "\r\n"]);
    }
    else if (event.isMessageEvent())
    {
       ogscript.debug("GOT " + event.getBytesAsString());
       sendNextMessage();
    }
    else
    {
       ogscript.putObject("listener", null);
    }</task>
       </listener>
       <button buttontype="push" height="69" left="184" name="Power ON" top="58" width="138">
          <task tasktype="ogscript">var messages = ogscript.getObject("messages");
    if (messages != null)
    {
       messages.push("POWR0001\r\n");
       sendNextMessage();
    }
    </task>
       </button>
       <button buttontype="push" height="69" left="330" name="Power OFF" top="58" width="138">
          <task tasktype="ogscript">var messages = ogscript.getObject("messages");
    if (messages != null)
    {
       messages.push("POWR0000\r\n");
       sendNextMessage();
    }</task>
       </button>
    </abs>


    #DashBoard


  • 13.  RE: Sending TCP commands to Sharp Television monitor

    Posted 09-21-2017 18:12
    @chipakj
    Just curious if this last approach was able to turn the monitor off or on.

    James
    #DashBoard