Class: ONVIF::PtzAction::SetPreset
- Defined in:
- lib/ruby_onvif_client/ptz/set_preset.rb
Instance Method Summary collapse
-
#run(options, cb) ⇒ Object
options 的结构 { profile_token: “xxxxxxx”, //[ReferenceToken] A reference to the MediaProfile where the operation should take place. preset_name: “xxxxx”, // optional; [string] A requested preset name. preset_token: “xxxxxxx” //optional; [ReferenceToken] A requested preset token. }.
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(options, cb) ⇒ Object
options 的结构
profile_token: "xxxxxxx", //[ReferenceToken] A reference to the MediaProfile where the operation should take place.
preset_name: "xxxxx", // optional; [string] A requested preset name.
preset_token: "xxxxxxx" //optional; [ReferenceToken] A requested preset token.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/ruby_onvif_client/ptz/set_preset.rb', line 12 def run ,cb = .body = ->(xml) do xml.wsdl(:SetPreset) do xml.wsdl :ProfileToken, [:profile_token] xml.wsdl :PresetName, [:preset_name] unless [:preset_name].nil? xml.wsdl :PresetToken, [:preset_token] unless [:preset_token].nil? end end do |success, result| if success xml_doc = Nokogiri::XML(result[:content]) preset_token = value(xml_doc, '//tptz:PresetToken') callback cb, success, preset_token else callback cb, success, result end end end |