mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-09-02 18:31:22 +02:00
* reworked CA menu code
* added support for internal cardreaders for future conax support * added inactivity shutdown timer for EuP WARNING: new libcoolstream and libOpenThreads needed. git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@925 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
@@ -57,6 +57,7 @@
|
||||
#include <eventserver.h>
|
||||
|
||||
#include <global.h>
|
||||
#include <driver/shutdown_count.h>
|
||||
#include <neutrino.h>
|
||||
#include <cs_api.h>
|
||||
|
||||
@@ -1143,6 +1144,8 @@ printf("[neutrino] CSectionsdClient::EVT_GOT_CN_EPG\n");
|
||||
|
||||
if(ret != sizeof(t_input_event))
|
||||
continue;
|
||||
|
||||
SHTDCNT::getInstance()->resetSleepTimer();
|
||||
printf("key: %04x value %d, translate: %04x -%s-\n", ev.code, ev.value, translate(ev.code, i), getKeyName(translate(ev.code, i)).c_str());
|
||||
uint32_t trkey = translate(ev.code, i);
|
||||
|
||||
|
@@ -63,6 +63,8 @@ void* SHTDCNT::TimeThread(void *)
|
||||
|
||||
void SHTDCNT::init()
|
||||
{
|
||||
shutdown_cnt = atoi(g_settings.shutdown_count) * 60;
|
||||
sleep_cnt = g_settings.shutdown_min*60;
|
||||
if (pthread_create (&thrTime, NULL, TimeThread, NULL) != 0 )
|
||||
{
|
||||
perror("[SHTDCNT]: pthread_create(TimeThread)");
|
||||
@@ -72,6 +74,7 @@ void SHTDCNT::init()
|
||||
|
||||
void SHTDCNT::shutdown_counter()
|
||||
{
|
||||
static bool sleeptimer_active = true;
|
||||
if (atoi(g_settings.shutdown_count) > 0)
|
||||
{
|
||||
if ((CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_standby) && (!CNeutrinoApp::getInstance ()->recordingstatus))
|
||||
@@ -79,13 +82,14 @@ void SHTDCNT::shutdown_counter()
|
||||
if (shutdown_cnt > 0 )
|
||||
{
|
||||
shutdown_cnt = shutdown_cnt - 1;
|
||||
printf("[SHTDCNT] shutdown counter: %d sec to shutdown\n", shutdown_cnt);
|
||||
//printf("[SHTDCNT] shutdown counter: %d sec to shutdown\n", shutdown_cnt);
|
||||
}
|
||||
else
|
||||
{
|
||||
// send shutdown message
|
||||
printf("[SHTDCNT] shutdown counter send NeutrinoMessages::SHUTDOWN\n");
|
||||
CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::SHUTDOWN, 0);
|
||||
// send shutdown message
|
||||
printf("[SHTDCNT] shutdown counter send NeutrinoMessages::SHUTDOWN\n");
|
||||
//CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::SHUTDOWN, 0);
|
||||
g_RCInput->postMsg(NeutrinoMessages::SHUTDOWN, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -94,4 +98,20 @@ void SHTDCNT::shutdown_counter()
|
||||
shutdown_cnt = atoi(g_settings.shutdown_count) * 60;
|
||||
}
|
||||
}
|
||||
|
||||
if(g_settings.shutdown_min > 0) {
|
||||
if(sleep_cnt > 0) {
|
||||
sleeptimer_active = true;
|
||||
sleep_cnt--;
|
||||
} else if(sleeptimer_active && !CNeutrinoApp::getInstance ()->recordingstatus) {
|
||||
sleeptimer_active = false;
|
||||
printf("[SHTDCNT] sleep-timer send NeutrinoMessages::SLEEPTIMER\n");
|
||||
g_RCInput->postMsg(NeutrinoMessages::SLEEPTIMER, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SHTDCNT::resetSleepTimer()
|
||||
{
|
||||
sleep_cnt = g_settings.shutdown_min*60;
|
||||
}
|
||||
|
@@ -33,9 +33,10 @@ class SHTDCNT
|
||||
{
|
||||
private:
|
||||
|
||||
pthread_t thrTime;
|
||||
pthread_t thrTime;
|
||||
unsigned int shutdown_cnt;
|
||||
CConfigFile configfile;
|
||||
unsigned int sleep_cnt;
|
||||
CConfigFile configfile;
|
||||
|
||||
void shutdown_counter();
|
||||
SHTDCNT();
|
||||
@@ -48,6 +49,7 @@ class SHTDCNT
|
||||
|
||||
static SHTDCNT* getInstance();
|
||||
void init();
|
||||
void resetSleepTimer();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user