add neutrino restart to webif

Origin commit data
------------------
Branch: ni/coolstream
Commit: 822993d333
Author: TangoCash <eric@loxat.de>
Date: 2021-09-17 (Fri, 17 Sep 2021)


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

------------------
This commit was generated by Migit
This commit is contained in:
TangoCash
2021-09-17 23:20:40 +02:00
committed by vanhofen
parent 7f3f22ea62
commit f92278c106
11 changed files with 44 additions and 3 deletions

View File

@@ -7,6 +7,7 @@ ERROR=-1
NORMAL=0
SHUTDOWN=1
REBOOT=2
RESTART=3
echo "Starting Neutrino"

View File

@@ -55,6 +55,14 @@ function init() {
CEC: <input id="checkCEC" name="checkCEC" type="checkbox" checked="checked"/>
</td>
</tr>
<tr><td class="y_form_header">{=L:bc.control.neutrino=}</td><td class="y_form_header">&nbsp; <!-- just a placeholder --></td></tr>
<td>
<input type="button" value="{=L:bc.control.restart=}" onclick='goUrl("/control/restart");'/>
</td>
<td>
&nbsp; <!-- just a placeholder -->
</td>
</tr>
<tr><td class="y_form_header">{=L:bc.control.playback=}</td><td class="y_form_header">{=L:bc.control.recording_mode=}</td></tr>
<tr>
<td>

View File

@@ -140,7 +140,8 @@ bc.control.reboot=Neustart
bc.control.shutdown.ask=Box wirklich ausschalten?
bc.control.shutdown=Ausschalten
bc.control.status=Status
bc.control.restart=Neu starten
bc.control.restart=Neustart
bc.control.neutrino=Neutrino
========= Boxcontrol - Message
bc.msg.message_to_screen_desc=Nachricht eingeben

View File

@@ -143,6 +143,7 @@ bc.control.shutdown.ask=Really shutdown the Box?
bc.control.shutdown=shutdown
bc.control.status=status
bc.control.restart=restart
bc.control.neutrino=Neutrino
========= Boxcontrol - Message
bc.msg.message_to_screen_desc=enter message to send to TV screen

View File

@@ -920,6 +920,10 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6
*msg = NeutrinoMessages::REBOOT;
*data = 0;
break;
case NeutrinoMessages::RESTART :
*msg = NeutrinoMessages::RESTART;
*data = 0;
break;
case NeutrinoMessages::EVT_POPUP :
*msg = NeutrinoMessages::EVT_POPUP;
*data = (unsigned long) p;

View File

@@ -4567,6 +4567,9 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data)
}
return messages_return::handled;
}
else if( msg == NeutrinoMessages::RESTART ) {
ExitRun(CNeutrinoApp::EXIT_RESTART);
}
else if( msg == NeutrinoMessages::REBOOT ) {
ExitRun(CNeutrinoApp::EXIT_REBOOT);
}
@@ -4849,7 +4852,7 @@ void CNeutrinoApp::ExitRun(int exit_code)
if (cs_get_revision() != 10)
bright = g_settings.lcd_setting[SNeutrinoSettings::LCD_DEEPSTANDBY_BRIGHTNESS];
#endif
if (exit_code != CNeutrinoApp::EXIT_REBOOT)
if (exit_code != EXIT_NORMAL && exit_code != EXIT_RESTART)
{
if (timer_minutes)
{
@@ -5403,6 +5406,12 @@ int CNeutrinoApp::exec(CMenuTarget* parent, const std::string & actionKey)
ExitRun(CNeutrinoApp::EXIT_REBOOT);
returnval = menu_return::RETURN_NONE;
}
else if (actionKey=="restart")
{
videoDecoder->SetCECMode((VIDEO_HDMI_CEC_MODE)0);
ExitRun(CNeutrinoApp::EXIT_RESTART);
returnval = menu_return::RETURN_NONE;
}
else if (actionKey=="clock_switch")
{
InfoClock->switchClockOnOff();

View File

@@ -62,7 +62,8 @@ public:
EXIT_ERROR = -1,
EXIT_NORMAL = 0, // g_info.hw_caps->can_shutdown == 0
EXIT_SHUTDOWN = 1, // g_info.hw_caps->can_shutdown == 1
EXIT_REBOOT = 2
EXIT_REBOOT = 2,
EXIT_RESTART = 3
};
enum

View File

@@ -77,6 +77,7 @@ struct NeutrinoMessages {
RELOAD_SETUP = CRCInput::RC_Messages + 24,
SHOW_MAINMENU = CRCInput::RC_Messages + 25,
LEAVE_ALL = CRCInput::RC_Messages + 26,
RESTART = CRCInput::RC_Messages + 27,
EVT_VOLCHANGED = CRCInput::RC_Events + 1,

View File

@@ -194,6 +194,7 @@ const CControlAPI::TyCgiCall CControlAPI::yCgiCallList[]=
{"standby", &CControlAPI::StandbyCGI, "text/plain"},
{"shutdown", &CControlAPI::ShutdownCGI, "text/plain"},
{"reboot", &CControlAPI::RebootCGI, "text/plain"},
{"restart", &CControlAPI::RestartCGI, "text/plain"},
{"getdate", &CControlAPI::GetDateCGI, "text/plain"},
{"gettime", &CControlAPI::GetTimeCGI, "text/plain"},
{"info", &CControlAPI::InfoCGI, "text/plain"},
@@ -888,6 +889,18 @@ void CControlAPI::RebootCGI(CyhookHandler *hh)
hh->SendError();
}
//-----------------------------------------------------------------------------
void CControlAPI::RestartCGI(CyhookHandler *hh)
{
if (hh->ParamList.empty())
{
NeutrinoAPI->EventServer->sendEvent(NeutrinoMessages::RESTART, CEventServer::INITID_HTTPD);
hh->SendOk();
}
else
hh->SendError();
}
//-----------------------------------------------------------------------------
unsigned int revert_translate(unsigned int code)
{

View File

@@ -111,6 +111,7 @@ private:
void LCDAction(CyhookHandler *hh);
void YWebCGI(CyhookHandler *hh);
void RebootCGI(CyhookHandler *hh);
void RestartCGI(CyhookHandler *hh);
void RCEmCGI(CyhookHandler *hh);
void AspectRatioCGI(CyhookHandler *hh);
void VideoFormatCGI(CyhookHandler *hh);

View File

@@ -132,6 +132,7 @@ CNeutrinoAPI::CNeutrinoAPI()
EventServer = new CEventServer;
EventServer->registerEvent2( NeutrinoMessages::SHUTDOWN, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
EventServer->registerEvent2( NeutrinoMessages::REBOOT, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
EventServer->registerEvent2( NeutrinoMessages::RESTART, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
EventServer->registerEvent2( NeutrinoMessages::STANDBY_ON, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
EventServer->registerEvent2( NeutrinoMessages::STANDBY_OFF, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
EventServer->registerEvent2( NeutrinoMessages::STANDBY_TOGGLE, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");