NervesDiscovery (nerves_discovery v0.1.0)

View Source

Discover Nerves devices on the local network using mDNS.

Supports macOS (dns-sd), Linux (avahi), and other platforms (generic OTP).

Summary

Types

Options for discover/1

Information about each found Nerves device

Functions

Discover Nerves devices on the local network.

Types

options()

@type options() :: [
  timeout: non_neg_integer(),
  method: :auto | :macos | :avahi | :generic
]

Options for discover/1

result()

@type result() :: %{
  name: String.t(),
  hostname: String.t(),
  ip: String.t(),
  serial: String.t() | nil,
  version: String.t() | nil,
  product: String.t() | nil,
  description: String.t() | nil,
  platform: String.t() | nil,
  architecture: String.t() | nil,
  author: String.t() | nil,
  uuid: String.t() | nil
}

Information about each found Nerves device

  • :name - name of the Nerves device
  • :hostname - hostname o the device (usually the name with .local)
  • :ip - the first IP address of the device
  • :serial - the device's serial number if included in the advertisement
  • :version - the device's firmware version if included in the advertisement
  • :product - the device's product if included in the advertisement
  • :description - the device's description if included in the advertisement
  • :platform - the device's platform if included in the advertisement
  • :architecture - the device's CPU architecture if included in the advertisement
  • :author - the device's firmware author if included in the advertisement
  • :uuid - the device's firmware UUID if included in the advertisement

Functions

discover(opts \\ [])

@spec discover(options()) :: [result()]

Discover Nerves devices on the local network.

Options:

  • :timeout - timeout in milliseconds to wait for replies (default 5000 ms)
  • :method - method to use for querying mDNS (:auto, :macos, :avahi, :generic)

Examples

iex> NervesDiscovery.discover()
[%{name: "nerves-1234", hostname: "nerves-1234.local", ip: "192.168.1.100"}]