From 0a38f9f8cde03a188c79f66dc4b005d83a6f0cfd Mon Sep 17 00:00:00 2001 From: root Date: Thu, 18 Dec 2008 08:46:41 +0100 Subject: Initial commit --- status.cpp | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 status.cpp (limited to 'status.cpp') 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); + } + } + } +} -- cgit v1.2.3