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 $password = @ARGV ? shift @ARGV: '';
my $client = ONVIF::Client->new( { my $client = ONVIF::Client->new( {
verbose => $ZoneMinder::ONVIF::verbose,
url_svc_device => $url_svc_device, url_svc_device => $url_svc_device,
soap_version => $soap_version } ); soap_version => $soap_version } );
@ -104,27 +105,41 @@ if ( $action eq 'probe' ) {
if ( $action eq 'profiles' ) { if ( $action eq 'profiles' ) {
my @profiles = ZoneMinder::ONVIF::profiles($client); my @profiles = ZoneMinder::ONVIF::profiles($client);
foreach my $profile ( @profiles ) { 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, print join(', ', $token,
$name, $name,
$encoding, $encoding,
$width, $width,
$height, $height,
$frame_rate_limit, $frame_rate_limit,
$stream_type,
$uri, $uri,
) . "\n"; ) . "\n";
} # end foreach profile } # end foreach profile
} elsif( $action eq 'move' ) { } elsif ( $action eq 'move' ) {
my $dir = shift; my $dir = shift;
ZoneMinder::ONVIF::move($client, $dir); ZoneMinder::ONVIF::move($client, $dir);
} elsif ( $action eq 'metadata' ) { } elsif ( $action eq 'metadata' ) {
ZoneMinder::ONVIF::metadata($client); ZoneMinder::ONVIF::metadata($client);
} else { } else {
print("Error: Unknown command \"$action\""); my $media = $client->get_endpoint('media');
exit(1); 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; 1;
__END__ __END__
@ -143,6 +158,8 @@ zmonvif-probe.pl - ZoneMinder ONVIF probing tool
profiles - print the device's supported stream configurations profiles - print the device's supported stream configurations
metadata - print some of the device's configuration settings metadata - print some of the device's configuration settings
move - move the device (only ptz cameras) move - move the device (only ptz cameras)
other - Any command supported by the ONVIF Media element.
Common parameters: Common parameters:
-v - increase verbosity -v - increase verbosity
Device access parameters (for all commands but 'probe'): Device access parameters (for all commands but 'probe'):