class EventMachine::MQTTSN::Packet::Connack

Attributes

return_code[RW]

Public Instance Methods

encode_body() click to toggle source
# File lib/em/mqtt-sn/packet.rb, line 187
def encode_body
  [return_code].pack('C')
end
parse_body(buffer) click to toggle source
# File lib/em/mqtt-sn/packet.rb, line 191
def parse_body(buffer)
  self.return_code = buffer.unpack('C')[0]
end
return_msg() click to toggle source

Get a string message corresponding to a return code

# File lib/em/mqtt-sn/packet.rb, line 172
def return_msg
  case return_code
    when 0x00
      "Accepted"
    when 0x01
      "Rejected: congestion"
    when 0x02
      "Rejected: invalid topic ID"
    when 0x03
      "Rejected: not supported"
    else
      "Rejected: error code #{return_code}"
  end
end