diff options
Diffstat (limited to 'p2pvr/devices/frontend.cpp')
-rw-r--r-- | p2pvr/devices/frontend.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/p2pvr/devices/frontend.cpp b/p2pvr/devices/frontend.cpp new file mode 100644 index 0000000..54870a1 --- /dev/null +++ b/p2pvr/devices/frontend.cpp @@ -0,0 +1,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); + |