Add a verbose var to ONVIF::CLient and allow it to be set during build.

This commit is contained in:
Isaac Connor 2020-05-12 15:47:27 -04:00
parent 69e5feb28b
commit f8249251bd
1 changed files with 15 additions and 12 deletions

View File

@ -74,6 +74,7 @@ my %services_of :ATTR(:default<{}>);
my %serializer_of :ATTR();
my %soap_version_of :ATTR(:default<('1.1')>);
my $verbose;
# =========================================================================
# private methods
@ -121,25 +122,27 @@ sub get_service_urls {
}
);
if ( $result ) {
print "Have results from GetServices\n" if $verbose;
foreach my $svc ( @{ $result->get_Service() } ) {
my $short_name = $namespace_map{$svc->get_Namespace()};
my $url_svc = $svc->get_XAddr()->get_value();
if ( defined $short_name && defined $url_svc ) {
#print "Got $short_name service\n";
print "Got $short_name service $url_svc\n" if $verbose;
$self->set_service($short_name, 'url', $url_svc);
}
}
#} else {
#print "No results from GetServices: $result\n";
} else {
print "No results from GetServices\n" if $verbose;
}
# Some devices do not support getServices, so we have to try getCapabilities
$result = $self->service('device', 'ep')->GetCapabilities( {}, , );
if ( !$result ) {
print "No results from GetCapabilities: $result\n";
print "No results from GetCapabilities: $result\n" if $verbose;
return;
}
print "Have results from GetCapabilities: $result\n" if $verbose;
# Result is a GetCapabilitiesResponse
foreach my $capabilities ( @{ $result->get_Capabilities() } ) {
foreach my $capability ( 'PTZ', 'Media', 'Imaging', 'Events', 'Device' ) {
@ -160,7 +163,6 @@ sub get_service_urls {
}
} else {
print "No $capability function\n";
} # end if has a get_ function
} # end foreach capability
} # end foreach capabilities
@ -189,8 +191,9 @@ sub http_digest {
sub BUILD {
my ($self, $ident, $args_ref) = @_;
my $url_svc_device = $args_ref->{'url_svc_device'};
my $soap_version = $args_ref->{'soap_version'};
$verbose = $args_ref->{verbose};
my $url_svc_device = $args_ref->{url_svc_device};
my $soap_version = $args_ref->{soap_version};
if ( !$soap_version ) {
$soap_version = '1.1';
}
@ -299,7 +302,7 @@ sub create_services {
# transport => $transport
}));
}
}
} # end sub create_services
sub get_endpoint {
my ($self, $serviceType) = @_;