# `NervesHubLink`
[🔗](https://github.com/nerves-hub/nerves_hub_link/blob/v2.12.0/lib/nerves_hub_link.ex#L10)

The Device-side client for NervesHub.

The `:nerves_hub_link` Erlang application will start by default if installed
as a dependency and use provided configuration to connect to a NervesHub
server.

This module primarily provides utility functions for checking the status of
the connection and performing some operations such as reconnecting, sending
a file to a connected console and more.

# `update_status`

```elixir
@type update_status() ::
  :received
  | {:started, downloader_network_interface :: String.t() | nil}
  | {:downloading, non_neg_integer()}
  | {:updating, non_neg_integer()}
  | :completed
  | {:ignored, reason :: String.t()}
  | {:reschedule, delay_for :: pos_integer()}
  | {:reschedule, delay_for :: pos_integer(), reason :: String.t()}
  | {:failed, reason :: String.t()}
```

# `connected?`

```elixir
@spec connected?(GenServer.server()) :: boolean()
```

Checks if the device is connected to the NervesHub device channel.

# `console_active?`

```elixir
@spec console_active?(GenServer.server()) :: boolean()
```

Return whether there's currently an active console session

# `console_connected?`

```elixir
@spec console_connected?(GenServer.server()) :: boolean()
```

Checks if the device is connected to the NervesHub console channel.

# `extensions_connected?`

```elixir
@spec extensions_connected?(GenServer.server()) :: boolean()
```

Checks if the device is connected to the NervesHub extensions channel.

# `reconnect`

```elixir
@spec reconnect(GenServer.server()) :: :ok
```

Restart the socket and device channel

# `send_file`

```elixir
@spec send_file(GenServer.server(), Path.t()) ::
  :ok | {:error, :too_large | File.posix()}
```

Send a file to the connected console

# `send_update_status`

```elixir
@spec send_update_status(GenServer.server(), update_status()) :: :ok
```

Send an update status to web

# `socket_connected?`

```elixir
@spec socket_connected?(GenServer.server()) :: boolean()
```

Checks if the device has a socket connection with NervesHub

# `status`

```elixir
@spec status(GenServer.server()) :: NervesHubLink.UpdateManager.status()
```

Current status of the update manager

---

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