diff options
Diffstat (limited to 'p2pvr/daemon/globalDevices.cpp')
-rw-r--r-- | p2pvr/daemon/globalDevices.cpp | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/p2pvr/daemon/globalDevices.cpp b/p2pvr/daemon/globalDevices.cpp index 3f0c485..4557fc6 100644 --- a/p2pvr/daemon/globalDevices.cpp +++ b/p2pvr/daemon/globalDevices.cpp @@ -1,22 +1,23 @@ -#include <pch.hpp> #include "globalDevices.h" #include <Ice/Ice.h> -std::vector<std::string> GlobalDevices::Devices; +namespace po = boost::program_options; -DECLARE_OPTIONS(GlobalDevices, "P2PVR Devices") -("p2pvr.globaldevices.carddaemon", - Options::functions( - [](const VariableType & df) { Devices.push_back(df); }, - []{ Devices.clear(); }), - "ICE address of remote device pools (<adapter>:<endpoint>)") -END_OPTIONS(GlobalDevices); +GlobalDevices::Options::Options() : + IceTray::Options("P2PVR Devices") +{ +} + +ICETRAY_OPTIONS(GlobalDevices::Options, + ("p2pvr.globaldevices.carddaemon", po::value(&Devices), + "ICE address of remote device pools (<object>:<endpoint>)") +) P2PVR::TunerPrx GlobalDevices::GetTunerSpecific(const DVBSI::DeliveryPtr & delivery, const Ice::Current & ice) { auto ic = ice.adapter->getCommunicator(); - for (const auto & pool : Devices) { + for (const auto & pool : options->Devices) { try { auto poolprx = P2PVR::DevicesPrx::checkedCast(ic->stringToProxy(pool)); return poolprx->GetTunerSpecific(delivery); @@ -31,7 +32,7 @@ P2PVR::TunerPrx GlobalDevices::GetTunerAny(const DVBSI::DeliveryPtr & delivery, const Ice::Current & ice) { auto ic = ice.adapter->getCommunicator(); - for (const auto & pool : Devices) { + for (const auto & pool : options->Devices) { try { auto poolprx = P2PVR::DevicesPrx::checkedCast(ic->stringToProxy(pool)); return poolprx->GetTunerAny(delivery); @@ -46,7 +47,7 @@ P2PVR::PrivateTunerPrx GlobalDevices::GetPrivateTuner(short type, const Ice::Current & ice) { auto ic = ice.adapter->getCommunicator(); - for (const auto & pool : Devices) { + for (const auto & pool : options->Devices) { try { auto poolprx = P2PVR::DevicesPrx::checkedCast(ic->stringToProxy(pool)); return poolprx->GetPrivateTuner(type); @@ -61,7 +62,7 @@ void GlobalDevices::ReleaseTuner(const P2PVR::TunerPrx & tuner, const Ice::Current & ice) { auto ic = ice.adapter->getCommunicator(); - for (const auto & pool : Devices) { + for (const auto & pool : options->Devices) { auto poolprx = P2PVR::DevicesPrx::checkedCast(ic->stringToProxy(pool)); poolprx->ReleaseTuner(tuner); } @@ -72,7 +73,7 @@ GlobalDevices::TunerCount(const Ice::Current & ice) { int total = 0; auto ic = ice.adapter->getCommunicator(); - for (const auto & pool : Devices) { + for (const auto & pool : options->Devices) { try { auto poolprx = P2PVR::DevicesPrx::checkedCast(ic->stringToProxy(pool)); total += poolprx->TunerCount(); |