Class: Sphero::Response::GetPowerState

Inherits:
Sphero::Response show all
Defined in:
lib/sphero/response.rb

Direct Known Subclasses

PowerNotification

Constant Summary collapse

CHARGING =

constants for power_state

0x01
OK =
0x02
LOW =
0x03
CRITICAL =
0x04

Constants inherited from Sphero::Response

ASYNC_RESPONSE, CODE_OK, DLEN, MRSP, SEQ, SIMPLE_RESPONSE, SOP1, SOP2

Instance Method Summary collapse

Methods inherited from Sphero::Response

async?, #empty?, #initialize, #seq, simple?, #success?, #valid?

Constructor Details

This class inherits a constructor from Sphero::Response

Instance Method Details

#batt_voltageObject

Voltage * 100



72
73
74
# File 'lib/sphero/response.rb', line 72

def batt_voltage
  body[2]
end

#bodyObject



59
60
61
# File 'lib/sphero/response.rb', line 59

def body
  @body.unpack 'CCnnnC'
end

#num_chargesObject



76
77
78
# File 'lib/sphero/response.rb', line 76

def num_charges
  body[3]
end

#power_stateObject



67
68
69
# File 'lib/sphero/response.rb', line 67

def power_state
  body[1]
end

#rec_verObject



63
64
65
# File 'lib/sphero/response.rb', line 63

def rec_ver
  body[0]
end

#time_since_chargeObject

Time since awakened in seconds



81
82
83
# File 'lib/sphero/response.rb', line 81

def time_since_charge
  body[4]
end