Class: EventMachine::MQTTSN::Packet::Publish
- Inherits:
-
EventMachine::MQTTSN::Packet
- Object
- EventMachine::MQTTSN::Packet
- EventMachine::MQTTSN::Packet::Publish
- Defined in:
- lib/em/mqtt-sn/packet.rb
Constant Summary collapse
- DEFAULTS =
{ :id => 0x00, :duplicate => false, :qos => 0, :retain => false, :topic_id_type => :normal }
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#id ⇒ Object
Returns the value of attribute id.
-
#topic_id ⇒ Object
Returns the value of attribute topic_id.
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
#data ⇒ Object
Returns the value of attribute data.
239 240 241 |
# File 'lib/em/mqtt-sn/packet.rb', line 239 def data @data end |
#id ⇒ Object
Returns the value of attribute id.
238 239 240 |
# File 'lib/em/mqtt-sn/packet.rb', line 238 def id @id end |
#topic_id ⇒ Object
Returns the value of attribute topic_id.
237 238 239 |
# File 'lib/em/mqtt-sn/packet.rb', line 237 def topic_id @topic_id end |
Instance Method Details
#encode_body ⇒ Object
249 250 251 |
# File 'lib/em/mqtt-sn/packet.rb', line 249 def encode_body [encode_flags, encode_topic_id, id, data].pack('Cnna*') end |
#parse_body(buffer) ⇒ Object
253 254 255 256 257 |
# File 'lib/em/mqtt-sn/packet.rb', line 253 def parse_body(buffer) flags, topic_id, self.id, self.data = buffer.unpack('Cnna*') parse_flags(flags) parse_topic_id(topic_id) end |