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 }
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.
220 221 222 |
# File 'lib/mqtt/sn/packet.rb', line 220 def gateway_address @gateway_address end |
#gateway_id ⇒ Object
Returns the value of attribute gateway_id.
219 220 221 |
# File 'lib/mqtt/sn/packet.rb', line 219 def gateway_id @gateway_id end |
Instance Method Details
#encode_body ⇒ Object
226 227 228 |
# File 'lib/mqtt/sn/packet.rb', line 226 def encode_body [gateway_id,gateway_address].pack('Ca*') end |
#parse_body(buffer) ⇒ Object
230 231 232 233 234 235 236 237 |
# File 'lib/mqtt/sn/packet.rb', line 230 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 |