struct Connect
Overview
Fixed header for CONNECT PACKET
7 3 0
+--------------------------+--------------------------+
| CONNECT (1) NIBBLE | RESERVED | 0
+--------------------------+--------------------------+
| Remaining Len = Len of Varable header(10) + Payload | 1
+-----------------------------------------------------+
Variable header ( LENGTH = 10 Bytes)
+--------------------------+--------------------------+
| PROTOCOL Name Length MSB (VALUE = 0) | 2
+-----------------------------------------------------+
+--------------------------+--------------------------+
| PROTOCOL Name Length LSB (VALUE = 4) | 3
+-----------------------------------------------------+
+--------------------------+--------------------------+
| M | 4
+-----------------------------------------------------+
+--------------------------+--------------------------+
| Q | 5
+-----------------------------------------------------+
+--------------------------+--------------------------+
| T | 6
+-----------------------------------------------------+
+--------------------------+--------------------------+
| T | 7
+-----------------------------------------------------+
+--------------------------+--------------------------+
| PROTOCOL LEVEL (VALUE = 4 for MQTT 3.1.1) | 8
+-----------------------------------------------------+
+--------------------------+--------------------------+
| CONNECT FLAGS |
| UN(1 bit), PW(1), WR(1), WQ(2), W(1), CS(1), R(1) | 9
+-----------------------------------------------------+
+--------------------------+--------------------------+
| KEEP ALIVE MSB | 10
+-----------------------------------------------------+
+--------------------------+--------------------------+
| KEEP ALIVE LSB | 11
+-----------------------------------------------------+
Payload: Set these optionals depending on CONNECT flags in variable header
2 bytes client id length + client id
+
2 bytes len of will topic + will topic
+
2 bytes len of will payload + will payload
+
2 bytes len of username + username
+
2 bytes len of password + password
Defined in:
crymq/mqtt.crConstructors
Instance Method Summary
Instance methods inherited from struct Control
write_mqtt_string(io : IO, s : String)
write_mqtt_string,
write_remaining_length(io : IO, remaining_len)
write_remaining_length
Constructor methods inherited from struct Control
new
new
Constructor Detail
def self.new(client_id : String = "", keep_alive : UInt16 = 30_u16, clean_session : Bool = true, username : String = "", password : String = "")
#