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();
|
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
|
int cSatipDevice::SignalStrength(void) const
|
||||||
{
|
{
|
||||||
debug16("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
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 DeviceType(void) const;
|
||||||
virtual cString DeviceName(void) const;
|
virtual cString DeviceName(void) const;
|
||||||
virtual bool AvoidRecording(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 SignalStrength(void) const;
|
||||||
virtual int SignalQuality(void) const;
|
virtual int SignalQuality(void) const;
|
||||||
|
|
||||||
@ -99,7 +100,7 @@ public:
|
|||||||
|
|
||||||
// for transponder lock
|
// for transponder lock
|
||||||
public:
|
public:
|
||||||
virtual bool HasLock(int timeoutMsP) const;
|
virtual bool HasLock(int timeoutMsP = 0) const;
|
||||||
|
|
||||||
// for common interface
|
// for common interface
|
||||||
public:
|
public:
|
||||||
|
4
satip.c
4
satip.c
@ -19,8 +19,8 @@
|
|||||||
#warning "CURL version >= 7.36.0 is recommended"
|
#warning "CURL version >= 7.36.0 is recommended"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(APIVERSNUM) && APIVERSNUM < 20304
|
#if defined(APIVERSNUM) && APIVERSNUM < 20305
|
||||||
#error "VDR-2.3.4 API version or greater is required!"
|
#error "VDR-2.3.5 API version or greater is required!"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef GITVERSION
|
#ifndef GITVERSION
|
||||||
|
12
tuner.c
12
tuner.c
@ -40,6 +40,7 @@ cSatipTuner::cSatipTuner(cSatipDeviceIf &deviceP, unsigned int packetLenP)
|
|||||||
externalStateM(),
|
externalStateM(),
|
||||||
timeoutM(eMinKeepAliveIntervalMs),
|
timeoutM(eMinKeepAliveIntervalMs),
|
||||||
hasLockM(false),
|
hasLockM(false),
|
||||||
|
signalStrengthDBmM(0.0),
|
||||||
signalStrengthM(-1),
|
signalStrengthM(-1),
|
||||||
signalQualityM(-1),
|
signalQualityM(-1),
|
||||||
frontendIdM(-1),
|
frontendIdM(-1),
|
||||||
@ -134,6 +135,7 @@ void cSatipTuner::Action(void)
|
|||||||
// Quirk for devices without valid reception data
|
// Quirk for devices without valid reception data
|
||||||
if (currentServerM.IsQuirk(cSatipServer::eSatipQuirkForceLock)) {
|
if (currentServerM.IsQuirk(cSatipServer::eSatipQuirkForceLock)) {
|
||||||
hasLockM = true;
|
hasLockM = true;
|
||||||
|
signalStrengthDBmM = eDefaultSignalStrengthDBm;
|
||||||
signalStrengthM = eDefaultSignalStrength;
|
signalStrengthM = eDefaultSignalStrength;
|
||||||
signalQualityM = eDefaultSignalQuality;
|
signalQualityM = eDefaultSignalQuality;
|
||||||
}
|
}
|
||||||
@ -261,6 +263,7 @@ bool cSatipTuner::Disconnect(void)
|
|||||||
|
|
||||||
// Reset signal parameters
|
// Reset signal parameters
|
||||||
hasLockM = false;
|
hasLockM = false;
|
||||||
|
signalStrengthDBmM = 0.0;
|
||||||
signalStrengthM = -1;
|
signalStrengthM = -1;
|
||||||
signalQualityM = -1;
|
signalQualityM = -1;
|
||||||
frontendIdM = -1;
|
frontendIdM = -1;
|
||||||
@ -330,8 +333,9 @@ void cSatipTuner::ProcessApplicationData(u_char *bufferP, int lengthP)
|
|||||||
// No signal corresponds to 0
|
// No signal corresponds to 0
|
||||||
c = strstr(c, ",");
|
c = strstr(c, ",");
|
||||||
value = min(atoi(++c), 255);
|
value = min(atoi(++c), 255);
|
||||||
|
signalStrengthDBmM = (value >= 0) ? 40.0 * (value - 32) / 192.0 - 65.0 : 0.0;
|
||||||
// Scale value to 0-100
|
// Scale value to 0-100
|
||||||
signalStrengthM = (value >= 0) ? (value * 100 / 255) : -1;
|
signalStrengthM = (value >= 0) ? value * 100 / 255 : -1;
|
||||||
|
|
||||||
// lock:
|
// lock:
|
||||||
// lock Set to one of the following values:
|
// lock Set to one of the following values:
|
||||||
@ -667,6 +671,12 @@ int cSatipTuner::SignalStrength(void)
|
|||||||
return signalStrengthM;
|
return signalStrengthM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double cSatipTuner::SignalStrengthDBm(void)
|
||||||
|
{
|
||||||
|
debug16("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||||
|
return signalStrengthDBmM;
|
||||||
|
}
|
||||||
|
|
||||||
int cSatipTuner::SignalQuality(void)
|
int cSatipTuner::SignalQuality(void)
|
||||||
{
|
{
|
||||||
debug16("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
debug16("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||||
|
23
tuner.h
23
tuner.h
@ -77,16 +77,17 @@ class cSatipTuner : public cThread, public cSatipTunerStatistics, public cSatipT
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
enum {
|
enum {
|
||||||
eDummyPid = 100,
|
eDummyPid = 100,
|
||||||
eDefaultSignalStrength = 15,
|
eDefaultSignalStrengthDBm = -25,
|
||||||
eDefaultSignalQuality = 224,
|
eDefaultSignalStrength = 224,
|
||||||
eSleepTimeoutMs = 250, // in milliseconds
|
eDefaultSignalQuality = 15,
|
||||||
eStatusUpdateTimeoutMs = 1000, // in milliseconds
|
eSleepTimeoutMs = 250, // in milliseconds
|
||||||
ePidUpdateIntervalMs = 250, // in milliseconds
|
eStatusUpdateTimeoutMs = 1000, // in milliseconds
|
||||||
eConnectTimeoutMs = 5000, // in milliseconds
|
ePidUpdateIntervalMs = 250, // in milliseconds
|
||||||
eIdleCheckTimeoutMs = 15000, // in milliseconds
|
eConnectTimeoutMs = 5000, // in milliseconds
|
||||||
eTuningTimeoutMs = 20000, // in milliseconds
|
eIdleCheckTimeoutMs = 15000, // in milliseconds
|
||||||
eMinKeepAliveIntervalMs = 30000 // in milliseconds
|
eTuningTimeoutMs = 20000, // in milliseconds
|
||||||
|
eMinKeepAliveIntervalMs = 30000 // in milliseconds
|
||||||
};
|
};
|
||||||
enum eTunerState { tsIdle, tsRelease, tsSet, tsTuned, tsLocked };
|
enum eTunerState { tsIdle, tsRelease, tsSet, tsTuned, tsLocked };
|
||||||
enum eStateMode { smInternal, smExternal };
|
enum eStateMode { smInternal, smExternal };
|
||||||
@ -114,6 +115,7 @@ private:
|
|||||||
cVector<eTunerState> externalStateM;
|
cVector<eTunerState> externalStateM;
|
||||||
int timeoutM;
|
int timeoutM;
|
||||||
bool hasLockM;
|
bool hasLockM;
|
||||||
|
double signalStrengthDBmM;
|
||||||
int signalStrengthM;
|
int signalStrengthM;
|
||||||
int signalQualityM;
|
int signalQualityM;
|
||||||
int frontendIdM;
|
int frontendIdM;
|
||||||
@ -148,6 +150,7 @@ public:
|
|||||||
bool Close(void);
|
bool Close(void);
|
||||||
int FrontendId(void);
|
int FrontendId(void);
|
||||||
int SignalStrength(void);
|
int SignalStrength(void);
|
||||||
|
double SignalStrengthDBm(void);
|
||||||
int SignalQuality(void);
|
int SignalQuality(void);
|
||||||
bool HasLock(void);
|
bool HasLock(void);
|
||||||
cString GetSignalStatus(void);
|
cString GetSignalStatus(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user