Class: EventMachine::MQTTSN::Packet::Connack
- Inherits:
-
EventMachine::MQTTSN::Packet
- Object
- EventMachine::MQTTSN::Packet
- EventMachine::MQTTSN::Packet::Connack
- Defined in:
- lib/em/mqtt-sn/packet.rb
Constant Summary
Constants inherited from EventMachine::MQTTSN::Packet
Instance Attribute Summary collapse
-
#return_code ⇒ Object
Returns the value of attribute return_code.
Attributes inherited from EventMachine::MQTTSN::Packet
#clean_session, #duplicate, #qos, #request_will, #retain, #topic_id_type
Instance Method Summary collapse
- #encode_body ⇒ Object
- #parse_body(buffer) ⇒ Object
-
#return_msg ⇒ Object
Get a string message corresponding to a return code.
Methods inherited from EventMachine::MQTTSN::Packet
#initialize, parse, #to_s, #type_id, #update_attributes
Constructor Details
This class inherits a constructor from EventMachine::MQTTSN::Packet
Instance Attribute Details
#return_code ⇒ Object
Returns the value of attribute return_code.
169 170 171 |
# File 'lib/em/mqtt-sn/packet.rb', line 169 def return_code @return_code end |
Instance Method Details
#encode_body ⇒ Object
187 188 189 |
# File 'lib/em/mqtt-sn/packet.rb', line 187 def encode_body [return_code].pack('C') end |
#parse_body(buffer) ⇒ Object
191 192 193 |
# File 'lib/em/mqtt-sn/packet.rb', line 191 def parse_body(buffer) self.return_code = buffer.unpack('C')[0] end |
#return_msg ⇒ Object
Get a string message corresponding to a return code
172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
# File 'lib/em/mqtt-sn/packet.rb', line 172 def return_msg case return_code when 0x00 "Accepted" when 0x01 "Rejected: congestion" when 0x02 "Rejected: invalid topic ID" when 0x03 "Rejected: not supported" else "Rejected: error code #{return_code}" end end |