add ability to choose "Multiple service support (auto/no/yes)" in Ci Setup
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Wed, 19 Jul 2006 18:19:48 +0000 (18:19 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Wed, 19 Jul 2006 18:19:48 +0000 (18:19 +0000)
data/keymap.xml
data/skin_default.xml
lib/dvb_ci/dvbci.cpp
lib/python/Screens/Ci.py
mytest.py
po/de.po
po/enigma2.pot

index 3839715..bf5e424 100644 (file)
                <key id="KEY_ENTER" mapto="showMenu" flags="m" />
        </map>
        
+       <map context="CiSelectionActions">
+               <key id="KEY_LEFT" mapto="left" flags="mr" />
+               <key id="KEY_RIGHT" mapto="right" flags="mr" />
+       </map>
+
        <map context="PiPSetupActions">
                <key id="KEY_UP" mapto="up" flags="mr" />
                <key id="KEY_DOWN" mapto="down" flags="mr" />
index 9bb9e86..041fb5c 100644 (file)
@@ -92,8 +92,8 @@
        <screen name="CiWait" position="180,263" size="360,50" title="Common Interface">
                <widget name="message" position="20,10" size="320,25" font="Regular;23" />
        </screen>
-       <screen name="CiSelection" position="180,238" size="360,100" title="Common Interface">
-               <widget name="entries" position="10,10" size="340,75" />
+       <screen name="CiSelection" position="140,226" size="440,125" title="Common Interface">
+               <widget name="entries" position="10,10" size="420,100" />
        </screen>
        <screen name="CiMmi" position="135,153" size="450,270">
                <widget name="title" position="10,10" size="430,25" font="Regular;23" />
index 9c4e0ac..f646262 100644 (file)
@@ -6,6 +6,7 @@
 #include <lib/base/ebase.h>
 
 #include <lib/base/eerror.h>
+#include <lib/base/nconfig.h> // access to python config
 #include <lib/dvb/pmt.h>
 #include <lib/dvb_ci/dvbci.h>
 #include <lib/dvb_ci/dvbci_session.h>
@@ -217,6 +218,24 @@ void eDVBCIInterfaces::ciRemoved(eDVBCISlot *slot)
        }
 }
 
