ruby_onvif_client 0.0.5 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ruby_onvif_client.rb +1 -0
- data/lib/ruby_onvif_client/action.rb +7 -0
- data/lib/ruby_onvif_client/device_management/get_capabilities.rb +7 -7
- data/lib/ruby_onvif_client/device_management/get_network_interfaces.rb +19 -19
- data/lib/ruby_onvif_client/device_management/get_system_date_and_time.rb +2 -2
- data/lib/ruby_onvif_client/device_management/set_network_interfaces.rb +17 -17
- data/lib/ruby_onvif_client/device_management/set_system_date_and_time.rb +9 -9
- data/lib/ruby_onvif_client/media/get_audio_encoder_configuration_options.rb +4 -4
- data/lib/ruby_onvif_client/media/get_profile.rb +44 -44
- data/lib/ruby_onvif_client/media/get_profiles.rb +44 -44
- data/lib/ruby_onvif_client/media/get_stream_uri.rb +6 -6
- data/lib/ruby_onvif_client/media/get_video_encoder_configuration.rb +2 -2
- data/lib/ruby_onvif_client/media/get_video_encoder_configuration_options.rb +4 -4
- data/lib/ruby_onvif_client/media/get_video_encoder_configurations.rb +2 -2
- data/lib/ruby_onvif_client/media/set_video_encoder_configuration.rb +24 -24
- data/lib/ruby_onvif_client/ptz.rb +9 -0
- data/lib/ruby_onvif_client/ptz/get_node.rb +26 -0
- data/lib/ruby_onvif_client/ptz/get_nodes.rb +24 -0
- data/lib/ruby_onvif_client/ptz/stop.rb +33 -0
- data/ruby-onvif-client.gemspec +2 -2
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab23cbb25cad70f098518423df54826d7a75c1ae
|
4
|
+
data.tar.gz: cc1e662e1b7e25b1c88535c7e2551e7ed0906a81
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c8b233a208a8e2570650ceba6be1bb42a1886cbb944b06c1d240c5ff6f192115ed05edb2405b6fed47d4fc07536e3b3fe001d5e4e2e897c68ca9e1c89788913
|
7
|
+
data.tar.gz: d273e1e94f21a0c000ec045fc87310ba1786eb6dcfe6e8413a0b5709f6e2b90683d7ddcd60f495f21bdfd56ea47c745f23ad2da07366570b80d8a25564dbe21d
|
data/lib/ruby_onvif_client.rb
CHANGED
@@ -39,5 +39,12 @@ module ONVIF
|
|
39
39
|
options[:namespaces] = namespaces
|
40
40
|
Message.new options
|
41
41
|
end
|
42
|
+
def create_ptz_onvif_message options = {}
|
43
|
+
namespaces = {
|
44
|
+
:'xmlns:wsdl' => "http://www.onvif.org/ver20/ptz/wsdl"
|
45
|
+
}.merge(options[:namespaces] || {})
|
46
|
+
options[:namespaces] = namespaces
|
47
|
+
Message.new options
|
48
|
+
end
|
42
49
|
end
|
43
50
|
end
|
@@ -14,7 +14,7 @@ module ONVIF
|
|
14
14
|
xml.wsdl(:GetCapabilities) do
|
15
15
|
unless options.nil?
|
16
16
|
options.each do |option|
|
17
|
-
xml.wsdl :Category, option[
|
17
|
+
xml.wsdl :Category, option[:Category]
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -29,12 +29,12 @@ module ONVIF
|
|
29
29
|
xml_media = xml_doc.xpath('//tt:Media')
|
30
30
|
xml_ptz = xml_doc.xpath('//tt:PTZ')
|
31
31
|
success_result = {}
|
32
|
-
success_result[
|
33
|
-
success_result[
|
34
|
-
success_result[
|
35
|
-
success_result[
|
36
|
-
success_result[
|
37
|
-
success_result[
|
32
|
+
success_result[:analytics] = _get_analytics(xml_analytics) unless xml_analytics.nil?
|
33
|
+
success_result[:device] = _get_device(xml_device) unless xml_device.nil?
|
34
|
+
success_result[:events] = _get_events(xml_events) unless xml_events.nil?
|
35
|
+
success_result[:imaging] = _get_imaging(xml_imaging) unless xml_imaging.nil?
|
36
|
+
success_result[:media] = _get_media(xml_media) unless xml_media.nil?
|
37
|
+
success_result[:ptz] = _get_ptz(xml_ptz) unless xml_ptz.nil?
|
38
38
|
callback cb, success, success_result
|
39
39
|
else
|
40
40
|
callback cb, success, result
|
@@ -21,10 +21,10 @@ module ONVIF
|
|
21
21
|
token: attribute(xml_doc, "token"),
|
22
22
|
enabled: value(xml_doc, "tt:Enabled")
|
23
23
|
}
|
24
|
-
success_result[
|
25
|
-
success_result[
|
26
|
-
success_result[
|
27
|
-
success_result[
|
24
|
+
success_result[:info] = _get_info(xml_info) unless xml_info.nil?
|
25
|
+
success_result[:link] = _get_link(xml_link) unless xml_link.nil?
|
26
|
+
success_result[:ipv4] = _get_ipv_four(xml_ipv4) unless xml_ipv4.nil?
|
27
|
+
success_result[:ipv6] = _get_ipv_six(xml_ipv6) unless xml_ipv6.nil?
|
28
28
|
interfaces << success_result
|
29
29
|
end
|
30
30
|
callback cb, success, interfaces
|
@@ -47,20 +47,20 @@ module ONVIF
|
|
47
47
|
oper_xml_doc = xml_link.at_xpath('tt:OperSettings')
|
48
48
|
link = {}
|
49
49
|
unless xml_doc.nil?
|
50
|
-
link[
|
50
|
+
link[:admin_settings] = {
|
51
51
|
auto_negotiation: value(admin_xml_doc, "tt:AutoNegotiation"),
|
52
52
|
speed: value(admin_xml_doc, "tt:Speed"),
|
53
53
|
duplex: value(admin_xml_doc, "tt:Duplex")
|
54
54
|
}
|
55
55
|
end
|
56
56
|
unless oper_xml_doc.nil?
|
57
|
-
link[
|
57
|
+
link[:oper_settings] = {
|
58
58
|
auto_negotiation: value(oper_xml_doc, "tt:AutoNegotiation"),
|
59
59
|
speed: value(oper_xml_doc, "tt:Speed"),
|
60
60
|
duplex: value(oper_xml_doc, "tt:Duplex")
|
61
61
|
}
|
62
62
|
end
|
63
|
-
link[
|
63
|
+
link[:interface_type] = value(xml_link, "tt:InterfaceType") unless xml_link.at_xpath('tt:InterfaceType')
|
64
64
|
return link
|
65
65
|
end
|
66
66
|
|
@@ -76,17 +76,17 @@ module ONVIF
|
|
76
76
|
prefix_length: value(node, "tt:PrefixLength")
|
77
77
|
}
|
78
78
|
end
|
79
|
-
config[
|
80
|
-
config[
|
79
|
+
config[:manual] = manual
|
80
|
+
config[:link_local] = {
|
81
81
|
address: value(link_local, "tt:Address"),
|
82
82
|
prefix_length: value(link_local, "tt:PrefixLength")
|
83
83
|
}
|
84
|
-
config[
|
84
|
+
config[:form_dhcp] = {
|
85
85
|
address: value(form_dhcp, "tt:Address"),
|
86
86
|
prefix_length: value(form_dhcp, "tt:PrefixLength")
|
87
87
|
}
|
88
|
-
config[
|
89
|
-
ipv_four[
|
88
|
+
config[:dhcp] = value(xml_ipv_four, "tt:Config//tt:DHCP")
|
89
|
+
ipv_four[:config] = config
|
90
90
|
return ipv_four
|
91
91
|
end
|
92
92
|
|
@@ -117,13 +117,13 @@ module ONVIF
|
|
117
117
|
prefix_length: value(node, "tt:PrefixLength")
|
118
118
|
}
|
119
119
|
end
|
120
|
-
config[
|
121
|
-
config[
|
122
|
-
config[
|
123
|
-
config[
|
124
|
-
config[
|
125
|
-
config[
|
126
|
-
ipv_six[
|
120
|
+
config[:manual] = manual
|
121
|
+
config[:link_local] = link_local
|
122
|
+
config[:form_dhcp] = form_dhcp
|
123
|
+
config[:form_ra] = form_ra
|
124
|
+
config[:ara] = value(xml_ipv_six, "tt:AcceptRouterAdvert")
|
125
|
+
config[:dhcp] = value(xml_ipv_six, "tt:DHCP")
|
126
|
+
ipv_six[:config] = config
|
127
127
|
return ipv_six
|
128
128
|
end
|
129
129
|
end
|
@@ -47,8 +47,8 @@ module ONVIF
|
|
47
47
|
}
|
48
48
|
xml_utc_time = xml_doc.at_xpath('//tt:UTCDateTime')
|
49
49
|
xml_local_time = xml_doc.at_xpath('//tt:LocalDateTime')
|
50
|
-
date_time[
|
51
|
-
date_time[
|
50
|
+
date_time[:utc_date_time] = utc_data_time unless xml_utc_time.nil?
|
51
|
+
date_time[:local_date_time] = local_date_time unl unless xml_local_time.nil?
|
52
52
|
callback cb, success, date_time
|
53
53
|
else
|
54
54
|
callback cb, success, result
|
@@ -37,35 +37,35 @@ module ONVIF
|
|
37
37
|
message = Message.new namespaces: {:'xmlns:sch' => 'http://www.onvif.org/ver10/schema'}
|
38
38
|
message.body = ->(xml) do
|
39
39
|
xml.wsdl(:SetNetworkInterfaces) do
|
40
|
-
xml.wsdl :InterfaceToken, network_interface[
|
40
|
+
xml.wsdl :InterfaceToken, network_interface[:interface_token]
|
41
41
|
xml.wsdl :NetworkInterface do
|
42
|
-
xml.sch :Enabled, network_interface[
|
42
|
+
xml.sch :Enabled, network_interface[:nwif][:enabled]
|
43
43
|
xml.sch :Link do
|
44
|
-
xml.sch :AutoNegotiation, network_interface[
|
45
|
-
xml.sch :Speed, network_interface[
|
46
|
-
xml.sch :Duplex, network_interface[
|
44
|
+
xml.sch :AutoNegotiation, network_interface[:nwif][:link][:auto_negotiation]
|
45
|
+
xml.sch :Speed, network_interface[:nwif][:link][:speed]
|
46
|
+
xml.sch :Duplex, network_interface[:nwif][:link][:duplex]
|
47
47
|
end
|
48
|
-
xml.sch :MTU, network_interface[
|
48
|
+
xml.sch :MTU, network_interface[:nwif][:mtu]
|
49
49
|
xml.sch :IPv4 do
|
50
|
-
xml.sch :Enabled, network_interface[
|
51
|
-
network_interface[
|
50
|
+
xml.sch :Enabled, network_interface[:nwif][:ipv4][:enabled]
|
51
|
+
network_interface[:nwif][:ipv4][:manual].each do |manual|
|
52
52
|
xml.sch :Manual do
|
53
|
-
xml.sch :Address, manual[
|
54
|
-
xml.sch :PrefixLength, manual[
|
53
|
+
xml.sch :Address, manual[:address]
|
54
|
+
xml.sch :PrefixLength, manual[:prefix_length]
|
55
55
|
end
|
56
56
|
end
|
57
|
-
xml.sch :DHCP, network_interface[
|
57
|
+
xml.sch :DHCP, network_interface[:nwif][:ipv4][:dhcp]
|
58
58
|
end
|
59
59
|
xml.sch :IPv6 do
|
60
|
-
xml.sch :Enabled, network_interface[
|
61
|
-
xml.sch :AcceptRouterAdvert, network_interface[
|
62
|
-
network_interface[
|
60
|
+
xml.sch :Enabled, network_interface[:nwif][:ipv6][:enabled]
|
61
|
+
xml.sch :AcceptRouterAdvert, network_interface[:nwif][:ipv6][:ara]
|
62
|
+
network_interface[:nwif][:ipv6][:manual].each do |manual|
|
63
63
|
xml.sch :Manual do
|
64
|
-
xml.sch :Address, manual[
|
65
|
-
xml.sch :PrefixLength, manual[
|
64
|
+
xml.sch :Address, manual[:address]
|
65
|
+
xml.sch :PrefixLength, manual[:prefix_length]
|
66
66
|
end
|
67
67
|
end
|
68
|
-
xml.sch :DHCP, network_interface[
|
68
|
+
xml.sch :DHCP, network_interface[:nwif][:ipv6][:dhcp]
|
69
69
|
end
|
70
70
|
|
71
71
|
end
|
@@ -19,21 +19,21 @@ module ONVIF
|
|
19
19
|
message = Message.new namespaces: {:'xmlns:sch' => 'http://www.onvif.org/ver10/schema'}
|
20
20
|
message.body = ->(xml) do
|
21
21
|
xml.wsdl(:SetSystemDateAndTime) do
|
22
|
-
xml.wsdl :DateTimeType, system_date_time[
|
23
|
-
xml.wsdl :DaylightSavings, system_date_time[
|
22
|
+
xml.wsdl :DateTimeType, system_date_time[:type]
|
23
|
+
xml.wsdl :DaylightSavings, system_date_time[:ds]
|
24
24
|
xml.wsdl(:TimeZone) do
|
25
|
-
xml.sch :TZ, system_date_time[
|
25
|
+
xml.sch :TZ, system_date_time[:time_zone_tz]
|
26
26
|
end
|
27
27
|
xml.wsdl(:TimeZone) do
|
28
28
|
xml.sch :Time do
|
29
|
-
xml.sch :Hour, system_date_time[
|
30
|
-
xml.sch :Minute, system_date_time[
|
31
|
-
xml.sch :Second, system_date_time[
|
29
|
+
xml.sch :Hour, system_date_time[:hour]
|
30
|
+
xml.sch :Minute, system_date_time[:minute]
|
31
|
+
xml.sch :Second, system_date_time[:second]
|
32
32
|
end
|
33
33
|
xml.sch :Date do
|
34
|
-
xml.sch :Year, system_date_time[
|
35
|
-
xml.sch :Month, system_date_time[
|
36
|
-
xml.sch :Day, system_date_time[
|
34
|
+
xml.sch :Year, system_date_time[:year]
|
35
|
+
xml.sch :Month, system_date_time[:month]
|
36
|
+
xml.sch :Day, system_date_time[:day]
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
@@ -12,8 +12,8 @@ module ONVIF
|
|
12
12
|
message = create_media_onvif_message
|
13
13
|
message.body = ->(xml) do
|
14
14
|
xml.wsdl(:GetAudioEncoderConfigurationOptions) do
|
15
|
-
xml.wsdl :ConfigurationToken, options[
|
16
|
-
xml.wsdl :ProfileToken, options[
|
15
|
+
xml.wsdl :ConfigurationToken, options[:c_token]
|
16
|
+
xml.wsdl :ProfileToken, options[:p_token]
|
17
17
|
end
|
18
18
|
end
|
19
19
|
send_message message do |success, result|
|
@@ -30,7 +30,7 @@ module ONVIF
|
|
30
30
|
items: item.content
|
31
31
|
}
|
32
32
|
end
|
33
|
-
this_options[
|
33
|
+
this_options[:bitrate_list] = bitrate_list
|
34
34
|
end
|
35
35
|
sample_rate = node.at_xpath("tt:SampleRateList")
|
36
36
|
unless sample_rate.nil?
|
@@ -40,7 +40,7 @@ module ONVIF
|
|
40
40
|
items: item.content
|
41
41
|
}
|
42
42
|
end
|
43
|
-
this_options[
|
43
|
+
this_options[:sample_rate_list] = sample_rate_list
|
44
44
|
end
|
45
45
|
|
46
46
|
|
@@ -30,13 +30,13 @@ module ONVIF
|
|
30
30
|
fixed: attribute(root_node, "fixed"),
|
31
31
|
extension: ""
|
32
32
|
}
|
33
|
-
profile[
|
34
|
-
profile[
|
35
|
-
profile[
|
36
|
-
profile[
|
37
|
-
profile[
|
38
|
-
profile[
|
39
|
-
profile[
|
33
|
+
profile[:video_source_configuration] = _get_video_source_configuration(video_source) unless video_source.nil?
|
34
|
+
profile[:audio_source_configuration] = _get_audio_source_configuration(audio_source) unless audio_source.nil?
|
35
|
+
profile[:video_encoder_configuration] = _get_video_encoder_configuration(video_encoder) unless video_encoder.nil?
|
36
|
+
profile[:audio_encoder_configuration] = _get_audio_encoder_configuration(audio_encoder) unless audio_encoder.nil?
|
37
|
+
profile[:video_analytics_configuration] = _get_video_analytics_configuration(video_analytics) unless video_analytics.nil?
|
38
|
+
profile[:ptz_configuration] = _get_ptz_configuration(ptz) unless ptz.nil?
|
39
|
+
profile[:metadata_configuration] = _get_metadata_configuration(metadata) unless metadata.nil?
|
40
40
|
callback cb, success, profile
|
41
41
|
else
|
42
42
|
callback cb, success, result
|
@@ -76,9 +76,9 @@ module ONVIF
|
|
76
76
|
|
77
77
|
def _get_video_source_configuration parent_node
|
78
78
|
configuration = _get_public_sector(parent_node)
|
79
|
-
configuration[
|
79
|
+
configuration[:source_token] = value(parent_node, "tt:SourceToken")
|
80
80
|
bounds = parent_node.at_xpath("tt:Bounds")
|
81
|
-
configuration[
|
81
|
+
configuration[:bounds] = {
|
82
82
|
x: attribute(bounds, "x"),
|
83
83
|
y: attribute(bounds, "y"),
|
84
84
|
width: attribute(bounds, "width"),
|
@@ -89,47 +89,47 @@ module ONVIF
|
|
89
89
|
|
90
90
|
def _get_audio_source_configuration parent_node
|
91
91
|
configuration = _get_public_sector(parent_node)
|
92
|
-
configuration[
|
92
|
+
configuration[:source_token] = value(parent_node, "tt:SourceToken")
|
93
93
|
return configuration
|
94
94
|
end
|
95
95
|
|
96
96
|
def _get_video_encoder_configuration parent_node
|
97
97
|
configuration = _get_public_sector(parent_node)
|
98
|
-
configuration[
|
99
|
-
configuration[
|
98
|
+
configuration[:encoding] = value(parent_node, "tt:Encoding")
|
99
|
+
configuration[:resolution] = {
|
100
100
|
width: value(_get_node(parent_node, "tt:Resolution"), "tt:Width"),
|
101
101
|
height: value(_get_node(parent_node, "tt:Resolution"), "tt:Height")
|
102
102
|
}
|
103
|
-
configuration[
|
104
|
-
configuration[
|
103
|
+
configuration[:quality] = value(parent_node, "tt:Quality")
|
104
|
+
configuration[:rate_control] = {
|
105
105
|
frame_rate_limit: value(_get_node(parent_node, "tt:RateControl"), "tt:FrameRateLimit"),
|
106
106
|
encoding_interval: value(_get_node(parent_node, "tt:RateControl"), "tt:EncodingInterval"),
|
107
107
|
bitrate_limit: value(_get_node(parent_node, "tt:RateControl"), "tt:BitrateLimit")
|
108
108
|
}
|
109
109
|
unless parent_node.at_xpath('//tt:MPEG4').nil?
|
110
|
-
configuration[
|
110
|
+
configuration[:MPEG4] = {
|
111
111
|
gov_length: value(_get_node(parent_node, "tt:MPEG4"), "tt:GovLength"),
|
112
112
|
mpeg4_profile: value(_get_node(parent_node, "tt:MPEG4"), "tt:Mpeg4Profile")
|
113
113
|
}
|
114
114
|
end
|
115
115
|
unless parent_node.at_xpath('//tt:H264').nil?
|
116
|
-
configuration[
|
116
|
+
configuration[:H264] = {
|
117
117
|
gov_length: value(_get_node(parent_node, "tt:H264"), "tt:GovLength"),
|
118
118
|
h264_profile: value(_get_node(parent_node, "tt:H264"), "tt:H264Profile")
|
119
119
|
}
|
120
120
|
end
|
121
|
-
configuration[
|
122
|
-
configuration[
|
121
|
+
configuration[:multicast] = _get_multicast(parent_node)
|
122
|
+
configuration[:session_timeout] = value(parent_node, "tt:SessionTimeout")
|
123
123
|
return configuration
|
124
124
|
end
|
125
125
|
|
126
126
|
def _get_audio_encoder_configuration parent_node
|
127
127
|
configuration = _get_public_sector(parent_node)
|
128
|
-
configuration[
|
129
|
-
configuration[
|
130
|
-
configuration[
|
131
|
-
configuration[
|
132
|
-
configuration[
|
128
|
+
configuration[:encoding] = value(parent_node, "tt:Encoding")
|
129
|
+
configuration[:bitrate] = value(parent_node, "tt:Bitrate")
|
130
|
+
configuration[:sample_rate] = value(parent_node, "tt:SampleRate")
|
131
|
+
configuration[:multicast] = _get_multicast(parent_node)
|
132
|
+
configuration[:session_timeout] = value(parent_node, "tt:SessionTimeout")
|
133
133
|
return configuration
|
134
134
|
end
|
135
135
|
|
@@ -150,11 +150,11 @@ module ONVIF
|
|
150
150
|
parameters: _get_parameters(node)
|
151
151
|
}
|
152
152
|
end
|
153
|
-
configuration[
|
153
|
+
configuration[:analytics_engine_configuration] = {
|
154
154
|
analytics_module: analytics_module,
|
155
155
|
extension: ""
|
156
156
|
}
|
157
|
-
configuration[
|
157
|
+
configuration[:rule_engine_configuration] = {
|
158
158
|
rule: rule,
|
159
159
|
extension: ""
|
160
160
|
}
|
@@ -163,16 +163,16 @@ module ONVIF
|
|
163
163
|
|
164
164
|
def _get_ptz_configuration parent_node
|
165
165
|
configuration = _get_public_sector(parent_node)
|
166
|
-
configuration[
|
167
|
-
configuration[
|
168
|
-
configuration[
|
169
|
-
configuration[
|
170
|
-
configuration[
|
171
|
-
configuration[
|
172
|
-
configuration[
|
166
|
+
configuration[:node_token] = value(parent_node, "tt:NodeToken")
|
167
|
+
configuration[:default_absolute_pant_tilt_position_space] = value(parent_node, "tt:DefaultAbsolutePantTiltPositionSpace")
|
168
|
+
configuration[:default_absolute_zoom_position_space] = value(parent_node, "tt:DefaultAbsoluteZoomPositionSpace")
|
169
|
+
configuration[:default_relative_pan_tilt_translation_space] = value(parent_node, "tt:DefaultRelativePanTiltTranslationSpace")
|
170
|
+
configuration[:default_relative_zoom_translation_space] = value(parent_node, "tt:DefaultRelativeZoomTranslationSpace")
|
171
|
+
configuration[:default_continuous_pan_tilt_velocity_space] = value(parent_node, "tt:DefaultContinuousPanTiltVelocitySpace")
|
172
|
+
configuration[:default_continuous_zoom_velocity_space] = value(parent_node, "tt:DefaultContinuousZoomVelocitySpace")
|
173
173
|
pan_tilt = _get_node(parent_node,"//tt:DefaultPTZSpeed//tt:PanTilt")
|
174
174
|
zoom = _get_node(parent_node,"//tt:DefaultPTZSpeed//tt:Zoom")
|
175
|
-
configuration[
|
175
|
+
configuration[:default_ptz_speed] = {
|
176
176
|
pan_tilt:{
|
177
177
|
x: attribute(pan_tilt, "x"),
|
178
178
|
y: attribute(pan_tilt, "y"),
|
@@ -183,37 +183,37 @@ module ONVIF
|
|
183
183
|
space: attribute(zoom, "space")
|
184
184
|
}
|
185
185
|
}
|
186
|
-
configuration[
|
187
|
-
configuration[
|
186
|
+
configuration[:fefault_ptz_timeout] = value(parent_node, "tt:DefaultPTZTimeout")
|
187
|
+
configuration[:pan_tilt_limits] = {
|
188
188
|
range: {
|
189
189
|
uri: value(_get_node(parent_node, "tt:PanTiltLimits//tt:Range"), "tt:URI"),
|
190
190
|
x_range: _get_min_max(_get_node(parent_node,"tt:PanTiltLimits//tt:Range"), "tt:XRange"),
|
191
191
|
y_range: _get_min_max(_get_node(parent_node,"tt:PanTiltLimits//tt:Range"), "tt:YRange")
|
192
192
|
}
|
193
193
|
}
|
194
|
-
configuration[
|
194
|
+
configuration[:zoom_limits] = {
|
195
195
|
range: {
|
196
196
|
uri: value(_get_node(parent_node, "tt:PanTiltLimits//tt:Range"), "tt:URI"),
|
197
197
|
x_range: _get_min_max(_get_node(parent_node,"tt:PanTiltLimits//tt:Range"), "tt:XRange"),
|
198
198
|
}
|
199
199
|
}
|
200
|
-
configuration[
|
200
|
+
configuration[:extension] = ""
|
201
201
|
return configuration
|
202
202
|
end
|
203
203
|
|
204
204
|
def _get_metadata_configuration parent_node
|
205
205
|
configuration = _get_public_sector(parent_node)
|
206
|
-
configuration[
|
206
|
+
configuration[:ptz_status] = {
|
207
207
|
status: value(_get_node(parent_node, "tt:PTZStatus"), "tt:Status"),
|
208
208
|
sosition: value(_get_node(parent_node, "tt:PTZStatus"), "tt:Position")
|
209
209
|
}
|
210
|
-
configuration[
|
210
|
+
configuration[:events] = {
|
211
211
|
filter: value(_get_node(parent_node, "tt:Events"), "tt:Filter"),
|
212
212
|
subscription_policy: value(_get_node(parent_node, "tt:Events"), "tt:SubscriptionPolicy")
|
213
213
|
}
|
214
|
-
configuration[
|
215
|
-
configuration[
|
216
|
-
configuration[
|
214
|
+
configuration[:analytics] = value(parent_node, "tt:Analytics")
|
215
|
+
configuration[:multicast] = _get_multicast(parent_node)
|
216
|
+
configuration[:session_timeout] = value(parent_node, "tt:SessionTimeout")
|
217
217
|
unless parent_node.at_xpath("tt:AnalyticsEngineConfiguration//tt:AnalyticsModule").nil?
|
218
218
|
analytics_module = []
|
219
219
|
parent_node.at_xpath("tt:AnalyticsEngineConfiguration//tt:AnalyticsModule").each do |node|
|
@@ -223,12 +223,12 @@ module ONVIF
|
|
223
223
|
parameters: _get_parameters(node)
|
224
224
|
}
|
225
225
|
end
|
226
|
-
configuration[
|
226
|
+
configuration[:analytics_engine_configuration] = {
|
227
227
|
analytics_module: analytics_module,
|
228
228
|
extension: ""
|
229
229
|
}
|
230
230
|
end
|
231
|
-
configuration[
|
231
|
+
configuration[:extension] = ""
|
232
232
|
return configuration
|
233
233
|
end
|
234
234
|
|
@@ -26,13 +26,13 @@ module ONVIF
|
|
26
26
|
fixed: attribute(root_node, "fixed"),
|
27
27
|
extension: ""
|
28
28
|
}
|
29
|
-
success_result[
|
30
|
-
success_result[
|
31
|
-
success_result[
|
32
|
-
success_result[
|
33
|
-
success_result[
|
34
|
-
success_result[
|
35
|
-
success_result[
|
29
|
+
success_result[:video_source_configuration] = _get_video_source_configuration(video_source) unless video_source.nil?
|
30
|
+
success_result[:audio_source_configuration] = _get_audio_source_configuration(audio_source) unless audio_source.nil?
|
31
|
+
success_result[:video_encoder_configuration] = _get_video_encoder_configuration(video_encoder) unless video_encoder.nil?
|
32
|
+
success_result[:audio_encoder_configuration] = _get_audio_encoder_configuration(audio_encoder) unless audio_encoder.nil?
|
33
|
+
success_result[:video_analytics_configuration] = _get_video_analytics_configuration(video_analytics) unless video_analytics.nil?
|
34
|
+
success_result[:ptz_configuration] = _get_ptz_configuration(ptz) unless ptz.nil?
|
35
|
+
success_result[:metadata_configuration] = _get_metadata_configuration(metadata) unless metadata.nil?
|
36
36
|
profiles << success_result
|
37
37
|
end
|
38
38
|
callback cb, success, profiles
|
@@ -74,9 +74,9 @@ module ONVIF
|
|
74
74
|
|
75
75
|
def _get_video_source_configuration parent_node
|
76
76
|
configuration = _get_public_sector(parent_node)
|
77
|
-
configuration[
|
77
|
+
configuration[:source_token] = value(parent_node, "tt:SourceToken")
|
78
78
|
bounds = parent_node.at_xpath("tt:Bounds")
|
79
|
-
configuration[
|
79
|
+
configuration[:bounds] = {
|
80
80
|
x: attribute(bounds, "x"),
|
81
81
|
y: attribute(bounds, "y"),
|
82
82
|
width: attribute(bounds, "width"),
|
@@ -87,47 +87,47 @@ module ONVIF
|
|
87
87
|
|
88
88
|
def _get_audio_source_configuration parent_node
|
89
89
|
configuration = _get_public_sector(parent_node)
|
90
|
-
configuration[
|
90
|
+
configuration[:source_token] = value(parent_node, "tt:SourceToken")
|
91
91
|
return configuration
|
92
92
|
end
|
93
93
|
|
94
94
|
def _get_video_encoder_configuration parent_node
|
95
95
|
configuration = _get_public_sector(parent_node)
|
96
|
-
configuration[
|
97
|
-
configuration[
|
96
|
+
configuration[:encoding] = value(parent_node, "tt:Encoding")
|
97
|
+
configuration[:resolution] = {
|
98
98
|
width: value(_get_node(parent_node, "tt:Resolution"), "tt:Width"),
|
99
99
|
height: value(_get_node(parent_node, "tt:Resolution"), "tt:Height")
|
100
100
|
}
|
101
|
-
configuration[
|
102
|
-
configuration[
|
101
|
+
configuration[:quality] = value(parent_node, "tt:Quality")
|
102
|
+
configuration[:rate_control] = {
|
103
103
|
frame_rate_limit: value(_get_node(parent_node, "tt:RateControl"), "tt:FrameRateLimit"),
|
104
104
|
encoding_interval: value(_get_node(parent_node, "tt:RateControl"), "tt:EncodingInterval"),
|
105
105
|
bitrate_limit: value(_get_node(parent_node, "tt:RateControl"), "tt:BitrateLimit")
|
106
106
|
}
|
107
107
|
unless parent_node.at_xpath('//tt:MPEG4').nil?
|
108
|
-
configuration[
|
108
|
+
configuration[:MPEG4] = {
|
109
109
|
gov_length: value(_get_node(parent_node, "tt:MPEG4"), "tt:GovLength"),
|
110
110
|
mpeg4_profile: value(_get_node(parent_node, "tt:MPEG4"), "tt:Mpeg4Profile")
|
111
111
|
}
|
112
112
|
end
|
113
113
|
unless parent_node.at_xpath('//tt:H264').nil?
|
114
|
-
configuration[
|
114
|
+
configuration[:H264] = {
|
115
115
|
gov_length: value(_get_node(parent_node, "tt:H264"), "tt:GovLength"),
|
116
116
|
h264_profile: value(_get_node(parent_node, "tt:H264"), "tt:H264Profile")
|
117
117
|
}
|
118
118
|
end
|
119
|
-
configuration[
|
120
|
-
configuration[
|
119
|
+
configuration[:multicast] = _get_multicast(parent_node)
|
120
|
+
configuration[:session_timeout] = value(parent_node, "tt:SessionTimeout")
|
121
121
|
return configuration
|
122
122
|
end
|
123
123
|
|
124
124
|
def _get_audio_encoder_configuration parent_node
|
125
125
|
configuration = _get_public_sector(parent_node)
|
126
|
-
configuration[
|
127
|
-
configuration[
|
128
|
-
configuration[
|
129
|
-
configuration[
|
130
|
-
configuration[
|
126
|
+
configuration[:encoding] = value(parent_node, "tt:Encoding")
|
127
|
+
configuration[:bitrate] = value(parent_node, "tt:Bitrate")
|
128
|
+
configuration[:sample_rate] = value(parent_node, "tt:SampleRate")
|
129
|
+
configuration[:multicast] = _get_multicast(parent_node)
|
130
|
+
configuration[:session_timeout] = value(parent_node, "tt:SessionTimeout")
|
131
131
|
return configuration
|
132
132
|
end
|
133
133
|
|
@@ -148,11 +148,11 @@ module ONVIF
|
|
148
148
|
parameters: _get_parameters(node)
|
149
149
|
}
|
150
150
|
end
|
151
|
-
configuration[
|
151
|
+
configuration[:analytics_engine_configuration] = {
|
152
152
|
analytics_module: analytics_module,
|
153
153
|
extension: ""
|
154
154
|
}
|
155
|
-
configuration[
|
155
|
+
configuration[:rule_engine_configuration] = {
|
156
156
|
rule: rule,
|
157
157
|
extension: ""
|
158
158
|
}
|
@@ -161,16 +161,16 @@ module ONVIF
|
|
161
161
|
|
162
162
|
def _get_ptz_configuration parent_node
|
163
163
|
configuration = _get_public_sector(parent_node)
|
164
|
-
configuration[
|
165
|
-
configuration[
|
166
|
-
configuration[
|
167
|
-
configuration[
|
168
|
-
configuration[
|
169
|
-
configuration[
|
170
|
-
configuration[
|
164
|
+
configuration[:node_token] = value(parent_node, "tt:NodeToken")
|
165
|
+
configuration[:default_absolute_pant_tilt_position_space] = value(parent_node, "tt:DefaultAbsolutePantTiltPositionSpace")
|
166
|
+
configuration[:default_absolute_zoom_position_space] = value(parent_node, "tt:DefaultAbsoluteZoomPositionSpace")
|
167
|
+
configuration[:default_relative_pan_tilt_translation_space] = value(parent_node, "tt:DefaultRelativePanTiltTranslationSpace")
|
168
|
+
configuration[:default_relative_zoom_translation_space] = value(parent_node, "tt:DefaultRelativeZoomTranslationSpace")
|
169
|
+
configuration[:default_continuous_pan_tilt_velocity_space] = value(parent_node, "tt:DefaultContinuousPanTiltVelocitySpace")
|
170
|
+
configuration[:default_continuous_zoom_velocity_space] = value(parent_node, "tt:DefaultContinuousZoomVelocitySpace")
|
171
171
|
pan_tilt = _get_node(parent_node,"//tt:DefaultPTZSpeed//tt:PanTilt")
|
172
172
|
zoom = _get_node(parent_node,"//tt:DefaultPTZSpeed//tt:Zoom")
|
173
|
-
configuration[
|
173
|
+
configuration[:default_ptz_speed] = {
|
174
174
|
pan_tilt:{
|
175
175
|
x: attribute(pan_tilt, "x"),
|
176
176
|
y: attribute(pan_tilt, "y"),
|
@@ -181,37 +181,37 @@ module ONVIF
|
|
181
181
|
space: attribute(zoom, "space")
|
182
182
|
}
|
183
183
|
}
|
184
|
-
configuration[
|
185
|
-
configuration[
|
184
|
+
configuration[:fefault_ptz_timeout] = value(parent_node, "tt:DefaultPTZTimeout")
|
185
|
+
configuration[:pan_tilt_limits] = {
|
186
186
|
range: {
|
187
187
|
uri: value(_get_node(parent_node, "tt:PanTiltLimits//tt:Range"), "tt:URI"),
|
188
188
|
x_range: _get_min_max(_get_node(parent_node,"tt:PanTiltLimits//tt:Range"), "tt:XRange"),
|
189
189
|
y_range: _get_min_max(_get_node(parent_node,"tt:PanTiltLimits//tt:Range"), "tt:YRange")
|
190
190
|
}
|
191
191
|
}
|
192
|
-
configuration[
|
192
|
+
configuration[:zoom_limits] = {
|
193
193
|
range: {
|
194
194
|
uri: value(_get_node(parent_node, "tt:PanTiltLimits//tt:Range"), "tt:URI"),
|
195
195
|
x_range: _get_min_max(_get_node(parent_node,"tt:PanTiltLimits//tt:Range"), "tt:XRange"),
|
196
196
|
}
|
197
197
|
}
|
198
|
-
configuration[
|
198
|
+
configuration[:extension] = ""
|
199
199
|
return configuration
|
200
200
|
end
|
201
201
|
|
202
202
|
def _get_metadata_configuration parent_node
|
203
203
|
configuration = _get_public_sector(parent_node)
|
204
|
-
configuration[
|
204
|
+
configuration[:ptz_status] = {
|
205
205
|
status: value(_get_node(parent_node, "tt:PTZStatus"), "tt:Status"),
|
206
206
|
sosition: value(_get_node(parent_node, "tt:PTZStatus"), "tt:Position")
|
207
207
|
}
|
208
|
-
configuration[
|
208
|
+
configuration[:events] = {
|
209
209
|
filter: value(_get_node(parent_node, "tt:Events"), "tt:Filter"),
|
210
210
|
subscription_policy: value(_get_node(parent_node, "tt:Events"), "tt:SubscriptionPolicy")
|
211
211
|
}
|
212
|
-
configuration[
|
213
|
-
configuration[
|
214
|
-
configuration[
|
212
|
+
configuration[:analytics] = value(parent_node, "tt:Analytics")
|
213
|
+
configuration[:multicast] = _get_multicast(parent_node)
|
214
|
+
configuration[:session_timeout] = value(parent_node, "tt:SessionTimeout")
|
215
215
|
unless parent_node.at_xpath("tt:AnalyticsEngineConfiguration//tt:AnalyticsModule").nil?
|
216
216
|
analytics_module = []
|
217
217
|
parent_node.at_xpath("tt:AnalyticsEngineConfiguration//tt:AnalyticsModule").each do |node|
|
@@ -221,12 +221,12 @@ module ONVIF
|
|
221
221
|
parameters: _get_parameters(node)
|
222
222
|
}
|
223
223
|
end
|
224
|
-
configuration[
|
224
|
+
configuration[:analytics_engine_configuration] = {
|
225
225
|
analytics_module: analytics_module,
|
226
226
|
extension: ""
|
227
227
|
}
|
228
228
|
end
|
229
|
-
configuration[
|
229
|
+
configuration[:extension] = ""
|
230
230
|
return configuration
|
231
231
|
end
|
232
232
|
|
@@ -21,19 +21,19 @@ module ONVIF
|
|
21
21
|
message.body = ->(xml) do
|
22
22
|
xml.wsdl(:GetStreamUri) do
|
23
23
|
xml.wsdl(:StreamSetup) do
|
24
|
-
xml.sch :Stream, options[
|
24
|
+
xml.sch :Stream, options[:stream_setup][:stream]
|
25
25
|
xml.sch :Transport do
|
26
|
-
xml.sch :Protocol, options[
|
26
|
+
xml.sch :Protocol, options[:stream_setup][:transport][:protocol]
|
27
27
|
xml.sch :Tunnel do
|
28
|
-
tunnel = options[
|
28
|
+
tunnel = options[:stream_setup][:transport][:tunnel]
|
29
29
|
unless tunnel.nil?
|
30
|
-
xml.sch :Protocol,options[
|
31
|
-
xml.sch :Tunnel,options[
|
30
|
+
xml.sch :Protocol,options[:stream_setup][:transport][:tunnel][:protocol]
|
31
|
+
xml.sch :Tunnel,options[:stream_setup][:transport][:tunnel][:tunnel]
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
36
|
-
xml.wsdl :ProfileToken, options[
|
36
|
+
xml.wsdl :ProfileToken, options[:profile_token]
|
37
37
|
end
|
38
38
|
end
|
39
39
|
send_message message do |success, result|
|
@@ -44,13 +44,13 @@ module ONVIF
|
|
44
44
|
session_timeout: value(xml_doc, "//tt:SessionTimeout")
|
45
45
|
}
|
46
46
|
unless xml_doc.at_xpath('//tt:MPEG4').nil?
|
47
|
-
configuration[
|
47
|
+
configuration[:mpeg4] = {
|
48
48
|
gov_length: value(_get_node(xml_doc, "//tt:MPEG4"), "//tt:GovLength"),
|
49
49
|
mpeg4_profile: value(_get_node(xml_doc, "//tt:MPEG4"), "//tt:Mpeg4Profile")
|
50
50
|
}
|
51
51
|
end
|
52
52
|
unless xml_doc.at_xpath('//tt:H264').nil?
|
53
|
-
configuration[
|
53
|
+
configuration[:h264] = {
|
54
54
|
gov_length: value(_get_node(xml_doc, "//tt:H264"), "//tt:GovLength"),
|
55
55
|
h264_profile: value(_get_node(xml_doc, "//tt:H264"), "//tt:H264Profile")
|
56
56
|
}
|
@@ -12,8 +12,8 @@ module ONVIF
|
|
12
12
|
message = create_media_onvif_message
|
13
13
|
message.body = ->(xml) do
|
14
14
|
xml.wsdl(:GetVideoEncoderConfigurationOptions) do
|
15
|
-
xml.wsdl :ConfigurationToken, options[
|
16
|
-
xml.wsdl :ProfileToken, options[
|
15
|
+
xml.wsdl :ConfigurationToken, options[:c_token]
|
16
|
+
xml.wsdl :ProfileToken, options[:p_token]
|
17
17
|
end
|
18
18
|
end
|
19
19
|
send_message message do |success, result|
|
@@ -29,7 +29,7 @@ module ONVIF
|
|
29
29
|
extension: ""
|
30
30
|
}
|
31
31
|
unless xml_doc.at_xpath('//tt:MPEG4').nil?
|
32
|
-
options[
|
32
|
+
options[:mpeg4] = {
|
33
33
|
resolutions_available: _get_each_val(_get_node(xml_doc, "//tt:MPEG4"), "//tt:ResolutionsAvailable"),
|
34
34
|
gov_length_range: _get_min_max(_get_node(xml_doc, "//tt:MPEG4"), "//tt:GovLengthRange"),
|
35
35
|
frame_rate_range: _get_min_max(_get_node(xml_doc, "//tt:MPEG4"), "//tt:FrameRateRange"),
|
@@ -38,7 +38,7 @@ module ONVIF
|
|
38
38
|
}
|
39
39
|
end
|
40
40
|
unless xml_doc.at_xpath('//tt:H264').nil?
|
41
|
-
options[
|
41
|
+
options[:h264] = {
|
42
42
|
resolutions_available: _get_each_val(_get_node(xml_doc, "//tt:H264"), "//tt:ResolutionsAvailable"),
|
43
43
|
gov_length_range: _get_min_max(_get_node(xml_doc, "//tt:H264"), "//tt:GovLengthRange"),
|
44
44
|
frame_rate_range: _get_min_max(_get_node(xml_doc, "//tt:H264"), "//tt:FrameRateRange"),
|
@@ -32,13 +32,13 @@ module ONVIF
|
|
32
32
|
session_timeout: value(root_node, "tt:SessionTimeout")
|
33
33
|
}
|
34
34
|
unless root_node.at_xpath('//tt:MPEG4').nil?
|
35
|
-
success_result[
|
35
|
+
success_result[:MPEG4] = {
|
36
36
|
gov_length: value(_get_node(root_node, "tt:MPEG4"), "tt:GovLength"),
|
37
37
|
mpeg4_profile: value(_get_node(root_node, "tt:MPEG4"), "tt:Mpeg4Profile")
|
38
38
|
}
|
39
39
|
end
|
40
40
|
unless root_node.at_xpath('//tt:H264').nil?
|
41
|
-
success_result[
|
41
|
+
success_result[:H264] = {
|
42
42
|
gov_length: value(_get_node(root_node, "tt:H264"), "tt:GovLength"),
|
43
43
|
h264_profile: value(_get_node(root_node, "tt:H264"), "tt:H264Profile")
|
44
44
|
}
|
@@ -46,46 +46,46 @@ module ONVIF
|
|
46
46
|
message = create_media_onvif_message namespaces: {:'xmlns:sch' => 'http://www.onvif.org/ver10/schema'}
|
47
47
|
message.body = ->(xml) do
|
48
48
|
xml.wsdl(:SetVideoEncoderConfiguration) do
|
49
|
-
xml.wsdl :Configuration, {"token" => configuration[
|
49
|
+
xml.wsdl :Configuration, {"token" => configuration[:configuration][:token]}
|
50
50
|
xml.wsdl(:Configuration) do
|
51
|
-
xml.sch :Name, configuration[
|
52
|
-
xml.sch :UseCount, configuration[
|
53
|
-
xml.sch :Encoding, configuration[
|
51
|
+
xml.sch :Name, configuration[:configuration][:name]
|
52
|
+
xml.sch :UseCount, configuration[:configuration][:use_count]
|
53
|
+
xml.sch :Encoding, configuration[:configuration][:encoding]
|
54
54
|
xml.sch(:Resolution) do
|
55
|
-
xml.sch :Width, configuration[
|
56
|
-
xml.sch :Height, configuration[
|
55
|
+
xml.sch :Width, configuration[:configuration][:resolution][:width]
|
56
|
+
xml.sch :Height, configuration[:configuration][:resolution][:height]
|
57
57
|
end
|
58
|
-
xml.sch :Quality,configuration[
|
58
|
+
xml.sch :Quality,configuration[:configuration][:quality]
|
59
59
|
xml.sch(:RateControl) do
|
60
|
-
xml.sch :FrameRateLimit, configuration[
|
61
|
-
xml.sch :EncodingInterval, configuration[
|
62
|
-
xml.sch :BitrateLimit, configuration[
|
60
|
+
xml.sch :FrameRateLimit, configuration[:configuration][:rate_control][:frame_rate_limit]
|
61
|
+
xml.sch :EncodingInterval, configuration[:configuration][:rate_control][:encoding_interval]
|
62
|
+
xml.sch :BitrateLimit, configuration[:configuration][:rate_control][:bitrate_limit]
|
63
63
|
end
|
64
|
-
unless configuration[
|
64
|
+
unless configuration[:configuration][:mpeg4].nil?
|
65
65
|
xml.sch(:MPEG4) do
|
66
|
-
xml.sch :GovLength, configuration[
|
67
|
-
xml.sch :Mpeg4Profile, configuration[
|
66
|
+
xml.sch :GovLength, configuration[:configuration][:mpeg4][:gov_length]
|
67
|
+
xml.sch :Mpeg4Profile, configuration[:configuration][:mpeg4][:mpeg4_profile]
|
68
68
|
end
|
69
69
|
end
|
70
|
-
unless configuration[
|
70
|
+
unless configuration[:configuration][:h264].nil?
|
71
71
|
xml.sch(:H264) do
|
72
|
-
xml.sch :GovLength, configuration[
|
73
|
-
xml.sch :H264Profile, configuration[
|
72
|
+
xml.sch :GovLength, configuration[:configuration][:h264][:gov_length]
|
73
|
+
xml.sch :H264Profile, configuration[:configuration][:h264][:h264_profile]
|
74
74
|
end
|
75
75
|
end
|
76
76
|
xml.sch(:Multicast) do
|
77
77
|
xml.sch(:Address) do
|
78
|
-
xml.sch :Type, configuration[
|
79
|
-
xml.sch :IPv4Address, configuration[
|
80
|
-
xml.sch :IPv6Address, configuration[
|
78
|
+
xml.sch :Type, configuration[:configuration][:multicast][:address][:type]
|
79
|
+
xml.sch :IPv4Address, configuration[:configuration][:multicast][:address][:ipv4_address]
|
80
|
+
xml.sch :IPv6Address, configuration[:configuration][:multicast][:address][:ipv6_address]
|
81
81
|
end
|
82
|
-
xml.sch :Port, configuration[
|
83
|
-
xml.sch :TTL, configuration[
|
84
|
-
xml.sch :AutoStart, configuration[
|
82
|
+
xml.sch :Port, configuration[:configuration][:multicast][:port]
|
83
|
+
xml.sch :TTL, configuration[:configuration][:multicast][:ttl]
|
84
|
+
xml.sch :AutoStart, configuration[:configuration][:multicast][:auto_start]
|
85
85
|
end
|
86
|
-
xml.sch :SessionTimeout, configuration[
|
86
|
+
xml.sch :SessionTimeout, configuration[:configuration][:session_timeout]
|
87
87
|
end
|
88
|
-
xml.wsdl :ForcePersistence, configuration[
|
88
|
+
xml.wsdl :ForcePersistence, configuration[:force_persistence]
|
89
89
|
end
|
90
90
|
end
|
91
91
|
send_message message do |success, result|
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require_relative '../action'
|
2
|
+
|
3
|
+
module ONVIF
|
4
|
+
module PtzAction
|
5
|
+
class GetNode < Action
|
6
|
+
# node_token 的结构 //[ReferenceToken] Token of the requested PTZNode.
|
7
|
+
def run node_token ,cb
|
8
|
+
message = create_ptz_onvif_message
|
9
|
+
message.body = ->(xml) do
|
10
|
+
xml.wsdl(:GetNode) do
|
11
|
+
xml.wsdl :NodeToken, node_token
|
12
|
+
end
|
13
|
+
end
|
14
|
+
send_message message do |success, result|
|
15
|
+
if success
|
16
|
+
xml_doc = Nokogiri::XML(result[:content])
|
17
|
+
preset_token = value(xml_doc, '//tptz:PTZNode')
|
18
|
+
callback cb, success, preset_token
|
19
|
+
else
|
20
|
+
callback cb, success, result
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require_relative '../action'
|
2
|
+
|
3
|
+
module ONVIF
|
4
|
+
module PtzAction
|
5
|
+
class GetNodes < Action
|
6
|
+
# node_token 的结构 //[ReferenceToken] Token of the requested PTZNode.
|
7
|
+
def run node_token ,cb
|
8
|
+
message = create_ptz_onvif_message
|
9
|
+
message.body = ->(xml) do
|
10
|
+
xml.wsdl(:GetNodes)
|
11
|
+
end
|
12
|
+
send_message message do |success, result|
|
13
|
+
if success
|
14
|
+
xml_doc = Nokogiri::XML(result[:content])
|
15
|
+
# ???
|
16
|
+
callback cb, success, preset_token
|
17
|
+
else
|
18
|
+
callback cb, success, result
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require_relative '../action'
|
2
|
+
|
3
|
+
module ONVIF
|
4
|
+
module PtzAction
|
5
|
+
class Stop < Action
|
6
|
+
# options 的结构
|
7
|
+
# {
|
8
|
+
# profile_token: 'xxxxx', //[ReferenceToken]
|
9
|
+
# pantilt: 'xxxxx', // [string] A requested preset name.
|
10
|
+
# zoom: 'xxxxx', // [ReferenceToken]A requested preset token.
|
11
|
+
# }
|
12
|
+
def run options ,cb
|
13
|
+
message = create_ptz_onvif_message
|
14
|
+
message.body = ->(xml) do
|
15
|
+
xml.wsdl(:Stop) do
|
16
|
+
xml.wsdl :ProfileToken, options[:profile_token]
|
17
|
+
xml.wsdl :PanTilt, options[:pantilt]
|
18
|
+
xml.wsdl :Zoom, options[:zoom]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
send_message message do |success, result|
|
22
|
+
if success
|
23
|
+
xml_doc = Nokogiri::XML(result[:content])
|
24
|
+
preset_token = value(xml_doc, '//tptz:PresetToken')
|
25
|
+
callback cb, success, preset_token
|
26
|
+
else
|
27
|
+
callback cb, success, result
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/ruby-onvif-client.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_onvif_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jimxl
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-07-
|
11
|
+
date: 2013-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: em_ws_discovery
|
@@ -86,6 +86,9 @@ files:
|
|
86
86
|
- lib/ruby_onvif_client/client.rb
|
87
87
|
- lib/ruby_onvif_client/message.rb
|
88
88
|
- lib/ruby_onvif_client/path.rb
|
89
|
+
- lib/ruby_onvif_client/ptz/get_nodes.rb
|
90
|
+
- lib/ruby_onvif_client/ptz/stop.rb
|
91
|
+
- lib/ruby_onvif_client/ptz/get_node.rb
|
89
92
|
- lib/ruby_onvif_client/device_management.rb
|
90
93
|
- lib/ruby_onvif_client/media.rb
|
91
94
|
- lib/ruby_onvif_client/media/get_video_encoder_configuration.rb
|
@@ -102,6 +105,7 @@ files:
|
|
102
105
|
- lib/ruby_onvif_client/media/get_video_encoder_configurations.rb
|
103
106
|
- lib/ruby_onvif_client/media/get_stream_uri.rb
|
104
107
|
- lib/ruby_onvif_client/action.rb
|
108
|
+
- lib/ruby_onvif_client/ptz.rb
|
105
109
|
- lib/ruby_onvif_client/device_discovery.rb
|
106
110
|
- lib/ruby_onvif_client.rb
|
107
111
|
- Gemfile
|