class MQTT::SN::Packet::Register

Constants

DEFAULTS

Attributes

id[RW]
topic_id[RW]
topic_name[RW]

Public Instance Methods

encode_body() click to toggle source
# File lib/mqttbridge/sn/packet.rb, line 359
def encode_body
  unless id.is_a?(Integer)
    raise "id must be an Integer"
  end

  unless topic_id.is_a?(Integer)
    raise "topic_id must be an Integer"
  end

  [topic_id, id, topic_name].pack('nna*')
end
parse_body(buffer) click to toggle source
# File lib/mqttbridge/sn/packet.rb, line 371
def parse_body(buffer)
  self.topic_id, self.id, self.topic_name = buffer.unpack('nna*')
end