object

# `ccsds_frames`

Helpers for introspecting CCSDS transfer frame terms.

Availability:
`logtalk_load(ccsds_frames(loader))`
Author: Paulo Moura
Version: 1:0:0
Date: 2026-05-09
Compilation flags:
`static, context_switching_calls`
Uses:
ccsds_packets(SecondaryHeaderLength)
list
type
Remarks:
(none)
Inherited public predicates:
(none)

## Public predicates

### `valid/1`

True if the argument is a known CCSDS transfer frame term.

Compilation flags:
`static`
Template:
`valid(Frame)`
Mode and number of proofs:
`valid(@compound)` - `zero_or_one`

### `frame_type/2`

Returns the CCSDS transfer frame type for a known frame term.

Compilation flags:
`static`
Template:
`frame_type(Frame,Type)`
Mode and number of proofs:
`frame_type(+compound,-atom)` - `one`

### `version/2`

Extracts the transfer frame version number from a known frame term.

Compilation flags:
`static`
Template:
`version(Frame,Version)`
Mode and number of proofs:
`version(+compound,-integer)` - `one`

### `spacecraft_id/2`

Extracts the spacecraft identifier from a known frame term.

Compilation flags:
`static`
Template:
`spacecraft_id(Frame,SpacecraftId)`
Mode and number of proofs:
`spacecraft_id(+compound,-integer)` - `one`

### `virtual_channel_id/2`

Extracts the virtual channel identifier from a known frame term.

Compilation flags:
`static`
Template:
`virtual_channel_id(Frame,VirtualChannelId)`
Mode and number of proofs:
`virtual_channel_id(+compound,-integer)` - `one`

### `data_field/2`

Extracts the raw data field bytes from a known frame term.

Compilation flags:
`static`
Template:
`data_field(Frame,DataField)`
Mode and number of proofs:
`data_field(+compound,-list(byte))` - `one`

### `ocf/2`

Extracts the operational control field. Returns `none` when absent.

Compilation flags:
`static`
Template:
`ocf(Frame,OCF)`
Mode and number of proofs:
`ocf(+compound,-compound)` - `one`

### `fecf/2`

Extracts the frame error control field. Returns `none` when absent.

Compilation flags:
`static`
Template:
`fecf(Frame,FECF)`
Mode and number of proofs:
`fecf(+compound,-compound)` - `one`

### `update_fecf/2`

Refreshes a present frame error control field from the remaining frame fields while leaving frames without an FECF unchanged.

Compilation flags:
`static`
Template:
`update_fecf(Frame,UpdatedFrame)`
Mode and number of proofs:
`update_fecf(+compound,-compound)` - `one_or_error`
Exceptions:
`Frame` is a variable:
`instantiation_error`
`Frame` is not a valid CCSDS transfer frame term:
`domain_error(ccsds_frame_term,Frame)`

### `verify_fecf/1`

True if a present frame error control field matches the remaining frame fields. Frames without an FECF succeed.

Compilation flags:
`static`
Template:
`verify_fecf(Frame)`
Mode and number of proofs:
`verify_fecf(@compound)` - `zero_or_one`

### `extract_packets/3`

Parses the raw frame data field as CCSDS space packet bytes using the given packet secondary header length.

Compilation flags:
`static`
Template:
`extract_packets(Frame,SecondaryHeaderLength,Packets)`
Mode and number of proofs:
`extract_packets(+compound,+integer,-list(compound))` - `one_or_error`
Exceptions:
`Frame` is a variable:
`instantiation_error`
`SecondaryHeaderLength` is a variable:
`instantiation_error`
`Frame` is neither a variable nor a valid CCSDS transfer frame term:
`domain_error(ccsds_frame_term,Frame)`
`SecondaryHeaderLength` is neither a variable nor a valid CCSDS packet secondary header length:
`domain_error(ccsds_secondary_header_length,SecondaryHeaderLength)`
The frame data field is not a valid CCSDS packet byte sequence:
`domain_error(ccsds_byte_sequence,Bytes)`

### `insert_packets/4`

Generates CCSDS packet bytes and replaces the raw data field of a frame term, preserving the remaining header fields unchanged.

Compilation flags:
`static`
Template:
`insert_packets(Packets,SecondaryHeaderLength,Frame,UpdatedFrame)`
Mode and number of proofs:
`insert_packets(+list(compound),+integer,+compound,-compound)` - `one_or_error`
Exceptions:
`Packets` is a variable:
`instantiation_error`
`SecondaryHeaderLength` is a variable:
`instantiation_error`
`Frame` is a variable:
`instantiation_error`
`Frame` is neither a variable nor a valid CCSDS transfer frame term:
`domain_error(ccsds_frame_term,Frame)`
`SecondaryHeaderLength` is neither a variable nor a valid CCSDS packet secondary header length:
`domain_error(ccsds_secondary_header_length,SecondaryHeaderLength)`
An element `Packet` of `Packets` is a variable or `Packets` is a partial list:
`instantiation_error`
An element `Packet` of `Packets` is neither a variable nor a valid CCSDS packet term:
`domain_error(ccsds_packet_term,Packet)`

## Protected predicates

(no local declarations; see entity ancestors if any)

## Private predicates

(no local declarations; see entity ancestors if any)

## Operators

(none)