Class: EventMachine::MQTTSN::Packet::Register

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.



197
198
199
# File 'lib/em/mqtt-sn/packet.rb', line 197

def id
  @id
end

#topic_idObject

Returns the value of attribute topic_id.



198
199
200
# File 'lib/em/mqtt-sn/packet.rb', line 198

def topic_id
  @topic_id
end

#topic_nameObject

Returns the value of attribute topic_name.



199
200
201
# File 'lib/em/mqtt-sn/packet.rb', line 199

def topic_name
  @topic_name
end

Instance Method Details

#encode_bodyObject



206
207
208
# File 'lib/em/mqtt-sn/packet.rb', line 206

def encode_body
  [encode_topic_id, id, topic_name].pack('nna*')
end

#parse_body(buffer) ⇒ Object



210
211
212
213
# File 'lib/em/mqtt-sn/packet.rb', line 210

def parse_body(buffer)
  topic_id, self.id, self.topic_name = buffer.unpack('nna*')
  parse_topic_id(topic_id)
end