From a0a463730e1eac46d89e63f6775dc3427091db36 Mon Sep 17 00:00:00 2001 From: GetAway Date: Mon, 29 May 2023 22:32:56 +0200 Subject: [PATCH] controlapi.cpp: add possibility to get boxinfo Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/5fbe77afa5bab8a0096029bf0ab710cf3b0aeda5 Author: GetAway Date: 2023-05-29 (Mon, 29 May 2023) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- doc/nhttpd/nhttpd_controlapi.html | 23 ++++++++++++++++++++ src/nhttpd/tuxboxapi/controlapi.cpp | 33 +++++++++++++++++++++++++++++ src/nhttpd/tuxboxapi/controlapi.h | 1 + 3 files changed, 57 insertions(+) diff --git a/doc/nhttpd/nhttpd_controlapi.html b/doc/nhttpd/nhttpd_controlapi.html index c4d946ce0..2efa4c1e7 100644 --- a/doc/nhttpd/nhttpd_controlapi.html +++ b/doc/nhttpd/nhttpd_controlapi.html @@ -63,6 +63,10 @@ Allgemeine Informationen http://box_ip/control/info + + Box Informationen + http://box_ip/control/boxinfo + Aktuellen Kanal abfragen @@ -1100,6 +1104,25 @@ Beispiel:

+ +
Boxinfo abfragen
+
Handler: http://box_ip/control/boxinfo
+
+Parameter:
+Rückgabe:
+
+Es wird der Hersteller, der Boxname und die Boxarchitektur zurückgegeben.
+
+
+Beispiel:
+
+>>>http://box_ip/control/boxinfo
+vendor=AX
+boxname=H51
+boxarch=BCM7251S
+
+
+
Aktuellen Kanal abfragen
Handler: http://box_ip/control/getonidsid
diff --git a/src/nhttpd/tuxboxapi/controlapi.cpp b/src/nhttpd/tuxboxapi/controlapi.cpp index cf860a8bb..ec20d5e0a 100644 --- a/src/nhttpd/tuxboxapi/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/controlapi.cpp @@ -223,6 +223,7 @@ const CControlAPI::TyCgiCall CControlAPI::yCgiCallList[]= {"getdate", &CControlAPI::GetDateCGI, "text/plain"}, {"gettime", &CControlAPI::GetTimeCGI, "text/plain"}, {"info", &CControlAPI::InfoCGI, "text/plain"}, + {"boxinfo", &CControlAPI::BoxInfoCGI, "text/plain"}, {"version", &CControlAPI::VersionCGI, ""}, {"reloadsetup", &CControlAPI::ReloadNeutrinoSetupCGI, ""}, {"reloadplugins", &CControlAPI::ReloadPluginsCGI, ""}, @@ -877,6 +878,38 @@ void CControlAPI::InfoCGI(CyhookHandler *hh) } } +void CControlAPI::BoxInfoCGI(CyhookHandler *hh) +{ + std::string boxinfo(g_info.hw_caps->boxvendor); + /* + I don't know the current legal situation. + So better let's change the vendor's name to CST. + + After change this, you'll have to align code in Y_Blocks.txt + */ + + if (boxinfo.compare("Coolstream") == 0) { + boxinfo = "CST"; + } + std::string boxname(g_info.hw_caps->boxname); + if (strcmp(boxname.c_str(), "Neo") == 0) + { + // detecting Neo Twin by counting frontends + if (CFEManager::getInstance()->getFrontendCount() > 1) + boxname = "Neo Twin"; + } + + boxinfo = "vendor=" + boxinfo; + boxinfo += "\n"; + boxinfo += "boxname="; + boxinfo += boxname; + boxinfo += "\n"; + boxinfo += "boxarch="; + boxinfo += g_info.hw_caps->boxarch; + + hh->printf("%s\n", boxinfo.c_str()); +} + void CControlAPI::HWInfoCGI(CyhookHandler *hh) { static CNetAdapter netadapter; diff --git a/src/nhttpd/tuxboxapi/controlapi.h b/src/nhttpd/tuxboxapi/controlapi.h index 1325aa657..d445277a0 100644 --- a/src/nhttpd/tuxboxapi/controlapi.h +++ b/src/nhttpd/tuxboxapi/controlapi.h @@ -91,6 +91,7 @@ private: void GetTPChannel_IDCGI(CyhookHandler *hh); void MessageCGI(CyhookHandler *hh); void InfoCGI(CyhookHandler *hh); + void BoxInfoCGI(CyhookHandler *hh); void HWInfoCGI(CyhookHandler *hh); void ShutdownCGI(CyhookHandler *hh); void VolumeCGI(CyhookHandler *hh);