NervesHubLink (nerves_hub_link v2.7.0)

View Source

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.

Summary

Functions

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

Return whether there's currently an active console session

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

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

Restart the socket and device channel

Send a file to the connected console

Send update progress percentage for display in web

Send an update status to web

Checks if the device has a socket connection with NervesHub

Current status of the update manager

Functions

connected?()

@spec connected?() :: boolean()

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

console_active?()

@spec console_active?() :: boolean()

Return whether there's currently an active console session

console_connected?()

@spec console_connected?() :: boolean()

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

extensions_connected?()

@spec extensions_connected?() :: boolean()

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

reconnect()

@spec reconnect() :: :ok

Restart the socket and device channel

send_file(file_path)

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

Send a file to the connected console

send_update_progress(progress)

@spec send_update_progress(non_neg_integer()) :: :ok

Send update progress percentage for display in web

send_update_status(status)

@spec send_update_status(String.t() | atom()) :: :ok

Send an update status to web

socket_connected?()

@spec socket_connected?() :: boolean()

Checks if the device has a socket connection with NervesHub

status()

Current status of the update manager