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
100 std::string receiver_name = {};
101 std::string mode = {};
106 bool dechirped = false;
107 bool if_resampled = false;
108 unsigned adc_bits = 0;
114 };
115
117 {
121 std::span<const ComplexType> samples;
122 std::uint64_t sample_start = 0;
123 bool valid_data = true;
124 bool calibrated_time = true;
125 bool reference_lock = true;
126 std::shared_ptr<const OutputFileMetadata> file_metadata = nullptr;
127 };
128
130 {
132 std::string receiver_name;
133 std::uint32_t stream_id = 0;
134 std::string mode = "unknown";
137 std::uint64_t packets_emitted = 0;
138 std::uint64_t context_packets = 0;
139 std::uint64_t samples_emitted = 0;
140 std::uint64_t packets_dropped = 0;
141 std::uint64_t samples_dropped = 0;
142 std::uint64_t over_range_count = 0;
143 std::uint64_t late_packet_count = 0;
144 std::optional<RealType> first_sample_time = std::nullopt;
145 std::optional<RealType> end_sample_time = std::nullopt;
146 std::optional<Vita49Timestamp> first_timestamp = std::nullopt;
147 std::optional<Vita49Timestamp> end_timestamp = std::nullopt;
148 };
149
151 {
153 std::optional<std::uint64_t> epoch_unix_nanoseconds = std::nullopt;
154 std::vector<ReceiverStreamStats> streams;
155 };
156
158 {
159 std::uint64_t sequence = 0;
160 std::string event;
161 std::uint32_t stream_id = 0;
162 std::uint64_t byte_count = 0;
163 std::uint64_t sample_count = 0;
165 std::optional<Vita49Timestamp> timestamp = std::nullopt;
166 bool data_packet = false;
167 bool context_packet = false;
168 bool dropped = false;
169 bool over_range = false;
170 bool sample_loss = false;
171 };
172
174 std::function<void(const std::optional<OutputStats>&, std::span<const ReceiverOutputPacketTrace>)>;
175
177 {
178 public:
179 virtual ~ReceiverOutputSink() = default;
180
181 virtual void initializeRun(const OutputConfig& config, std::string simulation_name) = 0;
182 virtual std::uint32_t registerStream(const ReceiverStreamDescriptor& stream) = 0;
183 virtual void openStream(std::uint32_t stream_id, RealType first_sample_time) = 0;
184 virtual void submitBlock(const ReceiverSampleBlock& block) = 0;
186 virtual void closeStream(std::uint32_t stream_id) = 0;
187 virtual OutputStats finalize() = 0;
188 [[nodiscard]] virtual OutputStats snapshotStats() const { return {}; }
189 };
190}
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< Vita49Timestamp > first_timestamp
std::optional< RealType > first_sample_time
std::optional< RealType > end_sample_time
std::optional< Vita49Timestamp > end_timestamp