Class: Sphero::Response
- Inherits:
-
Object
show all
- Defined in:
- lib/sphero/response.rb
Defined Under Namespace
Classes: GetAutoReconnect, GetBluetoothInfo, GetPowerState, GetRGB
Constant Summary
collapse
- SOP1 =
0
- SOP2 =
1
- MRSP =
2
- SEQ =
3
- DLEN =
4
- CODE_OK =
0
Instance Method Summary
collapse
Constructor Details
#initialize(header, body) ⇒ Response
Returns a new instance of Response.
11
12
13
14
|
# File 'lib/sphero/response.rb', line 11
def initialize , body
@header =
@body = body
end
|
Instance Method Details
#body ⇒ Object
28
29
30
|
# File 'lib/sphero/response.rb', line 28
def body
@body.unpack 'C*'
end
|
#empty? ⇒ Boolean
16
17
18
|
# File 'lib/sphero/response.rb', line 16
def empty?
@header[DLEN] == 1
end
|
#seq ⇒ Object
24
25
26
|
# File 'lib/sphero/response.rb', line 24
def seq
@header[SEQ]
end
|
#success? ⇒ Boolean
20
21
22
|
# File 'lib/sphero/response.rb', line 20
def success?
@header[MRSP] == CODE_OK
end
|