aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ConfigParser.cpp6
-rw-r--r--src/DabMod.cpp2
-rw-r--r--src/Events.cpp10
-rw-r--r--src/Events.h20
4 files changed, 15 insertions, 23 deletions
diff --git a/src/ConfigParser.cpp b/src/ConfigParser.cpp
index 4a1e362..fb2c1a1 100644
--- a/src/ConfigParser.cpp
+++ b/src/ConfigParser.cpp
@@ -38,8 +38,6 @@
#include "Utils.h"
#include "Log.h"
#include "Events.h"
-#include "DabModulator.h"
-#include "output/SDR.h"
using namespace std;
@@ -124,7 +122,11 @@ static void parse_configfile(
// log parameters:
const string events_endpoint = pt.Get("log.events_endpoint", "");
if (not events_endpoint.empty()) {
+#if defined(HAVE_ZEROMQ)
events.bind(events_endpoint);
+#else
+ throw std::runtime_error("Cannot configure events sender when compiled without zeromq");
+#endif
}
if (pt.GetInteger("log.syslog", 0) == 1) {
diff --git a/src/DabMod.cpp b/src/DabMod.cpp
index 6b02d75..3b072c1 100644
--- a/src/DabMod.cpp
+++ b/src/DabMod.cpp
@@ -375,7 +375,9 @@ int launch_modulator(int argc, char* argv[])
mod_settings_t mod_settings;
parse_args(argc, argv, mod_settings);
+#if defined(HAVE_ZEROMQ)
etiLog.register_backend(make_shared<LogToEventSender>());
+#endif // defined(HAVE_ZEROMQ)
etiLog.level(info) << "Configuration parsed. Starting up version " <<
#if defined(GITVERSION)
diff --git a/src/Events.cpp b/src/Events.cpp
index 3171cda..f8cc2b8 100644
--- a/src/Events.cpp
+++ b/src/Events.cpp
@@ -3,7 +3,7 @@
Her Majesty the Queen in Right of Canada (Communications Research
Center Canada)
- Copyright (C) 2023
+ Copyright (C) 2024
Matthias P. Braendli, matthias.braendli@mpb.li
http://www.opendigitalradio.org
@@ -22,16 +22,13 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-#include <list>
#include <string>
-#include <iostream>
-#include <sstream>
-#include <iomanip>
#include <string>
-#include <algorithm>
#include "Events.h"
+#if defined(HAVE_ZEROMQ)
+
EventSender events;
EventSender::EventSender() :
@@ -95,3 +92,4 @@ std::string LogToEventSender::get_name() const
{
return "EventSender";
}
+#endif // defined(HAVE_ZEROMQ)
diff --git a/src/Events.h b/src/Events.h
index 9f838e5..ea1ace2 100644
--- a/src/Events.h
+++ b/src/Events.h
@@ -3,12 +3,10 @@
Her Majesty the Queen in Right of Canada (Communications Research
Center Canada)
- Copyright (C) 2023
+ Copyright (C) 2024
Matthias P. Braendli, matthias.braendli@mpb.li
http://www.opendigitalradio.org
-
- This module adds remote-control capability to some of the dabmux/dabmod modules.
*/
/*
This program is free software: you can redistribute it and/or modify
@@ -33,18 +31,9 @@
#if defined(HAVE_ZEROMQ)
# include "zmq.hpp"
-#endif
-
-#include <list>
-#include <unordered_map>
-#include <variant>
-#include <map>
-#include <memory>
-#include <string>
-#include <stdexcept>
-
-#include "Log.h"
-#include "Json.h"
+# include <string>
+# include "Log.h"
+# include "Json.h"
class EventSender {
public:
@@ -75,3 +64,4 @@ class LogToEventSender: public LogBackend {
* It is constructed in Events.cpp */
extern EventSender events;
+#endif // defined(HAVE_ZEROMQ)