Function: tokenizeBody()
tokenizeBody(
body,base,warnings):TelecomSegment[]
Tokenize the variable body of a Telecom transmission (everything after the
fixed header) into segments. The body is split into group-separated
transactions; only the first transaction's segments are decoded (a
MULTI_TRANSACTION_TRUNCATED warning is raised when more are present so they
are never silently ignored). Within a transaction, segments are
segment-separator delimited and fields are field-separator delimited; the first
field of each segment is the Segment Identification (AM).
Parameters
body
string
The raw message body (the portion after the fixed header).
base
number
The absolute offset of body[0] in the raw message.
warnings
Sink that collects non-fatal warnings.
Returns
The decoded segments of the first transaction, in wire order.
Example
const warnings: NcpdpTelecomWarning[] = [];
const segs = tokenizeBody("\x1cAM07\x1cD2RX1", 56, warnings);
segs[0]?.segmentId; // "07"