class SetHotspotAction

Public Class Methods

new(h={}) click to toggle source
Calls superclass method ConnectivityAction::new
# File lib/ruby-macrodroid/actions.rb, line 882
def initialize(h={})

  # to-do: check when *disable hotspot*, is the
  #        *enable wifi* option selected?
  
  options = {
    device_name: "", state: 0, turn_wifi_on: true, use_legacy_mechanism: false, mechanism: 0

  }

  super(options.merge h)

end

Public Instance Methods

to_s(colour: false, indent: 0) click to toggle source
Calls superclass method MacroObject#to_s
# File lib/ruby-macrodroid/actions.rb, line 896
def to_s(colour: false, indent: 0)
  
  @s =  "%s HotSpot" % [@h[:state] == 0 ? 'Enable' : 'Disable']
  
  if @h[:state] == 1 then
    @s += "\n" + (@h[:turn_wifi_on] ? 'Enable WiFi' : 'Don\'t Enable Wifi')
  end
  
  super()
  
end