summaryrefslogtreecommitdiff
path: root/p2pvr/lib/localDevices.h
blob: a16443ca462ea3dfbd7d79e878a554e61852b113 (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
#ifndef LOCALDEVICES_H
#define LOCALDEVICES_H

// Local devices implements a device collection (P2PVR::Devices) for any devices physically
// attached to the local machine; that is, can be accessed directly through /dev/dvb/adapterX

#include <p2pvr.h>
#include <options.h>
#include <mutex>

class LocalDevices : public P2PVR::LocalDevices {
	public:
		P2PVR::TunerPrx GetTunerSpecific(const DVBSI::DeliveryPtr &, Ice::Long until, const Ice::Current &);
		P2PVR::TunerPrx GetTunerAny(short type, const DVBSI::DeliveryPtr &, Ice::Long until, const Ice::Current &);
		P2PVR::PrivateTunerPrx GetPrivateTuner(short type, Ice::Long until, const Ice::Current &);
		void ReleaseTuner(const P2PVR::TunerPrx &, const Ice::Current &);

		void Scan(const Ice::Current &);
		void Add(const std::string & frontend, const Ice::Current &);
		void Remove(const std::string & frontend, const Ice::Current &);

		INITOPTIONS;
	private:
		class OpenTuner {
			public:
				OpenTuner(DVBSI::DeliveryPtr, P2PVR::PrivateTunerPrx, Ice::Long, bool);

				const bool openedPrivate;
				const DVBSI::DeliveryPtr delivery;
				const P2PVR::PrivateTunerPrx tuner;

				Ice::Long until;
				unsigned int clients;
		};
		typedef boost::shared_ptr<OpenTuner> OpenTunerPtr;
		typedef std::map<std::string, OpenTunerPtr> Devices;
		static Devices devices;
		static std::mutex lock;
};

#endif