MqttCrystal::Packet::Connect
Inherits MqttCrystal::Packet / Reference / Object
Constants
CFLAG_CLEAN_SESSION = 2_u8
CFLAG_PASSWORD = 64_u8
CFLAG_USERNAME = 128_u8
CFLAG_WILL = 4_u8
CFLAG_WILL_RETAIN = 32_u8
PROTOCOL = "MQTT"
Constructors
new(client_id : String = UUID.random.to_s, username : String | Nil = nil, password : String | Nil = nil, protocol_level : UInt8 = 4_u8, keep_alive : UInt16 = 15_u16, clean_session : Bool = true, will_retain : Bool = false, will_topic : String | Nil = nil, will_qos : UInt8 = 0_u8, will_message : String | Nil = nil, flags : Array(Bool) = [false, false, false, false], body_length : UInt64 = 0_u64)
SourceInstance methods
clean_session
Sourceclean_session=(clean_session : Bool)
Sourceclient_id
Sourceencode_body
Sourcekeep_alive
Sourcekeep_alive=(keep_alive : UInt16)
Sourceparse_body(buffer : Array(UInt8))
byte[2..5] = 'MQTT' byte[6] = Protocol requires 4 for MQTTv3.1.1 byte[7] = cflags 7 - User Name Flag - is there a username 0x80 6 - Password Flag - is there a password 0x40 5 - Will Retain 0x20 - Sould the will be retained 4 - Will QoS 0x10 - 0b10 (qos2),0b01 (qos1), 0b00 (qos0) 3 - Will QoS 0x08 2 - Will Flag 0x04 - Should there be a will message published 1 - Clean Session 0x02 0 - RESERVED (always 0) 0x00 byte[8,9] = Keepalive (seconds) from ehre on 2 byte length N bytes payload, in order: Client Identifier, Will Topic, Will Message, User Name, Password
password
Sourceprotocol_level
Sourceprotocol_level=(protocol_level : UInt8)
Sourceusername
Sourcewill_message
Sourcewill_qos
Sourcewill_qos=(will_qos : UInt8)
Sourcewill_retain
Sourcewill_retain=(will_retain : Bool)
Sourcewill_topic
Source