*neutrino: add timeout parameter for message via web api

based up patch by FlatTV
see also: http://www.dbox2world.net/board293-coolstream-hd1/board314-coolstream-development/10855-nachrichten-%C3%BCber-das-yweb-mit-variablem-timeout-senden/

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@1782 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
thilo
2011-10-28 21:57:23 +00:00
parent b265df5204
commit c8e76315ce
3 changed files with 33 additions and 9 deletions

View File

@@ -3023,18 +3023,27 @@ _repeat:
fclose(f); fclose(f);
ExitRun(true); ExitRun(true);
} }
else if (msg == NeutrinoMessages::EVT_POPUP) { else if (msg == NeutrinoMessages::EVT_POPUP || msg == NeutrinoMessages::EVT_EXTMSG) {
if (mode != mode_scart) if (mode != mode_scart) {
ShowHintUTF(LOCALE_MESSAGEBOX_INFO, (const char *) data); // UTF-8 std::string timeout="-1";
std::string text = (char*)data;
std::string::size_type pos;
pos = text.find("&timeout=", 0);
if (pos != std::string::npos) {
timeout = text.substr( pos+9, text.length()+1 );
text[pos] = '\0';
}
if (msg == NeutrinoMessages::EVT_POPUP)
ShowHintUTF(LOCALE_MESSAGEBOX_INFO, text.c_str(), NULL, atoi(timeout.c_str())); // UTF-8
else if (msg == NeutrinoMessages::EVT_EXTMSG)
ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, text, CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_INFO, NULL, atoi(timeout.c_str())); // UTF-8
}
delete (unsigned char*) data; delete (unsigned char*) data;
return messages_return::handled; return messages_return::handled;
} }
else if (msg == NeutrinoMessages::EVT_EXTMSG) {
if (mode != mode_scart)
ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, (const char *) data, CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_INFO); // UTF-8
delete[] (unsigned char*) data;
return messages_return::handled;
}
else if (msg == NeutrinoMessages::EVT_RECORDING_ENDED) { else if (msg == NeutrinoMessages::EVT_RECORDING_ENDED) {
/* FIXME TODO, when/if needed, monitor record status somewhere /* FIXME TODO, when/if needed, monitor record status somewhere
* and report possible error to user if any with this message ? * and report possible error to user if any with this message ?

View File

@@ -1048,12 +1048,16 @@ Neutrino opens a pop up (popup) or message (nmsg) window in which the<br>
text part of the parameter is displayed. A pop up window closes<br> text part of the parameter is displayed. A pop up window closes<br>
itself after a few seconds whereas a message window must be closed<br> itself after a few seconds whereas a message window must be closed<br>
using the remote control.<br> using the remote control.<br>
To change the time, after the window closes automaticly, use the parameter "timeout"<br>
<div class="example"> <div class="example">
Examples:<br> Examples:<br>
<br> <br>
&gt;&gt;&gt;http://dbox/control/message?popup=Hello%20World<br> &gt;&gt;&gt;http://dbox/control/message?popup=Hello%20World<br>
opens a popup window on the TV screen with content &quot;Hello World&quot;<br> opens a popup window on the TV screen with content &quot;Hello World&quot;<br>
<br> <br>
&gt;&gt;&gt;http://dbox/control/message?popup=Hello%20World&timeout=30<br>
opens a popup window on the TV screen with content &quot;Hello World&quot;. The window closes automaticly after 30 seconds.<br>
<br>
&gt;&gt;&gt;http://dbox/control/message?nmsg=Hello%20Welt<br> &gt;&gt;&gt;http://dbox/control/message?nmsg=Hello%20Welt<br>
opens a message window on the TV screen with content &quot;Hello World&quot;<br> opens a message window on the TV screen with content &quot;Hello World&quot;<br>
</div> </div>
@@ -1090,12 +1094,17 @@ Neutrino oeffnet ein Popup(popup)- oder Message(nmsg)-Fenster, in dem<br>
der Text des Parameters dargestellt wird. Ein Popupfenster schliesst<br> der Text des Parameters dargestellt wird. Ein Popupfenster schliesst<br>
sich nach wenigen Sekunden selbst, wohingegen ein Message-Fenster mit<br> sich nach wenigen Sekunden selbst, wohingegen ein Message-Fenster mit<br>
der Fernbedienung geschlossen werden muss.<br> der Fernbedienung geschlossen werden muss.<br>
Um die Zeit zu <20>ndern, wie lange das Fenster ge<67>ffnet bleiben soll,<br>
kann der Parameter "timeout" angegeben werden.<br>
<div class="example"> <div class="example">
Beispiele:<br> Beispiele:<br>
<br> <br>
&gt;&gt;&gt;http://dbox/control/message?popup=Hallo%20World<br> &gt;&gt;&gt;http://dbox/control/message?popup=Hallo%20World<br>
<EFBFBD>ffnet ein Popup-Fenster auf dem Fernseher, in dem &quot;Hallo World&quot; steht<br> <EFBFBD>ffnet ein Popup-Fenster auf dem Fernseher, in dem &quot;Hallo World&quot; steht<br>
<br> <br>
&gt;&gt;&gt;http://dbox/control/message?popup=Hallo%20World&timeout=30<br>
<EFBFBD>ffnet ein Popup-Fenster auf dem Fernseher, in dem &quot;Hallo World&quot; steht und sich nach 30 Sekunden schlie<69>t.<br>
<br>
&gt;&gt;&gt;http://dbox/control/message?nmsg=Hallo%20Welt<br> &gt;&gt;&gt;http://dbox/control/message?nmsg=Hallo%20Welt<br>
<EFBFBD>ffnet ein Message-Fenster auf dem Fernseher, in dem &quot;Hallo Welt&quot; steht<br> <EFBFBD>ffnet ein Message-Fenster auf dem Fernseher, in dem &quot;Hallo Welt&quot; steht<br>
</div> </div>

View File

@@ -546,6 +546,12 @@ void CControlAPI::MessageCGI(CyhookHandler *hh)
return; return;
} }
if (!(hh->ParamList["timeout"].empty()))
{
message += "&timeout=";
message += hh->ParamList["timeout"];
}
if (event != 0) if (event != 0)
{ {
message=decodeString(message); message=decodeString(message);