Cleanup old Continuous stop. Rename lastMove to LastCmd and implement for Zoom

This commit is contained in:
Isaac Connor 2021-04-21 14:30:02 -04:00
parent 354a3d9f09
commit 7c70c26fbd
1 changed files with 24 additions and 43 deletions

View File

@ -187,74 +187,57 @@ sub moveAbs ## Up, Down, Left, Right, etc. ??? Doesn't make sense here...
sub moveConUp { sub moveConUp {
my $self = shift; my $self = shift;
Debug('Move Up'); Debug('Move Up');
$$self{LastMove} = 'code=Up&channel=0&arg1=0&arg2=1&arg3=0'; $$self{LastCmd} = 'code=Up&channel=0&arg1=0&arg2=1&arg3=0';
$self->sendCmd('cgi-bin/ptz.cgi?action=start&code=Up&channel=0&arg1=0&arg2=1&arg3=0'); $self->sendCmd('cgi-bin/ptz.cgi?action=start&'.$$self{LastCmd});
#usleep(500); ##XXX Should this be passed in as a "speed" parameter?
#$self->sendCmd('cgi-bin/ptz.cgi?action=stop&code=Up&channel=0&arg1=0&arg2=1&arg3=0');
} }
sub moveConDown { sub moveConDown {
my $self = shift; my $self = shift;
Debug('Move Down'); Debug('Move Down');
$$self{LastMove} = 'code=Down&channel=0&arg1=0&arg2=1&arg3=0'; $$self{LastCmd} = 'code=Down&channel=0&arg1=0&arg2=1&arg3=0';
$self->sendCmd('cgi-bin/ptz.cgi?action=start&code=Down&channel=0&arg1=0&arg2=1&arg3=0'); $self->sendCmd('cgi-bin/ptz.cgi?action=start&'.$$self{LastCmd});
#usleep(500);
#$self->sendCmd('cgi-bin/ptz.cgi?action=stop&code=Down&channel=0&arg1=0&arg2=1&arg3=0');
} }
sub moveConLeft { sub moveConLeft {
my $self = shift; my $self = shift;
Debug('Move Left'); Debug('Move Left');
$$self{LastMove} = 'code=Left&channel=0&arg1=0&arg2=1&arg3=0'; $$self{LastCmd} = 'code=Left&channel=0&arg1=0&arg2=1&arg3=0';
$self->sendCmd('cgi-bin/ptz.cgi?action=start&code=Left&channel=0&arg1=0&arg2=1&arg3=0'); $self->sendCmd('cgi-bin/ptz.cgi?action=start&'.$$self{LastCmd});
#usleep(500);
#$self->sendCmd('cgi-bin/ptz.cgi?action=stop&code=Left&channel=0&arg1=0&arg2=1&arg3=0');
} }
sub moveConRight { sub moveConRight {
my $self = shift; my $self = shift;
Debug('Move Right'); Debug('Move Right');
$$self{LastMove} = 'code=Right&channel=0&arg1=0&arg2=1&arg3=0'; $$self{LastCmd} = 'code=Right&channel=0&arg1=0&arg2=1&arg3=0';
$self->sendCmd('cgi-bin/ptz.cgi?action=start&code=Right&channel=0&arg1=0&arg2=1&arg3=0'); $self->sendCmd('cgi-bin/ptz.cgi?action=start&'.$$self{LastCmd});
#usleep(500);
#Debug('Move Right Stop');
#$self->sendCmd('cgi-bin/ptz.cgi?action=stop&code=Right&channel=0&arg1=0&arg2=1&arg3=0');
} }
sub moveConUpRight { sub moveConUpRight {
my $self = shift; my $self = shift;
Debug('Move Diagonally Up Right'); Debug('Move Diagonally Up Right');
$$self{LastMove} = 'code=RightUp&channel=0&arg1=0&arg2=1&arg3=0'; $$self{LastCmd} = 'code=RightUp&channel=0&arg1=0&arg2=1&arg3=0';
$self->sendCmd('cgi-bin/ptz.cgi?action=start&code=RightUp&channel=0&arg1=1&arg2=1&arg3=0'); $self->sendCmd('cgi-bin/ptz.cgi?action=start&'.$$self{LastCmd});
#usleep(500);
#$self->sendCmd('cgi-bin/ptz.cgi?action=stop&code=RightUp&channel=0&arg1=0&arg2=1&arg3=0');
} }
sub moveConDownRight { sub moveConDownRight {
my $self = shift; my $self = shift;
Debug('Move Diagonally Down Right'); Debug('Move Diagonally Down Right');
$$self{LastMove} = 'code=RightDown&channel=0&arg1=0&arg2=1&arg3=0'; $$self{LastCmd} = 'code=RightDown&channel=0&arg1=0&arg2=1&arg3=0';
$self->sendCmd('cgi-bin/ptz.cgi?action=start&code=RightDown&channel=0&arg1=1&arg2=1&arg3=0'); $self->sendCmd('cgi-bin/ptz.cgi?action=start&'.$$self{LastCmd});
#usleep(500);
#$self->sendCmd('cgi-bin/ptz.cgi?action=stop&code=RightDown&channel=0&arg1=0&arg2=1&arg3=0');
} }
sub moveConUpLeft { sub moveConUpLeft {
my $self = shift; my $self = shift;
Debug('Move Diagonally Up Left'); Debug('Move Diagonally Up Left');
$$self{LastMove} = 'code=LeftUp&channel=0&arg1=0&arg2=1&arg3=0'; $$self{LastCmd} = 'code=LeftUp&channel=0&arg1=0&arg2=1&arg3=0';
$self->sendCmd('cgi-bin/ptz.cgi?action=start&code=LeftUp&channel=0&arg1=1&arg2=1&arg3=0'); $self->sendCmd('cgi-bin/ptz.cgi?action=start&'.$$self{LastCmd});
#usleep(500);
#$self->sendCmd('cgi-bin/ptz.cgi?action=stop&code=LeftUp&channel=0&arg1=0&arg2=1&arg3=0');
} }
sub moveConDownLeft { sub moveConDownLeft {
my $self = shift; my $self = shift;
Debug('Move Diagonally Down Left'); Debug('Move Diagonally Down Left');
$$self{LastMove} = 'code=LeftDown&channel=0&arg1=0&arg2=1&arg3=0'; $$self{LastCmd} = 'code=LeftDown&channel=0&arg1=0&arg2=1&arg3=0';
$self->sendCmd('cgi-bin/ptz.cgi?action=start&code=LeftDown&channel=0&arg1=1&arg2=1&arg3=0'); $self->sendCmd('cgi-bin/ptz.cgi?action=start&'.$$self{LastCmd});
#usleep (500);
#$self->sendCmd('cgi-bin/ptz.cgi?action=stop&code=LeftDown&channel=0&arg1=0&arg2=1&arg3=0');
} }
# Stop is not "correctly" implemented as control_functions.php translates this to "Center" # Stop is not "correctly" implemented as control_functions.php translates this to "Center"
@ -263,10 +246,10 @@ sub moveConDownLeft {
sub moveStop { sub moveStop {
my $self = shift; my $self = shift;
if ($$self{LastMove}) { if ($$self{LastCmd}) {
Debug('Move Stop '.$$self{LastMove}); Debug('Move Stop '.$$self{LastCmd});
$self->sendCmd('cgi-bin/ptz.cgi?action=stop&'.$$self{LastMove}); $self->sendCmd('cgi-bin/ptz.cgi?action=stop&'.$$self{LastCmd});
$$self{LastMove} = ''; $$self{LastCmd} = '';
} else { } else {
Debug('Move Stop/Center'); Debug('Move Stop/Center');
$self->sendCmd('cgi-bin/ptz.cgi?action=start&code=PositionABS&channel=0&arg1=0&arg2=0&arg3=0&arg4=1'); $self->sendCmd('cgi-bin/ptz.cgi?action=start&code=PositionABS&channel=0&arg1=0&arg2=0&arg3=0&arg4=1');
@ -320,17 +303,15 @@ sub moveMap {
sub zoomConTele { sub zoomConTele {
my $self = shift; my $self = shift;
Debug('Zoom continuous tele'); Debug('Zoom continuous tele');
$self->sendCmd('cgi-bin/ptz.cgi?action=start&channel=0&code=ZoomTele&arg1=0&arg2=0&arg3=0&arg4=0'); $$self{LastCmd} = 'code=ZoomTele&channel=0&arg1=0&arg2=0&arg3=0&arg4=0';
usleep(100000); $self->sendCmd('cgi-bin/ptz.cgi?action=start&'.$$self{LastCmd});
$self->sendCmd('cgi-bin/ptz.cgi?action=stop&channel=0&code=ZoomTele&arg1=0&arg2=0&arg3=0&arg4=0');
} }
sub zoomConWide { sub zoomConWide {
my $self = shift; my $self = shift;
Debug('Zoom continuous wide'); Debug('Zoom continuous wide');
$self->sendCmd('cgi-bin/ptz.cgi?action=start&channel=0&code=ZoomWide&arg1=0&arg2=0&arg3=0&arg4=0'); $$self{LastCmd} = 'code=ZoomWide&channel=0&arg1=0&arg2=0&arg3=0&arg4=0';
usleep (100000); $self->sendCmd('cgi-bin/ptz.cgi?action=start&'.$$self{LastCmd});
$self->sendCmd('cgi-bin/ptz.cgi?action=stop&channel=0&code=ZoomWide&arg1=0&arg2=0&arg3=0&arg4=0');
} }
1; 1;