class

MQTT::V5::Property

Inherits BinData / Reference / Object

One property: an identifier followed by exactly one value.

onlyif picks the value's encoding from the identifier that was just read, which is what lets the whole property system stay declarative

Constants

AFTER_DESERIALIZE = [] of Nil

One property: an identifier followed by exactly one value.

onlyif picks the value's encoding from the identifier that was just read, which is what lets the whole property system stay declarative

BEFORE_SERIALIZE = [] of Nil

One property: an identifier followed by exactly one value.

onlyif picks the value's encoding from the identifier that was just read, which is what lets the whole property system stay declarative

ENDIAN = ["big"]

One property: an identifier followed by exactly one value.

onlyif picks the value's encoding from the identifier that was just read, which is what lets the whole property system stay declarative

KLASS_NAME = [MQTT::V5::Property]

One property: an identifier followed by exactly one value.

onlyif picks the value's encoding from the identifier that was just read, which is what lets the whole property system stay declarative

PARTS = [{type: "enum", name: identifier, cls: typeof(PropertyId::UserProperty.value), onlyif: nil, verify: nil, value: nil, encoding: nil, enum_type: MQTT::V5::PropertyId}, {type: "basic", name: byte_value, cls: UInt8, onlyif: -> do identifier.data_type.byte? end, verify: nil, value: nil, endian: nil}, {type: "basic", name: two_byte_value, cls: UInt16, onlyif: -> do identifier.data_type.two_byte? end, verify: nil, value: nil, endian: nil}, {type: "basic", name: four_byte_value, cls: UInt32, onlyif: -> do identifier.data_type.four_byte? end, verify: nil, value: nil, endian: nil}, {type: "basic", name: vbi1, cls: UInt8, onlyif: -> do variable_byte? end, verify: nil, value: nil, endian: nil}, {type: "basic", name: vbi2, cls: UInt8, onlyif: -> do variable_byte? && (vbi1 & 128) > 0 end, verify: nil, value: nil, endian: nil}, {type: "basic", name: vbi3, cls: UInt8, onlyif: -> do variable_byte? && (vbi2 & 128) > 0 end, verify: nil, value: nil, endian: nil}, {type: "basic", name: vbi4, cls: UInt8, onlyif: -> do variable_byte? && (vbi3 & 128) > 0 end, verify: nil, value: nil, endian: nil}, {type: "basic", name: key_size, cls: UInt16, onlyif: -> do string? end, verify: nil, value: -> do key.bytesize end, endian: nil}, {type: "string", name: key, cls: String, onlyif: -> do string? end, verify: nil, length: -> do key_size end, value: nil, encoding: nil}, {type: "basic", name: value_size, cls: UInt16, onlyif: -> do pair? end, verify: nil, value: -> do value.bytesize end, endian: nil}, {type: "string", name: value, cls: String, onlyif: -> do pair? end, verify: nil, length: -> do value_size end, value: nil, encoding: nil}, {type: "basic", name: data_size, cls: UInt16, onlyif: -> do binary? end, verify: nil, value: -> do data.size end, endian: nil}, {type: "bytes", name: data, cls: Slice(UInt8), onlyif: -> do binary? end, verify: nil, length: -> do data_size end, value: nil}] of Nil

One property: an identifier followed by exactly one value.

onlyif picks the value's encoding from the identifier that was just read, which is what lets the whole property system stay declarative

REMAINING = [] of Nil

One property: an identifier followed by exactly one value.

onlyif picks the value's encoding from the identifier that was just read, which is what lets the whole property system stay declarative

Class methods

bit_fields

One property: an identifier followed by exactly one value.

onlyif picks the value's encoding from the identifier that was just read, which is what lets the whole property system stay declarative

Source

Instance methods

__format__

A group or bit_field captures the endianness at its declaration point, so declaring endian after one would silently leave it system-endian. Fail loudly.

Source
binary?
Source
byte_value
byte_value=(byte_value : UInt8)
bytesize

Bytes this property occupies on the wire

Source
data
data=(data : Bytes)
data_size
data_size=(data_size : UInt16)
four_byte_value
four_byte_value=(four_byte_value : UInt32)
identifier
identifier=(identifier : PropertyId)
key
key=(key : String)
key_size

a string pair is simply two strings back to back, so the first one shares its encoding with a plain UTF-8 string

key_size=(key_size : UInt16)

a string pair is simply two strings back to back, so the first one shares its encoding with a plain UTF-8 string

pair?
Source
string?
Source
two_byte_value
two_byte_value=(two_byte_value : UInt16)
value
value=(value : String)
value_size
value_size=(value_size : UInt16)
variable_byte?
Source
variable_value

The variable byte integer value, decoded

Source
variable_value=(value : UInt32) : UInt32
Source
vbi1

variable byte integer, a continuation bit per byte

vbi1=(vbi1 : UInt8)

variable byte integer, a continuation bit per byte

vbi2
vbi2=(vbi2 : UInt8)
vbi3
vbi3=(vbi3 : UInt8)
vbi4
vbi4=(vbi4 : UInt8)