Fixed PTZ control for non-Pelco protocols.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@2229 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
parent
1bfa9f6c06
commit
4b1716062e
|
@ -42,6 +42,7 @@ our $VERSION = $ZoneMinder::Base::VERSION;
|
|||
# ==========================================================================
|
||||
|
||||
use ZoneMinder::Debug qw(:all);
|
||||
use ZoneMinder::Config qw(:all);
|
||||
|
||||
use Time::HiRes qw( usleep );
|
||||
|
||||
|
@ -108,8 +109,8 @@ sub sendCmd
|
|||
printMsg( $cmd, "Tx" );
|
||||
|
||||
#print( "http://$address/$cmd\n" );
|
||||
my $req = HTTP::Request->new( GET=>"http://$address/$cmd" );
|
||||
my $res = $ua->request($req);
|
||||
my $req = HTTP::Request->new( GET=>"http://".$self->{Monitor}->{ControlAddress}."/$cmd" );
|
||||
my $res = $self->{ua}->request($req);
|
||||
|
||||
if ( $res->is_success )
|
||||
{
|
||||
|
|
|
@ -42,6 +42,7 @@ our $VERSION = $ZoneMinder::Base::VERSION;
|
|||
# ==========================================================================
|
||||
|
||||
use ZoneMinder::Debug qw(:all);
|
||||
use ZoneMinder::Config qw(:all);
|
||||
|
||||
use Time::HiRes qw( usleep );
|
||||
|
||||
|
@ -107,8 +108,8 @@ sub sendCmd
|
|||
|
||||
printMsg( $cmd, "Tx" );
|
||||
|
||||
my $req = HTTP::Request->new( POST=>"http://$address/PANTILTCONTROL.CGI" );
|
||||
my $res = $ua->request($req);
|
||||
my $req = HTTP::Request->new( POST=>"http://".$self->{Monitor}->{ControlAddress}."/PANTILTCONTROL.CGI" );
|
||||
my $res = $self->{ua}->request($req);
|
||||
|
||||
if ( $res->is_success )
|
||||
{
|
||||
|
|
|
@ -42,6 +42,7 @@ our $VERSION = $ZoneMinder::Base::VERSION;
|
|||
# ==========================================================================
|
||||
|
||||
use ZoneMinder::Debug qw(:all);
|
||||
use ZoneMinder::Config qw(:all);
|
||||
|
||||
use Time::HiRes qw( usleep );
|
||||
|
||||
|
@ -107,8 +108,8 @@ sub sendCmd
|
|||
|
||||
printMsg( $cmd, "Tx" );
|
||||
|
||||
my $req = HTTP::Request->new( GET=>"http://$address/$cmd" );
|
||||
my $res = $ua->request($req);
|
||||
my $req = HTTP::Request->new( GET=>"http://".$self->{Monitor}->{ControlAddress}."/$cmd" );
|
||||
my $res = $self->{ua}->request($req);
|
||||
|
||||
if ( $res->is_success )
|
||||
{
|
||||
|
@ -179,7 +180,7 @@ sub zoomConTele
|
|||
my $params = shift;
|
||||
my $step = $self->getParam( $params, 'step' );
|
||||
Debug( "Zoom Tele" );
|
||||
cmy $cmd = "nphControlCamera?Direction=ZoomTele";
|
||||
my $cmd = "nphControlCamera?Direction=ZoomTele";
|
||||
$self->sendCmd( $cmd );
|
||||
}
|
||||
|
||||
|
|
|
@ -496,7 +496,6 @@ sub zoomConTele
|
|||
my $speed = $self->getParam( $params, 'speed', 0x06 );
|
||||
my $autostop = $self->getParam( $params, 'autostop', 0 );
|
||||
Debug( "Zoom Tele" );
|
||||
my $speed = shift || 0x06;
|
||||
my @msg = ( 0x80|$self->{Monitor}->{ControlAddress}, 0x01, 0x04, 0x07, 0x20|$speed, SYNC );
|
||||
$self->sendCmd( \@msg );
|
||||
if( $autostop && $self->{Monitor}->{AutoStopTimeout} )
|
||||
|
@ -579,7 +578,7 @@ sub focusMan
|
|||
sub presetClear
|
||||
{
|
||||
my $self = shift;
|
||||
my $preset = shift || 1;
|
||||
my $params = shift;
|
||||
my $preset = $self->getParam( $params, 'preset', 1 );
|
||||
Debug( "Clear Preset $preset" );
|
||||
my @msg = ( 0x80|$self->{Monitor}->{ControlAddress}, 0x01, 0x04, 0x3f, 0x00, $preset, SYNC );
|
||||
|
|
|
@ -58,7 +58,7 @@ delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
|
|||
sub Usage
|
||||
{
|
||||
print( "
|
||||
Usage: zmcontrol.pl --protocol <protocol> <various options>
|
||||
Usage: zmcontrol.pl --id <monitor_id> --command=<command> <various options>
|
||||
");
|
||||
exit( -1 );
|
||||
}
|
||||
|
@ -67,12 +67,10 @@ zmDbgInit( DBG_ID, level=>DBG_LEVEL );
|
|||
|
||||
my $arg_string = join( " ", @ARGV );
|
||||
|
||||
my $protocol;
|
||||
my $id;
|
||||
my %options;
|
||||
|
||||
if ( !GetOptions(
|
||||
'protocol=s'=>\$protocol,
|
||||
'id=i'=>\$id,
|
||||
'command=s'=>\$options{command},
|
||||
'xcoord=i'=>\$options{xcoord},
|
||||
|
@ -91,7 +89,12 @@ if ( !GetOptions(
|
|||
Usage();
|
||||
}
|
||||
|
||||
( $protocol ) = $protocol =~ /^(\w+)$/;
|
||||
if ( !$id || !$options{command} )
|
||||
{
|
||||
print( STDERR "Please give a valid monitor id and command\n" );
|
||||
Usage();
|
||||
}
|
||||
|
||||
( $id ) = $id =~ /^(\w+)$/;
|
||||
|
||||
Debug( $arg_string );
|
||||
|
@ -105,6 +108,13 @@ my $server_up = connect( CLIENT, $saddr );
|
|||
if ( !$server_up )
|
||||
{
|
||||
# The server isn't there
|
||||
my $monitor = zmDbGetMonitorAndControl( $id );
|
||||
if ( !$monitor )
|
||||
{
|
||||
Fatal( "Unable to load control data for monitor $id" );
|
||||
}
|
||||
my $protocol = $monitor->{Protocol};
|
||||
|
||||
Info( "Starting control server $id/$protocol" );
|
||||
close( CLIENT );
|
||||
|
||||
|
@ -133,7 +143,7 @@ if ( !$server_up )
|
|||
|
||||
Info( "Control server $id/$protocol starting at ".strftime( '%y/%m/%d %H:%M:%S', localtime() ) );
|
||||
|
||||
$0 = $0." --id $id --protocol $protocol";
|
||||
$0 = $0." --id $id";
|
||||
|
||||
load "ZoneMinder::Control::$protocol";
|
||||
|
||||
|
|
|
@ -254,7 +254,7 @@ sub getCmdFormat
|
|||
my $suffix = "";
|
||||
my $command = $prefix.$null_command.$suffix;
|
||||
Debug( "Testing \"$command\"\n" );
|
||||
$command .= " >& /dev/null";
|
||||
$command .= " > /dev/null 2>&1";
|
||||
my $output = qx($command);
|
||||
my $status = $? >> 8;
|
||||
if ( !$status )
|
||||
|
|
Loading…
Reference in New Issue