nhttpd::controlapi.cpp:execute more comands on/off only once (fix doubleclick)

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


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Jacek Jendrzej
2012-10-22 14:00:01 +02:00
parent f803f92af4
commit b0b4b885ed

View File

@@ -425,13 +425,21 @@ void CControlAPI::StandbyCGI(CyhookHandler *hh)
{ {
if (hh->ParamList["1"] == "on") // standby mode on if (hh->ParamList["1"] == "on") // standby mode on
{ {
NeutrinoAPI->EventServer->sendEvent(NeutrinoMessages::STANDBY_ON, CEventServer::INITID_HTTPD); if(CNeutrinoApp::getInstance()->getMode() == 4){
hh->SendOk(); 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 else if (hh->ParamList["1"] == "off")// standby mode off
{ {
NeutrinoAPI->EventServer->sendEvent(NeutrinoMessages::STANDBY_OFF, CEventServer::INITID_HTTPD); if(CNeutrinoApp::getInstance()->getMode() != 4){
hh->SendOk(); hh->WriteLn("standby is already off");
}else {
NeutrinoAPI->EventServer->sendEvent(NeutrinoMessages::STANDBY_OFF, CEventServer::INITID_HTTPD);
hh->SendOk();
}
} }
else else
hh->SendError(); hh->SendError();
@@ -448,12 +456,29 @@ void CControlAPI::RCCGI(CyhookHandler *hh)
{ {
if (!(hh->ParamList.empty())) if (!(hh->ParamList.empty()))
{ {
if (hh->ParamList["1"] == "lock") // lock remote control static bool on_off = false;
NeutrinoAPI->EventServer->sendEvent(NeutrinoMessages::LOCK_RC, CEventServer::INITID_HTTPD); if (hh->ParamList["1"] == "lock"){ // lock remote control
else if (hh->ParamList["1"] == "unlock")// unlock remote control if(!on_off){
NeutrinoAPI->EventServer->sendEvent(NeutrinoMessages::UNLOCK_RC, CEventServer::INITID_HTTPD); NeutrinoAPI->EventServer->sendEvent(NeutrinoMessages::LOCK_RC, CEventServer::INITID_HTTPD);
else on_off = true;
}else{
hh->WriteLn("remote is already locked");
return;
}
}
else if (hh->ParamList["1"] == "unlock"){// unlock remote control
if(on_off){
NeutrinoAPI->EventServer->sendEvent(NeutrinoMessages::UNLOCK_RC, CEventServer::INITID_HTTPD);
on_off = false;
}else{
hh->WriteLn("remote is already unlocked");
return;
}
}
else{
hh->SendError(); hh->SendError();
}
} }
hh->SendOk(); hh->SendOk();
} }
@@ -1472,16 +1497,25 @@ void CControlAPI::ZaptoCGI(CyhookHandler *hh)
SendAllCurrentVAPid(hh); SendAllCurrentVAPid(hh);
else if (hh->ParamList["1"] == "stopplayback") else if (hh->ParamList["1"] == "stopplayback")
{ {
NeutrinoAPI->Zapit->stopPlayBack(); if(!NeutrinoAPI->Zapit->isPlayBackActive()){
NeutrinoAPI->Sectionsd->setPauseScanning(true); hh->WriteLn("playback is already off");
hh->SendOk(); }else{
NeutrinoAPI->Zapit->stopPlayBack();
NeutrinoAPI->Sectionsd->setPauseScanning(true);
hh->SendOk();
}
} }
else if (hh->ParamList["1"] == "startplayback") else if (hh->ParamList["1"] == "startplayback")
{ {
NeutrinoAPI->Zapit->startPlayBack(); if(NeutrinoAPI->Zapit->isPlayBackActive()){
NeutrinoAPI->Sectionsd->setPauseScanning(false); hh->WriteLn("playback is already on");
dprintf("start playback requested..\n"); }else{
hh->SendOk(); NeutrinoAPI->Zapit->startPlayBack();
NeutrinoAPI->Sectionsd->setPauseScanning(false);
dprintf("start playback requested..\n");
hh->SendOk();
}
} }
else if (hh->ParamList["1"] == "statusplayback") else if (hh->ParamList["1"] == "statusplayback")
hh->Write((char *) (NeutrinoAPI->Zapit->isPlayBackActive() ? "1" : "0")); hh->Write((char *) (NeutrinoAPI->Zapit->isPlayBackActive() ? "1" : "0"));