Class: PahoMqtt::Packet::Unsuback

Inherits:
Base
  • Object
show all
Defined in:
lib/paho_mqtt/packet/unsuback.rb

Constant Summary

Constants inherited from Base

Base::ATTR_DEFAULTS

Instance Attribute Summary

Attributes inherited from Base

#body_length, #flags, #id, #version

Instance Method Summary collapse

Methods inherited from Base

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



7
8
9
# File 'lib/paho_mqtt/packet/unsuback.rb', line 7

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

Instance Method Details

#encode_bodyObject

Get serialisation of packet’s body



12
13
14
# File 'lib/paho_mqtt/packet/unsuback.rb', line 12

def encode_body
  encode_short(@id)
end

#inspectObject

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



26
27
28
# File 'lib/paho_mqtt/packet/unsuback.rb', line 26

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

#parse_body(buffer) ⇒ Object

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



17
18
19
20
21
22
23
# File 'lib/paho_mqtt/packet/unsuback.rb', line 17

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