From 01ad896a37e194287d88807ab1a6db5a631cd803 Mon Sep 17 00:00:00 2001 From: LightsOnHudson Date: Mon, 5 Oct 2015 19:17:33 -0500 Subject: [PATCH] Add PJLINK Helper Added plink utility code from: https://gist.github.com/1677547.git --- pjlinkutil.pl | 85 +++++++++++++++++++++++++++++++++++++++++++ projectorCommands.inc | 3 +- 2 files changed, 86 insertions(+), 2 deletions(-) create mode 100755 pjlinkutil.pl diff --git a/pjlinkutil.pl b/pjlinkutil.pl new file mode 100755 index 0000000..7951c84 --- /dev/null +++ b/pjlinkutil.pl @@ -0,0 +1,85 @@ +#!/usr/bin/perl + +# ------------------------------------------------------------ +# Projector PJLink Control Script +# +# ------------------------------------------------------------ +# 2012 IT Services, Truman State University +# +# Maintained by Huan Truong, get the latest version at +# https://gist.github.com/1677547 +# ------------------------------------------------------------ + +use Net::PJLink; +use Getopt::Std; +use Getopt::Long; +use Switch; +use Data::Dumper; + +my $ip = $ARGV[0]; +my $action = $ARGV[1]; +my $password = ''; +my $param = ''; + +# Process options. +if ( @ARGV > 0 ) { + GetOptions( 'p|password=s'=> \$password, + ); +} else { + $help = <new( + host => $ip, + # keep_alive => 1, + # auth_password => $password, + # This does NOT work -- the documentation is wrong +); + +# If authentication is needed then we need to set it. +unless ($password == '') { + $prj->set_auth_password($password); +} + +switch ($action) { + case 'set_power_state' { + $param = $ARGV[2]; + print $prj->set_power($param); + } + case 'get_input' { + @current_input = $prj->get_input(); + print $current_input[0][0] . ',' . $current_input[0][1]; + } + case 'set_input' { + $param = $ARGV[2]; + $inputnumber = $ARGV[3]; + print $prj->set_input($param,$inputnumber); + } + else { # else, default to get power state + print $prj->get_power(); + } +} + +# Close all network connections to the projector. +$prj->close_all_connections; diff --git a/projectorCommands.inc b/projectorCommands.inc index 0a08f4f..5c8a04c 100755 --- a/projectorCommands.inc +++ b/projectorCommands.inc @@ -24,8 +24,7 @@ $PROJECTORS = Array( "RGB" => "set_input INPUT_RGB", "VIDEO" => "set_input INPUT_VIDEO", "DIGITAL" => "set_input INPUT_DIGITAL", - "VIDEO(RCA)" => "\xBE\xEF\x03\x06\x00\x6E\xD3\x01\x00\x00\x20\x01\x00", - "VIDEO(S)" => "\xBE\xEF\x03\x06\x00\x9E\xD3\x01\x00\x00\x20\x02\x00", + "IP" => "192.168.192.200", "PASSWORD" => "1234" //"BAUD_RATE" => "19200",