ZenohexPico (zenohex_pico v0.1.0-alpha.1)

Copy Markdown

ZenohexPico is a thin Elixir wrapper around Zenoh-Pico, implemented using C.

For reusable connections, use ZenohexPico.Session directly.

Summary

Functions

Query data with the given selector.

Publishes a payload to the specified key_expr.

Functions

get(config, selector, timeout, opts \\ [])

@spec get(
  ZenohexPico.Config.t(),
  String.t(),
  pos_integer(),
  ZenohexPico.Session.get_opts()
) ::
  {:ok, [ZenohexPico.Sample.t() | ZenohexPico.Query.ReplyError.t()]}
  | {:error, :timeout}
  | {:error, reason :: term()}

Query data with the given selector.

Internally opens a session, performs the query, and ensures the session is closed.

Parameters

  • config : The configuration used to open the session.
  • selector : The selector to query.
  • timeout : Timeout in milliseconds to wait for query replies.
  • opts : Additional options. See ZenohexPico.Session.get/4 for details.

put(config, key_expr, payload, opts \\ [])

@spec put(
  ZenohexPico.Config.t(),
  String.t(),
  binary(),
  ZenohexPico.Session.put_opts()
) ::
  :ok | {:error, reason :: term()}

Publishes a payload to the specified key_expr.

Internally opens a session, performs the publish, and ensures the session is closed.

Parameters

  • config : The configuration used to open the session.
  • key_expr : The key expression to publish to.
  • payload : The binary payload to publish.
  • opts : Additional options. See ZenohexPico.Session.put/4 for details.