Skip to content

Commit 46dc4f3

Browse files
Add reboot, use parent get()
1 parent 31e497e commit 46dc4f3

File tree

1 file changed

+10
-13
lines changed
  • scripts/ZoneMinder/lib/ZoneMinder/Control

1 file changed

+10
-13
lines changed

scripts/ZoneMinder/lib/ZoneMinder/Control/AxisV2.pm

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ sub open {
131131
} else {
132132
Debug('No headers line');
133133
} # end if headers
134+
# For parent get
135+
$$self{BaseURL} = $uri->canonical();
134136
} else {
135137
Debug('Failed to open '.$uri->canonical().$url.' status: '.$res->status_line());
136138
} # end if $res->status_line() eq '401 Unauthorized'
@@ -140,19 +142,7 @@ sub sendCmd {
140142
my $self = shift;
141143
my $cmd = shift;
142144

143-
$self->printMsg($cmd, 'Tx');
144-
145-
my $url = $uri->canonical().$cmd;
146-
my $res = $self->{ua}->get($url);
147-
148-
if ( $res->is_success ) {
149-
Debug('sndCmd command: '.$url.' content: '.$res->content);
150-
return !undef;
151-
}
152-
153-
Error("Error cmd $url failed: '".$res->status_line()."'");
154-
155-
return undef;
145+
return $self->get($url);
156146
}
157147

158148
sub cameraReset {
@@ -514,6 +504,13 @@ sub presetHome {
514504
$self->sendCmd($cmd);
515505
}
516506

507+
sub reboot {
508+
my $self = shift;
509+
$uri->path('/axis-cgi/restart.cgi');
510+
my $response = $self->get($uri->canonical);
511+
return $response->is_success;
512+
}
513+
517514
1;
518515
__END__
519516
# Below is stub documentation for your module. You'd better edit it!

0 commit comments

Comments
 (0)