Class: MQTT::SN::Packet::Willmsgresp

Inherits:
MQTT::SN::Packet show all
Defined in:
lib/mqtt/sn/packet.rb

Constant Summary collapse

DEFAULTS =
{
  :return_code => 0x00
}

Instance Attribute Summary collapse

Attributes inherited from MQTT::SN::Packet

#clean_session, #duplicate, #qos, #request_will, #retain, #topic_id_type

Instance Method Summary collapse

Methods inherited from MQTT::SN::Packet

#initialize, parse, #to_s, #type_id, #update_attributes

Constructor Details

This class inherits a constructor from MQTT::SN::Packet

Instance Attribute Details

#return_codeObject

Returns the value of attribute return_code.



671
672
673
# File 'lib/mqtt/sn/packet.rb', line 671

def return_code
  @return_code
end

Instance Method Details

#encode_bodyObject



677
678
679
680
681
# File 'lib/mqtt/sn/packet.rb', line 677

def encode_body
  raise 'return_code must be an Integer' unless return_code.is_a?(Integer)

  [return_code].pack('C')
end

#parse_body(buffer) ⇒ Object



683
684
685
# File 'lib/mqtt/sn/packet.rb', line 683

def parse_body(buffer)
  self.return_code, _ignore = buffer.unpack('C')
end