Class: MQTT::SN::Packet::Gwinfo
- Inherits:
-
MQTT::SN::Packet
- Object
- MQTT::SN::Packet
- MQTT::SN::Packet::Gwinfo
- Defined in:
- lib/mqtt/sn/packet.rb
Constant Summary collapse
- DEFAULTS =
{ gateway_id: 0, gateway_address: nil }.freeze
Instance Attribute Summary collapse
-
#gateway_address ⇒ Object
Returns the value of attribute gateway_address.
-
#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
#gateway_address ⇒ Object
Returns the value of attribute gateway_address.
212 213 214 |
# File 'lib/mqtt/sn/packet.rb', line 212 def gateway_address @gateway_address end |
#gateway_id ⇒ Object
Returns the value of attribute gateway_id.
212 213 214 |
# File 'lib/mqtt/sn/packet.rb', line 212 def gateway_id @gateway_id end |
Instance Method Details
#encode_body ⇒ Object
219 220 221 |
# File 'lib/mqtt/sn/packet.rb', line 219 def encode_body [gateway_id, gateway_address].pack('Ca*') end |
#parse_body(buffer) ⇒ Object
223 224 225 226 227 228 229 230 |
# File 'lib/mqtt/sn/packet.rb', line 223 def parse_body(buffer) if buffer.length > 1 self.gateway_id, self.gateway_address = buffer.unpack('Ca*') else self.gateway_id, _ignore = buffer.unpack('C') self.gateway_address = nil end end |