Class: MQTT::SN::Packet::Willtopicupd
- Defined in:
- lib/mqtt/sn/packet.rb
Constant Summary collapse
- DEFAULTS =
{ qos: 0, retain: false, topic_name: nil }.freeze
Constants inherited from Packet
Instance Attribute Summary collapse
-
#topic_name ⇒ Object
Returns the value of attribute topic_name.
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
#topic_name ⇒ Object
Returns the value of attribute topic_name.
608 609 610 |
# File 'lib/mqtt/sn/packet.rb', line 608 def topic_name @topic_name end |
Instance Method Details
#encode_body ⇒ Object
616 617 618 619 620 621 622 |
# File 'lib/mqtt/sn/packet.rb', line 616 def encode_body if topic_name.nil? || topic_name.empty? "" else [encode_flags, topic_name].pack("Ca*") end end |
#parse_body(buffer) ⇒ Object
624 625 626 627 628 629 630 631 |
# File 'lib/mqtt/sn/packet.rb', line 624 def parse_body(buffer) if buffer.length > 1 flags, self.topic_name = buffer.unpack("Ca*") parse_flags(flags) else self.topic_name = nil end end |