Class: EventMachine::MQTTSN::Packet::Regack

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.



217
218
219
# File 'lib/em/mqtt-sn/packet.rb', line 217

def id
  @id
end

#return_codeObject

Returns the value of attribute return_code.



219
220
221
# File 'lib/em/mqtt-sn/packet.rb', line 219

def return_code
  @return_code
end

#topic_idObject

Returns the value of attribute topic_id.



218
219
220
# File 'lib/em/mqtt-sn/packet.rb', line 218

def topic_id
  @topic_id
end

Instance Method Details

#encode_bodyObject



226
227
228
# File 'lib/em/mqtt-sn/packet.rb', line 226

def encode_body
  [encode_topic_id, id, return_code].pack('nnC')
end

#parse_body(buffer) ⇒ Object



230
231
232
233
# File 'lib/em/mqtt-sn/packet.rb', line 230

def parse_body(buffer)
  topic_id, self.id, self.return_code = buffer.unpack('nnC')
  parse_topic_id(topic_id)
end