|
FERS 0.1.0
The Flexible Extensible Radar Simulator
|
#include <stddef.h>#include <stdint.h>
Include dependency graph for api.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Classes | |
| struct | fers_antenna_pattern_data_t |
| Represents a sampled 2D antenna gain pattern. More... | |
| struct | fers_motion_waypoint_t |
| Represents a single waypoint for a motion path. More... | |
| struct | fers_rotation_waypoint_t |
| Represents a single waypoint for a rotation path. More... | |
| struct | fers_interpolated_point_t |
| Represents a single interpolated point on a motion path. More... | |
| struct | fers_interpolated_rotation_point_t |
| Represents a single interpolated point on a rotation path. More... | |
| struct | fers_interpolated_path_t |
| A container for an array of interpolated motion path points. More... | |
| struct | fers_interpolated_rotation_path_t |
| A container for an array of interpolated rotation path points. More... | |
| struct | fers_visual_link_t |
| Represents a single renderable line segment metadata. More... | |
| struct | fers_visual_link_list_t |
| A container for a list of visual links. More... | |
Typedefs | |
| typedef struct fers_context | fers_context_t |
| typedef void(* | fers_progress_callback_t) (const char *message, int current, int total, void *user_data) |
| A function pointer type for progress reporting callbacks. | |
| typedef int(* | fers_cancel_callback_t) (void *user_data) |
| A function pointer type for cooperative simulation cancellation. | |
| typedef void(* | fers_vita49_telemetry_callback_t) (const char *stats_json, const char *packet_batch_json, void *user_data) |
| A function pointer type for VITA 49.2 live telemetry callbacks. | |
| typedef void(* | fers_log_callback_t) (fers_log_level_t level, const char *line, void *user_data) |
| A function pointer type for receiving formatted log lines. | |
Enumerations | |
| enum | fers_log_level_t { FERS_LOG_TRACE , FERS_LOG_DEBUG , FERS_LOG_INFO , FERS_LOG_WARNING , FERS_LOG_ERROR , FERS_LOG_FATAL , FERS_LOG_OFF } |
| Log levels for the FERS library. More... | |
| enum | fers_interp_type_t { FERS_INTERP_STATIC , FERS_INTERP_LINEAR , FERS_INTERP_CUBIC } |
| Defines the interpolation methods available for path generation. More... | |
| enum | fers_angle_unit_t { FERS_ANGLE_UNIT_DEG , FERS_ANGLE_UNIT_RAD } |
| Units used for external rotation angles and rates. More... | |
| enum | fers_link_quality_t { FERS_LINK_STRONG , FERS_LINK_WEAK } |
| Quality of the radio link based on SNR. More... | |
| enum | fers_link_type_t { FERS_LINK_MONOSTATIC , FERS_LINK_BISTATIC_TX_TGT , FERS_LINK_BISTATIC_TGT_RX , FERS_LINK_DIRECT_TX_RX } |
| Type of visual link to render. More... | |
Functions | |
| fers_context_t * | fers_context_create () |
| Creates a new FERS simulation context. | |
| void | fers_context_destroy (fers_context_t *context) |
| Destroys a FERS simulation context and releases all associated memory. | |
| int | fers_set_output_directory (fers_context_t *context, const char *out_dir) |
| Sets the output directory for simulation results. | |
| int | fers_use_hdf5_output (fers_context_t *context) |
| Resets the context output mode to the default HDF5 output. | |
| int | fers_enable_vita49_udp_output (fers_context_t *context, const char *host, uint16_t port) |
| Enables the FERS VITA 49.2 UDP streaming profile for a context. | |
| int | fers_set_vita49_fullscale (fers_context_t *context, double fullscale) |
| Sets the fixed ADC full-scale value used by the FERS VITA 49.2 int16 IQ profile. | |
| int | fers_set_vita49_epoch_unix_nanoseconds (fers_context_t *context, uint64_t epoch_unix_nanoseconds) |
| Sets a deterministic FERS VITA 49.2 stream epoch as Unix nanoseconds. | |
| int | fers_set_vita49_max_udp_payload (fers_context_t *context, uint16_t max_udp_payload) |
| Sets the FERS VITA 49.2 UDP profile maximum payload size in bytes. | |
| int | fers_set_vita49_queue_depth (fers_context_t *context, uint32_t queue_depth) |
| Sets the bounded FERS VITA 49.2 sender queue depth in packets. | |
| int | fers_set_vita49_packet_trace_enabled (fers_context_t *context, int enabled) |
| Enables or disables FERS VITA 49.2 packet trace telemetry. | |
| int | fers_configure_logging (fers_log_level_t level, const char *log_file_path) |
| Configures the internal logger. | |
| const char * | fers_get_version (void) |
| Returns the library version string. | |
| fers_log_level_t | fers_get_log_level () |
| Returns the current internal logger level. | |
| void | fers_set_log_callback (fers_log_callback_t callback, void *user_data) |
| Registers a callback for formatted log lines. | |
| void | fers_log (fers_log_level_t level, const char *message) |
| Submits a log message to the library's unified logging system. | |
| int | fers_set_thread_count (unsigned num_threads) |
| Sets the number of worker threads for the simulation. | |
| int | fers_load_scenario_from_xml_file (fers_context_t *context, const char *xml_filepath, int validate) |
| Loads a scenario into the context from a FERS XML file. | |
| int | fers_load_scenario_from_xml_string (fers_context_t *context, const char *xml_content, int validate) |
| Loads a scenario into the context from a FERS XML string. | |
| char * | fers_get_scenario_as_json (fers_context_t *context) |
| Serializes the current simulation scenario into a JSON string. | |
| char * | fers_get_scenario_as_xml (fers_context_t *context) |
| Serializes the current simulation scenario into a FERS XML string. | |
| char * | fers_get_last_output_metadata_json (fers_context_t *context) |
| Returns JSON metadata for the most recent simulation output files. | |
| char * | fers_get_memory_projection_json (fers_context_t *context) |
| Returns a JSON projection of simulation startup memory and HDF5 payload size. | |
| int | fers_update_scenario_from_json (fers_context_t *context, const char *scenario_json) |
| Updates the simulation scenario from a JSON string. | |
| int | fers_update_platform_from_json (fers_context_t *context, uint64_t id, const char *json) |
| Updates a single platform's paths and name from JSON without full context recreation. | |
| int | fers_update_parameters_from_json (fers_context_t *context, const char *json) |
| Updates the global simulation parameters from JSON without full context recreation. | |
| int | fers_update_antenna_from_json (fers_context_t *context, const char *json) |
| Updates a single antenna from JSON without full context recreation. | |
| int | fers_update_waveform_from_json (fers_context_t *context, const char *json) |
| Updates a single waveform from JSON without full context recreation. | |
| int | fers_update_transmitter_from_json (fers_context_t *context, uint64_t id, const char *json) |
| Updates a single transmitter from JSON without full context recreation. | |
| int | fers_update_receiver_from_json (fers_context_t *context, uint64_t id, const char *json) |
| Updates a single receiver from JSON without full context recreation. | |
| int | fers_update_target_from_json (fers_context_t *context, uint64_t id, const char *json) |
| Updates a single target from JSON without full context recreation. | |
| int | fers_update_monostatic_from_json (fers_context_t *context, const char *json) |
| Updates a monostatic radar from JSON without full context recreation. | |
| int | fers_update_timing_from_json (fers_context_t *context, uint64_t id, const char *json) |
| Updates a single timing source from JSON without full context recreation. | |
| char * | fers_get_last_error_message () |
| Retrieves the last error message that occurred on the current thread. | |
| char * | fers_get_last_warning_messages_json () |
| Returns the last deduplicated rotation-unit warning list for the calling thread as JSON. | |
| void | fers_free_string (char *str) |
| Frees a string that was allocated and returned by the libfers API. | |
| int | fers_run_simulation (fers_context_t *context, fers_progress_callback_t callback, void *user_data) |
| Runs the simulation defined in the provided context. | |
| int | fers_run_simulation_ex (fers_context_t *context, fers_progress_callback_t progress_callback, void *progress_user_data, fers_cancel_callback_t cancel_callback, void *cancel_user_data, fers_vita49_telemetry_callback_t vita49_telemetry_callback, void *vita49_telemetry_user_data) |
| Runs the simulation with optional progress, cancellation, and VITA telemetry callbacks. | |
| int | fers_generate_kml (const fers_context_t *context, const char *output_kml_filepath) |
| Generates a KML file for visualizing the scenario in the context. | |
| fers_antenna_pattern_data_t * | fers_get_antenna_pattern (const fers_context_t *context, uint64_t antenna_id, size_t az_samples, size_t el_samples, double frequency_hz) |
| Samples the gain pattern of a specified antenna and provides the data. | |
| void | fers_free_antenna_pattern_data (fers_antenna_pattern_data_t *data) |
| Frees the memory allocated for an antenna pattern data structure. | |
| fers_interpolated_path_t * | fers_get_interpolated_motion_path (const fers_motion_waypoint_t *waypoints, size_t waypoint_count, fers_interp_type_t interp_type, size_t num_points) |
| Calculates an interpolated motion path from a set of waypoints. | |
| void | fers_free_interpolated_motion_path (fers_interpolated_path_t *path) |
| Frees the memory allocated for an interpolated motion path. | |
| fers_interpolated_rotation_path_t * | fers_get_interpolated_rotation_path (const fers_rotation_waypoint_t *waypoints, size_t waypoint_count, fers_interp_type_t interp_type, fers_angle_unit_t angle_unit, size_t num_points) |
| Calculates an interpolated rotation path from a set of waypoints. | |
| void | fers_free_interpolated_rotation_path (fers_interpolated_rotation_path_t *path) |
| Frees the memory allocated for an interpolated rotation path. | |
| fers_visual_link_list_t * | fers_calculate_preview_links (const fers_context_t *context, double time) |
| Calculates visual links for a specific simulation time. | |
| void | fers_free_preview_links (fers_visual_link_list_t *list) |
| Frees the memory allocated for a preview link list. | |
A function pointer type for cooperative simulation cancellation.
The callback should return non-zero when the active simulation should stop. It is polled between event-loop iterations and streaming sample chunks.
| user_data | An opaque pointer passed back to the caller. |
| typedef void(* fers_progress_callback_t) (const char *message, int current, int total, void *user_data) |
A function pointer type for progress reporting callbacks.
This callback can be implemented by the client to receive progress updates during long-running operations like fers_run_simulation.
| message | A descriptive message about the current operation. |
| current | The current progress step. |
| total | The total number of steps for the operation. |
| user_data | An opaque pointer passed back to the caller, useful for maintaining state (e.g., a class instance or application handle). |
| typedef void(* fers_vita49_telemetry_callback_t) (const char *stats_json, const char *packet_batch_json, void *user_data) |
A function pointer type for VITA 49.2 live telemetry callbacks.
The JSON strings are valid only for the duration of the callback. Either argument may be NULL when that payload has not changed.
| stats_json | Full stream-counter snapshot JSON, or NULL. |
| packet_batch_json | Packet trace batch JSON array, or NULL. |
| user_data | An opaque pointer passed back to the caller. |
Units used for external rotation angles and rates.
| Enumerator | |
|---|---|
| FERS_ANGLE_UNIT_DEG | |
| FERS_ANGLE_UNIT_RAD | |
Definition at line 604 of file api.h.
Defines the interpolation methods available for path generation.
This enum provides a language-agnostic way to specify the desired interpolation algorithm when calling the path generation functions.
| Enumerator | |
|---|---|
| FERS_INTERP_STATIC | |
| FERS_INTERP_LINEAR | |
| FERS_INTERP_CUBIC | |
Definition at line 594 of file api.h.
Quality of the radio link based on SNR.
| Enumerator | |
|---|---|
| FERS_LINK_STRONG | |
| FERS_LINK_WEAK | |
Definition at line 731 of file api.h.
Type of visual link to render.
| Enumerator | |
|---|---|
| FERS_LINK_MONOSTATIC | |
| FERS_LINK_BISTATIC_TX_TGT | |
| FERS_LINK_BISTATIC_TGT_RX | |
| FERS_LINK_DIRECT_TX_RX | |
Definition at line 740 of file api.h.
Log levels for the FERS library.
Definition at line 192 of file api.h.
| fers_visual_link_list_t * fers_calculate_preview_links | ( | const fers_context_t * | context, |
| double | time | ||
| ) |
Calculates visual links for a specific simulation time.
| context | The simulation context. |
| time | The simulation time in seconds. |
Definition at line 1595 of file api.cpp.
References simulation::BistaticTgtRx, simulation::BistaticTxTgt, simulation::calculatePreviewLinks(), simulation::DirectTxRx, logging::ERROR, FERS_LINK_BISTATIC_TGT_RX, FERS_LINK_BISTATIC_TX_TGT, FERS_LINK_DIRECT_TX_RX, FERS_LINK_MONOSTATIC, FERS_LINK_STRONG, FERS_LINK_WEAK, handle_api_exception(), last_error_message, LOG, simulation::Monostatic, simulation::Strong, and fers_visual_link_t::type.
Here is the call graph for this function:| int fers_configure_logging | ( | fers_log_level_t | level, |
| const char * | log_file_path | ||
| ) |
Configures the internal logger.
| level | The minimum severity level to log. |
| log_file_path | Optional path to a log file. Pass NULL to disable file logging. |
Definition at line 353 of file api.cpp.
References handle_api_exception(), last_error_message, logging::logger, logging::Logger::logToFile(), map_api_log_level(), and logging::Logger::setLevel().
Here is the call graph for this function:| fers_context_t * fers_context_create | ( | ) |
Creates a new FERS simulation context.
Allocates and initializes a new, empty simulation context in memory. This context serves as the container for a scenario loaded via one of the fers_load_... or fers_update_... functions.
fers_context_destroy() to prevent resource leaks.Definition at line 97 of file api.cpp.
References discard_warning_capture(), handle_api_exception(), and last_error_message.
Here is the call graph for this function:| void fers_context_destroy | ( | fers_context_t * | context | ) |
Destroys a FERS simulation context and releases all associated memory.
This function must be called for every context created by fers_context_create() to ensure proper cleanup of the underlying C++ objects. Accessing the context handle after calling this function results in undefined behavior.
| context | A valid pointer to a fers_context_t handle. If context is NULL, the function performs no action for safety and does not set an error. |
Definition at line 118 of file api.cpp.
| int fers_enable_vita49_udp_output | ( | fers_context_t * | context, |
| const char * | host, | ||
| uint16_t | port | ||
| ) |
Enables the FERS VITA 49.2 UDP streaming profile for a context.
HDF5 remains the default until this function succeeds. The host is copied by the library and may be freed by the caller after the call returns.
| context | A valid fers_context_t handle. |
| host | Null-terminated destination host name or address. |
| port | Destination UDP port in the range 1..65535. |
| void fers_free_antenna_pattern_data | ( | fers_antenna_pattern_data_t * | data | ) |
Frees the memory allocated for an antenna pattern data structure.
| data | A pointer to the fers_antenna_pattern_data_t struct to free. |
Definition at line 1582 of file api.cpp.
References fers_antenna_pattern_data_t::gains.
| void fers_free_interpolated_motion_path | ( | fers_interpolated_path_t * | path | ) |
Frees the memory allocated for an interpolated motion path.
| path | A pointer to the fers_interpolated_path_t struct to free. |
Definition at line 1379 of file api.cpp.
References fers_interpolated_path_t::points.
| void fers_free_interpolated_rotation_path | ( | fers_interpolated_rotation_path_t * | path | ) |
Frees the memory allocated for an interpolated rotation path.
| path | A pointer to the fers_interpolated_rotation_path_t struct to free. |
Definition at line 1480 of file api.cpp.
References fers_interpolated_rotation_path_t::points.
| void fers_free_preview_links | ( | fers_visual_link_list_t * | list | ) |
Frees the memory allocated for a preview link list.
| list | The list to free. |
Definition at line 1667 of file api.cpp.
References fers_visual_link_list_t::links.
Frees a string that was allocated and returned by the libfers API.
This function must be used to release memory for any string returned by functions like fers_get_scenario_as_json or fers_get_last_error_message. It exists to ensure that the memory deallocation mechanism (free) matches the allocation mechanism (strdup/malloc) used within the C++ library, preventing potential crashes from mismatched allocators across language boundaries.
| str | A pointer to the string to be freed. If str is NULL, no action is taken. |
| int fers_generate_kml | ( | const fers_context_t * | context, |
| const char * | output_kml_filepath | ||
| ) |
Generates a KML file for visualizing the scenario in the context.
This utility exists to provide a simple, out-of-the-box method for users to validate and visualize the geographic layout and motion paths of their scenarios in common external tools like Google Earth.
| context | A valid fers_context_t handle containing a loaded scenario. |
| output_kml_filepath | A null-terminated UTF-8 string for the output KML file path. |
fers_get_last_error_message() to retrieve KML generation details. Definition at line 1241 of file api.cpp.
References logging::ERROR, serial::KmlGenerator::generateKml(), handle_api_exception(), last_error_message, and LOG.
Here is the call graph for this function:| fers_antenna_pattern_data_t * fers_get_antenna_pattern | ( | const fers_context_t * | context, |
| uint64_t | antenna_id, | ||
| size_t | az_samples, | ||
| size_t | el_samples, | ||
| double | frequency_hz | ||
| ) |
Samples the gain pattern of a specified antenna and provides the data.
This function calculates the antenna's far-field gain at a specified resolution over the full sphere of directions (azimuth and elevation). The resulting gain values are linear (not in dB) and normalized relative to the pattern's peak gain. This is a stateless utility useful for UI previews and analysis.
| context | A valid fers_context_t handle containing a loaded scenario with the antenna. |
| antenna_id | The unique ID of the antenna asset to sample. |
| az_samples | The desired number of sample points along the azimuth axis. Must be at least 2 to span the full azimuth range. |
| el_samples | The desired number of sample points along the elevation axis. Must be at least 2 to span the full elevation range. |
| frequency_hz | The frequency in Hz to use for gain calculation (affects aperture antennas). |
fers_antenna_pattern_data_t struct containing the results. Returns NULL on failure (e.g., antenna not found). The caller owns the returned struct and must free it with fers_free_antenna_pattern_data. Definition at line 1494 of file api.cpp.
References params::c(), logging::ERROR, antenna::Antenna::getGain(), handle_api_exception(), last_error_message, LOG, and PI.
Here is the call graph for this function:| fers_interpolated_path_t * fers_get_interpolated_motion_path | ( | const fers_motion_waypoint_t * | waypoints, |
| size_t | waypoint_count, | ||
| fers_interp_type_t | interp_type, | ||
| size_t | num_points | ||
| ) |
Calculates an interpolated motion path from a set of waypoints.
This function is a stateless utility that computes the path without needing a full simulation context. It is useful for UI previews.
| waypoints | An array of fers_motion_waypoint_t structs. |
| waypoint_count | The number of waypoints in the array. |
| interp_type | The interpolation algorithm to use. |
| num_points | The desired number of points in the output interpolated path. |
fers_interpolated_path_t struct containing the results. Returns NULL on failure. The caller owns the returned struct and must free it with fers_free_interpolated_motion_path. Definition at line 1302 of file api.cpp.
References math::Path::addCoord(), c, logging::ERROR, FERS_INTERP_CUBIC, math::Path::finalize(), math::Path::getPosition(), math::Path::getVelocity(), handle_api_exception(), last_error_message, LOG, math::Path::setInterp(), math::Coord::t, fers_motion_waypoint_t::time, to_cpp_interp_type(), fers_motion_waypoint_t::x, math::Vec3::x, fers_motion_waypoint_t::y, math::Vec3::y, fers_motion_waypoint_t::z, and math::Vec3::z.
Here is the call graph for this function:| fers_interpolated_rotation_path_t * fers_get_interpolated_rotation_path | ( | const fers_rotation_waypoint_t * | waypoints, |
| size_t | waypoint_count, | ||
| fers_interp_type_t | interp_type, | ||
| fers_angle_unit_t | angle_unit, | ||
| size_t | num_points | ||
| ) |
Calculates an interpolated rotation path from a set of waypoints.
This function is a stateless utility for UI previews.
| waypoints | An array of fers_rotation_waypoint_t structs. |
| waypoint_count | The number of waypoints in the array. |
| interp_type | The interpolation algorithm to use (STATIC, LINEAR, CUBIC). |
| angle_unit | The unit used by the waypoint angles and desired output angles. |
| num_points | The desired number of points in the output interpolated path. |
fers_interpolated_rotation_path_t struct containing the results. Returns NULL on failure. The caller owns the returned struct and must free it with fers_free_interpolated_rotation_path. Definition at line 1391 of file api.cpp.
References math::RotationPath::addCoord(), serial::rotation_warning_utils::Angle, math::SVec3::azimuth, serial::rotation_warning_utils::clear_captured_warnings(), params::Degrees, math::SVec3::elevation, logging::ERROR, serial::rotation_angle_utils::external_rotation_to_internal(), FERS_ANGLE_UNIT_RAD, FERS_INTERP_CUBIC, math::RotationPath::finalize(), math::RotationPath::getPosition(), handle_api_exception(), serial::rotation_angle_utils::internal_azimuth_to_external(), serial::rotation_angle_utils::internal_elevation_to_external(), last_error_message, last_warning_messages, LOG, serial::rotation_warning_utils::maybe_warn_about_rotation_value(), params::Radians, math::RotationPath::setInterp(), fers_rotation_waypoint_t::time, and to_cpp_rot_interp_type().
Here is the call graph for this function:| char * fers_get_last_error_message | ( | ) |
Retrieves the last error message that occurred on the current thread.
Because C++ exceptions cannot safely propagate across the FFI boundary into other languages, this function provides the standard C-style error reporting mechanism. The error state is stored in a thread-local variable to ensure that concurrent API calls from different threads do not overwrite each other's error messages. The error is cleared at the start of each fallible API call.
fers_free_string() to prevent memory leaks.Definition at line 1084 of file api.cpp.
References last_error_message.
| char * fers_get_last_output_metadata_json | ( | fers_context_t * | context | ) |
Returns JSON metadata for the most recent simulation output files.
The returned JSON describes generated HDF5 file structure and sample ranges. The caller owns the returned string and must free it with fers_free_string. If no simulation has completed yet, the returned JSON contains an empty files array.
| context | A valid fers_context_t handle. |
Definition at line 758 of file api.cpp.
References logging::ERROR, FersContext::getLastOutputMetadataJson(), handle_api_exception(), last_error_message, and LOG.
Here is the call graph for this function:| char * fers_get_last_warning_messages_json | ( | ) |
Returns the last deduplicated rotation-unit warning list for the calling thread as JSON.
The returned value is a JSON array of strings. It is populated by successful XML/JSON load and update calls that detect suspicious rotation values. The caller owns the string and must free it with fers_free_string().
Definition at line 1097 of file api.cpp.
References last_warning_messages.
| fers_log_level_t fers_get_log_level | ( | ) |
Returns the current internal logger level.
Definition at line 379 of file api.cpp.
References logging::logger, and map_internal_log_level().
Here is the call graph for this function:| char * fers_get_memory_projection_json | ( | fers_context_t * | context | ) |
Returns a JSON projection of simulation startup memory and HDF5 payload size.
The projection includes phase-noise lookup memory, streaming I/Q buffer memory, rendered HDF5 payload size, current resident memory not attributed to streaming I/Q buffers where available, and an aggregate projected total. The caller owns the returned string and must free it with fers_free_string.
| context | A valid fers_context_t handle. |
Definition at line 781 of file api.cpp.
References logging::ERROR, handle_api_exception(), last_error_message, LOG, core::memoryProjectionToJsonString(), and core::projectSimulationMemory().
Here is the call graph for this function:| char * fers_get_scenario_as_json | ( | fers_context_t * | context | ) |
Serializes the current simulation scenario into a JSON string.
This function is the primary method for the UI to retrieve the full state of the simulation. JSON is used as the interchange format because it is lightweight, human-readable, and natively supported by web technologies, making it trivial to parse and use in the React/TypeScript frontend.
fers_free_string() to prevent memory leaks.| context | A valid fers_context_t handle. |
Definition at line 701 of file api.cpp.
References logging::ERROR, handle_api_exception(), last_error_message, LOG, and serial::world_to_json().
Here is the call graph for this function:| char * fers_get_scenario_as_xml | ( | fers_context_t * | context | ) |
Serializes the current simulation scenario into a FERS XML string.
This function enables exporting the in-memory state back into the standard FERS XML file format. This is essential for interoperability with legacy tools and for allowing a user to save a scenario that was created or modified in the UI.
fers_free_string() to prevent memory leaks.| context | A valid fers_context_t handle. |
Definition at line 728 of file api.cpp.
References logging::ERROR, handle_api_exception(), last_error_message, LOG, and serial::world_to_xml_string().
Here is the call graph for this function:Returns the library version string.
The returned pointer remains valid for the lifetime of the process and must not be freed by the caller.
Definition at line 377 of file api.cpp.
Referenced by core::showHelp().
Here is the caller graph for this function:| int fers_load_scenario_from_xml_file | ( | fers_context_t * | context, |
| const char * | xml_filepath, | ||
| int | validate | ||
| ) |
Loads a scenario into the context from a FERS XML file.
This is the standard method for initializing a simulation context from a file on disk. It is essential for interoperability with the CLI and legacy workflows that rely on the FERS XML format.
| context | A valid fers_context_t handle. |
| xml_filepath | A null-terminated UTF-8 string for the input XML file path. |
| validate | A boolean (0 or 1) indicating whether to validate the XML against the embedded FERS schema. Validation is recommended to ensure scenario correctness. |
fers_get_last_error_message() to retrieve error details. Definition at line 605 of file api.cpp.
References begin_warning_capture(), complete_warning_capture(), discard_warning_capture(), logging::ERROR, handle_api_exception(), logging::INFO, last_error_message, LOG, params::params, serial::parseSimulation(), and params::Parameters::random_seed.
Here is the call graph for this function:| int fers_load_scenario_from_xml_string | ( | fers_context_t * | context, |
| const char * | xml_content, | ||
| int | validate | ||
| ) |
Loads a scenario into the context from a FERS XML string.
This function provides a way to load a scenario from an in-memory string, avoiding file I/O. It is useful for test harnesses or for UIs that manage scenarios as text content before parsing.
| context | A valid fers_context_t handle. |
| xml_content | A null-terminated UTF-8 string containing the FERS scenario in XML format. |
| validate | A boolean (0 or 1) indicating whether to validate the XML against the embedded FERS schema. |
fers_get_last_error_message() to retrieve error details. Definition at line 656 of file api.cpp.
References begin_warning_capture(), complete_warning_capture(), discard_warning_capture(), logging::ERROR, handle_api_exception(), logging::INFO, last_error_message, LOG, params::params, serial::parseSimulationFromString(), and params::Parameters::random_seed.
Here is the call graph for this function:| void fers_log | ( | fers_log_level_t | level, |
| const char * | message | ||
| ) |
Submits a log message to the library's unified logging system.
This ensures CLI messages match the format (timestamps, alignment) of library messages.
Definition at line 392 of file api.cpp.
References logging::Logger::log(), logging::logger, and map_api_log_level().
Here is the call graph for this function:| int fers_run_simulation | ( | fers_context_t * | context, |
| fers_progress_callback_t | callback, | ||
| void * | user_data | ||
| ) |
Runs the simulation defined in the provided context.
This function is synchronous and will block the calling thread until the simulation is complete. This design keeps the API simple. For use in a responsive UI, it is the responsibility of the caller (e.g., the Tauri backend) to invoke this function on a separate worker thread to avoid freezing the user interface.
| context | A valid fers_context_t handle containing a loaded scenario. |
| callback | A function pointer to a progress callback. Can be NULL. |
| user_data | An opaque pointer passed to the callback function. |
fers_get_last_error_message() to retrieve error details. Definition at line 1211 of file api.cpp.
| int fers_run_simulation_ex | ( | fers_context_t * | context, |
| fers_progress_callback_t | progress_callback, | ||
| void * | progress_user_data, | ||
| fers_cancel_callback_t | cancel_callback, | ||
| void * | cancel_user_data, | ||
| fers_vita49_telemetry_callback_t | vita49_telemetry_callback, | ||
| void * | vita49_telemetry_user_data | ||
| ) |
Runs the simulation with optional progress, cancellation, and VITA telemetry callbacks.
Return values match fers_run_simulation, except 2 means the run was cooperatively cancelled after output finalization and metadata collection.
| context | A valid fers_context_t handle containing a loaded scenario. |
| progress_callback | Optional progress callback. Can be NULL. |
| progress_user_data | Opaque pointer passed to the progress callback. |
| cancel_callback | Optional cancellation callback. Can be NULL. |
| cancel_user_data | Opaque pointer passed to the cancellation callback. |
| vita49_telemetry_callback | Optional VITA live telemetry callback. Can be NULL. |
| vita49_telemetry_user_data | Opaque pointer passed to the VITA telemetry callback. |
Definition at line 1225 of file api.cpp.
| void fers_set_log_callback | ( | fers_log_callback_t | callback, |
| void * | user_data | ||
| ) |
Registers a callback for formatted log lines.
Pass NULL as callback to disable log callbacks.
Definition at line 381 of file api.cpp.
References logging::logger, and logging::Logger::setCallback().
Here is the call graph for this function:| int fers_set_output_directory | ( | fers_context_t * | context, |
| const char * | out_dir | ||
| ) |
Sets the output directory for simulation results.
| context | A valid fers_context_t handle. |
| out_dir | A null-terminated UTF-8 string for the output directory path. |
Definition at line 419 of file api.cpp.
References handle_api_exception(), last_error_message, and FersContext::setOutputDir().
Here is the call graph for this function:Sets the number of worker threads for the simulation.
| num_threads | The number of threads to use. |
Definition at line 400 of file api.cpp.
References handle_api_exception(), last_error_message, and params::setThreads().
Here is the call graph for this function:| int fers_set_vita49_epoch_unix_nanoseconds | ( | fers_context_t * | context, |
| uint64_t | epoch_unix_nanoseconds | ||
| ) |
Sets a deterministic FERS VITA 49.2 stream epoch as Unix nanoseconds.
The epoch must fit the VRT 32-bit UTC seconds timestamp field.
| context | A valid fers_context_t handle. |
| epoch_unix_nanoseconds | Unix epoch timestamp in nanoseconds. |
| int fers_set_vita49_fullscale | ( | fers_context_t * | context, |
| double | fullscale | ||
| ) |
Sets the fixed ADC full-scale value used by the FERS VITA 49.2 int16 IQ profile.
VITA mode requires a positive finite full-scale before simulation starts. HDF5 output keeps its existing full-buffer scaling behavior.
| context | A valid fers_context_t handle. |
| fullscale | Positive finite full-scale value. |
Definition at line 505 of file api.cpp.
References core::Vita49OutputConfig::adc_fullscale, last_error_message, and core::OutputConfig::vita49.
| int fers_set_vita49_max_udp_payload | ( | fers_context_t * | context, |
| uint16_t | max_udp_payload | ||
| ) |
Sets the FERS VITA 49.2 UDP profile maximum payload size in bytes.
The default is 1400 bytes to avoid ordinary IP fragmentation.
| context | A valid fers_context_t handle. |
| max_udp_payload | Maximum UDP payload size in bytes. |
| int fers_set_vita49_packet_trace_enabled | ( | fers_context_t * | context, |
| int | enabled | ||
| ) |
Enables or disables FERS VITA 49.2 packet trace telemetry.
Stream counter telemetry is unaffected. Disabling packet trace telemetry avoids per-packet diagnostic record creation for UI runs that only need live counters.
| context | A valid fers_context_t handle. |
| enabled | Non-zero to enable packet trace telemetry, zero to disable it. |
Definition at line 589 of file api.cpp.
References last_error_message, core::Vita49OutputConfig::packet_trace_enabled, and core::OutputConfig::vita49.
| int fers_set_vita49_queue_depth | ( | fers_context_t * | context, |
| uint32_t | queue_depth | ||
| ) |
Sets the bounded FERS VITA 49.2 sender queue depth in packets.
When this queue is full, the simulation thread blocks until the pacing thread sends a packet and frees a slot.
| context | A valid fers_context_t handle. |
| queue_depth | Queue depth in packets. Must be greater than zero. |
| int fers_update_antenna_from_json | ( | fers_context_t * | context, |
| const char * | json | ||
| ) |
Updates a single antenna from JSON without full context recreation.
| context | A valid fers_context_t handle. |
| json | The JSON string for the antenna. |
Definition at line 867 of file api.cpp.
References handle_api_exception(), last_error_message, and serial::update_antenna_from_json().
Here is the call graph for this function:| int fers_update_monostatic_from_json | ( | fers_context_t * | context, |
| const char * | json | ||
| ) |
Updates a monostatic radar from JSON without full context recreation.
| context | A valid fers_context_t handle. |
| json | The JSON string for the monostatic component. |
Definition at line 991 of file api.cpp.
References handle_api_exception(), last_error_message, and serial::update_monostatic_from_json().
Here is the call graph for this function:| int fers_update_parameters_from_json | ( | fers_context_t * | context, |
| const char * | json | ||
| ) |
Updates the global simulation parameters from JSON without full context recreation.
| context | A valid fers_context_t handle. |
| json | The JSON string for the parameters. |
Definition at line 842 of file api.cpp.
References begin_warning_capture(), complete_warning_capture(), discard_warning_capture(), handle_api_exception(), last_error_message, and serial::update_parameters_from_json().
Here is the call graph for this function:| int fers_update_platform_from_json | ( | fers_context_t * | context, |
| uint64_t | id, | ||
| const char * | json | ||
| ) |
Updates a single platform's paths and name from JSON without full context recreation.
| context | A valid fers_context_t handle. |
| id | The unique ID of the platform. |
| json | The JSON string for the platform. |
Definition at line 806 of file api.cpp.
References begin_warning_capture(), complete_warning_capture(), discard_warning_capture(), core::World::findPlatform(), FersContext::getWorld(), handle_api_exception(), last_error_message, and serial::update_platform_paths_from_json().
Here is the call graph for this function:| int fers_update_receiver_from_json | ( | fers_context_t * | context, |
| uint64_t | id, | ||
| const char * | json | ||
| ) |
Updates a single receiver from JSON without full context recreation.
| context | A valid fers_context_t handle. |
| id | The unique ID of the receiver. |
| json | The JSON string for the receiver. |
Definition at line 941 of file api.cpp.
References core::World::findReceiver(), FersContext::getWorld(), handle_api_exception(), last_error_message, and serial::update_receiver_from_json().
Here is the call graph for this function:| int fers_update_scenario_from_json | ( | fers_context_t * | context, |
| const char * | scenario_json | ||
| ) |
Updates the simulation scenario from a JSON string.
This is the primary method for the UI to push its state back to the C++ core. It performs a full replacement of the existing scenario.
| context | A valid fers_context_t handle. |
| scenario_json | A null-terminated UTF-8 string containing the FERS scenario in JSON format. |
fers_get_last_error_message() to retrieve error details. Definition at line 1045 of file api.cpp.
References begin_warning_capture(), complete_warning_capture(), discard_warning_capture(), logging::ERROR, handle_api_exception(), serial::json_to_world(), last_error_message, and LOG.
Here is the call graph for this function:| int fers_update_target_from_json | ( | fers_context_t * | context, |
| uint64_t | id, | ||
| const char * | json | ||
| ) |
Updates a single target from JSON without full context recreation.
| context | A valid fers_context_t handle. |
| id | The unique ID of the target. |
| json | The JSON string for the target. |
Definition at line 966 of file api.cpp.
References core::World::findTarget(), FersContext::getWorld(), handle_api_exception(), last_error_message, and serial::update_target_from_json().
Here is the call graph for this function:| int fers_update_timing_from_json | ( | fers_context_t * | context, |
| uint64_t | id, | ||
| const char * | json | ||
| ) |
Updates a single timing source from JSON without full context recreation.
| context | A valid fers_context_t handle. |
| id | The unique ID of the timing source. |
| json | The JSON string for the timing source. |
Definition at line 1021 of file api.cpp.
References handle_api_exception(), last_error_message, and serial::update_timing_from_json().
Here is the call graph for this function:| int fers_update_transmitter_from_json | ( | fers_context_t * | context, |
| uint64_t | id, | ||
| const char * | json | ||
| ) |
Updates a single transmitter from JSON without full context recreation.
| context | A valid fers_context_t handle. |
| id | The unique ID of the transmitter. |
| json | The JSON string for the transmitter. |
Definition at line 916 of file api.cpp.
References core::World::findTransmitter(), FersContext::getWorld(), handle_api_exception(), last_error_message, and serial::update_transmitter_from_json().
Here is the call graph for this function:| int fers_update_waveform_from_json | ( | fers_context_t * | context, |
| const char * | json | ||
| ) |
Updates a single waveform from JSON without full context recreation.
| context | A valid fers_context_t handle. |
| json | The JSON string for the waveform. |
Definition at line 893 of file api.cpp.
References handle_api_exception(), last_error_message, and serial::parse_waveform_from_json().
Here is the call graph for this function:| int fers_use_hdf5_output | ( | fers_context_t * | context | ) |
Resets the context output mode to the default HDF5 output.
Runtime-only VITA 49.2 endpoint settings are retained for later VITA runs, but the selected output mode is changed back to HDF5.
| context | A valid fers_context_t handle. |
Definition at line 440 of file api.cpp.
References handle_api_exception(), core::Hdf5, last_error_message, and core::OutputConfig::mode.
Here is the call graph for this function: