Fixup ONVIF module, making it actually usable
This commit is contained in:
parent
08bdf5a729
commit
11b29bf1ec
|
@ -16,6 +16,7 @@ configure_file(lib/ZoneMinder/Base.pm.in "${CMAKE_CURRENT_BINARY_DIR}/lib/ZoneMi
|
||||||
configure_file(lib/ZoneMinder/Config.pm.in "${CMAKE_CURRENT_BINARY_DIR}/lib/ZoneMinder/Config.pm" @ONLY)
|
configure_file(lib/ZoneMinder/Config.pm.in "${CMAKE_CURRENT_BINARY_DIR}/lib/ZoneMinder/Config.pm" @ONLY)
|
||||||
configure_file(lib/ZoneMinder/Memory.pm.in "${CMAKE_CURRENT_BINARY_DIR}/lib/ZoneMinder/Memory.pm" @ONLY)
|
configure_file(lib/ZoneMinder/Memory.pm.in "${CMAKE_CURRENT_BINARY_DIR}/lib/ZoneMinder/Memory.pm" @ONLY)
|
||||||
configure_file(lib/ZoneMinder/ConfigData.pm.in "${CMAKE_CURRENT_BINARY_DIR}/lib/ZoneMinder/ConfigData.pm" @ONLY)
|
configure_file(lib/ZoneMinder/ConfigData.pm.in "${CMAKE_CURRENT_BINARY_DIR}/lib/ZoneMinder/ConfigData.pm" @ONLY)
|
||||||
|
configure_file(lib/ZoneMinder/ONVIF.pm.in "${CMAKE_CURRENT_BINARY_DIR}/lib/ZoneMinder/ONVIF.pm" @ONLY)
|
||||||
|
|
||||||
if(CMAKE_VERBOSE_MAKEFILE)
|
if(CMAKE_VERBOSE_MAKEFILE)
|
||||||
set(MAKEMAKER_NOECHO_COMMAND "")
|
set(MAKEMAKER_NOECHO_COMMAND "")
|
||||||
|
|
|
@ -48,6 +48,8 @@ our $VERSION = $ZoneMinder::Base::VERSION;
|
||||||
use Getopt::Std;
|
use Getopt::Std;
|
||||||
use Data::UUID;
|
use Data::UUID;
|
||||||
|
|
||||||
|
use vars qw( $verbose $soap_version );
|
||||||
|
|
||||||
require ONVIF::Client;
|
require ONVIF::Client;
|
||||||
|
|
||||||
require WSDiscovery10::Interfaces::WSDiscovery::WSDiscoveryPort;
|
require WSDiscovery10::Interfaces::WSDiscovery::WSDiscoveryPort;
|
||||||
|
@ -77,7 +79,10 @@ sub deserialize_message {
|
||||||
|
|
||||||
# Try deserializing response - there may be some,
|
# Try deserializing response - there may be some,
|
||||||
# even if transport did not succeed (got a 500 response)
|
# even if transport did not succeed (got a 500 response)
|
||||||
if ( $response ) {
|
if ( ! $response ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
# as our faults are false, returning a success marker is the only
|
# as our faults are false, returning a success marker is the only
|
||||||
# reliable way of determining whether the deserializer succeeded.
|
# reliable way of determining whether the deserializer succeeded.
|
||||||
# Custom deserializers may return an empty list, or undef,
|
# Custom deserializers may return an empty list, or undef,
|
||||||
|
@ -89,21 +94,20 @@ sub deserialize_message {
|
||||||
return wantarray
|
return wantarray
|
||||||
? ($result_body, $result_header)
|
? ($result_body, $result_header)
|
||||||
: $result_body;
|
: $result_body;
|
||||||
}
|
} elsif (blessed $@) { #}&& $@->isa('SOAP::WSDL::SOAP::Typelib::Fault11')) {
|
||||||
elsif (blessed $@) { #}&& $@->isa('SOAP::WSDL::SOAP::Typelib::Fault11')) {
|
|
||||||
return $@;
|
return $@;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
|
#else
|
||||||
return $deserializer->generate_fault({
|
return $deserializer->generate_fault({
|
||||||
code => 'soap:Server',
|
code => 'soap:Server',
|
||||||
role => 'urn:localhost',
|
role => 'urn:localhost',
|
||||||
message => "Error deserializing message: $@. \n"
|
message => "Error deserializing message: $@. \n"
|
||||||
. "Message was: \n$response"
|
. "Message was: \n$response"
|
||||||
});
|
});
|
||||||
}
|
} # end sub deserialize_message
|
||||||
};
|
|
||||||
}
|
sub interpret_messages {
|
||||||
ub interpret_messages {
|
|
||||||
my ($svc_discover, $services, @responses ) = @_;
|
my ($svc_discover, $services, @responses ) = @_;
|
||||||
|
|
||||||
my @results;
|
my @results;
|
||||||
|
@ -167,6 +171,7 @@ ub interpret_messages {
|
||||||
# functions
|
# functions
|
||||||
|
|
||||||
sub discover {
|
sub discover {
|
||||||
|
my ( $soap_version ) = @_;
|
||||||
my @results;
|
my @results;
|
||||||
|
|
||||||
## collect all responses
|
## collect all responses
|
||||||
|
@ -246,6 +251,8 @@ sub discover {
|
||||||
}
|
}
|
||||||
|
|
||||||
sub profiles {
|
sub profiles {
|
||||||
|
my ( $client ) = @_;
|
||||||
|
|
||||||
my $result = $client->get_endpoint('media')->GetProfiles( { } ,, );
|
my $result = $client->get_endpoint('media')->GetProfiles( { } ,, );
|
||||||
die $result if not $result;
|
die $result if not $result;
|
||||||
if($verbose) {
|
if($verbose) {
|
||||||
|
@ -293,7 +300,7 @@ sub profiles {
|
||||||
}
|
}
|
||||||
|
|
||||||
sub move {
|
sub move {
|
||||||
my ($dir) = @_;
|
my ($client, $dir) = @_;
|
||||||
|
|
||||||
my $result = $client->get_endpoint('ptz')->GetNodes( { } ,, );
|
my $result = $client->get_endpoint('ptz')->GetNodes( { } ,, );
|
||||||
|
|
||||||
|
@ -302,6 +309,7 @@ sub move {
|
||||||
} # end sub move
|
} # end sub move
|
||||||
|
|
||||||
sub metadata {
|
sub metadata {
|
||||||
|
my ( $client ) = @_;
|
||||||
my $result = $client->get_endpoint('media')->GetMetadataConfigurations( { } ,, );
|
my $result = $client->get_endpoint('media')->GetMetadataConfigurations( { } ,, );
|
||||||
die $result if not $result;
|
die $result if not $result;
|
||||||
print $result . "\n";
|
print $result . "\n";
|
||||||
|
|
Loading…
Reference in New Issue