+static bool canDescrambleMultipleServices(int slotid)
+{
+       char configStr[255];
+       snprintf(configStr, 255, "config.ci%d.canDescrambleMultipleServices", slotid);
+       std::string str;
+       ePythonConfigQuery::getConfigValue(configStr, str);
+       eDebug("str is %s", str.empty()?"empty" : str.c_str());
+       if ( str == "auto" )
+       {
+               std::string appname = eDVBCI_UI::getInstance()->getAppName(slotid);
+               if (appname.find("AlphaCrypt") != std::string::npos)
+                       return true;
+       }
+       else if (str == "yes")
+               return true;
+       return false;
+}
+
 void eDVBCIInterfaces::recheckPMTHandlers()
 {
 //     eDebug("recheckPMTHAndlers()");
@@ -278,7 +297,6 @@ void eDVBCIInterfaces::recheckPMTHandlers()
                                                {
                                                        if ( tmp->cislot )
                                                        {
-                                                               bool canHandleMultipleServices=false;
                                                                eServiceReferenceDVB ref2;
                                                                tmp->pmthandler->getServiceReference(ref2);
                                                                eDVBChannelID s1, s2;
@@ -286,15 +304,8 @@ void eDVBCIInterfaces::recheckPMTHandlers()
                                                                {
                                                                        ref.getChannelID(s1);
                                                                        ref2.getChannelID(s2);
-                                                                       // FIXME .. build a "ci can handle multiple services" config entry
-                                                                       // Yes / No / Auto
-                                                                       if ( eDVBCI_UI::getInstance()->getAppName(ci_it->getSlotID()) == "AlphaCrypt" )
-                                                                       {
-                                                                               canHandleMultipleServices = true;
-                                                                               eDebug("Alphacrypt can handle multiple services");
-                                                                       }
                                                                }
-                                                               if (ref == ref2 || (s1 == s2 && canHandleMultipleServices) )
+                                                               if (ref == ref2 || (s1 == s2 && canDescrambleMultipleServices(ci_it->getSlotID())))
                                                                {
                                                                        it->cislot = tmp->cislot;
                                                                        ++it->cislot->use_count;
index b3653d2..b516ec7 100644 (file)
@@ -15,6 +15,13 @@ from enigma import eTimer, eDVBCI_UI, eListboxPythonStringContent, eListboxPytho
 
 TYPE_MENU = 0
 TYPE_CONFIG = 1
+MAX_NUM_CI = 4
+
+def InitCiConfig():
+       config.ci = [ ]
+       for slot in range(MAX_NUM_CI):
+               config.ci.append(ConfigSubsection())
+               config.ci[slot].canDescrambleMultipleServices = configElement("config.ci%d.canDescrambleMultipleServices"%(slot), configSelection, 0, (("auto", _("Auto")), ("no", _("No")), ("yes", _("Yes"))))
 
 class CiMmi(Screen):
        def __init__(self, session, slotid, action):
@@ -264,26 +271,42 @@ class CiSelection(Screen):
        def __init__(self, session):
                Screen.__init__(self, session)
 
-               self["actions"] = ActionMap(["OkCancelActions"],
+               self["actions"] = ActionMap(["OkCancelActions", "CiSelectionActions"],
                        {
+                               "left": self.keyLeft,
+                               "right": self.keyLeft,
                                "ok": self.okbuttonClick,
                                "cancel": self.cancel
-                       })
+                       },-1)
 
                self.dlg = None
                self.state = { }
                self.list = [ ]
 
-               for slot in range(4):
+               for slot in range(MAX_NUM_CI):
                        state = eDVBCI_UI.getInstance().getState(slot)
-                       self.appendEntries(slot, state) # FIXME more than one CI
-                       CiHandler.registerCIMessageHandler(slot, self.ciStateChanged)
+                       if state != -1:
+                               self.appendEntries(slot, state)
+                               CiHandler.registerCIMessageHandler(slot, self.ciStateChanged)
 
-               menuList = MenuList(list)
+               menuList = ConfigList(list)
                menuList.list = self.list
                menuList.l.setList(self.list)
                self["entries"] = menuList
 
+       def keyConfigEntry(self, key):
+               try:
+                       self["entries"].handleKey(key)
+                       self["entries"].getCurrent()[1].save()
+               except:
+                       pass
+
+       def keyLeft(self):
+               self.keyConfigEntry(config.key["prevElement"])
+
+       def keyRight(self):
+               self.keyConfigEntry(config.key["nextElement"])
+
        def appendEntries(self, slot, state):
                self.state[slot] = state
                self.list.append( (_("Reset"), 0, slot) )
@@ -298,6 +321,8 @@ class CiSelection(Screen):
                        appname = eDVBCI_UI.getInstance().getAppName(slot)
                        self.list.append( (appname, 2, slot) )
 
+               self.list.append(getConfigListEntry(_("Multiple service support"), config.ci[slot].canDescrambleMultipleServices))
+
        def updateState(self, slot):
                state = eDVBCI_UI.getInstance().getState(slot)
                self.state[slot] = state
@@ -337,7 +362,7 @@ class CiSelection(Screen):
 
        def okbuttonClick(self):
                cur = self["entries"].getCurrent()
-               if cur:
+               if cur and len(cur) > 2:
                        action = cur[1]
                        slot = cur[2]
                        if action == 0:         #reset
index db720a6..aa63567 100644 (file)
--- a/mytest.py
+++ b/mytest.py
@@ -484,6 +484,9 @@ Components.RFmod.InitRFmod()
 
 import Components.NimManager
 
+import Screens.Ci
+Screens.Ci.InitCiConfig()
+
 # first, setup a screen
 try:
        runScreenTest()
index 7ae25b4..dd7ac55 100644 (file)
--- a/po/de.po
+++ b/po/de.po
@@ -783,6 +783,10 @@ msgstr "Filmauswahl"
 msgid "Multi EPG"
 msgstr "Multi-EPG"
 
+#: ../lib/python/Screens/Ci.py:324
+msgid "Multiple service support"
+msgstr "Kann mehrere Sender entschl├╝sseln"
+
 #: ../lib/python/Screens/ScanSetup.py:352
 msgid "Multisat"
 msgstr "Multisat"
index 5dd5a15..652e73d 100644 (file)
@@ -756,6 +756,10 @@ msgstr ""
 msgid "Multi EPG"
 msgstr ""
 
+#: ../lib/python/Screens/Ci.py:324
+msgid "Multiple service support"
+msgstr ""
+
 #: ../lib/python/Screens/ScanSetup.py:352
 msgid "Multisat"
 msgstr ""