Class: Sphero::Response::GetPowerState

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

Constant Summary collapse

CHARGING =

constants for power_state

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

Constants inherited from Sphero::Response

CODE_EBAD_CMD, CODE_EBAD_DID, CODE_EBAD_MSG, CODE_ECHKSUM, CODE_EEXEC, CODE_EFRAG, CODE_EGEN, CODE_EPARAM, CODE_EUNSUPP, CODE_FLASH_FAIL, CODE_MA_CORRUPT, CODE_MSG_TIMEOUT, CODE_OK, CODE_PAGE_ILLEGAL, CODE_POWER_NOGOOD, CODE_TO_EXCEPTION, CODE_TO_MESSAGE, DLEN, MRSP, SEQ, SOP1, SOP2

Instance Method Summary collapse

Methods inherited from Sphero::Response

#empty?, #exception, #initialize, #seq, #success?

Constructor Details

This class inherits a constructor from Sphero::Response

Instance Method Details

#batt_voltageObject

Voltage * 100


103
104
105
# File 'lib/sphero/response.rb', line 103

def batt_voltage
  body[2]
end

#bodyObject


90
91
92
# File 'lib/sphero/response.rb', line 90

def body
  @body.unpack 'CCnnnC'
end

#num_chargesObject


107
108
109
# File 'lib/sphero/response.rb', line 107

def num_charges
  body[3]
end

#power_stateObject


98
99
100
# File 'lib/sphero/response.rb', line 98

def power_state
  body[1]
end

#rec_verObject


94
95
96
# File 'lib/sphero/response.rb', line 94

def rec_ver
  body[0]
end

#time_since_chargeObject

Time since awakened in seconds


112
113
114
# File 'lib/sphero/response.rb', line 112

def time_since_charge
  body[4]
end