module TLV::Helpers

Defined in:

tlv/helpers.cr

Class Method Summary

Class Method Detail

def self.get_array(hash : Hash(Tag, Value), tag : Int32) : Array(Value) | Nil #

Get array field by tag


[View source]
def self.get_bool(hash : Hash(Tag, Value), tag : Int32, default : Bool = false) : Bool #

Get boolean field by tag


[View source]
def self.get_by_tag(hash : Hash(Tag, Value), tag : Int32) : Value | Nil #

Safely get a value from a TLV hash by tag, trying multiple tag type variations


[View source]
def self.get_bytes(hash : Hash(Tag, Value), tag : Int32) : Bytes | Nil #

Get bytes field by tag


[View source]
def self.get_hash(hash : Hash(Tag, Value), tag : Int32) : Hash(Tag, Value) | Nil #

Get hash/structure field by tag


[View source]
def self.get_int(hash : Hash(Tag, Value), tag : Int32) : Int32 | Nil #

Get integer field by tag, handling different integer types


[View source]
def self.get_uint16(hash : Hash(Tag, Value), tag : Int32) : UInt16 | Nil #

Get UInt16 field by tag


[View source]
def self.get_uint32(hash : Hash(Tag, Value), tag : Int32) : UInt32 | Nil #

Get UInt32 field by tag


[View source]
def self.parse_attribute_path(value : Value) : Tuple(UInt16 | Nil, UInt32 | Nil, UInt32 | Nil) #

Parse attribute path from either list-form or structure-form List-form: [endpoint, cluster, attribute] Structure-form: {2 => endpoint, 3 => cluster, 4 => attribute}


[View source]
def self.unwrap_anonymous(hash : Hash(Tag, Value)) : Hash(Tag, Value) #

Extract from "Any" anonymous structure


[View source]