Class: FlipDeviceTrigger

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

Overview

Category: Sensors

options:

Face Up -> Face Down
Face Down -> Face Up
Any -> Face Down

Instance Attribute Summary

Attributes inherited from MacroObject

#options, #type

Instance Method Summary collapse

Methods inherited from Trigger

#match?

Methods inherited from MacroObject

#to_h

Constructor Details

#initialize(h = {}) ⇒ FlipDeviceTrigger

Returns a new instance of FlipDeviceTrigger.



2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
# File 'lib/ruby-macrodroid.rb', line 2087

def initialize(h={})

  options = {
    any_start: false,
    face_down: true,
    work_with_screen_off: false
  }

  super(options.merge h)

end

Instance Method Details

#to_pc ⇒ Object



2099
2100
2101
# File 'lib/ruby-macrodroid.rb', line 2099

def to_pc()
  @h[:face_down] ? 'flip_device_down?' : 'flip_device_up?'
end

#to_s ⇒ Object



2103
2104
2105
2106
2107
# File 'lib/ruby-macrodroid.rb', line 2103

def to_s()
  
  action = @h[:face_down] ? 'Face Up -> Face Down' : 'Face Down -> Face Up'
  'Flip Device ' + action
end