IEC60870.FileService.Receiver (ExIEC60870 v0.1.0)

Copy Markdown View Source

Accumulator for receiving multi-section / multi-segment files during IEC 60870-5-101/104 file transfers (CS101_IFileReceiver in cs101_file_service.h).

Summary

Functions

Appends a received segment to section nos (1-based section number).

Returns the ordered list of section binaries.

Reconstructs the complete file binary in section order (1..N).

Types

t()

@type t() :: %IEC60870.FileService.Receiver{
  ca: non_neg_integer(),
  data: binary(),
  expected_length: non_neg_integer(),
  ioa: non_neg_integer(),
  name: String.t() | nil,
  nof: non_neg_integer(),
  on_finished: (t(), :ok | {:error, term()} -> any()) | nil,
  sections: %{optional(pos_integer()) => binary()}
}

Functions

new(ca, ioa, nof, expected_length, opts \\ [])

put_segment(rec, nos, offset, data)

@spec put_segment(t(), pos_integer(), non_neg_integer(), binary()) :: t()

Appends a received segment to section nos (1-based section number).

sections_list(receiver)

@spec sections_list(t()) :: [binary()]

Returns the ordered list of section binaries.

to_binary(receiver)

@spec to_binary(t()) :: binary()

Reconstructs the complete file binary in section order (1..N).