How can I get zmcontrol-IP9100.pl patch?
Posted: Tue Sep 09, 2008 4:38 pm
How can I get zmcontrol-IP9100.pl patch as it doesn't seem to be implemented to zm1.23.3?
Best regards
Patrick
Best regards
Patrick
ZoneMinder Forums
https://forums.zoneminder.com/
Code: Select all
#!/usr/bin/perl -wT
#
#
# ==========================================================================
#
# ZoneMinder Aviosys 9100 Control Script, $Date: 2007/05/03 11:23:05 $, $Revision: .1 $
# Copyright (C) 2006 Glenn Neufeld
#
# Adapted From:
#
# ZoneMinder VISCA Control Script, $Date: 2005/07/14 08:53:15 $, $Revision: 1.6 $
# Copyright (C) 2003, 2004, 2005 Philip Coombes
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# ==========================================================================
#use strict;
#use Switch;
# ==========================================================================
#
# These are the elements you need to edit to suit your installation
#
# ==========================================================================
use constant DBG_ID => "zmctrl-ip9100"; # Tag that appears in debug to identify source
use constant DBG_LEVEL => 3; # 0 is errors, warnings and info only, > 0 for debug
# ==========================================================================
use ZoneMinder;
use Getopt::Long;
use LWP::UserAgent;
$| = 1;
$ENV{PATH} = '/bin:/usr/bin';
$ENV{SHELL} = '/bin/sh' if exists $ENV{SHELL};
delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
sub Usage
{
print( "
Usage: zmcontrol-SNC-M3W.pl <various options>
");
exit( -1 );
}
zmDbgInit( DBG_ID, level=>DBG_LEVEL );
my $arg_string = join( " ", @ARGV );
my $device = "";
my $address = "192.168.1.116";
my $command = "";
my $speed = 0;
my $step = 0;
my $xcoord = 0;
my $ycoord = 0;
my $panspeed = 0;
my $tiltspeed = 0;
my $panstep = 0;
my $tiltstep = 0;
my $preset = 0;
# Massive array of http commands and possible args:
# This script for this 4-port video digitizer only switches feeds using the presets
my %cameraCommands =
(
'preset_goto' => '$evalString = "/SetChannel.cgi?Channel=$preset"',
'preset_set' => '$evalString = "/SetChannel.cgi?Channel=$preset"'
);
if ( !GetOptions(
'device=s'=>\$device,
'address=i'=>\$address,
'command=s'=>\$command,
'speed=i'=>\$speed,
'step=i'=>\$step,
'xcoord=i'=>\$xcoord,
'ycoord=i'=>\$ycoord,
'panspeed=i'=>\$panspeed,
'tiltspeed=i'=>\$tiltspeed,
'panstep=i'=>\$panstep,
'tiltstep=i'=>\$tiltstep,
'preset=i'=>\$preset
)
)
{
Usage();
}
srand( time() );
Debug( "Passed => " . $arg_string . "\n" );
sub doCommand
# Given a zm_command, execute it using http commo to the camera
{
my $httpCommand = "";
# my $command = @_;
Debug ("doCommand => " . $command."\n");
$httpCommand = $cameraCommands{ $command };
Debug("doCommand => " . $httpCommand . "\n" );
#print( $httpCommand . "\n" );
if ( $httpCommand )
{
my $result = "";
my $a = "";
my $evalString = "";
#eval($httpCommand);
#print $evalString;
$httpCommand = "http://$address" . eval($httpCommand);
#$httpCommand =~ s/ //g;
Debug("doCommand => " . $httpCommand . "\n" );
$ua = LWP::UserAgent->new;
$ua->agent( "ZoneMinder Control Agent/".ZM_VERSION );
Debug( $httpCommand );
#print( $httpCommand."\n" );
$req = HTTP::Request->new( GET=>$httpCommand );
$res = $ua->request($req);
#print( $res->as_string );
if ( $res->is_success )
{
$result = !undef;
}
else
{
Error( "doCommand => Error check failed: '".$res->status_line()."'\n" );
}
#print( $result."\n" );
}
else
{
{ Debug("Error, can't handle command $command\n")}
}
}
# Usage here, too
if ( $command eq "" )
{
Usage();
}
if ( $command eq "preset_set" )
{
Debug("That tickles!");
}
# Device uses 0-3 (zero-based), ZM uses 1-4 (1-based)
# Input "-1" seems to make the device round-robin the *stream* ?!?!
if ( $preset == 0 )
{
Debug("Get the YOICS ROM if you want 4 feeds!");
exit( -1 );
}
$preset -= 1;
# Run it
doCommand( $command );