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

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.



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

def return_code
  @return_code
end

Instance Method Details

#encode_bodyObject



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

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



653
654
655
# File 'lib/mqtt/sn/packet.rb', line 653

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