dbux v1.0.1 DBux.Type

Summary

Functions

Returns alignment size for given D-Bus type

Returns bitstring that contains 1-byte D-Bus signature of given type

Returns atom that contains atom identifying type

Parses signature in D-Bus format and returns it as a nested list in which simple types are represented as atoms and container types as tuples

Types

container_type_name ::
  :array |
  :struct |
  :variant |
  :dict_entry
list_of_types :: [] | [t]
simple_type_name ::
  :byte |
  :boolean |
  :int16 |
  :uint16 |
  :int32 |
  :uint32 |
  :int64 |
  :uint64 |
  :double |
  :string |
  :object_path |
  :signature |
  :unix_fd

Functions

align_size(arg1)

Specs

align_size(simple_type_name | container_type_name) :: number

Returns alignment size for given D-Bus type.

signature(arg1)

Specs

signature(simple_type | :variant) :: String.t

Returns bitstring that contains 1-byte D-Bus signature of given type.

Reverse function is type/1.

type(binary)

Specs

type(String.t) :: simple_type | :variant

Returns atom that contains atom identifying type.

Reverse function is signature/1.

type_from_signature(signature)

Specs

type_from_signature(String.t) :: list_of_types

Parses signature in D-Bus format and returns it as a nested list in which simple types are represented as atoms and container types as tuples.

For example, “yba{s(ui)}” will become [:byte, :boolean, {:array, [{:dict, [:string, {:struct, [:uint32, :int32]}]}]}].

First of all, it is much more convenient to have such structure if you want to recursively parse signature in Elixir, so it is used internally while demarshalling messages. It can also serve as validator for signatures.

It returns {:ok, list} in case of success, {:error, reason} otherwise.

It does most of the checks from the specification, but it does not check for dicts constraints at the moment.