Class: CameraFlashLightAction

Inherits:
DeviceSettingsAction show all
Defined in:
lib/ruby-macrodroid/actions.rb

Overview

Category: Device Settings

Instance Attribute Summary

Attributes inherited from Action

#constraints

Attributes inherited from MacroObject

#options, #siguid, #type

Instance Method Summary collapse

Methods included from ObjectX

#action_to_object, #object_create, #varify

Methods inherited from MacroObject

#to_h

Constructor Details

#initialize(h = {}) ⇒ CameraFlashLightAction

options

0  Toch On
1  Torch Off
2  Torch Toggle


1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
# File 'lib/ruby-macrodroid/actions.rb', line 1115

def initialize(h={})

  options = {
    launch_foreground: false,
    state: 0
  }

  super(options.merge h)

end

Instance Method Details

#invokeObject



1125
1126
1127
# File 'lib/ruby-macrodroid/actions.rb', line 1125

def invoke()
  super(state: @h[:state])
end

#to_pcObject



1129
1130
1131
# File 'lib/ruby-macrodroid/actions.rb', line 1129

def to_pc()
  ['torch :on', 'torch :off', 'torch :toggle'][@h[:state]]
end

#to_s(colour: false, indent: 0) ⇒ Object



1133
1134
1135
# File 'lib/ruby-macrodroid/actions.rb', line 1133

def to_s(colour: false, indent: 0)
  ['Torch On', 'Torch Off', 'Torch Toggle'][@h[:state]]    
end