1 from Source import Source
2 from enigma import eTimer
4 class FrontendStatus(Source):
5 def __init__(self, service_source = None, frontend_source = None, update_interval = 1000):
7 self.update_interval = update_interval
8 self.service_source = service_source
9 self.frontend_source = frontend_source
11 self.poll_timer = eTimer()
12 self.poll_timer.timeout.get().append(self.updateFrontendStatus)
13 self.poll_timer.start(update_interval)
16 self.snr = self.agc = self.ber = self.lock = self.snr_db = None
18 def updateFrontendStatus(self):
19 status = self.getFrontendStatus()
23 self.snr = status.get("tuner_signal_power")
24 self.snr_db = status.get("tuner_signal_power_db")
25 self.agc = status.get("tuner_signal_quality")
26 self.ber = status.get("tuner_bit_error_rate")
27 self.lock = status.get("tuner_locked")
28 self.changed((self.CHANGED_ALL, ))
30 def getFrontendStatus(self):
31 if self.frontend_source:
32 frontend = self.frontend_source()
35 frontend.getFrontendStatus(dict)
37 elif self.service_source:
38 service = self.service_source()
39 feinfo = service and service.frontendInfo()
40 return feinfo and feinfo.getFrontendStatus()
44 def doSuspend(self, suspended):
46 self.poll_timer.stop()
48 self.poll_timer.start(self.update_interval)