Merge branch 'storageareas' of github.com:ConnorTechnology/ZoneMinder into storageareas
commit
eb93c75100
|
@ -45,265 +45,239 @@ use ZoneMinder::Config qw(:all);
|
||||||
|
|
||||||
use Time::HiRes qw( usleep );
|
use Time::HiRes qw( usleep );
|
||||||
|
|
||||||
sub new
|
sub new {
|
||||||
{
|
my $class = shift;
|
||||||
my $class = shift;
|
my $id = shift;
|
||||||
my $id = shift;
|
my $self = ZoneMinder::Control->new( $id );
|
||||||
my $self = ZoneMinder::Control->new( $id );
|
bless( $self, $class );
|
||||||
bless( $self, $class );
|
srand( time() );
|
||||||
srand( time() );
|
return $self;
|
||||||
return $self;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
our $AUTOLOAD;
|
our $AUTOLOAD;
|
||||||
|
|
||||||
sub AUTOLOAD
|
sub AUTOLOAD {
|
||||||
{
|
my $self = shift;
|
||||||
my $self = shift;
|
my $class = ref($self) || croak( "$self not object" );
|
||||||
my $class = ref($self) || croak( "$self not object" );
|
my $name = $AUTOLOAD;
|
||||||
my $name = $AUTOLOAD;
|
$name =~ s/.*://;
|
||||||
$name =~ s/.*://;
|
if ( exists($self->{$name}) ) {
|
||||||
if ( exists($self->{$name}) )
|
return( $self->{$name} );
|
||||||
{
|
}
|
||||||
return( $self->{$name} );
|
Fatal( "Can't access $name member of object of class $class" );
|
||||||
}
|
|
||||||
Fatal( "Can't access $name member of object of class $class" );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub open
|
sub open {
|
||||||
{
|
my $self = shift;
|
||||||
my $self = shift;
|
|
||||||
|
|
||||||
$self->loadMonitor();
|
$self->loadMonitor();
|
||||||
|
|
||||||
use LWP::UserAgent;
|
use LWP::UserAgent;
|
||||||
$self->{ua} = LWP::UserAgent->new;
|
$self->{ua} = LWP::UserAgent->new;
|
||||||
$self->{ua}->agent( "ZoneMinder Control Agent/".ZoneMinder::Base::ZM_VERSION );
|
$self->{ua}->agent( "ZoneMinder Control Agent/".ZoneMinder::Base::ZM_VERSION );
|
||||||
|
|
||||||
$self->{state} = 'open';
|
$self->{state} = 'open';
|
||||||
}
|
}
|
||||||
|
|
||||||
sub close
|
sub close {
|
||||||
{
|
my $self = shift;
|
||||||
my $self = shift;
|
$self->{state} = 'closed';
|
||||||
$self->{state} = 'closed';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub printMsg
|
sub printMsg {
|
||||||
{
|
my $self = shift;
|
||||||
my $self = shift;
|
my $msg = shift;
|
||||||
my $msg = shift;
|
my $msg_len = length($msg);
|
||||||
my $msg_len = length($msg);
|
|
||||||
|
|
||||||
Debug( $msg."[".$msg_len."]" );
|
Debug( $msg."[".$msg_len."]" );
|
||||||
}
|
}
|
||||||
|
|
||||||
sub sendCmd
|
sub sendCmd {
|
||||||
{
|
my $self = shift;
|
||||||
my $self = shift;
|
my $cmd = shift;
|
||||||
my $cmd = shift;
|
|
||||||
|
|
||||||
my $result = undef;
|
my $result = undef;
|
||||||
|
|
||||||
printMsg( $cmd, "Tx" );
|
printMsg( $cmd, "Tx" );
|
||||||
|
|
||||||
my $url;
|
my $url;
|
||||||
if ( $self->{Monitor}->{ControlAddress} =~ /^http/ ) {
|
if ( $self->{Monitor}->{ControlAddress} =~ /^http/ ) {
|
||||||
$url = $self->{Monitor}->{ControlAddress}.$cmd;
|
$url = $self->{Monitor}->{ControlAddress}.$cmd;
|
||||||
} else {
|
} else {
|
||||||
$url = 'http://'.$self->{Monitor}->{ControlAddress}.$cmd;
|
$url = 'http://'.$self->{Monitor}->{ControlAddress}.$cmd;
|
||||||
} # en dif
|
} # en dif
|
||||||
my $req = HTTP::Request->new( GET=>$url );
|
my $req = HTTP::Request->new( GET=>$url );
|
||||||
|
|
||||||
my $res = $self->{ua}->request($req);
|
my $res = $self->{ua}->request($req);
|
||||||
|
|
||||||
if ( $res->is_success )
|
if ( $res->is_success ) {
|
||||||
{
|
$result = !undef;
|
||||||
$result = !undef;
|
} else {
|
||||||
}
|
Error( "Error check failed: '".$res->status_line()."'" );
|
||||||
else
|
}
|
||||||
{
|
|
||||||
Error( "Error check failed: '".$res->status_line()."'" );
|
|
||||||
}
|
|
||||||
|
|
||||||
return( $result );
|
return( $result );
|
||||||
}
|
}
|
||||||
|
|
||||||
sub reset
|
sub reset {
|
||||||
{
|
my $self = shift;
|
||||||
my $self = shift;
|
Debug( "Camera Reset" );
|
||||||
Debug( "Camera Reset" );
|
my $cmd = "/admin/ptctl.cgi?move=reset";
|
||||||
my $cmd = "/admin/ptctl.cgi?move=reset";
|
$self->sendCmd( $cmd );
|
||||||
$self->sendCmd( $cmd );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub moveMap
|
sub moveMap {
|
||||||
{
|
my $self = shift;
|
||||||
my $self = shift;
|
my $params = shift;
|
||||||
my $params = shift;
|
my $xcoord = $self->getParam( $params, 'xcoord' );
|
||||||
my $xcoord = $self->getParam( $params, 'xcoord' );
|
my $ycoord = $self->getParam( $params, 'ycoord' );
|
||||||
my $ycoord = $self->getParam( $params, 'ycoord' );
|
|
||||||
|
|
||||||
my $hor = $xcoord * 100 / $self->{Monitor}->{Width};
|
my $hor = $xcoord * 100 / $self->{Monitor}->{Width};
|
||||||
my $ver = $ycoord * 100 / $self->{Monitor}->{Height};
|
my $ver = $ycoord * 100 / $self->{Monitor}->{Height};
|
||||||
|
|
||||||
my $maxver = 8;
|
my $maxver = 8;
|
||||||
my $maxhor = 30;
|
my $maxhor = 30;
|
||||||
|
|
||||||
my $horDir = "right";
|
|
||||||
my $verDir = "up";
|
|
||||||
my $horSteps = 0;
|
|
||||||
my $verSteps = 0;
|
|
||||||
|
|
||||||
# Horizontal movement
|
my $horDir = "right";
|
||||||
if ($hor < 50) {
|
my $verDir = "up";
|
||||||
# left
|
my $horSteps = 0;
|
||||||
$horSteps = ((50 - $hor) / 50) * $maxhor;
|
my $verSteps = 0;
|
||||||
$horDir = "left";
|
|
||||||
}
|
|
||||||
elsif ($hor > 50) {
|
|
||||||
# right
|
|
||||||
$horSteps = (($hor - 50) / 50) * $maxhor;
|
|
||||||
$horDir = "right";
|
|
||||||
}
|
|
||||||
|
|
||||||
# Vertical movement
|
|
||||||
if ($ver < 50) {
|
|
||||||
# up
|
|
||||||
$verSteps = ((50 - $ver) / 50) * $maxver;
|
|
||||||
$verDir = "up";
|
|
||||||
}
|
|
||||||
elsif ($ver > 50) {
|
|
||||||
# down
|
|
||||||
$verSteps = (($ver - 50) / 50) * $maxver;
|
|
||||||
$verDir = "down";
|
|
||||||
}
|
|
||||||
|
|
||||||
my $v = int($verSteps);
|
# Horizontal movement
|
||||||
my $h = int($horSteps);
|
if ( $hor < 50 ) {
|
||||||
|
# left
|
||||||
|
$horSteps = ((50 - $hor) / 50) * $maxhor;
|
||||||
|
$horDir = "left";
|
||||||
|
}
|
||||||
|
elsif ( $hor > 50 ) {
|
||||||
|
# right
|
||||||
|
$horSteps = (($hor - 50) / 50) * $maxhor;
|
||||||
|
$horDir = "right";
|
||||||
|
}
|
||||||
|
|
||||||
Debug( "Move Map to $xcoord,$ycoord, hor=$h $horDir, ver=$v $verDir");
|
# Vertical movement
|
||||||
my $cmd = "/cgi/admin/ptctrl.cgi?action=movedegree&Cmd=$horDir&Degree=$h";
|
if ( $ver < 50 ) {
|
||||||
$self->sendCmd( $cmd );
|
# up
|
||||||
$cmd = "/cgi/admin/ptctrl.cgi?action=movedegree&Cmd=$verDir&Degree=$v";
|
$verSteps = ((50 - $ver) / 50) * $maxver;
|
||||||
$self->sendCmd( $cmd );
|
$verDir = "up";
|
||||||
|
}
|
||||||
|
elsif ( $ver > 50 ) {
|
||||||
|
# down
|
||||||
|
$verSteps = (($ver - 50) / 50) * $maxver;
|
||||||
|
$verDir = "down";
|
||||||
|
}
|
||||||
|
|
||||||
|
my $v = int($verSteps);
|
||||||
|
my $h = int($horSteps);
|
||||||
|
|
||||||
|
Debug( "Move Map to $xcoord,$ycoord, hor=$h $horDir, ver=$v $verDir");
|
||||||
|
my $cmd = "/cgi/admin/ptctrl.cgi?action=movedegree&Cmd=$horDir&Degree=$h";
|
||||||
|
$self->sendCmd( $cmd );
|
||||||
|
$cmd = "/cgi/admin/ptctrl.cgi?action=movedegree&Cmd=$verDir&Degree=$v";
|
||||||
|
$self->sendCmd( $cmd );
|
||||||
}
|
}
|
||||||
|
|
||||||
sub moveRelUp
|
sub moveRelUp {
|
||||||
{
|
my $self = shift;
|
||||||
my $self = shift;
|
my $params = shift;
|
||||||
my $params = shift;
|
my $step = $self->getParam( $params, 'tiltstep' );
|
||||||
my $step = $self->getParam( $params, 'tiltstep' );
|
Debug( "Step Up $step" );
|
||||||
Debug( "Step Up $step" );
|
my $cmd = "/admin/ptctl.cgi?move=up";
|
||||||
my $cmd = "/admin/ptctl.cgi?move=up";
|
$self->sendCmd( $cmd );
|
||||||
$self->sendCmd( $cmd );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub moveRelDown
|
sub moveRelDown {
|
||||||
{
|
my $self = shift;
|
||||||
my $self = shift;
|
my $params = shift;
|
||||||
my $params = shift;
|
my $step = $self->getParam( $params, 'tiltstep' );
|
||||||
my $step = $self->getParam( $params, 'tiltstep' );
|
Debug( "Step Down $step" );
|
||||||
Debug( "Step Down $step" );
|
my $cmd = "/admin/ptctl.cgi?move=down";
|
||||||
my $cmd = "/admin/ptctl.cgi?move=down";
|
$self->sendCmd( $cmd );
|
||||||
$self->sendCmd( $cmd );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub moveRelLeft
|
sub moveRelLeft {
|
||||||
{
|
my $self = shift;
|
||||||
my $self = shift;
|
my $params = shift;
|
||||||
my $params = shift;
|
my $step = $self->getParam( $params, 'panstep' );
|
||||||
my $step = $self->getParam( $params, 'panstep' );
|
|
||||||
Debug( "Step Left $step" );
|
if ( $self->{Monitor}->{Orientation} eq "hori" ) {
|
||||||
my $cmd = "/admin/ptctl.cgi?move=left";
|
Debug( "Stepping Right because flipped horizontally " );
|
||||||
$self->sendCmd( $cmd );
|
$self->sendCmd( "/admin/ptctl.cgi?move=right" );
|
||||||
|
} else {
|
||||||
|
Debug( "Step Left" );
|
||||||
|
$self->sendCmd( "/admin/ptctl.cgi?move=left" );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub moveRelRight
|
sub moveRelRight {
|
||||||
{
|
my $self = shift;
|
||||||
my $self = shift;
|
my $params = shift;
|
||||||
my $params = shift;
|
my $step = $self->getParam( $params, 'panstep' );
|
||||||
my $step = $self->getParam( $params, 'panstep' );
|
if ( $self->{Monitor}->{Orientation} eq "hori" ) {
|
||||||
Debug( "Step Right $step" );
|
Debug( "Stepping Left because flipped horizontally " );
|
||||||
my $cmd = "/admin/ptctl.cgi?move=right";
|
$self->sendCmd( "/admin/ptctl.cgi?move=left" );
|
||||||
$self->sendCmd( $cmd );
|
} else {
|
||||||
|
Debug( "Step Right" );
|
||||||
|
$self->sendCmd( "/admin/ptctl.cgi?move=right" );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub presetClear
|
sub presetClear {
|
||||||
{
|
my $self = shift;
|
||||||
my $self = shift;
|
my $params = shift;
|
||||||
my $params = shift;
|
my $preset = $self->getParam( $params, 'preset' );
|
||||||
my $preset = $self->getParam( $params, 'preset' );
|
Debug( "Clear Preset $preset" );
|
||||||
Debug( "Clear Preset $preset" );
|
#my $cmd = "/axis-cgi/com/ptz.cgi?removeserverpresetno=$preset";
|
||||||
#my $cmd = "/axis-cgi/com/ptz.cgi?removeserverpresetno=$preset";
|
#$self->sendCmd( $cmd );
|
||||||
#$self->sendCmd( $cmd );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub presetSet
|
sub presetSet {
|
||||||
{
|
my $self = shift;
|
||||||
my $self = shift;
|
my $params = shift;
|
||||||
my $params = shift;
|
my $preset = $self->getParam( $params, 'preset' );
|
||||||
my $preset = $self->getParam( $params, 'preset' );
|
Debug( "Set Preset $preset" );
|
||||||
Debug( "Set Preset $preset" );
|
my $cmd = "/admin/ptctl.cgi?position=" . ($preset - 1) . "&positionname=zm$preset";
|
||||||
my $cmd = "/admin/ptctl.cgi?position=" . ($preset - 1) . "&positionname=zm$preset";
|
$self->sendCmd( $cmd );
|
||||||
$self->sendCmd( $cmd );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub presetGoto
|
sub presetGoto {
|
||||||
{
|
my $self = shift;
|
||||||
my $self = shift;
|
my $params = shift;
|
||||||
my $params = shift;
|
my $preset = $self->getParam( $params, 'preset' );
|
||||||
my $preset = $self->getParam( $params, 'preset' );
|
Debug( "Goto Preset $preset" );
|
||||||
Debug( "Goto Preset $preset" );
|
my $cmd = "/admin/ptctl.cgi?move=p" . ($preset - 1);
|
||||||
my $cmd = "/admin/ptctl.cgi?move=p" . ($preset - 1);
|
$self->sendCmd( $cmd );
|
||||||
$self->sendCmd( $cmd );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub presetHome
|
sub presetHome {
|
||||||
{
|
my $self = shift;
|
||||||
my $self = shift;
|
Debug( "Home Preset" );
|
||||||
Debug( "Home Preset" );
|
my $cmd = "/admin/ptctl.cgi?move=h";
|
||||||
my $cmd = "/admin/ptctl.cgi?move=h";
|
$self->sendCmd( $cmd );
|
||||||
$self->sendCmd( $cmd );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
__END__
|
__END__
|
||||||
# Below is stub documentation for your module. You'd better edit it!
|
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
ZoneMinder::Database - Perl extension for blah blah blah
|
ZoneMinder::Control::SkyIPCam7xx.pm - Module for controlling AirLink101 SkyIPams
|
||||||
|
|
||||||
=head1 SYNOPSIS
|
=head1 SYNOPSIS
|
||||||
|
|
||||||
use ZoneMinder::Database;
|
use ZoneMinder::Control::SkyIPCam7xx;
|
||||||
blah blah blah
|
|
||||||
|
|
||||||
=head1 DESCRIPTION
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
Stub documentation for ZoneMinder, created by h2xs. It looks like the
|
Module for controlling AirLink101 Cameras.
|
||||||
author of the extension was negligent enough to leave the stub
|
|
||||||
unedited.
|
|
||||||
|
|
||||||
Blah blah blah.
|
|
||||||
|
|
||||||
=head2 EXPORT
|
=head2 EXPORT
|
||||||
|
|
||||||
None by default.
|
None by default.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
=head1 SEE ALSO
|
=head1 SEE ALSO
|
||||||
|
|
||||||
Mention other useful documentation such as the documentation of
|
ZoneMinder::Control
|
||||||
related modules or operating system documentation (such as man pages
|
|
||||||
in UNIX), or any relevant external documentation such as RFCs or
|
|
||||||
standards.
|
|
||||||
|
|
||||||
If you have a mailing list set up for your module, mention it here.
|
|
||||||
|
|
||||||
If you have a web site set up for your module, mention it here.
|
|
||||||
|
|
||||||
=head1 AUTHOR
|
=head1 AUTHOR
|
||||||
|
|
||||||
|
@ -318,5 +292,4 @@ This library is free software; you can redistribute it and/or modify
|
||||||
it under the same terms as Perl itself, either Perl version 5.8.3 or,
|
it under the same terms as Perl itself, either Perl version 5.8.3 or,
|
||||||
at your option, any later version of Perl 5 you may have available.
|
at your option, any later version of Perl 5 you may have available.
|
||||||
|
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
|
@ -1262,7 +1262,12 @@ bool EventStream::sendFrame( int delta_us ) {
|
||||||
if ( monitor->GetOptSaveJPEGs() & 1) {
|
if ( monitor->GetOptSaveJPEGs() & 1) {
|
||||||
snprintf( filepath, sizeof(filepath), Event::capture_file_format, event_data->path, curr_frame_id );
|
snprintf( filepath, sizeof(filepath), Event::capture_file_format, event_data->path, curr_frame_id );
|
||||||
} else if ( monitor->GetOptSaveJPEGs() & 2 ) {
|
} else if ( monitor->GetOptSaveJPEGs() & 2 ) {
|
||||||
snprintf( filepath, sizeof(filepath), Event::analyse_file_format, event_data->path, curr_frame_id );
|
snprintf( filepath, sizeof(filepath), Event::analyse_file_format, event_data->path, curr_frame_id );
|
||||||
|
if ( stat( filepath, &filestat ) < 0 ) {
|
||||||
|
Debug(1, "%s not found, dalling back to capture");
|
||||||
|
snprintf( filepath, sizeof(filepath), Event::capture_file_format, event_data->path, curr_frame_id );
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Fatal("JPEGS not saved.zms is not capable of streaming jpegs from mp4 yet");
|
Fatal("JPEGS not saved.zms is not capable of streaming jpegs from mp4 yet");
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue