Added STAT command into SVDRP interface.

This commit is contained in:
Rolf Ahrenberg 2014-11-10 23:46:45 +02:00
parent a9109d750c
commit 7110cee7a9
8 changed files with 53 additions and 41 deletions

View File

@ -5,6 +5,8 @@
*
*/
#include <vdr/menu.h> // 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);

View File

@ -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:

View File

@ -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ó"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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());
}

30
setup.c
View File

@ -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);
}