class PahoMqtt::Packet::Pubrel
Constants
- ATTR_DEFAULTS
Default attribute values
Public Class Methods
new(args={})
click to toggle source
Create a new Pubrel
packet
Calls superclass method
PahoMqtt::Packet::Base::new
# File lib/paho_mqtt/packet/pubrel.rb, line 29 def initialize(args={}) super(ATTR_DEFAULTS.merge(args)) end
Public Instance Methods
encode_body()
click to toggle source
Get serialisation of packet's body
# File lib/paho_mqtt/packet/pubrel.rb, line 34 def encode_body encode_short(@id) end
inspect()
click to toggle source
Returns a human readable string, summarising the properties of the packet
# File lib/paho_mqtt/packet/pubrel.rb, line 57 def inspect "\#<#{self.class}: 0x%2.2X>" % id end
parse_body(buffer)
click to toggle source
Parse the body (variable header and payload) of a packet
Calls superclass method
PahoMqtt::Packet::Base#parse_body
# File lib/paho_mqtt/packet/pubrel.rb, line 39 def parse_body(buffer) super(buffer) @id = shift_short(buffer) unless buffer.empty? raise "Extra bytes at end of Publish Release packet" end end
validate_flags()
click to toggle source
Check that fixed header flags are valid for this packet type @private
# File lib/paho_mqtt/packet/pubrel.rb, line 49 def validate_flags if @flags != [false, true, false, false] raise PahoMqtt::PacketFormatException.new( "Invalid flags in #{type_name} packet header") end end