diff options
Diffstat (limited to 'src/output')
-rw-r--r-- | src/output/SDR.cpp | 26 | ||||
-rw-r--r-- | src/output/SDR.h | 2 | ||||
-rw-r--r-- | src/output/SDRDevice.h | 3 | ||||
-rw-r--r-- | src/output/UHD.h | 8 |
4 files changed, 29 insertions, 10 deletions
diff --git a/src/output/SDR.cpp b/src/output/SDR.cpp index cc080dc..860d8ed 100644 --- a/src/output/SDR.cpp +++ b/src/output/SDR.cpp @@ -491,6 +491,9 @@ const string SDR::get_parameter(const string& parameter) const else if (std::holds_alternative<bool>(value)) { ss << (std::get<bool>(value) ? 1 : 0); } + else if (std::holds_alternative<std::nullopt_t>(value)) { + ss << ""; + } else { throw std::logic_error("variant alternative not handled"); } @@ -507,4 +510,27 @@ const string SDR::get_parameter(const string& parameter) const return ss.str(); } +const RemoteControllable::map_t SDR::get_all_values() const +{ + map_t stat = m_device->get_run_statistics(); + + stat["txgain"] = m_config.txgain; + stat["rxgain"] = m_config.rxgain; + stat["freq"] = m_config.frequency; + stat["muting"] = m_config.muting; + stat["temp"] = std::nullopt; + + if (m_device) { + const std::optional<double> temp = m_device->get_temperature(); + if (temp) { + stat["temp"] = *temp; + } + } + stat["queued_frames_ms"] = m_queue.size() * + (size_t)chrono::duration_cast<chrono::milliseconds>(transmission_frame_duration(m_config.dabMode)) + .count(); + + return stat; +} + } // namespace Output diff --git a/src/output/SDR.h b/src/output/SDR.h index eb0ed9d..9f08348 100644 --- a/src/output/SDR.h +++ b/src/output/SDR.h @@ -67,6 +67,8 @@ class SDR : public ModOutput, public ModMetadata, public RemoteControllable { virtual const std::string get_parameter( const std::string& parameter) const override; + virtual const RemoteControllable::map_t get_all_values() const override; + private: void process_thread_entry(void); void handle_frame(struct FrameData&& frame); diff --git a/src/output/SDRDevice.h b/src/output/SDRDevice.h index a4f551c..628372a 100644 --- a/src/output/SDRDevice.h +++ b/src/output/SDRDevice.h @@ -112,8 +112,7 @@ struct FrameData { // All SDR Devices must implement the SDRDevice interface class SDRDevice { public: - using run_statistic_t = std::variant<std::string, double, size_t, ssize_t, bool>; - using run_statistics_t = std::unordered_map<std::string, run_statistic_t>; + using run_statistics_t = RemoteControllable::map_t; virtual void tune(double lo_offset, double frequency) = 0; virtual double get_tx_freq(void) const = 0; diff --git a/src/output/UHD.h b/src/output/UHD.h index 5823c0e..97a821e 100644 --- a/src/output/UHD.h +++ b/src/output/UHD.h @@ -55,14 +55,6 @@ DESCRIPTION: #include <stdio.h> #include <sys/types.h> -// If the timestamp is further in the future than -// 100 seconds, abort -#define TIMESTAMP_ABORT_FUTURE 100 - -// Add a delay to increase buffers when -// frames are too far in the future -#define TIMESTAMP_MARGIN_FUTURE 0.5 - namespace Output { class UHD : public Output::SDRDevice |