Class: MqttRails::Packet::Pubrec
- Defined in:
- lib/mqtt_rails/packet/pubrec.rb
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
#body_length, #flags, #id, #version
Instance Method Summary collapse
-
#encode_body ⇒ Object
Get serialisation of packet’s body.
-
#inspect ⇒ Object
Returns a human readable string, summarising the properties of the packet.
-
#parse_body(buffer) ⇒ Object
Parse the body (variable header and payload) of a packet.
Methods inherited from Base
create_from_header, #initialize, parse, parse_header, read, #to_s, #type_id, #type_name, #update_attributes, #validate_flags
Constructor Details
This class inherits a constructor from MqttRails::Packet::Base
Instance Method Details
#encode_body ⇒ Object
Get serialisation of packet’s body
24 25 26 |
# File 'lib/mqtt_rails/packet/pubrec.rb', line 24 def encode_body encode_short(@id) end |
#inspect ⇒ Object
Returns a human readable string, summarising the properties of the packet
39 40 41 |
# File 'lib/mqtt_rails/packet/pubrec.rb', line 39 def inspect "\#<#{self.class}: 0x%2.2X>" % id end |
#parse_body(buffer) ⇒ Object
Parse the body (variable header and payload) of a packet
29 30 31 32 33 34 35 36 |
# File 'lib/mqtt_rails/packet/pubrec.rb', line 29 def parse_body(buffer) super(buffer) @id = shift_short(buffer) unless buffer.empty? raise MqttRails::PacketFormatException.new( "Extra bytes at end of Publish Received packet") end end |