summaryrefslogtreecommitdiff
path: root/p2pvr/daemon
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2017-08-06 13:34:44 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2017-08-06 13:34:44 +0100
commit661856d0e138e5f1bc6809341b66e69eff903b1b (patch)
tree7fbf3491052ad94ed64fd49f9a14f19a9928cb54 /p2pvr/daemon
parentDrop out local file hanlde for AdHoc's (diff)
downloadp2pvr-661856d0e138e5f1bc6809341b66e69eff903b1b.tar.bz2
p2pvr-661856d0e138e5f1bc6809341b66e69eff903b1b.tar.xz
p2pvr-661856d0e138e5f1bc6809341b66e69eff903b1b.zip
Unify local/global devices and tuners into a single coherent service
Diffstat (limited to 'p2pvr/daemon')
-rw-r--r--p2pvr/daemon/daemon.cpp6
-rw-r--r--p2pvr/daemon/globalDevices.cpp89
-rw-r--r--p2pvr/daemon/globalDevices.h35
-rw-r--r--p2pvr/daemon/maintenance/events.cpp6
-rw-r--r--p2pvr/daemon/maintenance/network.cpp31
-rw-r--r--p2pvr/daemon/maintenance/services.cpp7
-rw-r--r--p2pvr/daemon/recorder.cpp2
-rw-r--r--p2pvr/daemon/schedules.cpp2
-rw-r--r--p2pvr/daemon/unittests/mockDefs.cpp3
-rw-r--r--p2pvr/daemon/unittests/mockDefs.h3
-rw-r--r--p2pvr/daemon/unittests/mockDevices.cpp109
-rw-r--r--p2pvr/daemon/unittests/mockDevices.h34
-rw-r--r--p2pvr/daemon/unittests/testErrorHandling.cpp14
-rw-r--r--p2pvr/daemon/unittests/testMaint.cpp2
-rw-r--r--p2pvr/daemon/unittests/testRecording.cpp2
-rw-r--r--p2pvr/daemon/unittests/testSched.cpp2
16 files changed, 134 insertions, 213 deletions
diff --git a/p2pvr/daemon/daemon.cpp b/p2pvr/daemon/daemon.cpp
index c19f5cf..3a3b40f 100644
--- a/p2pvr/daemon/daemon.cpp
+++ b/p2pvr/daemon/daemon.cpp
@@ -1,5 +1,4 @@
-#include "localDevices.h"
-#include "globalDevices.h"
+#include "devices.h"
#include "maintenance.h"
#include "si.h"
#include "schedules.h"
@@ -37,8 +36,7 @@ class P2PvrDaemon : public IceTray::Service {
IceUtil::TimerPtr timer = new IceUtil::Timer();
auto db = getConnectionPool(ic, "postgresql", "postgres");
- auto localDevices = add<LocalDevices>(ic, adapter, new LocalDevicesI(adapter, timer), "Devices");
- auto globalDevices = add<Devices>(ic, adapter, new GlobalDevices(), "GlobalDevices");
+ auto devices = add<Tuners>(ic, adapter, new DevicesI(), "Devices");
auto maintenance = add<Maintenance>(ic, adapter, new MaintenanceI(db, adapter, timer), "Maintenance");
auto si = add<SI>(ic, adapter, new SII(db), "SI");
auto schedules = add<Schedules>(ic, adapter, new SchedulesI(db), "Schedules");
diff --git a/p2pvr/daemon/globalDevices.cpp b/p2pvr/daemon/globalDevices.cpp
deleted file mode 100644
index 0705415..0000000
--- a/p2pvr/daemon/globalDevices.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-#include "globalDevices.h"
-#include <Ice/Ice.h>
-
-namespace po = boost::program_options;
-
-namespace P2PVR {
-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>)")
-)
-
-TunerPrx
-GlobalDevices::GetTunerSpecific(const DVBSI::DeliveryPtr & delivery, const Ice::Current & ice)
-{
- auto ic = ice.adapter->getCommunicator();
- for (const auto & pool : options->Devices) {
- try {
- auto poolprx = DevicesPrx::checkedCast(ic->stringToProxy(pool));
- return poolprx->GetTunerSpecific(delivery);
- }
- catch (...) {
- }
- }
- throw NoSuitableDeviceAvailable();
-}
-
-TunerPrx
-GlobalDevices::GetTunerAny(const DVBSI::DeliveryPtr & delivery, const Ice::Current & ice)
-{
- auto ic = ice.adapter->getCommunicator();
- for (const auto & pool : options->Devices) {
- try {
- auto poolprx = DevicesPrx::checkedCast(ic->stringToProxy(pool));
- return poolprx->GetTunerAny(delivery);
- }
- catch (...) {
- }
- }
- throw NoSuitableDeviceAvailable();
-}
-
-PrivateTunerPrx
-GlobalDevices::GetPrivateTuner(short type, const Ice::Current & ice)
-{
- auto ic = ice.adapter->getCommunicator();
- for (const auto & pool : options->Devices) {
- try {
- auto poolprx = DevicesPrx::checkedCast(ic->stringToProxy(pool));
- return poolprx->GetPrivateTuner(type);
- }
- catch (...) {
- }
- }
- throw NoSuitableDeviceAvailable();
-}
-
-void
-GlobalDevices::ReleaseTuner(const TunerPrx & tuner, const Ice::Current & ice)
-{
- auto ic = ice.adapter->getCommunicator();
- for (const auto & pool : options->Devices) {
- auto poolprx = DevicesPrx::checkedCast(ic->stringToProxy(pool));
- poolprx->ReleaseTuner(tuner);
- }
-}
-
-int
-GlobalDevices::TunerCount(const Ice::Current & ice)
-{
- int total = 0;
- auto ic = ice.adapter->getCommunicator();
- for (const auto & pool : options->Devices) {
- try {
- auto poolprx = DevicesPrx::checkedCast(ic->stringToProxy(pool));
- total += poolprx->TunerCount();
- }
- catch (...) {
- // Not available, don't count 'em
- }
- }
- return total;
-}
-}
-
diff --git a/p2pvr/daemon/globalDevices.h b/p2pvr/daemon/globalDevices.h
deleted file mode 100644
index 43a7dc3..0000000
--- a/p2pvr/daemon/globalDevices.h
+++ /dev/null
@@ -1,35 +0,0 @@
-#ifndef GLOBALDEVICES_H
-#define GLOBALDEVICES_H
-
-// Global devices implements a device collection (Devices) for any devices known
-// throughout the system through other Devices interfaces
-
-#include <dvb.h>
-#include <options.h>
-
-namespace P2PVR {
-class GlobalDevices : public Devices {
- public:
- class Options : public IceTray::Options {
- public:
- Options();
-
- ICETRAY_OPTIONS_DECLARE;
-
- std::vector<std::string> Devices;
- };
-
- TunerPrx GetTunerSpecific(const DVBSI::DeliveryPtr &, const Ice::Current &);
- TunerPrx GetTunerAny(const DVBSI::DeliveryPtr &, const Ice::Current &);
- PrivateTunerPrx GetPrivateTuner(short type, const Ice::Current &);
- void ReleaseTuner(const TunerPrx &, const Ice::Current &);
- int TunerCount(const Ice::Current &);
-
- private:
- IceTray::OptionsResolver<Options> options;
-};
-}
-
-#endif
-
-
diff --git a/p2pvr/daemon/maintenance/events.cpp b/p2pvr/daemon/maintenance/events.cpp
index 05c9149..2dd91af 100644
--- a/p2pvr/daemon/maintenance/events.cpp
+++ b/p2pvr/daemon/maintenance/events.cpp
@@ -43,7 +43,7 @@ class SiEventsStream : public Slicer::Stream<::DVBSI::EventPtr> {
void Produce(const Consumer & ch) override
{
auto ic = ice.adapter->getCommunicator();
- auto devs = DevicesPrx::checkedCast(ice.adapter->createProxy(ic->stringToIdentity("GlobalDevices")));
+ auto devs = TunersPrx::checkedCast(ice.adapter->createProxy(ic->stringToIdentity("Devices")));
auto si = SIPrx::checkedCast(ice.adapter->createProxy(ic->stringToIdentity("SI")));
if (!devs || !si) {
throw std::runtime_error("bad proxy(s)");
@@ -54,12 +54,10 @@ class SiEventsStream : public Slicer::Stream<::DVBSI::EventPtr> {
throw std::runtime_error("no delivery methods");
}
logger->messagebf(LOG::DEBUG, "%s: Getting a tuner", __PRETTY_FUNCTION__);
- auto tuner = devs->GetTunerAny(delivery);
logger->messagebf(LOG::DEBUG, "%s: Fetching events", __PRETTY_FUNCTION__);
TemporaryIceAdapterObject<RawDataClient> parser(ice.adapter, new SiEventsHandler(ch, logger));
- tuner->SendEventInformation(parser);
- devs->ReleaseTuner(tuner);
+ devs->SendEventInformation(delivery, parser);
}
private:
diff --git a/p2pvr/daemon/maintenance/network.cpp b/p2pvr/daemon/maintenance/network.cpp
index 3e08628..c514175 100644
--- a/p2pvr/daemon/maintenance/network.cpp
+++ b/p2pvr/daemon/maintenance/network.cpp
@@ -72,11 +72,11 @@ class SiNetworkInformationMerger : public DVBSI::SiNetworkInformationParser {
};
void
-MaintenanceI::UpdateNetwork(short type, const Ice::Current & ice)
+MaintenanceI::UpdateNetwork(short, const Ice::Current & ice)
{
auto dbc = db->get();
auto ic = ice.adapter->getCommunicator();
- auto devs = DevicesPrx::checkedCast(ice.adapter->createProxy(ic->stringToIdentity("GlobalDevices")));
+ auto devs = TunersPrx::checkedCast(ice.adapter->createProxy(ic->stringToIdentity("Devices")));
auto si = SIPrx::checkedCast(ice.adapter->createProxy(ic->stringToIdentity("SI")));
auto siparser = new SiNetworkInformationMerger(dbc.get(), logger);
TemporaryIceAdapterObject<RawDataClient> parser(ice.adapter, siparser);
@@ -89,32 +89,11 @@ MaintenanceI::UpdateNetwork(short type, const Ice::Current & ice)
auto transport = si->GetDeliveryForSi();
if (transport) {
- TunerPrx tuner;
- try {
- tuner = devs->GetTunerAny(transport);
- tuner->SendNetworkInformation(parser);
- devs->ReleaseTuner(tuner);
- return;
- }
- catch (const NoSuitableDeviceAvailable &) {
- logger->messagebf(LOG::WARNING, "%s: Failed to get a suitable tuner", __PRETTY_FUNCTION__);
- throw;
- }
- catch (const std::exception & ex) {
- logger->messagebf(LOG::WARNING, "%s: Failed to fetch network information: %s", __PRETTY_FUNCTION__, ex.what());
- devs->ReleaseTuner(tuner);
- throw;
- }
- catch (...) {
- logger->messagebf(LOG::WARNING, "%s: Failed to fetch network information", __PRETTY_FUNCTION__);
- devs->ReleaseTuner(tuner);
- throw;
- }
+ devs->SendNetworkInformation(transport, parser);
+ return;
}
// If we can't do that, do a complete scan
- auto tuner = devs->GetPrivateTuner(type);
- tuner->ScanAndSendNetworkInformation(parser);
- devs->ReleaseTuner(tuner);
+ devs->ScanAndSendNetworkInformation(parser);
}
}
diff --git a/p2pvr/daemon/maintenance/services.cpp b/p2pvr/daemon/maintenance/services.cpp
index d83e68a..12b23ce 100644
--- a/p2pvr/daemon/maintenance/services.cpp
+++ b/p2pvr/daemon/maintenance/services.cpp
@@ -43,7 +43,7 @@ void
MaintenanceI::UpdateServices(const Ice::Current & ice)
{
auto ic = ice.adapter->getCommunicator();
- auto devs = DevicesPrx::checkedCast(ice.adapter->createProxy(ic->stringToIdentity("GlobalDevices")));
+ auto devs = TunersPrx::checkedCast(ice.adapter->createProxy(ic->stringToIdentity("Devices")));
auto si = SIPrx::checkedCast(ice.adapter->createProxy(ic->stringToIdentity("SI")));
if (!devs || !si) {
@@ -60,12 +60,9 @@ MaintenanceI::UpdateServices(const Ice::Current & ice)
}
DB::TransactionScope tx(dbc.get());
- logger->messagebf(LOG::DEBUG, "%s: Getting a tuner", __PRETTY_FUNCTION__);
- auto tuner = devs->GetTunerAny(delivery);
logger->messagebf(LOG::DEBUG, "%s: Fetching service list", __PRETTY_FUNCTION__);
- tuner->SendServiceDescriptions(parser);
+ devs->SendServiceDescriptions(delivery, parser);
logger->messagebf(LOG::INFO, "%s: Updated service list", __PRETTY_FUNCTION__);
- devs->ReleaseTuner(tuner);
}
}
diff --git a/p2pvr/daemon/recorder.cpp b/p2pvr/daemon/recorder.cpp
index c797d04..f32eb73 100644
--- a/p2pvr/daemon/recorder.cpp
+++ b/p2pvr/daemon/recorder.cpp
@@ -56,7 +56,7 @@ RecorderI::StartRecording(SchedulePtr schedule, ::DVBSI::ServicePtr service, Eve
std::lock_guard<std::mutex> g(lock);
auto storage = StoragePrx::checkedCast(adapter->createProxy(adapter->getCommunicator()->stringToIdentity("Storage")));
auto recordings = RecordingsPrx::checkedCast(adapter->createProxy(adapter->getCommunicator()->stringToIdentity("Recordings")));
- auto devices = DevicesPrx::checkedCast(adapter->createProxy(adapter->getCommunicator()->stringToIdentity("GlobalDevices")));
+ auto devices = TunersPrx::checkedCast(adapter->createProxy(adapter->getCommunicator()->stringToIdentity("Devices")));
auto si = SIPrx::checkedCast(adapter->createProxy(adapter->getCommunicator()->stringToIdentity("SI")));
auto recordingId = recordings->NewRecording(new Recording(0, schedule->ScheduleId, event->EventUid));
diff --git a/p2pvr/daemon/schedules.cpp b/p2pvr/daemon/schedules.cpp
index 4fd2054..d948603 100644
--- a/p2pvr/daemon/schedules.cpp
+++ b/p2pvr/daemon/schedules.cpp
@@ -194,7 +194,7 @@ void
SchedulesI::DoReschedule(const Ice::Current & ice)
{
auto ic = ice.adapter->getCommunicator();
- auto devs = P2PVR::DevicesPrx::checkedCast(ice.adapter->createProxy(ic->stringToIdentity("GlobalDevices")));
+ auto devs = P2PVR::TunersPrx::checkedCast(ice.adapter->createProxy(ic->stringToIdentity("Devices")));
unsigned int tunerCount = devs->TunerCount();
// Load list from database
diff --git a/p2pvr/daemon/unittests/mockDefs.cpp b/p2pvr/daemon/unittests/mockDefs.cpp
index 0bba8c0..8282492 100644
--- a/p2pvr/daemon/unittests/mockDefs.cpp
+++ b/p2pvr/daemon/unittests/mockDefs.cpp
@@ -28,8 +28,7 @@ StandardMockDatabasePlusOffset::StandardMockDatabasePlusOffset(const Ice::String
}
TestClient::TestClient() :
- localDevices(getProxy<LocalDevicesPrx>("Devices")),
- devices(getProxy<DevicesPrx>("GlobalDevices")),
+ devices(getProxy<TunersPrx>("Devices")),
maint(getProxy<MaintenancePrx>("Maintenance")),
si(getProxy<SIPrx>("SI")),
schedules(getProxy<SchedulesPrx>("Schedules")),
diff --git a/p2pvr/daemon/unittests/mockDefs.h b/p2pvr/daemon/unittests/mockDefs.h
index fa6490c..1589440 100644
--- a/p2pvr/daemon/unittests/mockDefs.h
+++ b/p2pvr/daemon/unittests/mockDefs.h
@@ -20,8 +20,7 @@ class DLL_PUBLIC TestClient : public IceTray::DryIceClient {
public:
TestClient();
- LocalDevicesPrx localDevices;
- DevicesPrx devices;
+ TunersPrx devices;
MaintenancePrx maint;
SIPrx si;
SchedulesPrx schedules;
diff --git a/p2pvr/daemon/unittests/mockDevices.cpp b/p2pvr/daemon/unittests/mockDevices.cpp
index f0ec930..3e04c85 100644
--- a/p2pvr/daemon/unittests/mockDevices.cpp
+++ b/p2pvr/daemon/unittests/mockDevices.cpp
@@ -3,31 +3,96 @@
#include <Ice/ObjectAdapter.h>
namespace P2PVR {
-namespace Testing {
-TunerPrx MockDevices::GetTunerSpecific(const DVBSI::DeliveryPtr&, const Ice::Current & ice)
-{
- return PrivateTunerPrx::checkedCast(ice.adapter->addWithUUID(new MockTuner()));
-}
+ namespace Testing {
+ void MockDevices::ScanAndSendNetworkInformation(const RawDataClientPrx & target, const ::Ice::Current & ice)
+ {
+ MockTuner mt(ice.adapter->getCommunicator());
+ mt.ScanAndSendNetworkInformation(target);
+ }
-TunerPrx MockDevices::GetTunerAny(const DVBSI::DeliveryPtr&, const Ice::Current & ice)
-{
- return PrivateTunerPrx::checkedCast(ice.adapter->addWithUUID(new MockTuner()));
-}
+ void MockDevices::SendNetworkInformation(const ::DVBSI::DeliveryPtr & del, const RawDataClientPrx & target, const ::Ice::Current & ice)
+ {
+ BOOST_ASSERT(del);
+ MockTuner mt(ice.adapter->getCommunicator());
+ mt.SendNetworkInformation(target);
+ }
-PrivateTunerPrx MockDevices::GetPrivateTuner(Ice::Short, const Ice::Current & ice)
-{
- return PrivateTunerPrx::checkedCast(ice.adapter->addWithUUID(new MockTuner()));
-}
+ void MockDevices::SendBouquetAssociations(const ::DVBSI::DeliveryPtr & del, const RawDataClientPrx & target, const ::Ice::Current & ice)
+ {
+ BOOST_ASSERT(del);
+ MockTuner mt(ice.adapter->getCommunicator());
+ mt.SendBouquetAssociations(target);
+ }
-void MockDevices::ReleaseTuner(const TunerPrx & tuner, const Ice::Current & ice)
-{
- ice.adapter->remove(tuner->ice_getIdentity());
-}
+ void MockDevices::SendServiceDescriptions(const ::DVBSI::DeliveryPtr & del, const RawDataClientPrx & target, const ::Ice::Current & ice)
+ {
+ BOOST_ASSERT(del);
+ MockTuner mt(ice.adapter->getCommunicator());
+ mt.SendServiceDescriptions(target);
+ }
-Ice::Int MockDevices::TunerCount(const Ice::Current&)
-{
- return 1;
-}
-}
+ void MockDevices::SendProgramAssociationTable(const ::DVBSI::DeliveryPtr & del, const RawDataClientPrx & target, const ::Ice::Current & ice)
+ {
+ BOOST_ASSERT(del);
+ MockTuner mt(ice.adapter->getCommunicator());
+ mt.SendProgramAssociationTable(target);
+ }
+
+ void MockDevices::SendProgramMap(const ::DVBSI::DeliveryPtr & del, ::Ice::Int pid, const RawDataClientPrx & target, const ::Ice::Current & ice)
+ {
+ BOOST_ASSERT(del);
+ MockTuner mt(ice.adapter->getCommunicator());
+ mt.SendProgramMap(pid, target);
+ }
+
+ void MockDevices::SendEventInformation(const ::DVBSI::DeliveryPtr & del, const RawDataClientPrx & target, const ::Ice::Current & ice)
+ {
+ BOOST_ASSERT(del);
+ MockTuner mt(ice.adapter->getCommunicator());
+ mt.SendEventInformation(target);
+ }
+
+ ::Ice::Int MockDevices::StartSendingTS(const ::DVBSI::DeliveryPtr & del, const PacketIds & pids, const RawDataClientPrx & target, const ::Ice::Current & ice)
+ {
+ BOOST_ASSERT(del);
+ TunerPtr tuner = new MockTuner(ice.adapter->getCommunicator());
+ return bgOps.insert({ tuner->StartSendingTS(pids, target), tuner }).first->first;
+ }
+
+ ::Ice::Int MockDevices::StartSendingSection(const ::DVBSI::DeliveryPtr & del, ::Ice::Int sid, const RawDataClientPrx & target, const ::Ice::Current & ice)
+ {
+ BOOST_ASSERT(del);
+ TunerPtr tuner = new MockTuner(ice.adapter->getCommunicator());
+ return bgOps.insert({ tuner->StartSendingSection(sid, target), tuner }).first->first;
+ }
+
+ void MockDevices::StopSending(::Ice::Int handle, const ::Ice::Current &)
+ {
+ BOOST_ASSERT(handle);
+ auto itr = bgOps.find(handle);
+ BOOST_ASSERT(itr != bgOps.end());
+ BOOST_ASSERT(itr->second);
+ itr->second->StopSending(handle);
+ bgOps.erase(itr);
+ }
+
+
+ void MockDevices::Scan(const std::string &, const Ice::Current &)
+ {
+ }
+
+ void MockDevices::Add(const std::string &, const Ice::Current &)
+ {
+ }
+
+ void MockDevices::Remove(const std::string &, const Ice::Current &)
+ {
+ }
+
+ ::Ice::Int MockDevices::TunerCount(const Ice::Current &)
+ {
+ return 1;
+ }
+ }
}
diff --git a/p2pvr/daemon/unittests/mockDevices.h b/p2pvr/daemon/unittests/mockDevices.h
index be04772..bc0a22a 100644
--- a/p2pvr/daemon/unittests/mockDevices.h
+++ b/p2pvr/daemon/unittests/mockDevices.h
@@ -5,16 +5,30 @@
#include <visibility.h>
namespace P2PVR {
-namespace Testing {
-class DLL_PUBLIC MockDevices : public Devices {
- public:
- TunerPrx GetTunerSpecific(const DVBSI::DeliveryPtr&, const Ice::Current & ice) override;
- TunerPrx GetTunerAny(const DVBSI::DeliveryPtr&, const Ice::Current & ice) override;
- PrivateTunerPrx GetPrivateTuner(Ice::Short, const Ice::Current & ice) override;
- void ReleaseTuner(const TunerPrx & tuner, const Ice::Current & ice) override;
- Ice::Int TunerCount(const Ice::Current&) override;
-};
-}
+ namespace Testing {
+ class DLL_PUBLIC MockDevices : public Tuners {
+ public:
+ virtual void ScanAndSendNetworkInformation(const RawDataClientPrx&, const ::Ice::Current&) override;
+ virtual void SendNetworkInformation(const ::DVBSI::DeliveryPtr&, const RawDataClientPrx&, const ::Ice::Current&) override;
+ virtual void SendBouquetAssociations(const ::DVBSI::DeliveryPtr&, const RawDataClientPrx&, const ::Ice::Current&) override;
+ virtual void SendServiceDescriptions(const ::DVBSI::DeliveryPtr&, const RawDataClientPrx&, const ::Ice::Current&) override;
+ virtual void SendProgramAssociationTable(const ::DVBSI::DeliveryPtr&, const RawDataClientPrx&, const ::Ice::Current&) override;
+ virtual void SendProgramMap(const ::DVBSI::DeliveryPtr&, ::Ice::Int, const RawDataClientPrx&, const ::Ice::Current&) override;
+ virtual void SendEventInformation(const ::DVBSI::DeliveryPtr&, const RawDataClientPrx&, const ::Ice::Current&) override;
+ virtual ::Ice::Int StartSendingTS(const ::DVBSI::DeliveryPtr&, const PacketIds&, const RawDataClientPrx&, const ::Ice::Current&) override;
+ virtual ::Ice::Int StartSendingSection(const ::DVBSI::DeliveryPtr&, ::Ice::Int, const RawDataClientPrx&, const ::Ice::Current&) override;
+ virtual void StopSending(::Ice::Int, const ::Ice::Current&) override;
+
+ void Scan(const std::string & path, const Ice::Current &) override;
+ void Add(const std::string & frontend, const Ice::Current &) override;
+ void Remove(const std::string & frontend, const Ice::Current &) override;
+ ::Ice::Int TunerCount(const Ice::Current &) override;
+
+ private:
+ typedef std::map<::Ice::Int, TunerPtr> BackgroundOperations;
+ BackgroundOperations bgOps;
+ };
+ }
}
#endif
diff --git a/p2pvr/daemon/unittests/testErrorHandling.cpp b/p2pvr/daemon/unittests/testErrorHandling.cpp
index db07293..2ec1941 100644
--- a/p2pvr/daemon/unittests/testErrorHandling.cpp
+++ b/p2pvr/daemon/unittests/testErrorHandling.cpp
@@ -26,7 +26,7 @@ class Core : public StandardMockDatabase {
public:
Core()
{
- replace("GlobalDevices", new MockDevices());
+ replace("Devices", new MockDevices());
}
};
@@ -72,40 +72,36 @@ BOOST_AUTO_TEST_CASE(TestRawDataClient)
{
BOOST_TEST_CHECKPOINT("Setup");
auto del = si->GetDeliveryForSi();
- auto gd = devices->GetTunerAny(del);
TemporaryIceAdapterObject<RawDataClient> a(getAdapter(), new TestDataClient());
BOOST_TEST_CHECKPOINT("Make successful call");
- gd->SendNetworkInformation(a);
+ devices->SendNetworkInformation(del, a);
}
BOOST_AUTO_TEST_CASE(TestParser)
{
BOOST_TEST_CHECKPOINT("Setup");
auto del = si->GetDeliveryForSi();
- auto gd = devices->GetTunerAny(del);
TemporaryIceAdapterObject<RawDataClient> a(getAdapter(), new TestNetworkParser());
BOOST_TEST_CHECKPOINT("Make successful call");
- gd->SendNetworkInformation(a);
+ devices->SendNetworkInformation(del, a);
}
BOOST_AUTO_TEST_CASE(TestRawDataClientWithError)
{
BOOST_TEST_CHECKPOINT("Setup");
auto del = si->GetDeliveryForSi();
- auto gd = devices->GetTunerAny(del);
TemporaryIceAdapterObject<RawDataClient> a(getAdapter(), new FailingTestClient());
BOOST_TEST_CHECKPOINT("Make failing call");
- BOOST_REQUIRE_THROW(gd->SendNetworkInformation(a), DataHandlingException);
+ BOOST_REQUIRE_THROW(devices->SendNetworkInformation(del, a), DataHandlingException);
}
BOOST_AUTO_TEST_CASE(TestParserWithError)
{
BOOST_TEST_CHECKPOINT("Setup");
auto del = si->GetDeliveryForSi();
- auto gd = devices->GetTunerAny(del);
TemporaryIceAdapterObject<RawDataClient> a(getAdapter(), new FailingTestNetworkParser());
BOOST_TEST_CHECKPOINT("Make failing call");
- BOOST_REQUIRE_THROW(gd->SendNetworkInformation(a), DataHandlingException);
+ BOOST_REQUIRE_THROW(devices->SendNetworkInformation(del, a), DataHandlingException);
}
BOOST_AUTO_TEST_SUITE_END()
diff --git a/p2pvr/daemon/unittests/testMaint.cpp b/p2pvr/daemon/unittests/testMaint.cpp
index 026ec27..a1fc6fd 100644
--- a/p2pvr/daemon/unittests/testMaint.cpp
+++ b/p2pvr/daemon/unittests/testMaint.cpp
@@ -27,7 +27,7 @@ class TestService : public SchemaOnlyMockDatabase {
public:
TestService()
{
- replace("GlobalDevices", new MockDevices());
+ replace("Devices", new MockDevices());
replace("Schedules", new MockScheduler());
}
};
diff --git a/p2pvr/daemon/unittests/testRecording.cpp b/p2pvr/daemon/unittests/testRecording.cpp
index e4dc6c1..fe81b7d 100644
--- a/p2pvr/daemon/unittests/testRecording.cpp
+++ b/p2pvr/daemon/unittests/testRecording.cpp
@@ -28,7 +28,7 @@ class TestService : public StandardMockDatabase {
public:
TestService()
{
- replace("GlobalDevices", new MockDevices());
+ replace("Devices", new MockDevices());
replace("Schedules", new MockScheduler());
}
};
diff --git a/p2pvr/daemon/unittests/testSched.cpp b/p2pvr/daemon/unittests/testSched.cpp
index badf35c..9f6881a 100644
--- a/p2pvr/daemon/unittests/testSched.cpp
+++ b/p2pvr/daemon/unittests/testSched.cpp
@@ -26,7 +26,7 @@ class TestService : public StandardMockDatabasePlusOffset {
public:
TestService()
{
- replace("GlobalDevices", new MockDevices());
+ replace("Devices", new MockDevices());
replace("Recorder", new MockRecorder());
}
};