# `VintageNetWizard.Backend`
[🔗](https://github.com/nerves-networking/vintage_net_wizard/blob/v0.4.17/lib/vintage_net_wizard/backend.ex#L1)

Backends define the boundaries of getting access points, handling incoming
messages, and scanning the network

# `configuration_status`

```elixir
@type configuration_status() :: :not_configured | :good | :bad
```

# `device_info_name`

```elixir
@type device_info_name() :: String.t()
```

# `device_info_value`

```elixir
@type device_info_value() :: String.t()
```

# `opt`

```elixir
@type opt() ::
  {:device_info, [{device_info_name(), device_info_value()}]}
  | {:configurations, [map()]}
```

# `access_points`

```elixir
@callback access_points(state :: any()) :: [VintageNetWiFi.AccessPoint.t()]
```

Get all the access points that the backend knowns about

# `apply`

```elixir
@callback apply([map()], state :: any()) ::
  {:ok, state :: any()} | {:error, :invalid_state}
```

Apply the WiFi configurations

The configurations passed are network configurations that can be passed into
the `:network` list in a `VintageNetWiFi` configuration.

# `complete`

```elixir
@callback complete([map()], state :: any()) :: {:ok, state :: any()}
```

Perform final completion steps for the network configurations

# `configuration_status`

```elixir
@callback configuration_status(state :: any()) :: configuration_status()
```

Return the configuration status of a configuration that has been applied

# `handle_info`

```elixir
@callback handle_info(any(), state :: any()) ::
  {:reply, any(), state :: any()} | {:noreply, state :: any()}
```

Handle any message the is received by another process

If you want the socket to send data to the client
return `{:reply, message, state}`, otherwise return
`{:noreply, state}`

# `init`

```elixir
@callback init(VintageNet.ifname(), VintageNet.ifname()) :: state :: any()
```

Do any initialization work like subscribing to messages

Will be passed the interface names that the backend should use to scan and to set AP mode. By default
both will be `"wlan0"`. If you want to use different interface names you
can pass them in as options to `VintageNetWizard.run_wizard/1`.

# `reset`

```elixir
@callback reset(state :: any()) :: state :: any()
```

Apply any actions required to set the backend back to an
initial default state

# `start_scan`

```elixir
@callback start_scan(state :: any()) :: state :: any()
```

Start scanning for WiFi access points

# `stop_scan`

```elixir
@callback stop_scan(state :: any()) :: state :: any()
```

Stop the scan for WiFi access points

---

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