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.



710
711
712
# File 'lib/mqtt/sn/packet.rb', line 710

def return_code
  @return_code
end

Instance Method Details

#encode_bodyObject



716
717
718
719
720
721
722
# File 'lib/mqtt/sn/packet.rb', line 716

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) ⇒ Object



724
725
726
# File 'lib/mqtt/sn/packet.rb', line 724

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