13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/ruby_onvif_client/device_discovery.rb', line 13
def start options
@options = {
}.merge(options)
searcher = WSDiscovery.search(
env_namespaces: {
"xmlns:dn" => "http://www.onvif.org/ver10/network/wsdl"
},
types: "dn:NetworkVideoTransmitter"
)
searcher.discovery_responses.subscribe do |notification|
device = {
ep_address: notification[:probe_matches][:probe_match][:endpoint_reference][:address],
types: notification[:probe_matches][:probe_match][:types],
device_ip: URI(notification[:probe_matches][:probe_match][:x_addrs]).host,
device_service_address: notification[:probe_matches][:probe_match][:x_addrs],
scopes: notification[:probe_matches][:probe_match][:scopes].split(' '),
metadata_version: notification[:probe_matches][:probe_match][:metadata_version]
}
yield device
end
end
|