From 7110cee7a98e1799fedced0c3aabe1846a0f3e00 Mon Sep 17 00:00:00 2001 From: Rolf Ahrenberg Date: Mon, 10 Nov 2014 23:46:45 +0200 Subject: [PATCH] Added STAT command into SVDRP interface. --- device.c | 34 ++++++++++++++++++++++++++++++++++ device.h | 1 + po/ca_ES.po | 6 +++--- po/de_DE.po | 6 +++--- po/es_ES.po | 6 +++--- po/fi_FI.po | 6 +++--- satip.c | 5 +++++ setup.c | 30 +----------------------------- 8 files changed, 53 insertions(+), 41 deletions(-) diff --git a/device.c b/device.c index 7155468..5f732aa 100644 --- a/device.c +++ b/device.c @@ -5,6 +5,8 @@ * */ +#include // cRecordControl + #include "config.h" #include "discover.h" #include "param.h" @@ -92,6 +94,38 @@ cSatipDevice *cSatipDevice::GetSatipDevice(int cardIndexP) return NULL; } +cString cSatipDevice::GetSatipStatus(void) +{ + cString info = ""; + 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++; + } + } + info = cString::sprintf("%sDevice: %s\n", *info, *device->DeviceName()); + if (lock) + info = cString::sprintf("%sCardIndex: %d HasLock: yes Strength: %d Quality: %d%s\n", *info, device->CardIndex(), device->SignalStrength(), device->SignalQuality(), live ? " Live: yes" : ""); + else + info = cString::sprintf("%sCardIndex: %d HasLock: no\n", *info, device->CardIndex()); + if (channel && channel->Number() > 0) + info = cString::sprintf("%sChannel: %s\n", *info, (channel && channel->Number() > 0) ? channel->Name() : "---"); + if (timers) + info = cString::sprintf("%sRecording: %d timer%s\n", *info, timers, (timers > 1) ? "s" : ""); + info = cString::sprintf("%s\n", *info); + } + } + return isempty(*info) ? cString(tr("SAT>IP information not available!")) : info; +} + cString cSatipDevice::GetGeneralInformation(void) { //debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM); diff --git a/device.h b/device.h index 4e0cc1c..b852c01 100644 --- a/device.h +++ b/device.h @@ -23,6 +23,7 @@ public: static void Shutdown(void); static unsigned int Count(void); static cSatipDevice *GetSatipDevice(int CardIndex); + static cString GetSatipStatus(void); // private parts private: diff --git a/po/ca_ES.po b/po/ca_ES.po index 33e2820..01f23c2 100644 --- a/po/ca_ES.po +++ b/po/ca_ES.po @@ -31,6 +31,9 @@ msgstr "EIT (0x4E/0x4F/0x5X/0x6X)" msgid "TDT (0x70)" msgstr "TDT (0x70)" +msgid "SAT>IP information not available!" +msgstr "SAT>IP Informació no disponible!" + msgid "SAT>IP Devices" msgstr "SAT>IP Dispositius" @@ -52,9 +55,6 @@ 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ó" diff --git a/po/de_DE.po b/po/de_DE.po index 396e3c5..70117ab 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -31,6 +31,9 @@ msgstr "EIT (0x4E/0x4F/0x5X/0x6X)" msgid "TDT (0x70)" msgstr "TDT (0x70)" +msgid "SAT>IP information not available!" +msgstr "Keine SAT>IP Informationen verfügbar!" + msgid "SAT>IP Devices" msgstr "SAT>IP Geräte" @@ -52,9 +55,6 @@ msgstr "Zeitpunkt der Erstellung" msgid "SAT>IP Device Status" msgstr "SAT>IP Geräte Status" -msgid "SAT>IP information not available!" -msgstr "Keine SAT>IP Informationen verfügbar!" - msgid "SAT>IP Information" msgstr "SAT>IP Informationen" diff --git a/po/es_ES.po b/po/es_ES.po index bfbd979..ccd63a8 100644 --- a/po/es_ES.po +++ b/po/es_ES.po @@ -31,6 +31,9 @@ msgstr "EIT (0x4E/0x4F/0x5X/0x6X)" msgid "TDT (0x70)" msgstr "TDT (0x70)" +msgid "SAT>IP information not available!" +msgstr "SAT>IP Información no disponible!" + msgid "SAT>IP Devices" msgstr "SAT>IP Dispositivos" @@ -52,9 +55,6 @@ 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" diff --git a/po/fi_FI.po b/po/fi_FI.po index 6730686..6714178 100644 --- a/po/fi_FI.po +++ b/po/fi_FI.po @@ -31,6 +31,9 @@ msgstr "EIT (0x4E/0x4F/0x5X/0x6X)" msgid "TDT (0x70)" msgstr "TDT (0x70)" +msgid "SAT>IP information not available!" +msgstr "SAT>IP-tietoja ei saatavilla!" + msgid "SAT>IP Devices" msgstr "SAT>IP-laitteet" @@ -52,9 +55,6 @@ 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" diff --git a/satip.c b/satip.c index a84cf11..959f2cc 100644 --- a/satip.c +++ b/satip.c @@ -307,6 +307,8 @@ const char **cPluginSatip::SVDRPHelpPages(void) " Toggles between bit or byte information mode.\n", "LIST\n" " Lists active SAT>IP servers.\n", + "STAT\n" + " Lists status information of SAT>IP devices.\n", "CONT\n" " Shows SAT>IP device count.\n", "OPER\n" @@ -363,6 +365,9 @@ cString cPluginSatip::SVDRPCommand(const char *commandP, const char *optionP, in return cString("No SAT>IP devices detected!"); } } + else if (strcasecmp(commandP, "STAT") == 0) { + return cSatipDevice::GetSatipStatus(); + } else if (strcasecmp(commandP, "CONT") == 0) { return cString::sprintf("SAT>IP device count: %u", cSatipDevice::Count()); } diff --git a/setup.c b/setup.c index 39f94b3..d44eaba 100644 --- a/setup.c +++ b/setup.c @@ -196,35 +196,7 @@ 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!")); + textM = cSatipDevice::GetSatipStatus(); Display(); timeoutM.Set(eInfoTimeoutMs); }