class MQTT::V5::Property

Overview

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

Defined in:

mqtt/v5/property.cr

Constant Summary

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 Method Summary

Instance Method Summary

Class Method Detail

def self.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


[View source]

Instance Method Detail

def __format__ : IO::ByteFormat #

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.


[View source]
def binary? : Bool #

[View source]
def byte_value : UInt8 #

def byte_value=(byte_value : UInt8) #

def bytesize : Int32 #

Bytes this property occupies on the wire


[View source]
def data : Bytes #

def data=(data : Bytes) #

def data_size : UInt16 #

def data_size=(data_size : UInt16) #

def four_byte_value : UInt32 #

def four_byte_value=(four_byte_value : UInt32) #

def identifier : PropertyId #

def identifier=(identifier : PropertyId) #

def key : String #

def key=(key : String) #

def 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


def 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


def pair? : Bool #

[View source]
def string? : Bool #

[View source]
def two_byte_value : UInt16 #

def two_byte_value=(two_byte_value : UInt16) #

def value : String #

def value=(value : String) #

def value_size : UInt16 #

def value_size=(value_size : UInt16) #

def variable_byte? : Bool #

[View source]
def variable_value : UInt32 #

The variable byte integer value, decoded


[View source]
def variable_value=(value : UInt32) : UInt32 #

[View source]
def vbi1 : UInt8 #

variable byte integer, a continuation bit per byte


def vbi1=(vbi1 : UInt8) #

variable byte integer, a continuation bit per byte


def vbi2 : UInt8 #

def vbi2=(vbi2 : UInt8) #

def vbi3 : UInt8 #

def vbi3=(vbi3 : UInt8) #

def vbi4 : UInt8 #

def vbi4=(vbi4 : UInt8) #