# `BB.Camera.Discovery`
[🔗](https://github.com/beam-bots/bb_camera/blob/main/lib/bb/camera/discovery.ex#L5)

Finds the cameras a robot declares.

A static walk of the robot's DSL - the robot-level `sensors` section plus
every link and joint in the topology - keeping the sensors whose callback
module implements `BB.Camera`. It needs nothing running, which is the point:
a camera that should be there and isn't is exactly what an operator needs to
see, and a UI that can only list cameras once they work is no use while
something is broken.

Live hubs are merged in where they exist, so a single pass gives both the
declared set and the running state.

# `camera?`

```elixir
@spec camera?(module()) :: boolean()
```

Whether `module` is a camera driver.

# `declared`

```elixir
@spec declared(module()) :: [{BB.Dsl.Sensor.t(), [atom()], BB.Camera.Info.t()}]
```

The declared sensors of `robot` that are cameras, with their topology
position.

Returns `{%BB.Dsl.Sensor{}, parent_path, attached_to}` tuples, options and
all. Internal: the options are what `c:BB.Camera.stream_info/1` needs and are
deliberately not carried into `BB.Camera.Info`.

# `discover`

```elixir
@spec discover(module()) :: [BB.Camera.Info.t()]
```

Every camera `robot` declares, running or not.

# `hub_pid`

```elixir
@spec hub_pid(module(), atom()) :: pid() | :undefined
```

The hub serving a camera, or `:undefined`.

A robot that has never started has no registry at all, and asking one that
doesn't exist raises rather than answering. Everything here has to work on
stopped robots, so the absence of the registry is just another way of saying
nothing is running.

---

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