implement often wished feature :)
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Wed, 7 Dec 2005 23:57:57 +0000 (23:57 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Wed, 7 Dec 2005 23:57:57 +0000 (23:57 +0000)
displaying snr, agc and ber in the infobar

lib/python/Components/ProgressBar.py
lib/python/Screens/InfoBar.py
lib/python/Screens/InfoBarGenerics.py

index 68824d5a1cb460319fe7afda9f6cb2218b06092f..00b1bbe3c94b314246b8f80bc97ed5009c8f15a7 100644 (file)
@@ -11,7 +11,15 @@ class ProgressBar(HTMLComponent, GUIComponent, VariableValue):
                VariableValue.__init__(self)
 
        def createWidget(self, parent):
                VariableValue.__init__(self)
 
        def createWidget(self, parent):
-               g = eSlider(parent)
-               g.setRange(0, 100)
-               return g
-       
+               self.g = eSlider(parent)
+               self.g.setRange(0, 100)
+               return self.g
+
+       def setRange(self, start, end):
+               self.g.setRange(start, end)
+
+       def setValue(self, value):
+               self.g.setValue(value)
+
+
+
index cee385c1a3be8332e6bc371e47383887a8124103..a48cb75c6ec3b9ba3f07717aefc71b5a7d4698cb 100644 (file)
@@ -13,7 +13,7 @@ from Screens.InfoBarGenerics import InfoBarVolumeControl, InfoBarShowHide, \
        InfoBarPowerKey, InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, \
        InfoBarEPG, InfoBarEvent, InfoBarServiceName, InfoBarPVR, InfoBarInstantRecord, \
        InfoBarAudioSelection, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, \
        InfoBarPowerKey, InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, \
        InfoBarEPG, InfoBarEvent, InfoBarServiceName, InfoBarPVR, InfoBarInstantRecord, \
        InfoBarAudioSelection, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, \
-       InfoBarSubserviceSelection
+       InfoBarSubserviceSelection, InfoBarTuner
 
 from Screens.HelpMenu import HelpableScreen, HelpMenu
 
 
 from Screens.HelpMenu import HelpableScreen, HelpMenu
 
@@ -25,7 +25,7 @@ class InfoBar(Screen, InfoBarVolumeControl, InfoBarShowHide, InfoBarPowerKey,
        InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG,
        InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord, InfoBarAudioSelection, 
        HelpableScreen, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish,
        InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG,
        InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord, InfoBarAudioSelection, 
        HelpableScreen, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish,
-       InfoBarSubserviceSelection):
+       InfoBarSubserviceSelection, InfoBarTuner):
 
        def __init__(self, session):
                Screen.__init__(self, session)
 
        def __init__(self, session):
                Screen.__init__(self, session)
@@ -39,7 +39,7 @@ class InfoBar(Screen, InfoBarVolumeControl, InfoBarShowHide, InfoBarPowerKey,
                                InfoBarVolumeControl, InfoBarShowHide, InfoBarPowerKey, \
                                InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, \
                                InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord, InfoBarAudioSelection, \
                                InfoBarVolumeControl, InfoBarShowHide, InfoBarPowerKey, \
                                InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, \
                                InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord, InfoBarAudioSelection, \
-                               InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, InfoBarSubserviceSelection:
+                               InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, InfoBarSubserviceSelection, InfoBarTuner:
                        x.__init__(self)
 
                self.helpList.append((self["actions"], "InfobarActions", [("showMovies", "Watch a Movie...")]))
                        x.__init__(self)
 
                self.helpList.append((self["actions"], "InfobarActions", [("showMovies", "Watch a Movie...")]))
index 1b080d9bbc4bfcbc4cfdd24c1621899936ae2d1e..fc3f011cade56845164f40962af3cc74b2c2309c 100644 (file)
@@ -2,6 +2,7 @@ from Screen import Screen
 from Components.ActionMap import ActionMap, HelpableActionMap
 from Components.ActionMap import NumberActionMap
 from Components.Label import *
 from Components.ActionMap import ActionMap, HelpableActionMap
 from Components.ActionMap import NumberActionMap
 from Components.Label import *
+from Components.ProgressBar import *
 from Components.config import configfile, configsequencearg
 from Components.config import config, configElement, ConfigSubsection, configSequence
 from ChannelSelection import ChannelSelection
 from Components.config import configfile, configsequencearg
 from Components.config import config, configElement, ConfigSubsection, configSequence
 from ChannelSelection import ChannelSelection
@@ -383,6 +384,48 @@ class InfoBarEPG:
                        self.epglist[1]=tmp
                        setEvent(self.epglist[0])
 
                        self.epglist[1]=tmp
                        setEvent(self.epglist[0])
 
+from math import log
+
+class InfoBarTuner:
+       """provides a snr/agc/ber display"""
+       def __init__(self):
+               self["snr"] = Label()
+               self["agc"] = Label()
+               self["ber"] = Label()
+               self["snr_percent"] = Label()
+               self["agc_percent"] = Label()
+               self["ber_count"] = Label()
+               self["snr_progress"] = ProgressBar()
+               self["agc_progress"] = ProgressBar()
+               self["ber_progress"] = ProgressBar()
+               self.timer = eTimer()
+               self.timer.timeout.get().append(self.updateTunerInfo)
+               self.timer.start(500)
+
+       def log2(self,val):
+               if not val:
+                       return 0
+               return (long)(log(val)/log(2))
+
+       def updateTunerInfo(self):
+               if self.instance.isVisible():
+                       service = self.session.nav.getCurrentService()
+                       snr=0
+                       agc=0
+                       ber=0
+                       if service is not None:
+                               feinfo = service.frontendStatusInfo()
+                               if feinfo is not None:
+                                       ber=feinfo.getFrontendInfo(iFrontendStatusInformation.bitErrorRate)
+                                       snr=feinfo.getFrontendInfo(iFrontendStatusInformation.signalPower)*100/65536
+                                       agc=feinfo.getFrontendInfo(iFrontendStatusInformation.signalQuality)*100/65536
+                       self["snr_percent"].setText("%d%%"%(snr))
+                       self["agc_percent"].setText("%d%%"%(agc))
+                       self["ber_count"].setText("%d"%(ber))
+                       self["snr_progress"].setValue(snr)
+                       self["agc_progress"].setValue(agc)
+                       self["ber_progress"].setValue(self.log2(ber))
+
 class InfoBarEvent:
        """provides a current/next event info display"""
        def __init__(self):
 class InfoBarEvent:
        """provides a current/next event info display"""
        def __init__(self):