mirror of
https://github.com/rofafor/vdr-plugin-femon.git
synced 2023-10-10 13:36:53 +02:00
Updated for vdr-1.7.19: New API functions for signal strength and quality used to provide information for the OSD.
This commit is contained in:
parent
131a61c80c
commit
5003faabc4
2
HISTORY
2
HISTORY
@ -417,4 +417,6 @@ VDR Plugin 'femon' Revision History
|
||||
|
||||
2011-xx-xx: Version 1.7.11
|
||||
|
||||
- Updated for vdr-1.7.19: New API functions for signal strength
|
||||
and quality used to provide information for the OSD.
|
||||
- Added cppcheck target into Makefile.
|
8
README
8
README
@ -32,15 +32,15 @@ Terminology:
|
||||
|
||||
--------------------------------------------------------------
|
||||
|## Channel Name ################### [SVDRP][AR][VF][A/DD][D]|
|
||||
|[=====Signal Strength in % ==============|=================]|
|
||||
|[=====Signal-to-Noise Ratio in % ========|=================]|
|
||||
|[=====Signal Strength ===================|=================]|
|
||||
|[=====Signal Quality ================|=====================]|
|
||||
| STR: #0000 (0%) BER: #00000000 Video: 0 Mbit/s |
|
||||
| SNR: #0000 (0%) UNC: #00000000 Audio: 0 kbit/s |
|
||||
| [LOCK] [SIGNAL] [CARRIER] [VITERBI] [SYNC] |
|
||||
--------------------------------------------------------------
|
||||
|
||||
STR - Signal strength
|
||||
SNR - Signal-to-noise ratio
|
||||
STR - Signal strength from driver
|
||||
SNR - Signal-to-noise ratio from driver
|
||||
BER - Bit error rate
|
||||
UNC - Uncorrected blocks
|
||||
Video - Calculated video bitrate in Mbit/s
|
||||
|
18
femon.c
18
femon.c
@ -14,8 +14,8 @@
|
||||
#include "femonservice.h"
|
||||
#include "femontools.h"
|
||||
|
||||
#if defined(APIVERSNUM) && APIVERSNUM < 10718
|
||||
#error "VDR-1.7.18 API version or greater is required!"
|
||||
#if defined(APIVERSNUM) && APIVERSNUM < 10719
|
||||
#error "VDR-1.7.19 API version or greater is required!"
|
||||
#endif
|
||||
|
||||
static const char VERSION[] = "1.7.11";
|
||||
@ -169,10 +169,14 @@ const char **cPluginFemon::SVDRPHelpPages(void)
|
||||
" Print the current frontend name.",
|
||||
"STAT\n"
|
||||
" Print the current frontend status.",
|
||||
"SGNL\n"
|
||||
"STRG\n"
|
||||
" Print the current signal strength.",
|
||||
"QUAL\n"
|
||||
" Print the current signal quality.",
|
||||
"SGNL\n"
|
||||
" Print the current signal strength from driver.",
|
||||
"SNRA\n"
|
||||
" Print the current signal-to-noise ratio.",
|
||||
" Print the current signal-to-noise ratio from driver.",
|
||||
"BERA\n"
|
||||
" Print the current bit error rate.",
|
||||
"UNCB\n"
|
||||
@ -225,6 +229,12 @@ cString cPluginFemon::SVDRPCommand(const char *Command, const char *Option, int
|
||||
else if (strcasecmp(Command, "STAT") == 0) {
|
||||
return getFrontendStatus(cDevice::ActualDevice()->CardIndex());
|
||||
}
|
||||
else if (strcasecmp(Command, "STRG") == 0) {
|
||||
return cString::sprintf("%d on device #%d", cDevice::ActualDevice()->SignalStrength(), cDevice::ActualDevice()->CardIndex());
|
||||
}
|
||||
else if (strcasecmp(Command, "QUAL") == 0) {
|
||||
return cString::sprintf("%d on device #%d", cDevice::ActualDevice()->SignalQuality(), cDevice::ActualDevice()->CardIndex());
|
||||
}
|
||||
else if (strcasecmp(Command, "SGNL") == 0) {
|
||||
int value = getSignal(cDevice::ActualDevice()->CardIndex());
|
||||
return cString::sprintf("%04X (%02d%%) on device #%d", value, value / 655, cDevice::ActualDevice()->CardIndex());
|
||||
|
26
femonosd.c
26
femonosd.c
@ -171,6 +171,10 @@ cFemonOsd::cFemonOsd()
|
||||
m_SvdrpPlugin(NULL),
|
||||
m_Number(0),
|
||||
m_OldNumber(0),
|
||||
m_Quality(0),
|
||||
m_QualityValid(false),
|
||||
m_Strength(0),
|
||||
m_StrengthValid(false),
|
||||
m_SNR(0),
|
||||
m_SNRValid(false),
|
||||
m_Signal(0),
|
||||
@ -333,11 +337,11 @@ void cFemonOsd::DrawStatusWindow(void)
|
||||
OSDDRAWSTATUSBM(OSDSPACING);
|
||||
}
|
||||
offset += OSDROWHEIGHT;
|
||||
if (m_SignalValid)
|
||||
OSDDRAWSTATUSBAR(m_Signal / 655);
|
||||
if (m_StrengthValid)
|
||||
OSDDRAWSTATUSBAR(m_Strength);
|
||||
offset += OSDROWHEIGHT;
|
||||
if (m_SNRValid)
|
||||
OSDDRAWSTATUSBAR(m_SNR / 655);
|
||||
if (m_QualityValid)
|
||||
OSDDRAWSTATUSBAR(m_Quality);
|
||||
offset += OSDROWHEIGHT;
|
||||
OSDDRAWSTATUSVALUES("STR:", m_SignalValid ? *cString::sprintf("%04x", m_Signal) : "", m_SignalValid ? *cString::sprintf("(%2d%%)", m_Signal / 655) : "",
|
||||
"BER:", m_BERValid ? *cString::sprintf("%08x", m_BER) : "", *cString::sprintf("%s:", tr("Video")),
|
||||
@ -521,6 +525,10 @@ void cFemonOsd::Action(void)
|
||||
m_SvdrpVideoBitrate = -1.0;
|
||||
m_SvdrpAudioBitrate = -1.0;
|
||||
if (m_Frontend != -1) {
|
||||
m_Quality = cDevice::ActualDevice()->SignalQuality();
|
||||
m_QualityValid = (m_Quality >= 0);
|
||||
m_Strength = cDevice::ActualDevice()->SignalStrength();
|
||||
m_StrengthValid = (m_Strength >= 0);
|
||||
m_FrontendStatusValid = (ioctl(m_Frontend, FE_READ_STATUS, &m_FrontendStatus) >= 0);
|
||||
m_SignalValid = (ioctl(m_Frontend, FE_READ_SIGNAL_STRENGTH, &m_Signal) >= 0);
|
||||
m_SNRValid = (ioctl(m_Frontend, FE_READ_SNR, &m_SNR) >= 0);
|
||||
@ -533,6 +541,8 @@ void cFemonOsd::Action(void)
|
||||
cmd.handle = m_SvdrpConnection.handle;
|
||||
m_SvdrpPlugin->Service("SvdrpCommand-v1.0", &cmd);
|
||||
if (cmd.responseCode == 900) {
|
||||
m_StrengthValid = false;
|
||||
m_QualityValid = false;
|
||||
m_FrontendStatusValid = false;
|
||||
m_SignalValid = false;
|
||||
m_SNRValid = false;
|
||||
@ -542,6 +552,14 @@ void cFemonOsd::Action(void)
|
||||
const char *s = line->Text();
|
||||
if (!strncasecmp(s, "CARD:", 5))
|
||||
m_SvdrpFrontend = (int)strtol(s + 5, NULL, 10);
|
||||
else if (!strncasecmp(s, "STRG:", 5)) {
|
||||
m_Strength = (int)strtol(s + 5, NULL, 10);
|
||||
m_StrengthValid = (m_Strength >= 0);
|
||||
}
|
||||
else if (!strncasecmp(s, "QUAL:", 5)) {
|
||||
m_Quality = (int)strtol(s + 5, NULL, 10);
|
||||
m_QualityValid = (m_Quality >= 0);
|
||||
}
|
||||
else if (!strncasecmp(s, "TYPE:", 5))
|
||||
m_FrontendInfo.type = (fe_type_t)strtol(s + 5, NULL, 10);
|
||||
else if (!strncasecmp(s, "NAME:", 5)) {
|
||||
|
@ -36,6 +36,10 @@ private:
|
||||
cPlugin *m_SvdrpPlugin;
|
||||
int m_Number;
|
||||
int m_OldNumber;
|
||||
int m_Quality;
|
||||
bool m_QualityValid;
|
||||
int m_Strength;
|
||||
bool m_StrengthValid;
|
||||
uint16_t m_SNR;
|
||||
bool m_SNRValid;
|
||||
uint16_t m_Signal;
|
||||
|
@ -92,7 +92,7 @@ cString getFrontendInfo(int cardIndex)
|
||||
if (fe < 0)
|
||||
return NULL;
|
||||
|
||||
info = cString::sprintf("CARD:%d", cardIndex);
|
||||
info = cString::sprintf("CARD:%d\nSTRG:%d\nQUAL:%d", cardIndex, cDevice::ActualDevice()->SignalStrength(), cDevice::ActualDevice()->SignalQuality());
|
||||
|
||||
if (ioctl(fe, FE_GET_INFO, &value) >= 0)
|
||||
info = cString::sprintf("%s\nTYPE:%d\nNAME:%s", *info, value.type, value.name);
|
||||
|
Loading…
Reference in New Issue
Block a user