Class: Samsung::Protocol::Response

Inherits:
Frame
  • Object
show all
Defined in:
lib/samsung/protocol/response.rb

Instance Attribute Summary collapse

Attributes inherited from Frame

#data

Instance Method Summary collapse

Methods inherited from Frame

#hex, #pop_frame, #pop_int16, #pop_int32, #pop_int8, #pop_string, #pop_string64, #push_frame, #push_int16, #push_int32, #push_int8, #push_string, #push_string64, #size

Constructor Details

#initialize(data) ⇒ Response

Returns a new instance of Response.



6
7
8
9
# File 'lib/samsung/protocol/response.rb', line 6

def initialize data
  @data = data
  parse_response
end

Instance Attribute Details

#app_nameObject

Returns the value of attribute app_name.



4
5
6
# File 'lib/samsung/protocol/response.rb', line 4

def app_name
  @app_name
end

#codeObject

Returns the value of attribute code.



4
5
6
# File 'lib/samsung/protocol/response.rb', line 4

def code
  @code
end

#response_frameObject

Returns the value of attribute response_frame.



4
5
6
# File 'lib/samsung/protocol/response.rb', line 4

def response_frame
  @response_frame
end

Instance Method Details

#response_typeObject



11
12
13
14
15
16
17
# File 'lib/samsung/protocol/response.rb', line 11

def response_type
  return :wait if r[0].ord == 0x0a
  return :timeout if r[0].ord == 0x65
  return :accepted if r[0].ord == 0x64 and r[2].ord == 0x01
  return :rejected if r[0].ord == 0x64 and r[2].ord == 0x02
  return :unknown
end