Class: Foscam::Model::Device
- Includes:
- Singleton
- Defined in:
- lib/foscam/model/device.rb
Instance Attribute Summary collapse
-
#brightness ⇒ Object
attr_accessor :name (get_params, set_alias) attr_accessor :name (get_misc, set_misc).
-
#contrast ⇒ Object
attr_accessor :name (get_params, set_alias) attr_accessor :name (get_misc, set_misc).
-
#orientation ⇒ Object
attr_accessor :name (get_params, set_alias) attr_accessor :name (get_misc, set_misc).
-
#resolution ⇒ Object
attr_accessor :name (get_params, set_alias) attr_accessor :name (get_misc, set_misc).
Instance Method Summary collapse
-
#action(value) ⇒ FalseClass, TrueClass
Preform a decoder action.
-
#capture ⇒ nil, ::MiniMagick::Image
Capture the current image.
- #client=(obj) ⇒ Object
-
#save ⇒ FalseClass, TrueClass
Save the current device.
Methods inherited from Base
#connect, #initialize, #persisted?
Constructor Details
This class inherits a constructor from Foscam::Model::Base
Instance Attribute Details
#brightness ⇒ Object
attr_accessor :name (get_params, set_alias) attr_accessor :name (get_misc, set_misc)
11 12 13 |
# File 'lib/foscam/model/device.rb', line 11 def brightness @brightness end |
#contrast ⇒ Object
attr_accessor :name (get_params, set_alias) attr_accessor :name (get_misc, set_misc)
11 12 13 |
# File 'lib/foscam/model/device.rb', line 11 def contrast @contrast end |
#orientation ⇒ Object
attr_accessor :name (get_params, set_alias) attr_accessor :name (get_misc, set_misc)
11 12 13 |
# File 'lib/foscam/model/device.rb', line 11 def orientation @orientation end |
#resolution ⇒ Object
attr_accessor :name (get_params, set_alias) attr_accessor :name (get_misc, set_misc)
11 12 13 |
# File 'lib/foscam/model/device.rb', line 11 def resolution @resolution end |
Instance Method Details
#action(value) ⇒ FalseClass, TrueClass
Preform a decoder action
75 76 77 78 |
# File 'lib/foscam/model/device.rb', line 75 def action(value) # have an action map to map some subset to the foscam set client.decoder_control(value) end |
#capture ⇒ nil, ::MiniMagick::Image
Capture the current image
67 68 69 |
# File 'lib/foscam/model/device.rb', line 67 def capture client.snapshot end |
#client=(obj) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/foscam/model/device.rb', line 33 def client=(obj) unless obj.nil? Device::client = obj cam_params = client.get_camera_params unless cam_params.empty? @resolution = cam_params[:resolution] @brightness = cam_params[:brightness] @contrast = cam_params[:contrast] @orientation = cam_params[:flip] # mode end end end |
#save ⇒ FalseClass, TrueClass
Save the current device
52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/foscam/model/device.rb', line 52 def save run_callbacks :save do flag = false if changed? && is_valid? @previously_changed = changes flag = client.camera_control(dirty_params_hash) @changed_attributes.clear if flag end flag end end |