Class: MQTT::SN::Packet::Advertise
- Inherits:
-
MQTT::SN::Packet
- Object
- MQTT::SN::Packet
- MQTT::SN::Packet::Advertise
- Defined in:
- lib/mqtt/sn/packet.rb
Constant Summary collapse
- DEFAULTS =
{ :gateway_id => 0x00, :duration => 0 }
Instance Attribute Summary collapse
-
#duration ⇒ Object
Returns the value of attribute duration.
-
#gateway_id ⇒ Object
Returns the value of attribute gateway_id.
Attributes inherited from MQTT::SN::Packet
#clean_session, #duplicate, #qos, #request_will, #retain, #topic_id_type
Instance Method Summary collapse
Methods inherited from MQTT::SN::Packet
#initialize, parse, #to_s, #type_id, #update_attributes
Constructor Details
This class inherits a constructor from MQTT::SN::Packet
Instance Attribute Details
#duration ⇒ Object
Returns the value of attribute duration.
184 185 186 |
# File 'lib/mqtt/sn/packet.rb', line 184 def duration @duration end |
#gateway_id ⇒ Object
Returns the value of attribute gateway_id.
183 184 185 |
# File 'lib/mqtt/sn/packet.rb', line 183 def gateway_id @gateway_id end |
Instance Method Details
#encode_body ⇒ Object
191 192 193 |
# File 'lib/mqtt/sn/packet.rb', line 191 def encode_body [gateway_id, duration].pack('Cn') end |
#parse_body(buffer) ⇒ Object
195 196 197 |
# File 'lib/mqtt/sn/packet.rb', line 195 def parse_body(buffer) self.gateway_id, self.duration = buffer.unpack('Cn') end |