aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/ClockTAI.cpp6
-rw-r--r--lib/ClockTAI.h11
-rw-r--r--lib/Globals.cpp2
-rw-r--r--lib/RemoteControl.h2
4 files changed, 18 insertions, 3 deletions
diff --git a/lib/ClockTAI.cpp b/lib/ClockTAI.cpp
index d8e37ea..06e88f8 100644
--- a/lib/ClockTAI.cpp
+++ b/lib/ClockTAI.cpp
@@ -379,6 +379,7 @@ void Bulletin::clear_expiry_if_overridden()
}
}
+#if ENABLE_REMOTECONTROL
ClockTAI::ClockTAI(const std::vector<std::string>& bulletin_urls) :
RemoteControllable("clocktai")
{
@@ -386,6 +387,9 @@ ClockTAI::ClockTAI(const std::vector<std::string>& bulletin_urls) :
RC_ADD_PARAMETER(expiry, "Number of seconds until TAI Bulletin expires");
RC_ADD_PARAMETER(expires_at, "UNIX timestamp when TAI Bulletin expires");
RC_ADD_PARAMETER(url, "URLs used to fetch the bulletin, separated by pipes");
+#else
+ClockTAI::ClockTAI(const std::vector<std::string>& bulletin_urls) {
+#endif // ENABLE_REMOTECONTROL
if (bulletin_urls.empty()) {
etiLog.level(debug) << "Initialising default TAI Bulletin URLs";
@@ -629,6 +633,7 @@ void Bulletin::store_to_cache(const char* cache_filename) const
}
}
+#if ENABLE_REMOTECONTROL
void ClockTAI::set_parameter(const string& parameter, const string& value)
{
if (parameter == "expiry" or parameter == "expires_at") {
@@ -719,6 +724,7 @@ const json::map_t ClockTAI::get_all_values() const
return stat;
}
+#endif // ENABLE_REMOTECONTROL
#if 0
// Example testing code
diff --git a/lib/ClockTAI.h b/lib/ClockTAI.h
index 8cd00e5..d11dd10 100644
--- a/lib/ClockTAI.h
+++ b/lib/ClockTAI.h
@@ -35,8 +35,6 @@
#pragma once
#include <cstdint>
-#include <cstdlib>
-#include <sstream>
#include <chrono>
#include <future>
#include <mutex>
@@ -44,6 +42,7 @@
#include <vector>
#include <optional>
#include <variant>
+
#include "RemoteControl.h"
// EDI needs to know UTC-TAI, but doesn't need the CLOCK_TAI to be set.
@@ -86,7 +85,11 @@ class Bulletin {
};
/* Loads, parses and represents TAI-UTC offset information from the IETF bulletin */
-class ClockTAI : public RemoteControllable {
+class ClockTAI
+#if ENABLE_REMOTECONTROL
+: public RemoteControllable
+#endif // ENABLE_REMOTECONTROL
+{
public:
ClockTAI(const std::vector<std::string>& bulletin_urls);
@@ -125,6 +128,7 @@ class ClockTAI : public RemoteControllable {
std::optional<BulletinState> m_state;
std::chrono::steady_clock::time_point m_state_last_updated;
+#if ENABLE_REMOTECONTROL
public:
/* Remote control */
virtual void set_parameter(const std::string& parameter,
@@ -134,5 +138,6 @@ class ClockTAI : public RemoteControllable {
virtual const std::string get_parameter(const std::string& parameter) const;
virtual const json::map_t get_all_values() const;
+#endif // ENABLE_REMOTECONTROL
};
diff --git a/lib/Globals.cpp b/lib/Globals.cpp
index 6be26ec..6bd38fb 100644
--- a/lib/Globals.cpp
+++ b/lib/Globals.cpp
@@ -32,5 +32,7 @@
// the RC needs logging, and needs to be initialised later.
Logger etiLog;
+#if ENABLE_REMOTECONTROL
RemoteControllers rcs;
+#endif // ENABLE_REMOTECONTROL
diff --git a/lib/RemoteControl.h b/lib/RemoteControl.h
index 26f30d9..7dd763d 100644
--- a/lib/RemoteControl.h
+++ b/lib/RemoteControl.h
@@ -31,6 +31,8 @@
# include "config.h"
#endif
+#define ENABLE_REMOTECONTROL 1
+
#if defined(HAVE_ZEROMQ)
# include "zmq.hpp"
#endif