From d81f70019449a15aa42a217bfb71a821b513401c Mon Sep 17 00:00:00 2001 From: Rolf Ahrenberg Date: Mon, 3 Nov 2014 21:55:28 +0200 Subject: [PATCH] Added a new device status menu. --- HISTORY | 1 + README | 1 + po/ca_ES.po | 20 +++++---- po/de_DE.po | 20 +++++---- po/es_ES.po | 20 +++++---- po/fi_FI.po | 20 +++++---- setup.c | 119 ++++++++++++++++++++++++++++++++++++++++++++++++---- setup.h | 1 + 8 files changed, 166 insertions(+), 36 deletions(-) diff --git a/HISTORY b/HISTORY index 822a64e..b43cbc9 100644 --- a/HISTORY +++ b/HISTORY @@ -72,3 +72,4 @@ VDR Plugin 'satip' Revision History - Fixed server reuse for active transponders. - Added a preliminary support for Fritz!WLAN Repeater DVB-C (Thanks to Christian Wick). +- Added a new device status menu. diff --git a/README b/README index 0f2d9c6..017dbb9 100644 --- a/README +++ b/README @@ -84,6 +84,7 @@ Setup menu: to disable the individual section filters. Valid range: "none" = 0 ... 7 - [Red:Scan] Forces network scanning of SAT>IP hardware. +- [Yellow:Devices] Opens SAT>IP device status menu. - [Blue:Info] Opens SAT>IP information/statistics menu. - [Ok] Opens information menu of selected SAT>IP device. diff --git a/po/ca_ES.po b/po/ca_ES.po index 3ca2d71..768544c 100644 --- a/po/ca_ES.po +++ b/po/ca_ES.po @@ -34,8 +34,8 @@ msgstr "TDT (0x70)" msgid "SAT>IP Devices" msgstr "SAT>IP Dispositius" -msgid "SAT>IP Device" -msgstr "SAT>IP Dispositiu" +msgid "SAT>IP Server" +msgstr "" msgid "Address" msgstr "Adressa" @@ -49,6 +49,12 @@ msgstr "Descripció" msgid "Creation date" msgstr "Creació de data" +msgid "SAT>IP Device Status" +msgstr "" + +msgid "SAT>IP information not available!" +msgstr "SAT>IP Informació no disponible!" + msgid "SAT>IP Information" msgstr "SAT>IP Informació" @@ -64,9 +70,6 @@ msgstr "Filtres" msgid "Bits/bytes" msgstr "Bits/Bytes" -msgid "SAT>IP information not available!" -msgstr "SAT>IP Informació no disponible!" - msgid "off" msgstr "Apagat" @@ -79,6 +82,9 @@ msgstr "Normal" msgid "high" msgstr "Alt" +msgid "Button$Devices" +msgstr "" + msgid "Operating mode" msgstr "Mode de operació" @@ -142,8 +148,8 @@ msgstr "Filtra" msgid "Define an ill-behaving filter to be blacklisted." msgstr "Definir un filtre mal comportar a la llista negra." -msgid "Active SAT>IP devices:" -msgstr "Dispositius SAT>IP actius:" +msgid "Active SAT>IP servers:" +msgstr "" msgid "Help" msgstr "Ajuda" diff --git a/po/de_DE.po b/po/de_DE.po index 2ccd911..a0668a8 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -34,8 +34,8 @@ msgstr "TDT (0x70)" msgid "SAT>IP Devices" msgstr "SAT>IP Geräte" -msgid "SAT>IP Device" -msgstr "SAT>IP Gerät" +msgid "SAT>IP Server" +msgstr "" msgid "Address" msgstr "Adresse" @@ -49,6 +49,12 @@ msgstr "Beschreibung" msgid "Creation date" msgstr "Zeitpunkt der Erstellung" +msgid "SAT>IP Device Status" +msgstr "" + +msgid "SAT>IP information not available!" +msgstr "Keine SAT>IP Informationen verfügbar!" + msgid "SAT>IP Information" msgstr "SAT>IP Informationen" @@ -64,9 +70,6 @@ msgstr "Filter" msgid "Bits/bytes" msgstr "Bits/Bytes" -msgid "SAT>IP information not available!" -msgstr "Keine SAT>IP Informationen verfügbar!" - msgid "off" msgstr "aus" @@ -79,6 +82,9 @@ msgstr "normal" msgid "high" msgstr "hoch" +msgid "Button$Devices" +msgstr "" + msgid "Operating mode" msgstr "Betriebsmodus" @@ -142,8 +148,8 @@ msgstr "Filter" msgid "Define an ill-behaving filter to be blacklisted." msgstr "Bestimme einen fehlerhaften Filter der ausgeblendet werden soll." -msgid "Active SAT>IP devices:" -msgstr "Aktive SAT>IP Geräte:" +msgid "Active SAT>IP servers:" +msgstr "" msgid "Help" msgstr "Hilfe" diff --git a/po/es_ES.po b/po/es_ES.po index fff2e21..8c42597 100644 --- a/po/es_ES.po +++ b/po/es_ES.po @@ -34,8 +34,8 @@ msgstr "TDT (0x70)" msgid "SAT>IP Devices" msgstr "SAT>IP Dispositivos" -msgid "SAT>IP Device" -msgstr "SAT>IP Dispositivo" +msgid "SAT>IP Server" +msgstr "" msgid "Address" msgstr "Dirección" @@ -49,6 +49,12 @@ msgstr "Descripción" msgid "Creation date" msgstr "Fecha creación" +msgid "SAT>IP Device Status" +msgstr "" + +msgid "SAT>IP information not available!" +msgstr "SAT>IP Información no disponible!" + msgid "SAT>IP Information" msgstr "SAT>IP Información" @@ -64,9 +70,6 @@ msgstr "Filtros" msgid "Bits/bytes" msgstr "Bits/Bytes" -msgid "SAT>IP information not available!" -msgstr "SAT>IP Información no disponible!" - msgid "off" msgstr "Apagado" @@ -79,6 +82,9 @@ msgstr "Normal" msgid "high" msgstr "Alto" +msgid "Button$Devices" +msgstr "" + msgid "Operating mode" msgstr "Modo de operación" @@ -142,8 +148,8 @@ msgstr "Filtra" msgid "Define an ill-behaving filter to be blacklisted." msgstr "Define un filtro para poner en la lista negra." -msgid "Active SAT>IP devices:" -msgstr "Dispositivos SAT>IP activos:" +msgid "Active SAT>IP servers:" +msgstr "" msgid "Help" msgstr "Ayuda" diff --git a/po/fi_FI.po b/po/fi_FI.po index 4c66a88..b13a2d6 100644 --- a/po/fi_FI.po +++ b/po/fi_FI.po @@ -34,8 +34,8 @@ msgstr "TDT (0x70)" msgid "SAT>IP Devices" msgstr "SAT>IP-laitteet" -msgid "SAT>IP Device" -msgstr "SAT>IP-laite" +msgid "SAT>IP Server" +msgstr "SAT>IP-palvelin" msgid "Address" msgstr "Osoite" @@ -49,6 +49,12 @@ msgstr "Kuvaus" msgid "Creation date" msgstr "Luontiajankohta" +msgid "SAT>IP Device Status" +msgstr "SAT>IP-laitteiden tiedot" + +msgid "SAT>IP information not available!" +msgstr "SAT>IP-tietoja ei saatavilla!" + msgid "SAT>IP Information" msgstr "SAT>IP-tiedot" @@ -64,9 +70,6 @@ msgstr "Suodattimet" msgid "Bits/bytes" msgstr "Bitit/tavut" -msgid "SAT>IP information not available!" -msgstr "SAT>IP-tietoja ei saatavilla!" - msgid "off" msgstr "ei käytössä" @@ -79,6 +82,9 @@ msgstr "normaali" msgid "high" msgstr "korkea" +msgid "Button$Devices" +msgstr "Laitteet" + msgid "Operating mode" msgstr "Laitteiden toimintatapa" @@ -144,8 +150,8 @@ msgstr "Suodatin" msgid "Define an ill-behaving filter to be blacklisted." msgstr "Määrittele käytöstä poistettava suodatin, joka lisätään mustalle listalle." -msgid "Active SAT>IP devices:" -msgstr "Aktiiviset SAT>IP-laitteet:" +msgid "Active SAT>IP servers:" +msgstr "Aktiiviset SAT>IP-palvelimet:" msgid "Help" msgstr "Opaste" diff --git a/setup.c b/setup.c index 0cabe68..39f94b3 100644 --- a/setup.c +++ b/setup.c @@ -98,7 +98,7 @@ public: }; cSatipServerInfo::cSatipServerInfo(cSatipServer *serverP) -: cOsdMenu(tr("SAT>IP Device"), 20), +: cOsdMenu(tr("SAT>IP Server"), 20), addressM(serverP ? serverP->Address() : "---"), modelM(serverP ? serverP->Model() : "---"), descriptionM(serverP ? serverP->Description() : "---"), @@ -160,6 +160,99 @@ void cSatipServerItem::SetMenuItem(cSkinDisplayMenu *displayMenuP, int indexP, b displayMenuP->SetItem(Text(), indexP, currentP, selectableP); } +// --- cSatipMenuDeviceStatus ------------------------------------------------- + +class cSatipMenuDeviceStatus : public cOsdMenu +{ +private: + enum { + eInfoTimeoutMs = 15000 + }; + cString textM; + cTimeMs timeoutM; + void UpdateInfo(); + +public: + cSatipMenuDeviceStatus(); + virtual ~cSatipMenuDeviceStatus(); + virtual void Display(void); + virtual eOSState ProcessKey(eKeys keyP); +}; + +cSatipMenuDeviceStatus::cSatipMenuDeviceStatus() +: cOsdMenu(tr("SAT>IP Device Status")), + textM(""), + timeoutM() +{ + SetMenuCategory(mcText); + timeoutM.Set(eInfoTimeoutMs); + UpdateInfo(); + SetHelp(NULL, NULL, NULL, NULL); +} + +cSatipMenuDeviceStatus::~cSatipMenuDeviceStatus() +{ +} + +void cSatipMenuDeviceStatus::UpdateInfo() +{ + textM = ""; + for (int i = 0; i < cDevice::NumDevices(); i++) { + const cDevice *device = cDevice::GetDevice(i); + if (device && strstr(device->DeviceType(), "SAT>IP")) { + int timers = 0; + bool live = (device == cDevice::ActualDevice()); + bool lock = device->HasLock(); + const cChannel *channel = device->GetCurrentlyTunedTransponder(); + for (cTimer *timer = Timers.First(); timer; timer = Timers.Next(timer)) { + if (timer->Recording()) { + cRecordControl *control = cRecordControls::GetRecordControl(timer); + if (control && control->Device() == device) + timers++; + } + } + textM = cString::sprintf("%sDevice: %s\n", *textM, *device->DeviceName()); + if (lock) + textM = cString::sprintf("%sCardIndex: %d HasLock: yes Strength: %d Quality: %d%s\n", *textM, device->CardIndex(), device->SignalStrength(), device->SignalQuality(), live ? " Live: yes" : ""); + else + textM = cString::sprintf("%sCardIndex: %d HasLock: no\n", *textM, device->CardIndex()); + if (channel && channel->Number() > 0) + textM = cString::sprintf("%sChannel: %s\n", *textM, (channel && channel->Number() > 0) ? channel->Name() : "---"); + if (timers) + textM = cString::sprintf("%sRecording: %d timer%s\n", *textM, timers, (timers > 1) ? "s" : ""); + textM = cString::sprintf("%s\n", *textM); + } + } + if (isempty(*textM)) + textM = cString(tr("SAT>IP information not available!")); + Display(); + timeoutM.Set(eInfoTimeoutMs); +} + +void cSatipMenuDeviceStatus::Display(void) +{ + cOsdMenu::Display(); + DisplayMenu()->SetText(textM, true); + if (*textM) + cStatus::MsgOsdTextItem(textM); +} + +eOSState cSatipMenuDeviceStatus::ProcessKey(eKeys keyP) +{ + eOSState state = cOsdMenu::ProcessKey(keyP); + + if (state == osUnknown) { + switch (keyP) { + case kOk: state = osBack; break; + default: if (timeoutM.TimedOut()) + UpdateInfo(); + state = osContinue; + break; + } + } + return state; +} + // --- cSatipMenuInfo --------------------------------------------------------- class cSatipMenuInfo : public cOsdMenu @@ -284,7 +377,7 @@ cSatipPluginSetup::cSatipPluginSetup() } SetMenuCategory(mcSetupPlugins); Setup(); - SetHelp(trVDR("Button$Scan"), NULL, NULL, trVDR("Button$Info")); + SetHelp(trVDR("Button$Scan"), NULL, tr("Button$Devices"), trVDR("Button$Info")); } void cSatipPluginSetup::Setup(void) @@ -317,7 +410,7 @@ void cSatipPluginSetup::Setup(void) helpM.Append(tr("Define an ill-behaving filter to be blacklisted.")); } } - Add(new cOsdItem(tr("Active SAT>IP devices:"), osUnknown, false)); + Add(new cOsdItem(tr("Active SAT>IP servers:"), osUnknown, false)); helpM.Append(""); cSatipServers *servers = cSatipDiscover::GetInstance()->GetServers(); @@ -352,6 +445,15 @@ eOSState cSatipPluginSetup::DeviceInfo(void) return osContinue; } +eOSState cSatipPluginSetup::ShowDeviceStatus(void) +{ + debug("cSatipPluginSetup::%s()", __FUNCTION__); + if (HasSubMenu() || Count() == 0) + return osContinue; + + return AddSubMenu(new cSatipMenuDeviceStatus()); +} + eOSState cSatipPluginSetup::ShowInfo(void) { debug("cSatipPluginSetup::%s()", __FUNCTION__); @@ -376,11 +478,12 @@ eOSState cSatipPluginSetup::ProcessKey(eKeys keyP) if (state == osUnknown) { switch (keyP) { - case kRed: return DeviceScan(); - case kBlue: return ShowInfo(); - case kInfo: if (Current() < helpM.Size()) - return AddSubMenu(new cMenuText(cString::sprintf("%s - %s '%s'", tr("Help"), trVDR("Plugin"), PLUGIN_NAME_I18N), helpM[Current()])); - default: state = osContinue; break; + case kRed: return DeviceScan(); + case kYellow: return ShowDeviceStatus(); + case kBlue: return ShowInfo(); + case kInfo: if (Current() < helpM.Size()) + return AddSubMenu(new cMenuText(cString::sprintf("%s - %s '%s'", tr("Help"), trVDR("Plugin"), PLUGIN_NAME_I18N), helpM[Current()])); + default: state = osContinue; break; } } diff --git a/setup.h b/setup.h index 8cf1792..fdee144 100644 --- a/setup.h +++ b/setup.h @@ -28,6 +28,7 @@ private: eOSState DeviceScan(void); eOSState DeviceInfo(void); + eOSState ShowDeviceStatus(void); eOSState ShowInfo(void); void Setup(void); void StoreSources(const char *nameP, int *sourcesP);