Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] displaying the signal level and the snr



Hi, I've made a little modification to VDR to display the signal 
strength and the snr on the osd whenever you press ok or you change 
channel; it also puts the values in the syslog.

I put this in dvbapi.c:

int cDvbApi::GetSignalStrength()
{
   int signalStrength;
   ioctl(fd_frontend, FE_READ_SIGNAL_STRENGTH, &signalStrength);
   return signalStrength;
}

int cDvbApi::GetSignalNoiseRatio()
{
   int snr;
   ioctl(fd_frontend, FE_READ_SNR, &snr);
   return snr;
}

in dvbapi.h, inside the class cDvbApi as public functions:

public:
   int GetSignalStrength();
   int GetSignalNoiseRatio();

then, in config.c, inside the cChannel::Switch function:

for (int i = 3; i--;)
{
   switch (DvbApi->SetChannel(number, frequency, polarization, diseqc, 
srate, vpid, apid1, apid2, dpid1, dpid2, tpid, ca, pnr))
   {
     case scrOk:
       isyslog(LOG_INFO, "Signal Strength: %ddBm, SNR: %ddB.", 
DvbApi->GetSignalStrength(), DvbApi->GetSignalNoiseRatio());
       return true;

....


and the last modification in menu.c, in the function 
cDisplayChannel::DisplayChannel, at the end:

   const char *date = DayDateTime();
   cDvbApi *DvbApi = cDvbApi::PrimaryDvbApi;
   int signalStrength = DvbApi->GetSignalStrength();
   float snr = DvbApi->GetSignalNoiseRatio()/1000000;
   snprintf(buffer, BufSize, "SS:%ddBm SNR:%2.1fdB %s", signalStrength, 
snr, date
);
   Interface->Write(-strlen(buffer), 0, buffer);


sorry if I didn't made a patch but:
1) I've never used diff eheheheh
2) I also made other hacks and applied patches (AIO etc etc) so it would 
have been confusing (at least for me!)


what do you think?

ciao
as











Home | Main Index | Thread Index