mirror of
https://github.com/rofafor/vdr-plugin-satip.git
synced 2023-10-10 13:37:42 +02:00
Add support for cDevice::SignalStats().
This commit is contained in:
parent
e092d085b8
commit
40943b8bd2
15
device.c
15
device.c
@ -212,6 +212,21 @@ bool cSatipDevice::AvoidRecording(void) const
|
||||
return SatipConfig.IsOperatingModeLow();
|
||||
}
|
||||
|
||||
bool cSatipDevice::SignalStats(int &Valid, double *Strength, double *Cnr, double *BerPre, double *BerPost, double *Per, int *Status) const
|
||||
{
|
||||
debug16("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
Valid = DTV_STAT_VALID_NONE;
|
||||
if (Strength && pTunerM) {
|
||||
*Strength = pTunerM->SignalStrengthDBm();
|
||||
Valid |= DTV_STAT_VALID_STRENGTH;
|
||||
}
|
||||
if (Status) {
|
||||
*Status = HasLock() ? (DTV_STAT_HAS_SIGNAL | DTV_STAT_HAS_CARRIER | DTV_STAT_HAS_VITERBI | DTV_STAT_HAS_SYNC | DTV_STAT_HAS_LOCK) : DTV_STAT_HAS_NONE;
|
||||
Valid |= DTV_STAT_VALID_STATUS;
|
||||
}
|
||||
return Valid != DTV_STAT_VALID_NONE;
|
||||
}
|
||||
|
||||
int cSatipDevice::SignalStrength(void) const
|
||||
{
|
||||
debug16("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
|
3
device.h
3
device.h
@ -64,6 +64,7 @@ public:
|
||||
virtual cString DeviceType(void) const;
|
||||
virtual cString DeviceName(void) const;
|
||||
virtual bool AvoidRecording(void) const;
|
||||
virtual bool SignalStats(int &Valid, double *Strength = NULL, double *Cnr = NULL, double *BerPre = NULL, double *BerPost = NULL, double *Per = NULL, int *Status = NULL) const;
|
||||
virtual int SignalStrength(void) const;
|
||||
virtual int SignalQuality(void) const;
|
||||
|
||||
@ -99,7 +100,7 @@ public:
|
||||
|
||||
// for transponder lock
|
||||
public:
|
||||
virtual bool HasLock(int timeoutMsP) const;
|
||||
virtual bool HasLock(int timeoutMsP = 0) const;
|
||||
|
||||
// for common interface
|
||||
public:
|
||||
|
4
satip.c
4
satip.c
@ -19,8 +19,8 @@
|
||||
#warning "CURL version >= 7.36.0 is recommended"
|
||||
#endif
|
||||
|
||||
#if defined(APIVERSNUM) && APIVERSNUM < 20304
|
||||
#error "VDR-2.3.4 API version or greater is required!"
|
||||
#if defined(APIVERSNUM) && APIVERSNUM < 20305
|
||||
#error "VDR-2.3.5 API version or greater is required!"
|
||||
#endif
|
||||
|
||||
#ifndef GITVERSION
|
||||
|
12
tuner.c
12
tuner.c
@ -40,6 +40,7 @@ cSatipTuner::cSatipTuner(cSatipDeviceIf &deviceP, unsigned int packetLenP)
|
||||
externalStateM(),
|
||||
timeoutM(eMinKeepAliveIntervalMs),
|
||||
hasLockM(false),
|
||||
signalStrengthDBmM(0.0),
|
||||
signalStrengthM(-1),
|
||||
signalQualityM(-1),
|
||||
frontendIdM(-1),
|
||||
@ -134,6 +135,7 @@ void cSatipTuner::Action(void)
|
||||
// Quirk for devices without valid reception data
|
||||
if (currentServerM.IsQuirk(cSatipServer::eSatipQuirkForceLock)) {
|
||||
hasLockM = true;
|
||||
signalStrengthDBmM = eDefaultSignalStrengthDBm;
|
||||
signalStrengthM = eDefaultSignalStrength;
|
||||
signalQualityM = eDefaultSignalQuality;
|
||||
}
|
||||
@ -261,6 +263,7 @@ bool cSatipTuner::Disconnect(void)
|
||||
|
||||
// Reset signal parameters
|
||||
hasLockM = false;
|
||||
signalStrengthDBmM = 0.0;
|
||||
signalStrengthM = -1;
|
||||
signalQualityM = -1;
|
||||
frontendIdM = -1;
|
||||
@ -330,8 +333,9 @@ void cSatipTuner::ProcessApplicationData(u_char *bufferP, int lengthP)
|
||||
// No signal corresponds to 0
|
||||
c = strstr(c, ",");
|
||||
value = min(atoi(++c), 255);
|
||||
signalStrengthDBmM = (value >= 0) ? 40.0 * (value - 32) / 192.0 - 65.0 : 0.0;
|
||||
// Scale value to 0-100
|
||||
signalStrengthM = (value >= 0) ? (value * 100 / 255) : -1;
|
||||
signalStrengthM = (value >= 0) ? value * 100 / 255 : -1;
|
||||
|
||||
// lock:
|
||||
// lock Set to one of the following values:
|
||||
@ -667,6 +671,12 @@ int cSatipTuner::SignalStrength(void)
|
||||
return signalStrengthM;
|
||||
}
|
||||
|
||||
double cSatipTuner::SignalStrengthDBm(void)
|
||||
{
|
||||
debug16("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
return signalStrengthDBmM;
|
||||
}
|
||||
|
||||
int cSatipTuner::SignalQuality(void)
|
||||
{
|
||||
debug16("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
|
7
tuner.h
7
tuner.h
@ -78,8 +78,9 @@ class cSatipTuner : public cThread, public cSatipTunerStatistics, public cSatipT
|
||||
private:
|
||||
enum {
|
||||
eDummyPid = 100,
|
||||
eDefaultSignalStrength = 15,
|
||||
eDefaultSignalQuality = 224,
|
||||
eDefaultSignalStrengthDBm = -25,
|
||||
eDefaultSignalStrength = 224,
|
||||
eDefaultSignalQuality = 15,
|
||||
eSleepTimeoutMs = 250, // in milliseconds
|
||||
eStatusUpdateTimeoutMs = 1000, // in milliseconds
|
||||
ePidUpdateIntervalMs = 250, // in milliseconds
|
||||
@ -114,6 +115,7 @@ private:
|
||||
cVector<eTunerState> externalStateM;
|
||||
int timeoutM;
|
||||
bool hasLockM;
|
||||
double signalStrengthDBmM;
|
||||
int signalStrengthM;
|
||||
int signalQualityM;
|
||||
int frontendIdM;
|
||||
@ -148,6 +150,7 @@ public:
|
||||
bool Close(void);
|
||||
int FrontendId(void);
|
||||
int SignalStrength(void);
|
||||
double SignalStrengthDBm(void);
|
||||
int SignalQuality(void);
|
||||
bool HasLock(void);
|
||||
cString GetSignalStatus(void);
|
||||
|
Loading…
Reference in New Issue
Block a user