Systemd.DBus (systemd v0.1.0-pre.1)

Copy Markdown View Source

Small D-Bus client wrapper used by the systemd API.

This module intentionally keeps the surface tiny: connect to a bus and perform method calls, returning structured results or structured errors.

Summary

Functions

Sends a method call and returns a structured D-Bus result.

Sends a method call and returns only the decoded D-Bus body.

Connects to a D-Bus bus.

Types

bus()

@type bus() ::
  :system | :session | %{:family => :local | :inet, optional(atom()) => term()}

call_option()

@type call_option() ::
  {:destination, String.t()}
  | {:path, String.t()}
  | {:interface, String.t()}
  | {:member, String.t()}
  | {:signature, String.t()}
  | {:body, [term()]}

Functions

call(conn, opts)

@spec call(pid(), [call_option()]) ::
  {:ok, Systemd.DBus.Result.t()} | {:error, Systemd.Error.t()}

Sends a method call and returns a structured D-Bus result.

call_body(conn, opts)

@spec call_body(pid(), [call_option()]) ::
  {:ok, [term()]} | {:error, Systemd.Error.t()}

Sends a method call and returns only the decoded D-Bus body.

connect(bus \\ :system, opts \\ [])

@spec connect(
  bus(),
  keyword()
) :: {:ok, pid()} | {:error, Systemd.Error.t()}

Connects to a D-Bus bus.

Defaults to the system bus because systemd exposes its manager API there.