Class: MQTT::SN::Packet::Advertise
- Defined in:
- lib/mqtt/sn/packet.rb
Constant Summary collapse
- DEFAULTS =
{ gateway_id: 0x00, duration: 0 }.freeze
Constants inherited from Packet
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 Packet
#body_length, #flags, #id, #version
Instance Method Summary collapse
Methods inherited from Packet
create_from_header, #dup, #initialize, #inspect, #message_id, #message_id=, parse, parse_header, read, read_byte, #to_s, #type_id, #type_name, #update_attributes, #validate_flags
Constructor Details
This class inherits a constructor from MQTT::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 |