Packages
nerves_hub_link
2.2.0
2.12.0
2.11.1
2.11.0
retired
2.10.2
2.10.1
2.10.0
2.9.0
2.9.0-rc.3
2.9.0-rc.2
2.9.0-rc.1
2.8.1
2.8.0
2.7.3
2.7.2
2.7.0
retired
2.6.0
2.5.2
2.5.1
2.5.0
2.4.0
2.3.0
2.2.1
2.2.0
2.1.1
2.1.0
2.0.0
1.4.1
1.4.0
1.3.0
1.2.0
1.1.0
1.0.1
1.0.0
0.13.1
0.13.0
0.12.1
0.12.0
0.11.0
0.10.2
0.10.1
retired
0.10.0
retired
0.10.0-rc.0
0.9.4
0.9.3
0.9.2
0.9.1
0.9.0
0.8.2
0.8.1
0.8.0
0.7.6
Manage your Nerves fleet by connecting it to NervesHub
Current section
Files
Jump to
Current section
Files
lib/nerves_hub_link.ex
defmodule NervesHubLink do
alias NervesHubLink.Socket
@doc """
Checks if the device is connected to the NervesHub device channel.
"""
@spec connected? :: boolean()
def connected?() do
Socket.check_connection(:device)
end
def console_connected?() do
Socket.check_connection(:console)
end
@doc """
Checks if the device has a socket connection with NervesHub
"""
def socket_connected?() do
Socket.check_connection(:socket)
end
@doc """
Return whether there's currently an active console session
"""
@spec console_active?() :: boolean()
defdelegate console_active?, to: Socket
@doc """
Current status of the update manager
"""
@spec status :: NervesHubLink.UpdateManager.State.status()
defdelegate status(), to: NervesHubLink.UpdateManager
@doc """
Restart the socket and device channel
"""
@spec reconnect() :: :ok
defdelegate reconnect(), to: Socket
@doc """
Send update progress percentage for display in web
"""
@spec send_update_progress(non_neg_integer()) :: :ok
defdelegate send_update_progress(progress), to: Socket
@doc """
Send an update status to web
"""
@spec send_update_status(String.t() | atom()) :: :ok
defdelegate send_update_status(status), to: Socket
@doc """
Send a file to the connected console
"""
@spec send_file(Path.t()) :: :ok | {:error, :too_large | File.posix()}
defdelegate send_file(file_path), to: Socket
end