Pass verbose to client. Add stream type to profiles. Add passing generic commands to the media element so that we can query anything we want easier

This commit is contained in:
Isaac Connor 2020-05-12 15:49:42 -04:00
parent 43b776bc80
commit 045ea77bf3
1 changed files with 22 additions and 5 deletions

View File

@ -94,6 +94,7 @@ if ( $action eq 'probe' ) {
my $password = @ARGV ? shift @ARGV: '';
my $client = ONVIF::Client->new( {
verbose => $ZoneMinder::ONVIF::verbose,
url_svc_device => $url_svc_device,
soap_version => $soap_version } );
@ -104,13 +105,14 @@ if ( $action eq 'probe' ) {
if ( $action eq 'profiles' ) {
my @profiles = ZoneMinder::ONVIF::profiles($client);
foreach my $profile ( @profiles ) {
my ( $token, $name, $encoding, $width, $height, $frame_rate_limit, $uri ) = @{$profile};
my ( $token, $name, $encoding, $width, $height, $frame_rate_limit, $stream_type, $uri ) = @{$profile};
print join(', ', $token,
$name,
$encoding,
$width,
$height,
$frame_rate_limit,
$stream_type,
$uri,
) . "\n";
@ -120,11 +122,24 @@ if ( $action eq 'probe' ) {
ZoneMinder::ONVIF::move($client, $dir);
} elsif ( $action eq 'metadata' ) {
ZoneMinder::ONVIF::metadata($client);
} else {
my $media = $client->get_endpoint('media');
if ( ! $media ) {
print "No media endpoint for client.\n";
return;
}
my $result = $media->$action( { } ,, );
if ( $result ) {
use XML::LibXML;
my $dom = XML::LibXML->load_xml(string=>$result);
print "Received message:\n" . $dom->toString(1) . "\n";
} else {
print("Error: Unknown command \"$action\"");
exit(1);
}
}
} # end if probe or other
1;
__END__
@ -143,6 +158,8 @@ zmonvif-probe.pl - ZoneMinder ONVIF probing tool
profiles - print the device's supported stream configurations
metadata - print some of the device's configuration settings
move - move the device (only ptz cameras)
other - Any command supported by the ONVIF Media element.
Common parameters:
-v - increase verbosity
Device access parameters (for all commands but 'probe'):