Class: Geppeto::Commands::Power
- Inherits:
-
Object
- Object
- Geppeto::Commands::Power
- Defined in:
- lib/commands/power.rb
Instance Method Summary collapse
- #battery? ⇒ Boolean
- #charging? ⇒ Boolean
- #disablevcc ⇒ Object
- #enablevcc ⇒ Object
-
#initialize(scout) ⇒ Power
constructor
A new instance of Power.
- #percent ⇒ Object
- #report ⇒ Object
- #sleep(ms, command = nil) ⇒ Object
- #vcc? ⇒ Boolean
- #voltage ⇒ Object
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
12 13 14 |
# File 'lib/commands/power.rb', line 12 def battery? @scout.request("power.hasbattery").to_i == 1 end |
#charging? ⇒ Boolean
8 9 10 |
# File 'lib/commands/power.rb', line 8 def charging? @scout.request("power.ischarging").to_i == 1 end |
#disablevcc ⇒ Object
28 29 30 |
# File 'lib/commands/power.rb', line 28 def disablevcc @scout.request("power.disablevcc") end |
#enablevcc ⇒ Object
24 25 26 |
# File 'lib/commands/power.rb', line 24 def enablevcc @scout.request("power.enablevcc") end |
#percent ⇒ Object
16 17 18 |
# File 'lib/commands/power.rb', line 16 def percent @scout.request("power.percent").to_i end |
#report ⇒ Object
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
32 33 34 |
# File 'lib/commands/power.rb', line 32 def vcc? @scout.request("power.isvccenabled").to_i == 1 end |
#voltage ⇒ Object
20 21 22 |
# File 'lib/commands/power.rb', line 20 def voltage @scout.request("power.voltage").to_i end |