Espex.SerialProxy.Info (espex v0.10.0)

Copy Markdown View Source

Description of a serial proxy instance exposed by an Espex.SerialProxy adapter.

Adapters return a list of these from Espex.SerialProxy.list_instances/0. The :instance integer is the stable identifier used by the ESPHome client in SerialProxyConfigureRequest, SerialProxyWriteRequest, etc. — the adapter chooses the numbering and must keep it stable for the lifetime of the device.

Summary

Types

A modem control line the port can drive via set_modem_pins/3. Since 0.10.0.

t()

Functions

Encode a list of modem lines as the configured_line_states bitmask (:rts → bit 0, :dtr → bit 1).

Build an %Info{} from keyword options.

Convert to the protobuf SerialProxyInfo message used inside DeviceInfoResponse.serial_proxies.

Types

line()

@type line() :: :rts | :dtr

A modem control line the port can drive via set_modem_pins/3. Since 0.10.0.

port_type()

@type port_type() :: :ttl | :rs232 | :rs485

t()

@type t() :: %Espex.SerialProxy.Info{
  configured_line_states: [line()],
  instance: non_neg_integer(),
  name: String.t(),
  port_type: port_type()
}

Functions

line_states_to_bits(lines)

(since 0.10.0)
@spec line_states_to_bits([line()]) :: non_neg_integer()

Encode a list of modem lines as the configured_line_states bitmask (:rts → bit 0, :dtr → bit 1).

new(opts)

@spec new(keyword()) :: t()

Build an %Info{} from keyword options.

to_proto(info)

@spec to_proto(t()) :: Espex.Proto.SerialProxyInfo.t()

Convert to the protobuf SerialProxyInfo message used inside DeviceInfoResponse.serial_proxies.