controlapi/getmode: allow to get channelsmode in all stb modes

Origin commit data
------------------
Branch: ni/coolstream
Commit: 6a38042071
Author: vanhofen <vanhofen@gmx.de>
Date: 2016-03-01 (Tue, 01 Mar 2016)

Origin message was:
------------------
- controlapi/getmode: allow to get channelsmode in all stb modes

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

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2016-03-01 10:01:35 +01:00
parent 44f80f0529
commit d46725b9cc
2 changed files with 63 additions and 31 deletions

View File

@@ -48,7 +48,7 @@
<td><a href="http://box_ip/control/setmode">http://box_ip/control/setmode</a></td>
</tr>
<tr>
<td><a href="#getmode">Radio/TV Mode Abfrage</a></td>
<td><a href="#getmode">Neutrino Mode Abfrage</a></td>
<td><a href="http://box_ip/control/getmode">http://box_ip/control/getmode</td>
</tr>
<tr>
@@ -952,13 +952,14 @@ ok<br>
</div>
<!-- ----------------------------------------------------------- -->
<div class="title1"><a name="getmode"></a><b>Radio/TV Mode Abfrage</b></div>
<div class="title1"><a name="getmode"></a><b>Neutrino Mode Abfrage</b></div>
<div class="URL">Handler: http://box_ip/control/getmode</div>
<br>
<b>Parameter:</b> <br>
<b>R&uuml;ckgabe:</b> &quot;tv&quot;, &quot;radio&quot;, &quot;unkown&quot;<br>
<b>Parameter:</b> keine<br>
<b>R&uuml;ckgabe:</b> &quot;tv&quot;, &quot;radio&quot;, &quot;scart&quot;, &quot;standby&quot;, &quot;audio&quot;,<br>
&quot;pic&quot;, &quot;ts&quot;, &quot;webtv&quot;, &quot;upnp&quot;, &quot;unknown&quot;<br>
<br>
Es wird der aktuelle mode zur&uuml;ckgegeben tv / radio / unknown (shouldn't happen)<br>
Es wird der aktuelle Modus der Box zur&uuml;ckgegeben<br>
<div class="example">
Beispiel:<br>
<br>
@@ -966,6 +967,17 @@ Beispiel:<br>
tv<br>
<br>
</div>
<b>Parameter:</b> channelsmode<br>
<b>R&uuml;ckgabe:</b> &quot;tv&quot;, &quot;radio&quot;, &quot;unknown&quot;<br>
<br>
Es wird der eingestellte Kanalmodus der Box zur&uuml;ckgegeben<br>
<div class="example">
Beispiel:<br>
<br>
&gt;&gt;&gt;http://box_ip/control/getmode?channelmode<br>
radio<br>
<br>
</div>
<!-- ----------------------------------------------------------- -->
<div class="title1"><a name="getdate"></a><b>Datum von der Box abfragen</b></div>

View File

@@ -392,8 +392,22 @@ void CControlAPI::SetModeCGI(CyhookHandler *hh)
void CControlAPI::GetModeCGI(CyhookHandler *hh)
{
hh->outStart();
std::string result = "";
std::string key = "mode";
if (hh->ParamList_exist("channelsmode") && hh->ParamList["channelsmode"] != "false")
{
key = "channelsmode";
int mode = NeutrinoAPI->Zapit->getMode();
if (mode == CZapitClient::MODE_TV)
result = "tv";
else if (mode == CZapitClient::MODE_RADIO)
result = "radio";
else
result = "unknown";
}
else
{
int mode = CNeutrinoApp::getInstance()->getMode();
if (mode == NeutrinoMessages::mode_tv)
result = "tv";
@@ -415,13 +429,19 @@ void CControlAPI::GetModeCGI(CyhookHandler *hh)
result = "upnp";
else
result = "unknown";
}
if (!result.empty())
{
if (hh->getOutType() != plain)
{
result = hh->outPair("mode", result, false);
result = hh->outPair(key, result, false);
result = hh->outObject("getmode", result);
}
hh->SendResult(result);
}
else
hh->SendError();
}
//-----------------------------------------------------------------------------