Class: EventMachine::MQTTSN::Packet::Subscribe

Inherits:
EventMachine::MQTTSN::Packet show all
Defined in:
lib/em/mqtt-sn/packet.rb

Constant Summary collapse

DEFAULTS =
{
  :id => 0x00,
  :topic_id_type => :normal
}

Instance Attribute Summary collapse

Attributes inherited from EventMachine::MQTTSN::Packet

#clean_session, #duplicate, #qos, #request_will, #retain, #topic_id_type

Instance Method Summary collapse

Methods inherited from EventMachine::MQTTSN::Packet

#initialize, parse, #to_s, #type_id, #update_attributes

Constructor Details

This class inherits a constructor from EventMachine::MQTTSN::Packet

Instance Attribute Details

#idObject

Returns the value of attribute id.



261
262
263
# File 'lib/em/mqtt-sn/packet.rb', line 261

def id
  @id
end

#topic_idObject

Returns the value of attribute topic_id.



262
263
264
# File 'lib/em/mqtt-sn/packet.rb', line 262

def topic_id
  @topic_id
end

#topic_nameObject

Returns the value of attribute topic_name.



263
264
265
# File 'lib/em/mqtt-sn/packet.rb', line 263

def topic_name
  @topic_name
end

Instance Method Details

#encode_bodyObject



270
271
272
# File 'lib/em/mqtt-sn/packet.rb', line 270

def encode_body
  [encode_flags, id, topic_name].pack('Cna*')
end

#parse_body(buffer) ⇒ Object



274
275
276
277
# File 'lib/em/mqtt-sn/packet.rb', line 274

def parse_body(buffer)
  flags, self.id, self.topic_name = buffer.unpack('Cna*')
  parse_flags(flags)
end