class MqttCrystal::Packet::Connect
- MqttCrystal::Packet::Connect
- MqttCrystal::Packet
- Reference
- Object
Defined in:
mqtt_crystal/packet.crConstant Summary
-
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
Instance Method Summary
- #clean_session : Bool
- #clean_session=(clean_session : Bool)
- #client_id : String
- #client_id=(client_id : String)
- #encode_body : Bytes
- #keep_alive : UInt16
- #keep_alive=(keep_alive : UInt16)
-
#parse_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 : String?
- #password=(password : Nil | String)
- #protocol_level : UInt8
- #protocol_level=(protocol_level : UInt8)
- #username : String?
- #username=(username : Nil | String)
- #will_message : String?
- #will_message=(will_message : Nil | String)
- #will_qos : UInt8
- #will_qos=(will_qos : UInt8)
- #will_retain : Bool
- #will_retain=(will_retain : Bool)
- #will_topic : String?
- #will_topic=(will_topic : Nil | String)
Instance methods inherited from class MqttCrystal::Packet
_extract_string!(buffer : Array(UInt8), index : Int32 = 0) : String
_extract_string!,
body_length : UInt64
body_length,
body_length=(body_length : UInt64)
body_length=,
bytes : Bytes
bytes,
check_remaining_length(bytes : Array(UInt8)) : NamedTuple(pos: UInt8, body_length: UInt64)
check_remaining_length,
concatenate(*args) : Bytes
concatenate,
decode_short(buffer : Array(UInt8), index : Int32) : UInt16
decode_short,
encode_body : Bytes
encode_body,
encode_header : UInt8
encode_header,
encode_short(n : UInt16) : Bytes
encode_short,
encode_string(str : String) : Bytesencode_string(strings : Array(String)) : Bytes encode_string, flags : Array(Bool) flags, flags=(flags : Array(Bool)) flags=, parse_body(buffer : Array(UInt8)) parse_body, slice_it(a : Array(UInt8)) : Bytes slice_it, type_id : Int32 type_id, validate_flags validate_flags
Constructor methods inherited from class MqttCrystal::Packet
new(flags : Array(Bool) = [false, false, false, false], body_length : UInt64 = 0_u64)
new
Class methods inherited from class MqttCrystal::Packet
create_from_header(byte : UInt8)
create_from_header,
parse(bytes : Array(UInt8)) : Packet | Nil
parse,
slice_it(a : String) : Bytesslice_it(a : Array(UInt8)) : Bytes slice_it
Constructor Detail
Instance Method Detail
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