ExCEP.Transport.FrameChannel (ex_cep v0.1.1)

Copy Markdown

Shared frame encoding/sending helpers for both Gateway clients and Cluster sessions.

Summary

Functions

Synchronously receives one complete %Frame{} from a passive (active: false) socket. Used during the 3-way authentication handshake before switching to {:active, :once}.

Encodes and sends an authentication binary ASDU frame (auth?: true).

Encodes and sends a JSON %DataAsdu{} frame with automatic compression & signing policy.

Functions

recv_frame(socket, buffer \\ <<>>, opts \\ [])

@spec recv_frame(ExCEP.Transport.Socket.t(), binary(), keyword()) ::
  {:ok, ExCEP.Codec.Frame.t(), binary()} | {:error, term()}

Synchronously receives one complete %Frame{} from a passive (active: false) socket. Used during the 3-way authentication handshake before switching to {:active, :once}.

send_auth(socket, gateway_id, auth_asdu, opts \\ [])

@spec send_auth(
  ExCEP.Transport.Socket.t(),
  String.t(),
  ExCEP.Codec.AuthAsdu.t(),
  keyword()
) ::
  :ok | {:error, term()}

Encodes and sends an authentication binary ASDU frame (auth?: true).

send_data(socket, gateway_id, asdu, opts \\ [])

@spec send_data(
  ExCEP.Transport.Socket.t(),
  String.t(),
  ExCEP.Codec.DataAsdu.t(),
  keyword()
) ::
  :ok | {:error, term()}

Encodes and sends a JSON %DataAsdu{} frame with automatic compression & signing policy.