VintageNetECM.Modem behaviour (vintage_net_ecm v0.1.0)

Copy Markdown

Behaviour for the modem-specific AT interactions in VintageNetECM.

VintageNetECM.ATController drives the portable, standard-3GPP part of the lifecycle itself (echo/error setup, AT+CFUN, AT+CGDCONT, AT+COPS, registration polling via +CEREG, and +CSQ signal reporting). The pieces that differ between modem vendors live behind this behaviour:

  • how the ECM/usbnet data call is brought up and torn down,
  • how to tell whether that data call is currently active,
  • how to report the radio access technology, and
  • which AT control tty the modem exposes by default.

The default implementation is VintageNetECM.Modem.Quectel, which targets Quectel usbnet ECM modems such as the EG800Q. Select a different modem with the :modem key under :vintage_net_ecm:

VintageNet.configure("usb1", %{
  type: VintageNetECM,
  vintage_net_ecm: %{
    service_providers: [%{apn: "super"}],
    modem: MyApp.SomeOtherModem
  }
})

Summary

Callbacks

Current radio access technology (e.g. "LTE"), or nil if unknown.

Bring the ECM data call up.

Whether the ECM data call is currently active.

Tear the ECM data call down.

Default AT control tty basename for this modem family, e.g. "ttyUSB2".

Callbacks

access_technology(uart)

@callback access_technology(VintageNetECM.AT.uart()) :: String.t() | nil

Current radio access technology (e.g. "LTE"), or nil if unknown.

activate_data_call(uart, context_id)

@callback activate_data_call(VintageNetECM.AT.uart(), context_id :: pos_integer()) ::
  :ok | {:error, term()}

Bring the ECM data call up.

Called over the controller's open UART once the modem reports registered.

data_call_active?(uart)

@callback data_call_active?(VintageNetECM.AT.uart()) :: boolean()

Whether the ECM data call is currently active.

deactivate_data_call(uart, context_id)

@callback deactivate_data_call(VintageNetECM.AT.uart(), context_id :: pos_integer()) ::
  :ok | {:error, term()}

Tear the ECM data call down.

Called on teardown over a fresh, short-lived UART (the controller GenServer is already gone by then). Implementations should not assume any prior session state and should return :ok even if the modem reports nothing to tear down.

default_at_tty()

@callback default_at_tty() :: String.t()

Default AT control tty basename for this modem family, e.g. "ttyUSB2".