VintageNetECM.AT (vintage_net_ecm v0.1.0)

Copy Markdown

Minimal AT-command helper over Circuits.UART for VintageNetECM.

Passive, synchronous request/response: open a tty, send AT... lines, and read the response, draining until a final OK/ERROR (or timeout). This deliberately avoids vintage_net_mobile's ExChat so the module stays dependency-free for extraction into vintage_net_ecm.

Not for high-throughput or unsolicited-result-code (URC) streaming — it's a probe/ control channel. Each command/3 drains stale bytes first, so interleaved URCs are tolerated but not delivered to a subscriber.

Summary

Functions

Close and stop the UART process.

Send a single AT command and collect the response.

Open the AT tty in passive mode. Baud is ignored over USB CDC but required by the API.

Types

uart()

@type uart() :: pid()

Functions

close(uart)

@spec close(uart()) :: :ok

Close and stop the UART process.

command(uart, cmd, opts \\ [])

@spec command(uart(), String.t(), keyword()) :: {:ok, [String.t()]} | {:error, term()}

Send a single AT command and collect the response.

Returns {:ok, lines} with the command echo and trailing OK stripped, or {:error, {:cme, detail}} / {:error, {:cms, detail}} / {:error, :timeout} / {:error, reason}.

open(tty, opts \\ [])

@spec open(
  String.t(),
  keyword()
) :: {:ok, uart()} | {:error, term()}

Open the AT tty in passive mode. Baud is ignored over USB CDC but required by the API.