summaryrefslogtreecommitdiff
path: root/p2pvr/daemon/unittests/mockDevices.cpp
blob: 3e04c85799992f1cc9d02c4a434a2a2b46cf335b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#include "mockDevices.h"
#include <mockTuner.h>
#include <Ice/ObjectAdapter.h>

namespace P2PVR {
	namespace Testing {
		void MockDevices::ScanAndSendNetworkInformation(const RawDataClientPrx & target, const ::Ice::Current & ice)
		{
			MockTuner mt(ice.adapter->getCommunicator());
			mt.ScanAndSendNetworkInformation(target);
		}

		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);
		}

		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::SendServiceDescriptions(const ::DVBSI::DeliveryPtr & del, const RawDataClientPrx & target, const ::Ice::Current & ice)
		{
			BOOST_ASSERT(del);
			MockTuner mt(ice.adapter->getCommunicator());
			mt.SendServiceDescriptions(target);
		}

		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;
		}
	}
}