1 from Components.Converter.Converter import Converter
2 from Components.Element import cached
4 class FrontendInfo(Converter, object):
11 def __init__(self, type):
12 Converter.__init__(self, type)
18 self.type = self.SNRdB
26 assert self.type != self.LOCK, "the text output of FrontendInfo cannot be used for lock info"
28 if self.type == self.BER: # as count
29 count = self.source.ber
34 elif self.type == self.AGC:
35 percent = self.source.agc
36 elif self.type == self.SNR:
37 percent = self.source.snr
38 elif self.type == self.SNRdB:
39 if self.source.snr_db is not None:
40 return "%3.02f dB" % (self.source.snr_db / 100.0)
41 elif self.source.snr is not None: #fallback to normal SNR...
42 percent = self.source.snr
46 return "%d %%" % (percent * 100 / 65536)
50 assert self.type in [self.LOCK, self.BER], "the boolean output of FrontendInfo can only be used for lock or BER info"
51 if self.type == self.LOCK:
52 return self.source.lock
54 return self.source.ber > 0
56 text = property(getText)
58 boolean = property(getBool)
62 assert self.type != self.LOCK, "the value/range output of FrontendInfo can not be used for lock info"
63 if self.type == self.AGC:
64 return self.source.agc or 0
65 elif self.type == self.SNR:
66 return self.source.snr or 0
67 elif self.type == self.BER:
68 if self.BER < self.range:
74 value = property(getValue)