summaryrefslogtreecommitdiff
path: root/status.cpp
diff options
context:
space:
mode:
authorroot <root@lwg5001.(none)>2008-12-18 08:46:41 +0100
committerroot <root@lwg5001.(none)>2008-12-18 08:46:41 +0100
commit0a38f9f8cde03a188c79f66dc4b005d83a6f0cfd (patch)
treeac9bcbdab8b2a3c23423d7dd14278cd6d77606de /status.cpp
parentf381118bd3f91740edc5bf464ab1300938f3ec5d (diff)
downloadvdr-plugin-infosatepg-0a38f9f8cde03a188c79f66dc4b005d83a6f0cfd.tar.gz
vdr-plugin-infosatepg-0a38f9f8cde03a188c79f66dc4b005d83a6f0cfd.tar.bz2
Initial commit
Diffstat (limited to 'status.cpp')
-rw-r--r--status.cpp63
1 files changed, 63 insertions, 0 deletions
diff --git a/status.cpp b/status.cpp
new file mode 100644
index 0000000..b540f74
--- /dev/null
+++ b/status.cpp
@@ -0,0 +1,63 @@
+/*
+ * status.cpp: A plugin for the Video Disk Recorder
+ *
+ * See the README file for copyright information and how to reach the author.
+ *
+ * $Id$
+ */
+
+#include "status.h"
+
+cStatusInfosatepg::cStatusInfosatepg(cGlobalInfosatepg *Global)
+{
+ global = Global;
+ myFilter=new cFilterInfosatepg(global);
+ myFilterDevice=NULL;
+}
+
+cStatusInfosatepg::~cStatusInfosatepg(void)
+{
+ if (myFilterDevice) myFilterDevice->Detach(myFilter);
+ if (myFilter) delete myFilter;
+}
+
+void cStatusInfosatepg::ChannelSwitch(const cDevice *Device, int ChannelNumber)
+{
+ bool bAddFilter=false;
+
+ // just add filter if we aren't locked
+ if ((ChannelNumber==global->Channel) && (!global->isLocked())) bAddFilter=true;
+
+ if (bAddFilter)
+ {
+
+ if ((myFilterDevice) && (myFilter))
+ {
+ if (myFilterDevice==Device) return; // already attached -> bail out
+ dsyslog("infosatepg: detach previously attached filter");
+ myFilterDevice->Detach(myFilter);
+ }
+
+ myFilterDevice = Device->GetDevice(Device->DeviceNumber());
+ if (!myFilterDevice) return;
+
+ dsyslog("switching device %i to channel %i (infosatepg)",
+ Device->DeviceNumber()+1,ChannelNumber);
+ myFilterDevice->AttachFilter(myFilter);
+ global->SetSwitched(true);
+ }
+ else
+ {
+ if (myFilterDevice)
+ {
+ if (Device==myFilterDevice)
+ {
+ dsyslog("infosatepg: detach filter");
+ myFilterDevice->Detach(myFilter);
+ myFilterDevice=NULL;
+ global->SetTimer();
+ global->SetSwitched(false);
+ }
+ }
+ }
+}