Bluez.Variant (bluez v0.1.0)

Copy Markdown View Source

Unwraps org.bluez D-Bus property maps (as decoded by rebus) into plain Elixir maps for Bluez.Advert.

rebus decodes an a{sv} dict to a list of {key, {signature, value}} and a variant to {signature, value}. This module strips those wrappers, with two special cases that are themselves nested dicts of byte arrays:

  • ManufacturerData (a{qv}): [{company_id, {"ay", bytes}}]%{company_id => binary}
  • ServiceData (a{sv}): [{uuid, {"ay", bytes}}]%{uuid => binary}

Pure and host-testable — this is the main parse seam between raw D-Bus wire data and advert reconstruction.

Summary

Functions

Unwrap a decoded a{sv} property list into a %{name => value} map.

Functions

unwrap_props(props_list)

@spec unwrap_props([{String.t(), term()}]) :: %{optional(String.t()) => term()}

Unwrap a decoded a{sv} property list into a %{name => value} map.