From 045ea77bf30ee76e2b8a28f1057c8de6338d7dc5 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 12 May 2020 15:49:42 -0400 Subject: [PATCH] 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 --- scripts/zmonvif-probe.pl.in | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/scripts/zmonvif-probe.pl.in b/scripts/zmonvif-probe.pl.in index d68adea99..3598dfcae 100644 --- a/scripts/zmonvif-probe.pl.in +++ b/scripts/zmonvif-probe.pl.in @@ -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,27 +105,41 @@ 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"; } # end foreach profile - } elsif( $action eq 'move' ) { + } elsif ( $action eq 'move' ) { my $dir = shift; ZoneMinder::ONVIF::move($client, $dir); } elsif ( $action eq 'metadata' ) { ZoneMinder::ONVIF::metadata($client); } else { - print("Error: Unknown command \"$action\""); - exit(1); + 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'):