Class: ONVIF::PtzAction::GetPresets
- Includes:
- ONVIF::PtzCommon
- Defined in:
- lib/ruby_onvif_client/ptz/get_presets.rb
Instance Method Summary collapse
-
#run(p_token, cb) ⇒ Object
p_token 的结构 p_token = “xxxxx” //[ReferenceToken] A reference to the MediaProfile where the operation should take place.
Methods included from ONVIF::PtzCommon
#get_configuration_optional_value, #get_min_max, #get_pan_tilt_limits, #get_space_muster, #get_spaces, #get_speed, #get_zoom_limits
Methods inherited from Action
#attribute, #callback, #create_event_onvif_message, #create_media_onvif_message, #create_ptz_onvif_message, #initialize, #send_message, #value
Constructor Details
This class inherits a constructor from ONVIF::Action
Instance Method Details
#run(p_token, cb) ⇒ Object
p_token 的结构
p_token = “xxxxx” //[ReferenceToken] A reference to the MediaProfile where the operation should take place.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/ruby_onvif_client/ptz/get_presets.rb', line 10 def run p_token, cb = .body = ->(xml) do xml.wsdl(:GetPresets) do xml.wsdl :ProfileToken, p_token end end do |success, result| if success xml_doc = Nokogiri::XML(result[:content]) presets = [] xml_doc.xpath('//tptz:Preset').each do |node| preset = { name: value(node, 'tt:Name'), token: attribute(node, "token") } preset = get_speed node, "PTZPosition", preset presets << preset end callback cb, success, presets else callback cb, success, result end end end |