summaryrefslogtreecommitdiff
path: root/p2pvr/devices/frontend.cpp
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2014-03-13 19:42:07 +0000
committerrandomdan <randomdan@localhost>2014-03-13 19:42:07 +0000
commitab1eee942e75874739ce5f0b4ba289aac5cc3faf (patch)
tree6e43828794fe0c0c5c9921ec1911695b67357c50 /p2pvr/devices/frontend.cpp
parentExpose more of the interface (diff)
downloadp2pvr-ab1eee942e75874739ce5f0b4ba289aac5cc3faf.tar.bz2
p2pvr-ab1eee942e75874739ce5f0b4ba289aac5cc3faf.tar.xz
p2pvr-ab1eee942e75874739ce5f0b4ba289aac5cc3faf.zip
Restructure into more sensibly arranged libs
Diffstat (limited to 'p2pvr/devices/frontend.cpp')
-rw-r--r--p2pvr/devices/frontend.cpp39
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);
+