2004-12-30 23:43:55 +01:00
|
|
|
/*
|
2008-10-22 13:59:31 +02:00
|
|
|
* $Id: suspend.c,v 1.3 2008/10/22 11:59:32 schmirl Exp $
|
2004-12-30 23:43:55 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "server/suspend.h"
|
|
|
|
#include "server/suspend.dat"
|
|
|
|
#include "common.h"
|
|
|
|
|
|
|
|
cSuspendLive::cSuspendLive(void)
|
|
|
|
: cThread("Streamdev: server suspend")
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
cSuspendLive::~cSuspendLive() {
|
2008-10-22 13:59:31 +02:00
|
|
|
Stop();
|
2004-12-30 23:43:55 +01:00
|
|
|
Detach();
|
|
|
|
}
|
|
|
|
|
|
|
|
void cSuspendLive::Activate(bool On) {
|
|
|
|
Dprintf("Activate cSuspendLive %d\n", On);
|
|
|
|
if (On)
|
|
|
|
Start();
|
|
|
|
else
|
|
|
|
Stop();
|
|
|
|
}
|
|
|
|
|
|
|
|
void cSuspendLive::Stop(void) {
|
2008-10-22 13:59:31 +02:00
|
|
|
if (Running())
|
2004-12-30 23:43:55 +01:00
|
|
|
Cancel(3);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cSuspendLive::Action(void) {
|
2008-10-22 13:59:31 +02:00
|
|
|
while (Running()) {
|
2004-12-30 23:43:55 +01:00
|
|
|
DeviceStillPicture(suspend_mpg, sizeof(suspend_mpg));
|
2008-10-22 13:59:31 +02:00
|
|
|
cCondWait::SleepMs(100);
|
2004-12-30 23:43:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool cSuspendCtl::m_Active = false;
|
|
|
|
|
|
|
|
cSuspendCtl::cSuspendCtl(void):
|
2013-07-16 13:12:20 +02:00
|
|
|
cControl(m_Suspend = new cSuspendLive, true) {
|
2004-12-30 23:43:55 +01:00
|
|
|
m_Active = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
cSuspendCtl::~cSuspendCtl() {
|
|
|
|
m_Active = false;
|
|
|
|
DELETENULL(m_Suspend);
|
|
|
|
}
|
|
|
|
|
|
|
|
eOSState cSuspendCtl::ProcessKey(eKeys Key) {
|
2008-10-22 13:59:31 +02:00
|
|
|
if (!m_Suspend->Active() || Key == kBack) {
|
2004-12-30 23:43:55 +01:00
|
|
|
DELETENULL(m_Suspend);
|
|
|
|
return osEnd;
|
|
|
|
}
|
|
|
|
return osContinue;
|
|
|
|
}
|