summaryrefslogtreecommitdiffstats
path: root/src/ManagementServer.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2019-09-18 11:49:11 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2019-09-18 11:49:11 +0200
commit015427d9e74f34dc7d0f7fbad4ad1eaad6537cce (patch)
tree01ae9249194fbff234e32b59c07f7894aef16878 /src/ManagementServer.cpp
parent9c2e691744f96ae7ace8b82385b080ee9d858906 (diff)
downloaddabmux-015427d9e74f34dc7d0f7fbad4ad1eaad6537cce.tar.gz
dabmux-015427d9e74f34dc7d0f7fbad4ad1eaad6537cce.tar.bz2
dabmux-015427d9e74f34dc7d0f7fbad4ad1eaad6537cce.zip
EDI in: add audio levels metadata and source version
Diffstat (limited to 'src/ManagementServer.cpp')
-rw-r--r--src/ManagementServer.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/ManagementServer.cpp b/src/ManagementServer.cpp
index 201fc7b..783a40b 100644
--- a/src/ManagementServer.cpp
+++ b/src/ManagementServer.cpp
@@ -485,6 +485,14 @@ void InputStat::notifyOverrun(void)
}
}
+void InputStat::notifyVersion(const std::string& version, uint32_t uptime_s)
+{
+ unique_lock<mutex> lock(m_mutex);
+
+ m_version = version;
+ m_uptime_s = uptime_s;
+}
+
std::string InputStat::encodeValuesJSON()
{
std::ostringstream ss;
@@ -548,6 +556,13 @@ std::string InputStat::encodeValuesJSON()
return dB;
};
+ auto version = m_version;
+ size_t pos = 0;
+ while ((pos = version.find("\"", pos)) != std::string::npos) {
+ version.replace(pos, 1, "\\\"");
+ pos++;
+ }
+
ss <<
"{ \"inputstat\" : {"
"\"min_fill\": " << min_fill_buffer << ", "
@@ -557,7 +572,10 @@ std::string InputStat::encodeValuesJSON()
"\"peak_left_slow\": " << to_dB(peak_left) << ", "
"\"peak_right_slow\": " << to_dB(peak_right) << ", "
"\"num_underruns\": " << m_num_underruns << ", "
- "\"num_overruns\": " << m_num_overruns << ", ";
+ "\"num_overruns\": " << m_num_overruns << ", "
+ "\"version\": \"" << version << "\", "
+ "\"uptime\": " << m_uptime_s << ", "
+ ;
ss << "\"state\": ";