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 }.freeze
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.
179 180 181 |
# File 'lib/mqtt/sn/packet.rb', line 179 def duration @duration end |
#gateway_id ⇒ Object
Returns the value of attribute gateway_id.
178 179 180 |
# File 'lib/mqtt/sn/packet.rb', line 178 def gateway_id @gateway_id end |
Instance Method Details
#encode_body ⇒ Object
186 187 188 |
# File 'lib/mqtt/sn/packet.rb', line 186 def encode_body [gateway_id, duration].pack('Cn') end |
#parse_body(buffer) ⇒ Object
190 191 192 |
# File 'lib/mqtt/sn/packet.rb', line 190 def parse_body(buffer) self.gateway_id, self.duration = buffer.unpack('Cn') end |