looper/proxy_backend.cpp

32 lines
908 B
C++
Raw Normal View History

2024-04-09 10:15:05 -07:00
#include "proxy_backend.hpp"
#include "log.hpp"
#include <thread>
#include <chrono>
using namespace std::literals::chrono_literals;
std::string ProxyGlueBackend::get_id() {
return "proxy";
}
std::string ProxyGlueBackend::get_name() {
return "Proxy Backend";
}
bool ProxyGlueBackend::allow_multi_instance() {
return false;
}
int ProxyGlueBackend::run(std::vector<std::string> realArgs, int argc, char **argv) {
bool commands_specified = parse_args(realArgs, argc, argv);
if (!commands_specified) {
DEBUG.writeln("No commands specified.");
return 1;
}
sender = DBusAPISender::Create();
if (sender == nullptr) {
ERROR.writeln("Existing instance required to send commands.");
return 1;
}
playback = (Playback*)sender;
setup_playback_args();
return 0;
}
void ProxyGlueBackend::quitDaemon() {
((DBusAPISender*)playback)->Quit();
}