Exmbus.Parser.Tpl.Device (Exmbus v0.3.0)

View Source

A device type for the TPL header (also used in Wmbus DLL)

Examples

iex> decode(<<0x03>>)
{:ok, %Exmbus.Parser.Tpl.Device{id: 3}}

iex> encode(%Exmbus.Parser.Tpl.Device{id: 3})
{:ok, <<3>>}

iex> format(%Exmbus.Parser.Tpl.Device{id: 3})
"gas"

iex> format(0x03)
"gas"

Summary

Functions

decode a device byte into a Device struct

encode a Device struct into a byte

return a string describing the Device

Types

t()

@type t() :: %Exmbus.Parser.Tpl.Device{id: 0..255}

Functions

decode(arg)

@spec decode(binary()) :: {:ok, t()}

decode a device byte into a Device struct

encode(device)

@spec encode(t()) :: {:ok, binary()}

encode a Device struct into a byte

format(id)

@spec format(0..255 | t()) :: String.t()

return a string describing the Device