# `BB.Transmission.Resolver`
[🔗](https://github.com/beam-bots/bb/blob/main/lib/bb/transmission/resolver.ex#L5)

Resolve an attachment's transmission against the runtime parameter store.

Transmissions are properties of individual attachments — actuators and
joint-attached sensors. Their fields (`reduction`, `offset`, `reversed?`)
may be literal values or `BB.Dsl.ParamRef` references. At compile time the
parameterised fields appear as `nil` on the optimised attachment info and
the parameter paths are recorded in `BB.Robot.param_subscriptions`. This
module fills the `nil` fields in with current parameter values at process
startup and re-resolves when the parameter changes.

# `field`

```elixir
@type field() :: :reduction | :offset | :reversed?
```

# `kind`

```elixir
@type kind() :: :actuator | :sensor
```

# `subscriptions`

```elixir
@type subscriptions() :: %{required(field()) =&gt; [atom()]}
```

# `handle_change`

```elixir
@spec handle_change(
  [atom()],
  BB.Transmission.t(),
  subscriptions(),
  module(),
  kind(),
  atom()
) :: {:changed, BB.Transmission.t()} | :ignored
```

Re-resolve the transmission after a parameter change.

Call from a server's `handle_info` when a `[:param | path]` message
arrives. Returns `{:changed, new_transmission}` if the change affects
this transmission, or `:ignored` otherwise.

# `resolve`

```elixir
@spec resolve(module(), kind(), atom()) :: BB.Transmission.t() | nil
```

Resolve an attachment's transmission against the current parameter store
without subscribing to changes.

Suitable for one-shot lookups from helpers that don't run as a long-lived
process (e.g. `BB.Actuator.publish_begin_motion/3`). Returns the resolved
transmission, or `nil` if the attachment has no transmission.

# `resolve_and_subscribe`

```elixir
@spec resolve_and_subscribe(module(), kind(), atom()) ::
  {BB.Transmission.t() | nil, subscriptions()}
```

Resolve an attachment's transmission for use by a server process and
subscribe to parameter changes for any parameterised fields.

Returns `{resolved_transmission_or_nil, subscriptions_map}`. The
subscriptions map maps each transmission field that came from a `param/1`
reference to its parameter path; the empty map means everything was a
literal at compile time.

When the attachment has no transmission, returns `{nil, %{}}` and
subscribes to nothing.

---

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