# `ZenohexPico`

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

- Zenoh:
  - https://zenoh.io/
  - https://github.com/eclipse-zenoh/zenoh-pico

For reusable connections, use `ZenohexPico.Session` directly.

# `get`

```elixir
@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`

```elixir
@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.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
