class MQTT::V3::Connect

Overview

Class representing an MQTT Connect Packet

Defined in:

mqtt/v3/connect.cr

Constant Summary

ENDIAN = ["big"]

Class representing an MQTT Connect Packet

KLASS_NAME = [MQTT::V3::Connect]

Class representing an MQTT Connect Packet

PARTS = [{type: "basic", name: name_size, cls: UInt16, onlyif: nil, verify: nil, value: -> do name.bytesize end, endian: nil}, {type: "string", name: name, cls: String, onlyif: nil, verify: nil, length: -> do name_size end, value: nil, encoding: nil}, {type: "enum", name: version, cls: typeof(Version::V311.value), onlyif: nil, verify: nil, value: nil, encoding: nil, enum_type: MQTT::Version}, {type: "bitfield", name: 2, cls: MQTT::V3::Connect, onlyif: nil, verify: nil}, {type: "basic", name: keep_alive_seconds, cls: UInt16, onlyif: nil, verify: nil, value: nil, endian: nil}, {type: "basic", name: client_id_size, cls: UInt16, onlyif: nil, verify: nil, value: -> do client_id.bytesize end, endian: nil}, {type: "string", name: client_id, cls: String, onlyif: nil, verify: nil, length: -> do client_id_size end, value: nil, encoding: nil}, {type: "basic", name: will_topic_size, cls: UInt16, onlyif: -> do will_flag end, verify: nil, value: -> do will_topic.bytesize end, endian: nil}, {type: "string", name: will_topic, cls: String, onlyif: -> do will_flag end, verify: nil, length: -> do will_topic_size end, value: nil, encoding: nil}, {type: "basic", name: will_payload_size, cls: UInt16, onlyif: -> do will_flag end, verify: nil, value: -> do will_payload.bytesize end, endian: nil}, {type: "string", name: will_payload, cls: String, onlyif: -> do will_flag end, verify: nil, length: -> do will_payload_size end, value: nil, encoding: nil}, {type: "basic", name: username_size, cls: UInt16, onlyif: -> do has_username end, verify: nil, value: -> do username.bytesize end, endian: nil}, {type: "string", name: username, cls: String, onlyif: -> do has_username end, verify: nil, length: -> do username_size end, value: nil, encoding: nil}, {type: "basic", name: password_size, cls: UInt16, onlyif: -> do has_password end, verify: nil, value: -> do password.bytesize end, endian: nil}, {type: "string", name: password, cls: String, onlyif: -> do has_password end, verify: nil, length: -> do password_size end, value: nil, encoding: nil}] of Nil

Class representing an MQTT Connect Packet

REMAINING = [] of Nil

Class representing an MQTT Connect Packet

Class Method Summary

Macro Summary

Instance Method Summary

Instance methods inherited from class MQTT::V3::Header

__format__ : IO::ByteFormat __format__, duplicate : Bool duplicate, duplicate=(duplicate : UInt8)
duplicate=(value : Bool)
duplicate=
, id : MQTT::RequestType id, id=(id : UInt8)
id=(value : MQTT::RequestType)
id=
, packet_length : UInt32 packet_length, packet_length=(size : UInt32) : UInt32 packet_length=, qos : MQTT::QoS qos, qos=(qos : UInt8)
qos=(value : MQTT::QoS)
qos=
, qos? qos?, retain : Bool retain, retain=(retain : UInt8)
retain=(value : Bool)
retain=
, variable_length1 : UInt8 variable_length1, variable_length1=(variable_length1 : UInt8) variable_length1=, variable_length2 : UInt8 variable_length2, variable_length2=(variable_length2 : UInt8) variable_length2=, variable_length3 : UInt8 variable_length3, variable_length3=(variable_length3 : UInt8) variable_length3=, variable_length4 : UInt8 variable_length4, variable_length4=(variable_length4 : UInt8) variable_length4=

Class methods inherited from class MQTT::V3::Header

bit_fields bit_fields

Macros inherited from class MQTT::V3::Header

mqtt_v3_header(name, onlyif = nil, verify = nil, value = nil) mqtt_v3_header

Class Method Detail

def self.bit_fields #

Class representing an MQTT Connect Packet


[View source]

Macro Detail

macro mqtt_v3_ack(name, onlyif = nil, verify = nil, value = nil) #

Class representing an MQTT Connect Packet


[View source]
macro mqtt_v3_connack(name, onlyif = nil, verify = nil, value = nil) #

Class representing an MQTT Connect Packet


[View source]
macro mqtt_v3_connect(name, onlyif = nil, verify = nil, value = nil) #

Class representing an MQTT Connect Packet


[View source]
macro mqtt_v3_header(name, onlyif = nil, verify = nil, value = nil) #

Class representing an MQTT Connect Packet


[View source]

Instance Method Detail

def __format__ : IO::ByteFormat #

[View source]
def _reserved_ : UInt8 #

def _reserved_=(_reserved_ : UInt8) #

def calculate_length : UInt32 #

Packet length, excluding header


[View source]
def clean_start : Bool #

Set to false to keep a persistent session with the server http://www.steves-internet-guide.com/mqtt-clean-sessions-example/


[View source]
def clean_start=(clean_start : UInt8) #

Set to false to keep a persistent session with the server http://www.steves-internet-guide.com/mqtt-clean-sessions-example/


def clean_start=(value : Bool) #

Set to false to keep a persistent session with the server http://www.steves-internet-guide.com/mqtt-clean-sessions-example/


[View source]
def client_id : String #

def client_id=(client_id : String) #

def client_id_size : UInt16 #

def client_id_size=(client_id_size : UInt16) #

def has_password : Bool #

[View source]
def has_password=(has_password : UInt8) #

def has_password=(value : Bool) #

[View source]
def has_username : Bool #

[View source]
def has_username=(has_username : UInt8) #

def has_username=(value : Bool) #

[View source]
def keep_alive_seconds : UInt16 #

def keep_alive_seconds=(keep_alive_seconds : UInt16) #

def name : String #

def name=(name : String) #

def name_size : UInt16 #

def name_size=(name_size : UInt16) #

def password : String #

def password=(str : String) #

[View source]
def password_size : UInt16 #

def password_size=(password_size : UInt16) #

def username : String #

def username=(str : String) #

[View source]
def username_size : UInt16 #

def username_size=(username_size : UInt16) #

def version : Version #

The version number of the protocol


def version=(version : Version) #

The version number of the protocol


def will_flag : Bool #

flag to indicate if the will topic will be set


[View source]
def will_flag=(will_flag : UInt8) #

flag to indicate if the will topic will be set


def will_flag=(value : Bool) #

flag to indicate if the will topic will be set


[View source]
def will_payload : String #

def will_payload=(will_payload : String) #

def will_payload_size : UInt16 #

def will_payload_size=(will_payload_size : UInt16) #

def will_qos : MQTT::QoS #

The QoS level to send the Will message as


[View source]
def will_qos=(will_qos : UInt8) #

The QoS level to send the Will message as


def will_qos=(value : MQTT::QoS) #

The QoS level to send the Will message as


[View source]
def will_retain : Bool #

Set to true to make the Will message retained


[View source]
def will_retain=(will_retain : UInt8) #

Set to true to make the Will message retained


def will_retain=(value : Bool) #

Set to true to make the Will message retained


[View source]
def will_topic : String #

def will_topic=(str : String) #

[View source]
def will_topic_size : UInt16 #

def will_topic_size=(will_topic_size : UInt16) #