FERS 0.1.0
The Flexible Extensible Radar Simulator
Loading...
Searching...
No Matches
receiver_output.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-only
2//
3// Copyright (c) 2026-present FERS Contributors (see AUTHORS.md).
4//
5// See the GNU GPLv2 LICENSE file in the FERS project root for more information.
6
7#pragma once
8
9#include <cstdint>
10#include <functional>
11#include <memory>
12#include <optional>
13#include <span>
14#include <string>
15#include <vector>
16
17#include "core/config.h"
18#include "core/output_config.h"
19#include "core/sim_id.h"
21
22namespace core
23{
24 struct OutputFileMetadata;
25
27 {
29 {
30 std::string frame = "ENU";
34 std::int32_t utm_zone = 0;
36 };
37
51
53 {
54 bool present = false;
55 std::string waveform_shape = {};
61 std::string sweep_direction = {};
63 std::optional<RealType> triangle_period = std::nullopt;
64 std::optional<std::uint64_t> chirp_count = std::nullopt;
65 std::optional<std::uint64_t> triangle_count = std::nullopt;
66 std::string dechirp_mode = "none";
67 std::string dechirp_reference_source = "none";
72 };
73
89
90 struct CwContext
91 {
92 bool present = false;
94 std::string waveform_name = {};
97 };
98
120
122 std::string receiver_name = {};
123 std::string mode = {};
128 bool dechirped = false;
129 bool if_resampled = false;
130 unsigned adc_bits = 0;
137 };
138
140 {
144 std::span<const ComplexType> samples;
145 std::uint64_t sample_start = 0;
146 bool valid_data = true;
147 bool calibrated_time = true;
148 bool reference_lock = true;
149 std::shared_ptr<const OutputFileMetadata> file_metadata = nullptr;
150 };
151
153 {
155 std::string receiver_name;
156 std::uint32_t stream_id = 0;
157 std::string mode = "unknown";
160 std::uint64_t packets_emitted = 0;
161 std::uint64_t context_packets = 0;
162 std::uint64_t samples_emitted = 0;
163 std::uint64_t packets_dropped = 0;
164 std::uint64_t samples_dropped = 0;
165 std::uint64_t over_range_count = 0;
166 std::uint64_t late_packet_count = 0;
167 std::optional<RealType> first_sample_time = std::nullopt;
168 std::optional<RealType> end_sample_time = std::nullopt;
169 std::optional<Vita49Timestamp> first_timestamp = std::nullopt;
170 std::optional<Vita49Timestamp> end_timestamp = std::nullopt;
171 };
172
174 {
176 std::optional<std::uint64_t> epoch_unix_nanoseconds = std::nullopt;
177 std::vector<ReceiverStreamStats> streams;
178 };
179
181 {
182 std::uint64_t sequence = 0;
183 std::string event;
184 std::uint32_t stream_id = 0;
185 std::uint64_t byte_count = 0;
186 std::uint64_t sample_count = 0;
188 std::optional<Vita49Timestamp> timestamp = std::nullopt;
189 bool data_packet = false;
190 bool context_packet = false;
191 bool dropped = false;
192 bool over_range = false;
193 bool sample_loss = false;
194 };
195
197 std::function<void(const std::optional<OutputStats>&, std::span<const ReceiverOutputPacketTrace>)>;
198
200 {
201 public:
202 virtual ~ReceiverOutputSink() = default;
203
204 virtual void initializeRun(const OutputConfig& config, std::string simulation_name) = 0;
205 virtual std::uint32_t registerStream(const ReceiverStreamDescriptor& stream) = 0;
206 virtual void openStream(std::uint32_t stream_id, RealType first_sample_time) = 0;
207 virtual void submitBlock(const ReceiverSampleBlock& block) = 0;
209 virtual void closeStream(std::uint32_t stream_id) = 0;
210 virtual OutputStats finalize() = 0;
211 [[nodiscard]] virtual OutputStats snapshotStats() const { return {}; }
212 };
213}
virtual void emitContextHeartbeat(RealType simulation_time)=0
virtual void submitBlock(const ReceiverSampleBlock &block)=0
virtual void initializeRun(const OutputConfig &config, std::string simulation_name)=0
virtual OutputStats finalize()=0
virtual OutputStats snapshotStats() const
virtual std::uint32_t registerStream(const ReceiverStreamDescriptor &stream)=0
virtual ~ReceiverOutputSink()=default
virtual void closeStream(std::uint32_t stream_id)=0
virtual void openStream(std::uint32_t stream_id, RealType first_sample_time)=0
Global configuration file for the project.
double RealType
Type for real numbers.
Definition config.h:27
std::function< void(const std::optional< OutputStats > &, std::span< const ReceiverOutputPacketTrace >)> ReceiverOutputTelemetryCallback
uint64_t SimId
64-bit Unique Simulation ID.
Definition sim_id.h:18
math::Vec3 max
std::vector< ReceiverStreamStats > streams
std::optional< std::uint64_t > epoch_unix_nanoseconds
std::optional< Vita49Timestamp > timestamp
std::span< const ComplexType > samples
ReceiverStreamDescriptor stream
std::shared_ptr< const OutputFileMetadata > file_metadata
std::optional< std::uint64_t > chirp_count
std::optional< std::uint64_t > triangle_count
std::optional< std::uint64_t > sweep_count
std::optional< Vita49Timestamp > first_timestamp
std::optional< RealType > first_sample_time
std::optional< RealType > end_sample_time
std::optional< Vita49Timestamp > end_timestamp