diff options
| author | Ronny Strutz <ronny.strutz@multimedia-labs.de> | 2005-10-05 00:41:38 +0000 |
|---|---|---|
| committer | Ronny Strutz <ronny.strutz@multimedia-labs.de> | 2005-10-05 00:41:38 +0000 |
| commit | 90f0e14ac98cbbe2933338a5cda5b9aab6839888 (patch) | |
| tree | 175e32152ad1feb8c7a7922c573aeb43f2b8a2b3 /lib/python/Components/NimManager.py | |
| parent | 6af93b5c3368c99e489b272a7b18ca16ae320482 (diff) | |
| download | enigma2-90f0e14ac98cbbe2933338a5cda5b9aab6839888.tar.gz enigma2-90f0e14ac98cbbe2933338a5cda5b9aab6839888.zip | |
nimmanager add
Diffstat (limited to 'lib/python/Components/NimManager.py')
| -rw-r--r-- | lib/python/Components/NimManager.py | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py new file mode 100644 index 00000000..62b1fd8d --- /dev/null +++ b/lib/python/Components/NimManager.py @@ -0,0 +1,96 @@ +from config import config #global config instance + +from config import configElement +from config import ConfigSubsection +from config import ConfigSlider +from config import configSelection + +class nimSlot: + def __init__(self, slotid, nimtype, name): + self.slotid = slotid + self.nimType = nimtype + self.name = name + +class NimManager: + def getNimType(self, slotID): + #FIXME get it from /proc + if slotID == 0: + return self.nimType["DVB-S"] + else: + return self.nimType["empty/unknown"] + + def getNimName(self, slotID): + #FIXME get it from /proc + return "Alps BSBE1" + + def getNimSocketCount(self): + #FIXME get it from /proc + return 2 + + def getConfigPrefix(self, slotid): + return "config.Nim" + ("A","B","C","D")[slotid] + "." + + def __init__(self): + #use as enum + self.nimType = { "empty/unknown": -1, + "DVB-S": 0, + "DVB-C": 1, + "DVB-T": 2} + + self.nimCount = self.getNimSocketCount() + + self.nimslots = [ ] + x = 0 + while x < self.nimCount: + tType = self.getNimType(x) + tName = self.getNimName(x) + tNim = nimSlot(x, tType, tName) + self.nimslots.append(tNim) + x += 1 + + InitNimManager(self) #init config stuff + + def nimList(self): + list = [ ] + for slot in self.nimslots: + nimText = "Socket " + ("A", "B", "C", "D")[slot.slotid] + ": " + if slot.nimType == -1: + nimText += "empty/unknown" + else: + nimText += slot.name + " (" + nimText += ("DVB-S", "DVB-C", "DVB-T")[slot.nimType] + ")" + list.append((nimText, slot)) + return list + +def InitNimManager(nimmgr): + config.Nims = [ConfigSubsection()] * nimmgr.nimCount + + for slot in nimmgr.nimslots: + x = slot.slotid + cname = nimmgr.getConfigPrefix(x) + + if slot.nimType == nimmgr.nimType["DVB-S"]: + config.Nims[x].configMode = configElement(cname + "configMode",configSelection, 0, ("Simple", "Advanced")); + config.Nims[x].diseqcMode = configElement(cname + "diseqcMode",configSelection, 0, ("Single", "Toneburst A/B", "DiSEqC A/B")); + config.Nims[x].diseqcMode = configElement(cname + "toneburstA",configSelection, 0, ("Astra", "Hotbird")); + config.Nims[x].diseqcMode = configElement(cname + "toneburstB",configSelection, 0, ("Astra", "Hotbird")); + config.Nims[x].diseqcMode = configElement(cname + "diseqcA",configSelection, 0, ("Astra", "Hotbird")); + config.Nims[x].diseqcMode = configElement(cname + "diseqcB",configSelection, 0, ("Astra", "Hotbird")); + config.Nims[x].diseqcMode = configElement(cname + "diseqcC",configSelection, 0, ("Astra", "Hotbird")); + config.Nims[x].diseqcMode = configElement(cname + "diseqcD",configSelection, 0, ("Astra", "Hotbird")); + else: + print "pls add support for this frontend type!" + + #def nimConfig + + #def inputDevicesRepeatChanged(configElement): + # iDevices.setRepeat(configElement.value); + + #def inputDevicesDelayChanged(configElement): + # iDevices.setDelay(configElement.value); + + # this will call the "setup-val" initial + #config.inputDevices.repeat.addNotifier(inputDevicesRepeatChanged); + #config.inputDevices.delay.addNotifier(inputDevicesDelayChanged); + +nimmanager = NimManager() |
