looper/daemon_backend.cpp

31 lines
875 B
C++
Raw Normal View History

2024-04-24 09:59:51 -07:00
#ifdef DBUS_ENABLED
2024-04-09 10:15:05 -07:00
#include "daemon_backend.hpp"
#include "log.hpp"
#include <thread>
#include <chrono>
using namespace std::literals::chrono_literals;
std::string DaemonGlueBackend::get_id() {
return "daemon";
}
std::string DaemonGlueBackend::get_name() {
return "Daemon Backend";
}
bool DaemonGlueBackend::allow_multi_instance() {
return false;
}
int DaemonGlueBackend::run(std::vector<std::string> realArgs, int argc, char **argv) {
parse_args(realArgs, argc, argv);
playback = Playback::Create(nullptr, true);
if (playback == nullptr) {
ERROR.writeln("Cannot start daemon with existing instance running.");
return 1;
}
setup_playback_args();
dbus_api = DBusAPI::Create(playback, true);
exit_flag.store(false);
while (!exit_flag.load()) {
std::this_thread::sleep_for(100ms);
}
return 0;
2024-04-24 09:59:51 -07:00
}
#endif