aboutsummaryrefslogtreecommitdiffstats
path: root/src/output/SDR.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2023-03-31 14:31:32 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2023-03-31 14:31:32 +0200
commitae70341365e27d766c8530924209fc4826036aea (patch)
treeb18247e0b96b45b6f74b66d0ab5b5d69bb63f143 /src/output/SDR.cpp
parentfe19871f8ee362f65d194b864eb989618b994e58 (diff)
downloaddabmod-ae70341365e27d766c8530924209fc4826036aea.tar.gz
dabmod-ae70341365e27d766c8530924209fc4826036aea.tar.bz2
dabmod-ae70341365e27d766c8530924209fc4826036aea.zip
Add JSON output to RC
Diffstat (limited to 'src/output/SDR.cpp')
-rw-r--r--src/output/SDR.cpp26
1 files changed, 26 insertions, 0 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