VintageNetECM.ATController (vintage_net_ecm v0.1.0)

Copy Markdown

Supervised AT-control sidecar for VintageNetECM.

Started by VintageNet (as a child_spec) once the ECM netdev is present. Lifecycle:

  1. Open the AT tty.
  2. Configure the radio: ATE0, verbose errors, AT+CEREG=2, AT+CFUN=1, set the APN (AT+CGDCONT), automatic operator selection (AT+COPS=0).
  3. Poll AT+CEREG? until registered (stat 1 = home or 5 = roaming).
  4. Bring the ECM data call up via the VintageNetECM.Modem implementation. DHCP on the netdev — run by the composed VintageNetEthernet config — then obtains the lease.
  5. Periodically publish +CEREG / +CSQ / technology under ["interface", ifname, "mobile", ...] and re-activate the data call if it drops.

Steps 1-3 and the +CEREG/+CSQ reporting use standard 3GPP commands handled here. The modem-specific data-call control and access-technology reporting are delegated to the configured VintageNetECM.Modem implementation (defaulting to VintageNetECM.Modem.Quectel).

Teardown is handled out-of-band by deactivate_data_call/3 (a VintageNetECM down_cmds :fun), because VintageNet kills this process before running down_cmds, so terminate/2 is not a reliable place to talk to the modem.

Summary

Functions

Returns a specification to start this module under a supervisor.

Tear the modem's ECM data call down. Invoked from VintageNetECM down_cmds, where the controller GenServer is already gone — so this opens its own short-lived UART and delegates the actual command to the VintageNetECM.Modem implementation.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

deactivate_data_call(modem, tty, context_id)

@spec deactivate_data_call(module(), String.t(), pos_integer()) :: :ok

Tear the modem's ECM data call down. Invoked from VintageNetECM down_cmds, where the controller GenServer is already gone — so this opens its own short-lived UART and delegates the actual command to the VintageNetECM.Modem implementation.