Module: ONVIF::PtzCommon
- Included in:
- ONVIF::PtzAction::GetConfiguration, ONVIF::PtzAction::GetConfigurationOptions, ONVIF::PtzAction::GetConfigurations, ONVIF::PtzAction::GetNode, ONVIF::PtzAction::GetNodes, ONVIF::PtzAction::GetPresets
- Defined in:
- lib/ruby_onvif_client/helper/ptz_common.rb
Instance Method Summary collapse
- #get_configuration_optional_value(xml_doc, configuration) ⇒ Object
- #get_min_max(xml_doc, parent_name) ⇒ Object
- #get_pan_tilt_limits(xml_doc) ⇒ Object
- #get_space_muster(root_doc, parent_node_name, configuration) ⇒ Object
- #get_spaces(xml_doc, node_name) ⇒ Object
- #get_speed(xml_doc, speed_name, configuration) ⇒ Object
- #get_zoom_limits(xml_doc) ⇒ Object
Instance Method Details
#get_configuration_optional_value(xml_doc, configuration) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/ruby_onvif_client/helper/ptz_common.rb', line 3 def get_configuration_optional_value xml_doc, configuration configuration = {} if configuration.nil? unless xml_doc.at_xpath("tt:DefaultAbsolutePantTiltPositionSpace").nil? configuration[:daptps] = value(xml_doc, "tt:DefaultAbsolutePantTiltPositionSpace") end unless xml_doc.at_xpath("tt:DefaultAbsoluteZoomPositionSpace").nil? configuration[:dazps] = value(xml_doc, "tt:DefaultAbsoluteZoomPositionSpace") end unless xml_doc.at_xpath("tt:DefaultRelativePanTiltTranslationSpace").nil? configuration[:drptts] = value(xml_doc, "tt:DefaultRelativePanTiltTranslationSpace") end unless xml_doc.at_xpath("tt:DefaultRelativeZoomTranslationSpace").nil? configuration[:drzts] = value(xml_doc, "tt:DefaultRelativeZoomTranslationSpace") end unless xml_doc.at_xpath("tt:DefaultContinuousPanTiltVelocitySpace").nil? configuration[:dcptvs] = value(xml_doc, "tt:DefaultContinuousPanTiltVelocitySpace") end unless xml_doc.at_xpath("tt:DefaultContinuousZoomVelocitySpace").nil? configuration[:dczvs] = value(xml_doc, "tt:DefaultContinuousZoomVelocitySpace") end unless xml_doc.at_xpath("tt:DefaultPTZTimeout").nil? configuration[:d_ptz_timeout] = value(xml_doc, "tt:DefaultPTZTimeout") end return configuration end |
#get_min_max(xml_doc, parent_name) ⇒ Object
113 114 115 116 117 118 119 120 121 122 |
# File 'lib/ruby_onvif_client/helper/ptz_common.rb', line 113 def get_min_max xml_doc, parent_name this_node = xml_doc unless parent_name.nil? this_node = xml_doc.at_xpath(parent_name) end return { min: value(this_node, "tt:Min"), max: value(this_node, "tt:Max") } end |
#get_pan_tilt_limits(xml_doc) ⇒ Object
99 100 101 102 103 104 |
# File 'lib/ruby_onvif_client/helper/ptz_common.rb', line 99 def get_pan_tilt_limits xml_doc configuration = {} configuration = get_zoom_limits xml_doc configuration[:y_range] = get_min_max(xml_doc, "tt:YRange") return configuration end |
#get_space_muster(root_doc, parent_node_name, configuration) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/ruby_onvif_client/helper/ptz_common.rb', line 29 def get_space_muster root_doc, parent_node_name, configuration configuration = {} if configuration.nil? configuration[parent_node_name.underscore] = {} spaces = root_doc.xpath("tt:" + parent_node_name) unless spaces.at_xpath("tt:AbsolutePanTiltPositionSpace").nil? configuration[parent_node_name.underscore][:aptps] = get_spaces spaces, "AbsolutePanTiltPositionSpace" end unless spaces.at_xpath("tt:AbsoluteZoomPositionSpace").nil? configuration[parent_node_name.underscore][:azps] = get_spaces spaces, "AbsoluteZoomPositionSpace" end unless spaces.at_xpath("tt:RelativePanTiltTranslationSpace").nil? configuration[parent_node_name.underscore][:rptts] = get_spaces spaces, "RelativePanTiltTranslationSpace" end unless spaces.at_xpath("tt:RelativeZoomTranslationSpace").nil? configuration[parent_node_name.underscore][:rzts] = get_spaces spaces, "RelativeZoomTranslationSpace" end unless spaces.at_xpath("tt:ContinuousPanTiltVelocitySpace").nil? configuration[parent_node_name.underscore][:cptvs] = get_spaces spaces, "ContinuousPanTiltVelocitySpace" end unless spaces.at_xpath("tt:ContinuousZoomVelocitySpace").nil? configuration[parent_node_name.underscore][:czvs] = get_spaces spaces, "ContinuousZoomVelocitySpace" end unless spaces.at_xpath("tt:PanTiltSpeedSpace").nil? configuration[parent_node_name.underscore][:ptss] = get_spaces spaces, "PanTiltSpeedSpace" end unless spaces.at_xpath("tt:ZoomSpeedSpace").nil? configuration[parent_node_name.underscore][:zss] = get_spaces spaces, "ZoomSpeedSpace" end configuration[parent_node_name.underscore][:extension] = "" return configuration end |
#get_spaces(xml_doc, node_name) ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/ruby_onvif_client/helper/ptz_common.rb', line 61 def get_spaces xml_doc, node_name results = [] unless xml_doc.at_xpath("tt:" + node_name).nil? xml_doc.xpath("tt:" + node_name).each do |space| if space.at_xpath("tt:YRange").nil? results << get_zoom_limits(space) else results << get_pan_tilt_limits(space) end end end return results end |
#get_speed(xml_doc, speed_name, configuration) ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/ruby_onvif_client/helper/ptz_common.rb', line 75 def get_speed xml_doc, speed_name, configuration configuration = {} if configuration.nil? speed_doc = xml_doc.at_xpath("tt:" + speed_name) unless speed_doc.nil? pan_tilt = speed_doc.at_xpath("tt:PanTilt") zoom = speed_doc.at_xpath("tt:Zoom") configuration[speed_name.underscore] = {} unless pan_tilt.nil? configuration[speed_name.underscore][:pan_tilt] = { x: attribute(pan_tilt, "x"), y: attribute(pan_tilt, "y"), space: attribute(pan_tilt, "space") } end unless zoom.nil? configuration[speed_name.underscore][:pan_tilt] = { x: attribute(zoom, "x"), space: attribute(zoom, "space") } end end return configuration end |
#get_zoom_limits(xml_doc) ⇒ Object
106 107 108 109 110 111 |
# File 'lib/ruby_onvif_client/helper/ptz_common.rb', line 106 def get_zoom_limits xml_doc return { uri: value(xml_doc, "tt:URI"), x_range: get_min_max(xml_doc, "tt:XRange") } end |