Represents a connected or available device (physical or emulator/simulator).
This struct is the central data structure used throughout dala_dev for device identification, connection, and deployment operations.
Summary
Functions
Returns the short ID shown in mix dala.devices and accepted by --device.
Returns true if input identifies this device.
Returns the Erlang node name atom for a device.
Derives a short identifier from a serial for use in node names.
Human-readable one-line summary.
Types
@type device_type() :: :emulator | :simulator | :physical
@type platform() :: :android | :ios
@type status() :: :discovered | :unauthorized | :tunneled | :connected | :error
@type t() :: %DalaDev.Device{ dist_port: pos_integer() | nil, error: String.t() | nil, host_ip: String.t() | nil, name: String.t() | nil, node: atom() | nil, platform: platform(), serial: String.t(), status: status(), type: device_type() | nil, version: String.t() | nil }
Functions
Returns the short ID shown in mix dala.devices and accepted by --device.
- Android: the serial as-is (
emulator-5554,R5CW3089HVB) - iOS simulator: first 8 hex chars of the UDID, lowercased (
78354490) — same prefix used in the node name - iOS physical: full UDID
Returns true if input identifies this device.
Matches against either display_id/1 or the full serial, both case-insensitively.
This is used by mix dala.deploy --device <id> to target a specific device
by its short ID or full serial number.
Examples
iex> device = %DalaDev.Device{platform: :android, serial: "R5CW3089HVB"}
iex> DalaDev.Device.match_id?(device, "HVBA")
true
iex> DalaDev.Device.match_id?(device, "R5CW3089HVB")
true
Returns the Erlang node name atom for a device.
The node name format varies by platform:
Android (emulator/physical):
<app>_android_<serial-stub>@127.0.0.1Unique per device since Mac's EPMD is shared via adb-reverse, requiring a suffix to avoid collisions when multiple phones run the same app.iOS simulator:
<app>_ios_<8-char-udid>@127.0.0.1Unique per simulator, matches the name dala_beam.m builds using SIMULATOR_UDID.iOS physical:
<app>_ios@<device-ip>dala_beam.m finds the device IP using priority: USB > WiFi/LAN > Tailscale.
Derives a short identifier from a serial for use in node names.
Returns the last 4 alphanumeric characters of the serial (with dashes removed), uppercased. This provides a short, somewhat human-readable identifier.
Examples
iex> DalaDev.Device.short_id("emulator-5554")
"5554"
iex> DalaDev.Device.short_id("R5CW3089HVB")
"HVBA"
iex> DalaDev.Device.short_id("78354490-EF38-44D7-A437-DD941C20524D")
"524D"
Human-readable one-line summary.