Class: PahoMqtt::Packet::Unsuback

Inherits:
PahoMqtt::Packet show all
Defined in:
lib/paho.mqtt/packet_manager.rb

Overview

Class representing an MQTT Unsubscribe Acknowledgment packet

Constant Summary

Constants inherited from PahoMqtt::Packet

ATTR_DEFAULTS

Instance Attribute Summary

Attributes inherited from PahoMqtt::Packet

#body_length, #flags, #id, #version

Instance Method Summary collapse

Methods inherited from PahoMqtt::Packet

create_from_header, parse, parse_header, read, #to_s, #type_id, #type_name, #update_attributes, #validate_flags

Constructor Details

#initialize(args = {}) ⇒ Unsuback

Create a new Unsubscribe Acknowledgment packet



962
963
964
# File 'lib/paho.mqtt/packet_manager.rb', line 962

def initialize(args={})
  super(args)
end

Instance Method Details

#encode_bodyObject

Get serialisation of packet’s body



967
968
969
# File 'lib/paho.mqtt/packet_manager.rb', line 967

def encode_body
  encode_short(@id)
end

#inspectObject

Returns a human readable string, summarising the properties of the packet



981
982
983
# File 'lib/paho.mqtt/packet_manager.rb', line 981

def inspect
  "\#<#{self.class}: 0x%2.2X>" % id
end

#parse_body(buffer) ⇒ Object

Parse the body (variable header and payload) of a packet



972
973
974
975
976
977
978
# File 'lib/paho.mqtt/packet_manager.rb', line 972

def parse_body(buffer)
  super(buffer)
  @id = shift_short(buffer)
  unless buffer.empty?
    raise "Extra bytes at end of Unsubscribe Acknowledgment packet"
  end
end