diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2023-03-29 16:30:06 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2023-03-29 17:09:21 +0200 |
commit | fd46d43f51796a6bbdd629e08535bacbc853f283 (patch) | |
tree | 832f0a36a2d54c0dba23b59297d6894c8d9a6edc /src/output/SDRDevice.h | |
parent | efea1c485f178cdbadf5babdf7951e6d1a1ed801 (diff) | |
download | dabmod-fd46d43f51796a6bbdd629e08535bacbc853f283.tar.gz dabmod-fd46d43f51796a6bbdd629e08535bacbc853f283.tar.bz2 dabmod-fd46d43f51796a6bbdd629e08535bacbc853f283.zip |
Replace RunStatistics to permit representation of SDR device specific stats
Diffstat (limited to 'src/output/SDRDevice.h')
-rw-r--r-- | src/output/SDRDevice.h | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/output/SDRDevice.h b/src/output/SDRDevice.h index ffa1a3b..337d501 100644 --- a/src/output/SDRDevice.h +++ b/src/output/SDRDevice.h @@ -2,7 +2,7 @@ Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Her Majesty the Queen in Right of Canada (Communications Research Center Canada) - Copyright (C) 2022 + Copyright (C) 2023 Matthias P. Braendli, matthias.braendli@mpb.li http://opendigitalradio.org @@ -38,6 +38,9 @@ DESCRIPTION: #include <string> #include <vector> #include <complex> +#include <variant> +#include <optional> +#include <unordered_map> #include "TimestampDecoder.h" @@ -109,22 +112,15 @@ struct FrameData { // All SDR Devices must implement the SDRDevice interface class SDRDevice { public: - struct RunStatistics { - size_t num_underruns = 0; - size_t num_late_packets = 0; - size_t num_overruns = 0; - size_t num_frames_modulated = 0; - - int gpsdo_num_sv = 0; - bool gpsdo_holdover = false; - }; + using run_statistic_t = std::variant<std::string, size_t, ssize_t, bool>; + using run_statistics_t = std::unordered_map<std::string, run_statistic_t>; virtual void tune(double lo_offset, double frequency) = 0; virtual double get_tx_freq(void) const = 0; virtual void set_txgain(double txgain) = 0; virtual double get_txgain(void) const = 0; virtual void transmit_frame(struct FrameData&& frame) = 0; - virtual RunStatistics get_run_statistics(void) const = 0; + virtual run_statistics_t get_run_statistics(void) const = 0; virtual double get_real_secs(void) const = 0; virtual void set_rxgain(double rxgain) = 0; virtual double get_rxgain(void) const = 0; @@ -136,8 +132,8 @@ class SDRDevice { frame_timestamp& ts, double timeout_secs) = 0; - // Returns device temperature in degrees C or NaN if not available - virtual double get_temperature(void) const = 0; + // Returns device temperature in degrees C + virtual std::optional<double> get_temperature(void) const = 0; // Return true if GPS and reference clock inputs are ok virtual bool is_clk_source_ok(void) const = 0; |