Class: MQTT::SN::Packet::Willtopicresp

Inherits:
Packet
  • Object
show all
Defined in:
lib/mqtt/sn/packet.rb

Constant Summary collapse

DEFAULTS =
{
  return_code: 0x00
}.freeze

Constants inherited from Packet

Packet::ATTR_DEFAULTS

Instance Attribute Summary collapse

Attributes inherited from Packet

#body_length, #flags, #id, #version

Instance Method Summary collapse

Methods inherited from Packet

create_from_header, #dup, #initialize, #inspect, #message_id, #message_id=, parse, parse_header, read, read_byte, #to_s, #type_id, #type_name, #update_attributes, #validate_flags

Constructor Details

This class inherits a constructor from MQTT::Packet

Instance Attribute Details

#return_codeObject

Returns the value of attribute return_code.



635
636
637
# File 'lib/mqtt/sn/packet.rb', line 635

def return_code
  @return_code
end

Instance Method Details

#encode_bodyObject



641
642
643
644
645
# File 'lib/mqtt/sn/packet.rb', line 641

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



647
648
649
# File 'lib/mqtt/sn/packet.rb', line 647

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