Class: Geppeto::Commands::Power

Inherits:
Object
  • Object
show all
Defined in:
lib/commands/power.rb

Instance Method Summary collapse

Constructor Details

#initialize(scout) ⇒ Power

Returns a new instance of Power.



4
5
6
# File 'lib/commands/power.rb', line 4

def initialize(scout)
  @scout = scout
end

Instance Method Details

#battery?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/commands/power.rb', line 12

def battery?
  @scout.request("power.hasbattery").to_i == 1
end

#charging?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/commands/power.rb', line 8

def charging?
  @scout.request("power.ischarging").to_i == 1
end

#disablevccObject



28
29
30
# File 'lib/commands/power.rb', line 28

def disablevcc
  @scout.request("power.disablevcc")
end

#enablevccObject



24
25
26
# File 'lib/commands/power.rb', line 24

def enablevcc
  @scout.request("power.enablevcc")
end

#percentObject



16
17
18
# File 'lib/commands/power.rb', line 16

def percent
  @scout.request("power.percent").to_i
end

#reportObject



40
41
42
# File 'lib/commands/power.rb', line 40

def report
  @scout.request("power.report")
end

#sleep(ms, command = nil) ⇒ Object



36
37
38
# File 'lib/commands/power.rb', line 36

def sleep(ms, command = nil)
  @scout.request("power.sleep", ms, command)
end

#vcc?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/commands/power.rb', line 32

def vcc?
  @scout.request("power.isvccenabled").to_i == 1
end

#voltageObject



20
21
22
# File 'lib/commands/power.rb', line 20

def voltage
  @scout.request("power.voltage").to_i
end