class MQTT::SN::Packet::Connack
Attributes
return_code[RW]
Public Instance Methods
encode_body()
click to toggle source
# File lib/mqttbridge/sn/packet.rb, line 288 def encode_body unless return_code.is_a?(Integer) raise "return_code must be an Integer" end [return_code].pack('C') end
parse_body(buffer)
click to toggle source
# File lib/mqttbridge/sn/packet.rb, line 296 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/mqttbridge/sn/packet.rb, line 273 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