diff --git a/src/gui/rc_lock.cpp b/src/gui/rc_lock.cpp index 51e12a12d..2b7177692 100644 --- a/src/gui/rc_lock.cpp +++ b/src/gui/rc_lock.cpp @@ -38,6 +38,7 @@ #include const std::string CRCLock::NO_USER_INPUT = "noUserInput"; +bool CRCLock::locked = false; // -- Menue Handler Interface // -- Infinite Loop to lock remote control (until release lock key pressed) @@ -45,6 +46,9 @@ const std::string CRCLock::NO_USER_INPUT = "noUserInput"; int CRCLock::exec(CMenuTarget* parent, const std::string &actionKey) { + if(locked) + return menu_return::RETURN_EXIT_ALL; + if (parent) parent->hide(); @@ -55,7 +59,9 @@ int CRCLock::exec(CMenuTarget* parent, const std::string &actionKey) return menu_return::RETURN_EXIT_ALL; // -- Lockup Box + locked = true; lockBox(); + locked = false; ShowLocalizedMessage(LOCALE_RCLOCK_TITLE, LOCALE_RCLOCK_UNLOCKMSG, CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_INFO,450, no_input ? 5 : -1); return menu_return::RETURN_EXIT_ALL; diff --git a/src/gui/rc_lock.h b/src/gui/rc_lock.h index 4e6ea758c..bd32757d0 100644 --- a/src/gui/rc_lock.h +++ b/src/gui/rc_lock.h @@ -36,12 +36,13 @@ // class CRCLock: public CMenuTarget { +private: + void lockBox(); public: static const std::string NO_USER_INPUT; int exec(CMenuTarget* parent, const std::string & actionKey); - void lockBox(); + static bool locked; }; - #endif diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 0e46f62ff..ec4cd0b2a 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -3197,6 +3197,9 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby ) if(mode == mode_radio && g_Radiotext) g_Radiotext->radiotext_stop(); + lastMode = mode; + mode = mode_standby; + if(!fromDeepStandby && !CRecordManager::getInstance()->RecordingStatus()) { g_Zapit->setStandby(true); } else { @@ -3232,8 +3235,6 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby ) if(!CRecordManager::getInstance()->RecordingStatus()) cpuFreq->SetCpuFreq(g_settings.standby_cpufreq * 1000 * 1000); - lastMode = mode; - mode = mode_standby; //fan speed if (g_info.has_fan) { int fspeed = 1; diff --git a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp index d737dbf0a..109b00114 100644 --- a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp @@ -37,6 +37,8 @@ #include "gui/plugins.h"//for relodplugins #include #include +#include "gui/rc_lock.h" + // yhttpd #include "yhttpd.h" #include "ytypes_globals.h" @@ -425,13 +427,21 @@ void CControlAPI::StandbyCGI(CyhookHandler *hh) { if (hh->ParamList["1"] == "on") // standby mode on { - NeutrinoAPI->EventServer->sendEvent(NeutrinoMessages::STANDBY_ON, CEventServer::INITID_HTTPD); - hh->SendOk(); + if(CNeutrinoApp::getInstance()->getMode() == 4){ + hh->WriteLn("standby is already on"); + }else { + NeutrinoAPI->EventServer->sendEvent(NeutrinoMessages::STANDBY_ON, CEventServer::INITID_HTTPD); + hh->SendOk(); + } } else if (hh->ParamList["1"] == "off")// standby mode off { - NeutrinoAPI->EventServer->sendEvent(NeutrinoMessages::STANDBY_OFF, CEventServer::INITID_HTTPD); - hh->SendOk(); + if(CNeutrinoApp::getInstance()->getMode() != 4){ + hh->WriteLn("standby is already off"); + }else { + NeutrinoAPI->EventServer->sendEvent(NeutrinoMessages::STANDBY_OFF, CEventServer::INITID_HTTPD); + hh->SendOk(); + } } else hh->SendError(); @@ -448,12 +458,26 @@ void CControlAPI::RCCGI(CyhookHandler *hh) { if (!(hh->ParamList.empty())) { - if (hh->ParamList["1"] == "lock") // lock remote control - NeutrinoAPI->EventServer->sendEvent(NeutrinoMessages::LOCK_RC, CEventServer::INITID_HTTPD); - else if (hh->ParamList["1"] == "unlock")// unlock remote control - NeutrinoAPI->EventServer->sendEvent(NeutrinoMessages::UNLOCK_RC, CEventServer::INITID_HTTPD); - else + if (hh->ParamList["1"] == "lock"){ // lock remote control + if(!CRCLock::locked){ + NeutrinoAPI->EventServer->sendEvent(NeutrinoMessages::LOCK_RC, CEventServer::INITID_HTTPD); + }else{ + hh->WriteLn("remote is already locked"); + return; + } + } + else if (hh->ParamList["1"] == "unlock"){// unlock remote control + if(CRCLock::locked){ + NeutrinoAPI->EventServer->sendEvent(NeutrinoMessages::UNLOCK_RC, CEventServer::INITID_HTTPD); + + }else{ + hh->WriteLn("remote is already unlocked"); + return; + } + } + else{ hh->SendError(); + } } hh->SendOk(); } @@ -1472,16 +1496,25 @@ void CControlAPI::ZaptoCGI(CyhookHandler *hh) SendAllCurrentVAPid(hh); else if (hh->ParamList["1"] == "stopplayback") { - NeutrinoAPI->Zapit->stopPlayBack(); - NeutrinoAPI->Sectionsd->setPauseScanning(true); - hh->SendOk(); + if(!NeutrinoAPI->Zapit->isPlayBackActive()){ + hh->WriteLn("playback is already off"); + }else{ + NeutrinoAPI->Zapit->stopPlayBack(); + NeutrinoAPI->Sectionsd->setPauseScanning(true); + hh->SendOk(); + } } else if (hh->ParamList["1"] == "startplayback") { - NeutrinoAPI->Zapit->startPlayBack(); - NeutrinoAPI->Sectionsd->setPauseScanning(false); - dprintf("start playback requested..\n"); - hh->SendOk(); + if(NeutrinoAPI->Zapit->isPlayBackActive()){ + hh->WriteLn("playback is already on"); + }else{ + NeutrinoAPI->Zapit->startPlayBack(); + NeutrinoAPI->Sectionsd->setPauseScanning(false); + dprintf("start playback requested..\n"); + hh->SendOk(); + } + } else if (hh->ParamList["1"] == "statusplayback") hh->Write((char *) (NeutrinoAPI->Zapit->isPlayBackActive() ? "1" : "0"));