summaryrefslogtreecommitdiff
path: root/p2pvr/lib/frontend.cpp
blob: 54870a19ecd60317ff3e60d73a0dc331460cf18c (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
#include <pch.hpp>
#include "frontend.h"
#include "tuner.h"
#include <logger.h>
#include <sys/ioctl.h>
#include <linux/dvb/frontend.h>
#include <instanceStore.impl.h>

Frontend::Frontend(Tuner * t, int fd, const struct dvb_frontend_info & i) :
	tuner(t),
	frontendFD(fd),
	fe_info(i)
{
}

Frontend::~Frontend()
{
	close(frontendFD);
}

const struct dvb_frontend_info &
Frontend::Info() const
{
	return fe_info;
}

fe_status
Frontend::GetStatus() const
{
	fe_status_t status;
	if (ioctl(frontendFD, FE_READ_STATUS, &status) < 0) {
		Logger()->messagebf(LOG_ERR, "Reading frontend %s status failed (%s:%d)", tuner->Device(), strerror(errno), errno);
		throw P2PVR::DeviceError(tuner->Device(), strerror(errno), errno);
	}
	return status;
}

INSTANTIATESTORE(fe_type, FrontendLoader);