rc_lock: lock for rc_lock, use only once, supplement to 5bc50d70d8

Origin commit data
------------------
Commit: 9a2d6aea26
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2012-10-22 (Mon, 22 Oct 2012)

Origin message was:
------------------
rc_lock: lock for rc_lock, use only once, supplement to 5bc50d70d8
This commit is contained in:
Jacek Jendrzej
2012-10-22 15:52:07 +02:00
parent 5bc50d70d8
commit 0456a04ded
4 changed files with 16 additions and 9 deletions

View File

@@ -38,6 +38,7 @@
#include <gui/widget/stringinput.h> #include <gui/widget/stringinput.h>
const std::string CRCLock::NO_USER_INPUT = "noUserInput"; const std::string CRCLock::NO_USER_INPUT = "noUserInput";
bool CRCLock::locked = false;
// -- Menue Handler Interface // -- Menue Handler Interface
// -- Infinite Loop to lock remote control (until release lock key pressed) // -- 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) int CRCLock::exec(CMenuTarget* parent, const std::string &actionKey)
{ {
if(locked)
return menu_return::RETURN_EXIT_ALL;
if (parent) if (parent)
parent->hide(); parent->hide();
@@ -55,7 +59,9 @@ int CRCLock::exec(CMenuTarget* parent, const std::string &actionKey)
return menu_return::RETURN_EXIT_ALL; return menu_return::RETURN_EXIT_ALL;
// -- Lockup Box // -- Lockup Box
locked = true;
lockBox(); lockBox();
locked = false;
ShowLocalizedMessage(LOCALE_RCLOCK_TITLE, LOCALE_RCLOCK_UNLOCKMSG, CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_INFO,450, no_input ? 5 : -1); 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; return menu_return::RETURN_EXIT_ALL;

View File

@@ -36,12 +36,13 @@
// //
class CRCLock: public CMenuTarget class CRCLock: public CMenuTarget
{ {
private:
void lockBox();
public: public:
static const std::string NO_USER_INPUT; static const std::string NO_USER_INPUT;
int exec(CMenuTarget* parent, const std::string & actionKey); int exec(CMenuTarget* parent, const std::string & actionKey);
void lockBox(); static bool locked;
}; };
#endif #endif

View File

@@ -3197,6 +3197,9 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby )
if(mode == mode_radio && g_Radiotext) if(mode == mode_radio && g_Radiotext)
g_Radiotext->radiotext_stop(); g_Radiotext->radiotext_stop();
lastMode = mode;
mode = mode_standby;
if(!fromDeepStandby && !CRecordManager::getInstance()->RecordingStatus()) { if(!fromDeepStandby && !CRecordManager::getInstance()->RecordingStatus()) {
g_Zapit->setStandby(true); g_Zapit->setStandby(true);
} else { } else {
@@ -3232,8 +3235,6 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby )
if(!CRecordManager::getInstance()->RecordingStatus()) if(!CRecordManager::getInstance()->RecordingStatus())
cpuFreq->SetCpuFreq(g_settings.standby_cpufreq * 1000 * 1000); cpuFreq->SetCpuFreq(g_settings.standby_cpufreq * 1000 * 1000);
lastMode = mode;
mode = mode_standby;
//fan speed //fan speed
if (g_info.has_fan) { if (g_info.has_fan) {
int fspeed = 1; int fspeed = 1;

View File

@@ -37,6 +37,8 @@
#include "gui/plugins.h"//for relodplugins #include "gui/plugins.h"//for relodplugins
#include <neutrino.h> #include <neutrino.h>
#include <driver/screenshot.h> #include <driver/screenshot.h>
#include "gui/rc_lock.h"
// yhttpd // yhttpd
#include "yhttpd.h" #include "yhttpd.h"
#include "ytypes_globals.h" #include "ytypes_globals.h"
@@ -456,20 +458,17 @@ void CControlAPI::RCCGI(CyhookHandler *hh)
{ {
if (!(hh->ParamList.empty())) if (!(hh->ParamList.empty()))
{ {
static bool on_off = false;
if (hh->ParamList["1"] == "lock"){ // lock remote control if (hh->ParamList["1"] == "lock"){ // lock remote control
if(!on_off){ if(!CRCLock::locked){
NeutrinoAPI->EventServer->sendEvent(NeutrinoMessages::LOCK_RC, CEventServer::INITID_HTTPD); NeutrinoAPI->EventServer->sendEvent(NeutrinoMessages::LOCK_RC, CEventServer::INITID_HTTPD);
on_off = true;
}else{ }else{
hh->WriteLn("remote is already locked"); hh->WriteLn("remote is already locked");
return; return;
} }
} }
else if (hh->ParamList["1"] == "unlock"){// unlock remote control else if (hh->ParamList["1"] == "unlock"){// unlock remote control
if(on_off){ if(CRCLock::locked){
NeutrinoAPI->EventServer->sendEvent(NeutrinoMessages::UNLOCK_RC, CEventServer::INITID_HTTPD); NeutrinoAPI->EventServer->sendEvent(NeutrinoMessages::UNLOCK_RC, CEventServer::INITID_HTTPD);
on_off = false;
}else{ }else{
hh->WriteLn("remote is already unlocked"); hh->WriteLn("remote is already unlocked");