-from enigma import eTimer, eDVBSatelliteEquipmentControl, eDVBResourceManager, eDVBDiseqcCommand, eDVBResourceManagerPtr, iDVBChannelPtr, iDVBFrontendPtr, iDVBFrontend, eDVBFrontendParametersSatellite, eDVBFrontendParameters
+from enigma import eTimer, eDVBResourceManager,\
+ eDVBFrontendParametersSatellite, eDVBFrontendParameters
+
from Screens.Screen import Screen
from Screens.ScanSetup import ScanSetup
from Screens.MessageBox import MessageBox
from Plugins.Plugin import PluginDescriptor
from Components.Label import Label
-from Components.ConfigList import ConfigList
from Components.TunerInfo import TunerInfo
from Components.ActionMap import ActionMap
-from Components.NimManager import nimmanager
+from Components.NimManager import nimmanager, getConfigSatlist
from Components.MenuList import MenuList
-from Components.config import ConfigSelection, ConfigSatlist
+from Components.config import ConfigSelection, getConfigListEntry
class Tuner:
def __init__(self, frontend):
</screen>"""
def openFrontend(self):
- res_mgr = eDVBResourceManagerPtr()
- if eDVBResourceManager.getInstance(res_mgr) == 0:
- self.raw_channel = iDVBChannelPtr()
- if res_mgr.allocateRawChannel(self.raw_channel, self.feid) == 0:
- self.frontend = iDVBFrontendPtr()
- if self.raw_channel.getFrontend(self.frontend) == 0:
+ res_mgr = eDVBResourceManager.getInstance()
+ if res_mgr:
+ self.raw_channel = res_mgr.allocateRawChannel(self.feid)
+ if self.raw_channel:
+ self.frontend = self.raw_channel.getFrontend()
+ if self.frontend:
return True
else:
print "getFrontend failed"
print "getResourceManager instance failed"
return False
- def getFrontend(self):
- return self.frontend
-
def __init__(self, session, feid):
self.initcomplete = False
self.feid = feid
self.oldref = None
+ self.frontendStatus = { }
if not self.openFrontend():
self.oldref = session.nav.getCurrentlyPlayingServiceReference()
del session.pip
if not self.openFrontend():
self.frontend = None # in normal case this should not happen
- self.getFrontend = None
ScanSetup.__init__(self, session)
self.tuner = Tuner(self.frontend)
-
+
self["snr"] = Label()
self["agc"] = Label()
self["ber"] = Label()
self["lock"] = Label()
- self["snr_percentage"] = TunerInfo(TunerInfo.SNR_PERCENTAGE, frontendfkt = self.getFrontend)
- self["agc_percentage"] = TunerInfo(TunerInfo.AGC_PERCENTAGE, frontendfkt = self.getFrontend)
- self["ber_value"] = TunerInfo(TunerInfo.BER_VALUE, frontendfkt = self.getFrontend)
- self["snr_bar"] = TunerInfo(TunerInfo.SNR_BAR, frontendfkt = self.getFrontend)
- self["agc_bar"] = TunerInfo(TunerInfo.AGC_BAR, frontendfkt = self.getFrontend)
- self["ber_bar"] = TunerInfo(TunerInfo.BER_BAR, frontendfkt = self.getFrontend)
- self["lock_state"] = TunerInfo(TunerInfo.LOCK_STATE, frontendfkt = self.getFrontend)
-
- self["introduction"].setText("")
+ self["snr_percentage"] = TunerInfo(TunerInfo.SNR_PERCENTAGE, statusDict = self.frontendStatus)
+ self["agc_percentage"] = TunerInfo(TunerInfo.AGC_PERCENTAGE, statusDict = self.frontendStatus)
+ self["ber_value"] = TunerInfo(TunerInfo.BER_VALUE, statusDict = self.frontendStatus)
+ self["snr_bar"] = TunerInfo(TunerInfo.SNR_BAR, statusDict = self.frontendStatus)
+ self["agc_bar"] = TunerInfo(TunerInfo.AGC_BAR, statusDict = self.frontendStatus)
+ self["ber_bar"] = TunerInfo(TunerInfo.BER_BAR, statusDict = self.frontendStatus)
+ self["lock_state"] = TunerInfo(TunerInfo.LOCK_STATE, statusDict = self.frontendStatus)
+ self["introduction"].setText("")
+
self.statusTimer = eTimer()
self.statusTimer.timeout.get().append(self.updateStatus)
self.statusTimer.start(50, False)
-
self.initcomplete = True
- self.session = session
-
+
def updateStatus(self):
+ if self.frontend:
+ self.frontend.getFrontendStatus(self.frontendStatus)
+ else:
+ self.frontendStatus.clear()
self["snr_percentage"].update()
self["agc_percentage"].update()
self["ber_value"].update()
def createSetup(self):
self.typeOfTuningEntry = None
self.satEntry = None
-
+
self.list = []
self.typeOfTuningEntry = getConfigListEntry(_('Tune'), self.tuning_type)
self.list.append(self.typeOfTuningEntry)
self.satEntry = getConfigListEntry(_('Satellite'), self.tuning_sat)
self.list.append(self.satEntry)
- if currentConfigSelectionElement(self.tuning_type) == "manual_transponder":
+ if self.tuning_type.value == "manual_transponder":
self.list.append(getConfigListEntry(_('Frequency'), self.scan_sat.frequency))
self.list.append(getConfigListEntry(_('Inversion'), self.scan_sat.inversion))
self.list.append(getConfigListEntry(_('Symbol Rate'), self.scan_sat.symbolrate))
self.list.append(getConfigListEntry(_("Polarity"), self.scan_sat.polarization))
self.list.append(getConfigListEntry(_("FEC"), self.scan_sat.fec))
- elif self.tuning_transponder and currentConfigSelectionElement(self.tuning_type) == "predefined_transponder":
+ elif self.tuning_transponder and self.tuning_type.value == "predefined_transponder":
self.list.append(getConfigListEntry(_("Transponder"), self.tuning_transponder))
self["config"].list = self.list
self["config"].l.setList(self.list)
self.updateSats()
self.createSetup()
+ def sat_changed(self, config_element):
+ self.newConfig()
+ self.retune(config_element)
+
def retune(self, configElement):
returnvalue = (0, 0, 0, 0, 0, 0, 0)
- val = self.tuning_sat.orbital_positioon
- if val > 0 and len(self.tuning_sat.vals) > val:
- satpos = self.tuning_sat.vals[self.tuning_sat.value][1]
- elif len(self.tuning_sat.vals) > 0:
- satpos = self.tuning_sat.vals[0][1]
- else:
- satpos = None
- if satpos:
- if currentConfigSelectionElement(self.tuning_type) == "manual_transponder":
- returnvalue = (self.scan_sat.frequency.value[0], self.scan_sat.symbolrate.value[0], self.scan_sat.polarization.value, self.scan_sat.fec.value, self.scan_sat.inversion.value, satpos)
- elif currentConfigSelectionElement(self.tuning_type) == "predefined_transponder":
- transponder = nimmanager.getTransponders(self.tuning_sat.vals[self.tuning_sat.value][1])[self.tuning_transponder.value]
- returnvalue = (int(transponder[1] / 1000), int(transponder[2] / 1000), transponder[3], transponder[4], 2, self.tuning_sat.vals[self.tuning_sat.value][1], satpos)
+ satpos = self.tuning_sat.orbital_position
+
+ if satpos is not None:
+ if self.tuning_type.value == "manual_transponder":
+ returnvalue = (self.scan_sat.frequency.value, self.scan_sat.symbolrate.value, self.scan_sat.polarization.index, self.scan_sat.fec.index, self.scan_sat.inversion.index, satpos)
+ elif self.tuning_type.value == "predefined_transponder":
+ transponder = nimmanager.getTransponders(satpos)[self.tuning_transponder.index]
+ returnvalue = (int(transponder[1] / 1000), int(transponder[2] / 1000), transponder[3], transponder[4], 2, satpos)
self.tune(returnvalue)
def createConfig(self, foo):
-
self.tuning_transponder = None
- self.tuning_type = ConfigSelection(choices = [("manual_transponder", _("Manual transponder")), ("predefined_transponder", _("Predefined satellite"))])
- self.tuning_sat = ConfigSatlist(default = 192, satlist = nimmanager.getSatListForNim(self.feid))
+ self.tuning_type = ConfigSelection(choices = [("manual_transponder", _("Manual transponder")), ("predefined_transponder", _("Predefined transponder"))])
+ self.tuning_sat = getConfigSatlist(192, nimmanager.getSatListForNim(self.feid))
ScanSetup.createConfig(self, None)
self.updateSats()
-
- self.tuning_type.addNotifier(self.retune)
- self.tuning_sat.addNotifier(self.retune)
- self.scan_sat.frequency.addNotifier(self.retune)
- self.scan_sat.inversion.addNotifier(self.retune)
- self.scan_sat.symbolrate.addNotifier(self.retune)
- self.scan_sat.polarization.addNotifier(self.retune)
- self.scan_sat.fec.addNotifier(self.retune)
+
+ self.tuning_type.addNotifier(self.retune, initial_call = False)
+ self.tuning_sat.addNotifier(self.sat_changed, initial_call = False)
+ self.scan_sat.frequency.addNotifier(self.retune, initial_call = False)
+ self.scan_sat.inversion.addNotifier(self.retune, initial_call = False)
+ self.scan_sat.symbolrate.addNotifier(self.retune, initial_call = False)
+ self.scan_sat.polarization.addNotifier(self.retune, initial_call = False)
+ self.scan_sat.fec.addNotifier(self.retune, initial_call = False)
def updateSats(self):
- satnum = self.tuning_sat.value
- satlist = self.tuning_sat.vals
- if len(satlist):
- transponderlist = nimmanager.getTransponders(satlist[satnum][1])
+ orb_pos = self.tuning_sat.orbital_position
+ if orb_pos is not None:
+ transponderlist = nimmanager.getTransponders(orb_pos)
list = []
for x in transponderlist:
if x[3] == 0:
fec = "FEC_None"
list.append(str(x[1]) + "," + str(x[2]) + "," + pol + "," + fec)
self.tuning_transponder = ConfigSelection(choices = list)
- self.tuning_transponder.addNotifier(self.retune)
-
+ self.tuning_transponder.addNotifier(self.retune, initial_call = False)
+
def keyGo(self):
self.retune(self.tuning_type)
- def keyCancel(self):
- if self.oldref:
+ def restartPrevService(self, yesno):
+ if yesno:
if self.frontend:
self.frontend = None
del self.raw_channel
self.session.nav.playService(self.oldref)
self.close(None)
-
+
+ def keyCancel(self):
+ if self.oldref:
+ self.session.openWithCallback(self.restartPrevService, MessageBox, _("Zap back to service before satfinder?"), MessageBox.TYPE_YESNO)
+ else:
+ self.restartPrevService(False)
+
def tune(self, transponder):
if self.initcomplete:
if transponder is not None:
def __init__(self, session):
Screen.__init__(self, session)
- nimlist = nimmanager.getNimListOfType(nimmanager.nimType["DVB-S"])
+ nimlist = nimmanager.getNimListOfType("DVB-S")
nimMenuList = []
for x in nimlist:
- nimMenuList.append((_("NIM ") + (["A", "B", "C", "D"][x]) + ": " + nimmanager.getNimName(x) + " (" + nimmanager.getNimTypeName(x) + ")", x))
-
+ nimMenuList.append((nimmanager.nim_slots[x].friendly_full_description, x))
+
self["nimlist"] = MenuList(nimMenuList)
self["actions"] = ActionMap(["OkCancelActions"],
}, -1)
def okbuttonClick(self):
- selection = self["nimlist"].getCurrent()
- self.session.open(Satfinder, selection[1])
+ selection = self["nimlist"].getCurrent()[1]
+ self.session.open(Satfinder, selection)
def SatfinderMain(session, **kwargs):
- nimList = nimmanager.getNimListOfType(nimmanager.nimType["DVB-S"])
+ nimList = nimmanager.getNimListOfType("DVB-S")
if len(nimList) == 0:
- session.open(MessageBox, _("No positioner capable frontend found."), MessageBox.TYPE_ERROR)
+ session.open(MessageBox, _("No satellite frontend found!!"), MessageBox.TYPE_ERROR)
else:
if session.nav.RecordTimer.isRecording():
- session.open(MessageBox, _("A recording is currently running. Please stop the recording before trying to configure the positioner."), MessageBox.TYPE_ERROR)
+ session.open(MessageBox, _("A recording is currently running. Please stop the recording before trying to start the satfinder."), MessageBox.TYPE_ERROR)
else:
if len(nimList) == 1:
session.open(Satfinder, nimList[0])
- elif len(nimList) > 1:
- session.open(NimSelection)
else:
- session.open(MessageBox, _("No tuner is configured for use with a diseqc positioner!"), MessageBox.TYPE_ERROR)
+ session.open(NimSelection)
+def SatfinderStart(menuid):
+ if menuid == "scan":
+ return [(_("Satfinder"), SatfinderMain)]
+ else:
+ return []
def Plugins(**kwargs):
- return PluginDescriptor(name="Satfinder", description="Helps setting up your dish", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=SatfinderMain)
+ if (nimmanager.hasNimType("DVB-T")):
+ return PluginDescriptor(name=_("Satfinder"), description="Helps setting up your dish", where = PluginDescriptor.WHERE_SETUP, fnc=SatfinderStart)
+ else:
+ return []