diff --git a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp index c1e23697c..01a85382f 100644 --- a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp @@ -49,6 +49,8 @@ #include "neutrinoapi.h" #include "controlapi.h" #include +#include + extern cVideo * videoDecoder; extern CPlugins *g_PluginList;//for relodplugins @@ -161,6 +163,7 @@ const CControlAPI::TyCgiCall CControlAPI::yCgiCallList[]= {"epgsearch", &CControlAPI::EpgSearchTXTCGI, ""}, {"epg", &CControlAPI::EpgCGI, ""}, {"zapto", &CControlAPI::ZaptoCGI, "text/plain"}, + {"signal", &CControlAPI::SignalInfoCGI, "text/plain"}, {"getonidsid", &CControlAPI::GetChannel_IDCGI, "text/plain"}, {"currenttpchannels", &CControlAPI::GetTPChannel_IDCGI, "text/plain"}, // boxcontrol - system @@ -210,7 +213,7 @@ const CControlAPI::TyCgiCall CControlAPI::yCgiCallList[]= // settings {"config", &CControlAPI::ConfigCGI, "text/plain"}, // filehandling - {"file", &CControlAPI::FileCGI, "+xml"}, + {"file", &CControlAPI::FileCGI, "+xml"} }; @@ -1756,6 +1759,34 @@ void CControlAPI::SendChannelList(CyhookHandler *hh, bool currentTP) } } +//----------------------------------------------------------------------------- +void CControlAPI::SignalInfoCGI(CyhookHandler *hh) +{ + CFrontend *frontend = CFEManager::getInstance()->getLiveFE(); + if(frontend){ + bool parame_empty = false; + + if (hh->ParamList["1"].empty()) + parame_empty = true; + + if ( parame_empty || (hh->ParamList["1"] == "sig") ){ + unsigned int sig = frontend->getSignalStrength() & 0xFFFF; + sig = (sig & 0xFFFF) * 100 / 65535; + hh->printf("SIG:%3u\n", sig); + } + if ( parame_empty || (hh->ParamList["1"] == "snr") ){ + unsigned int snr = frontend->getSignalNoiseRatio() & 0xFFFF; + snr = (snr & 0xFFFF) * 100 / 65535; + hh->printf("SNR:%3u\n", snr); + } + if ( parame_empty || (hh->ParamList["1"] == "ber") ){ + unsigned int ber = frontend->getBitErrorRate(); + hh->printf("BER:%3u\n", ber); + } + }else + hh->SendError(); +} + //----------------------------------------------------------------------------- void CControlAPI::SendStreamInfo(CyhookHandler *hh) { diff --git a/src/nhttpd/tuxboxapi/coolstream/controlapi.h b/src/nhttpd/tuxboxapi/coolstream/controlapi.h index 33d969ae6..ce7f7d9a3 100644 --- a/src/nhttpd/tuxboxapi/coolstream/controlapi.h +++ b/src/nhttpd/tuxboxapi/coolstream/controlapi.h @@ -111,6 +111,8 @@ private: void logoCGI(CyhookHandler *hh); void ConfigCGI(CyhookHandler *hh); void FileCGI(CyhookHandler *hh); + void SignalInfoCGI(CyhookHandler *hh); + protected: static const unsigned int PLUGIN_DIR_COUNT = 7;