Pip is now working with CI
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Wed, 21 Jun 2006 00:47:54 +0000 (00:47 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Wed, 21 Jun 2006 00:47:54 +0000 (00:47 +0000)
fixes for more than one CI

lib/dvb/pmt.cpp
lib/dvb_ci/dvbci.cpp
lib/dvb_ci/dvbci_resmgr.cpp
lib/dvb_ci/dvbci_ui.cpp
lib/python/Screens/Ci.py

index 3b7a376f12d6b872aed410c7e08932c15f9deccf..d0119508470a6642f9e81c14b5f5081d9b5b99a3 100644 (file)
@@ -100,8 +100,7 @@ void eDVBServicePMTHandler::PMTready(int error)
                                eDVBCAService::register_service(m_reference, demuxes, m_ca_servicePtr);
                                eDVBCIInterfaces::getInstance()->recheckPMTHandlers();
                        }
                                eDVBCAService::register_service(m_reference, demuxes, m_ca_servicePtr);
                                eDVBCIInterfaces::getInstance()->recheckPMTHandlers();
                        }
-                       else
-                               eDVBCIInterfaces::getInstance()->gotPMT(this);
+                       eDVBCIInterfaces::getInstance()->gotPMT(this);
                }
                if (m_ca_servicePtr)
                {
                }
                if (m_ca_servicePtr)
                {
@@ -449,6 +448,11 @@ int eDVBServicePMTHandler::tune(eServiceReferenceDVB &ref, int use_decode_demux,
                ref.getChannelID(chid);
                res = m_resourceManager->allocateChannel(chid, m_channel);
                eDebug("allocate Channel: res %d", res);
                ref.getChannelID(chid);
                res = m_resourceManager->allocateChannel(chid, m_channel);
                eDebug("allocate Channel: res %d", res);
+
+               ePtr<iDVBChannelList> db;
+               if (!m_resourceManager->getChannelList(db))
+                               db->getService((eServiceReferenceDVB&)m_reference, m_service);
+
                if (!res)
                        eDVBCIInterfaces::getInstance()->addPMTHandler(this);
        } else
                if (!res)
                        eDVBCIInterfaces::getInstance()->addPMTHandler(this);
        } else
@@ -482,10 +486,6 @@ int eDVBServicePMTHandler::tune(eServiceReferenceDVB &ref, int use_decode_demux,
                m_channel = m_pvr_channel;
        }
 
                m_channel = m_pvr_channel;
        }
 
-       ePtr<iDVBChannelList> db;
-       if (!m_resourceManager->getChannelList(db))
-               db->getService((eServiceReferenceDVB&)m_reference, m_service);
-
        if (m_channel)
        {
                m_channel->connectStateChange(
        if (m_channel)
        {
                m_channel->connectStateChange(
index c24ddd2569367cfcaa037ffad59733722905f251..9c4e0ac20893773f01f8a744757b38ca30b16ba9 100644 (file)
@@ -250,9 +250,6 @@ void eDVBCIInterfaces::recheckPMTHandlers()
                {
                        for (eSmartPtrList<eDVBCISlot>::iterator ci_it(m_slots.begin()); ci_it != m_slots.end(); ++ci_it)
                        {
                {
                        for (eSmartPtrList<eDVBCISlot>::iterator ci_it(m_slots.begin()); ci_it != m_slots.end(); ++ci_it)
                        {
-                               if (ci_it->getState() == eDVBCISlot::stateInvalid)
-                                       ci_it->reset();
-
                                bool useThis=false;
                                eDVBCICAManagerSession *ca_manager = ci_it->getCAManager();
                                if (ca_manager)
                                bool useThis=false;
                                eDVBCICAManagerSession *ca_manager = ci_it->getCAManager();
                                if (ca_manager)
@@ -358,12 +355,15 @@ void eDVBCIInterfaces::removePMTHandler(eDVBServicePMTHandler *pmthandler)
                bool sameServiceExist=false;
                for (PMTHandlerList::iterator i=m_pmt_handlers.begin(); i != m_pmt_handlers.end(); ++i)
                {
                bool sameServiceExist=false;
                for (PMTHandlerList::iterator i=m_pmt_handlers.begin(); i != m_pmt_handlers.end(); ++i)
                {
-                       eServiceReferenceDVB ref;
-                       i->pmthandler->getServiceReference(ref);
-                       if ( ref == service_to_remove )
+                       if (i->cislot)
                        {
                        {
-                               sameServiceExist=true;
-                               break;
+                               eServiceReferenceDVB ref;
+                               i->pmthandler->getServiceReference(ref);
+                               if ( ref == service_to_remove )
+                               {
+                                       sameServiceExist=true;
+                                       break;
+                               }
                        }
                }
 
                        }
                }
 
index 69ff611c8605f57c1fb95ad5f1d9c66f3d154903..e9e4bd1b12b394d10323df4d6e9ae0194d76581a 100644 (file)
@@ -71,10 +71,10 @@ int eDVBCIResourceManagerSession::doAction()
                                {0x00, 0x01, 0x00, 0x41},
                                {0x00, 0x02, 0x00, 0x41},
                                {0x00, 0x03, 0x00, 0x41},
                                {0x00, 0x01, 0x00, 0x41},
                                {0x00, 0x02, 0x00, 0x41},
                                {0x00, 0x03, 0x00, 0x41},
-                               {0x00, 0x20, 0x00, 0x41},
+//                             {0x00, 0x20, 0x00, 0x41}, // host control
                                {0x00, 0x24, 0x00, 0x41},
                                {0x00, 0x40, 0x00, 0x41},
                                {0x00, 0x24, 0x00, 0x41},
                                {0x00, 0x40, 0x00, 0x41},
-                               {0x00, 0x10, 0x00, 0x41}, // auth.
+//                             {0x00, 0x10, 0x00, 0x41}, // auth.
                        };
                sendAPDU(tag, data, sizeof(data));
                state=stateFinal;
                        };
                sendAPDU(tag, data, sizeof(data));
                state=stateFinal;
index 56ca25fcc84594f53f991fe5ea9a1cdda86889de..ce9aac1f83ca995e8d5544070082dcec5066a903 100644 (file)
@@ -22,7 +22,7 @@ eDVBCI_UI::eDVBCI_UI()
                slotdata[i].mmiScreen=NULL;
                slotdata[i].mmiScreenReady=0;
                slotdata[i].mmiTuplePos=0;
                slotdata[i].mmiScreen=NULL;
                slotdata[i].mmiScreenReady=0;
                slotdata[i].mmiTuplePos=0;
-               slotdata[i].state=0;
+               slotdata[i].state=-1;
        }
 }
 
        }
 }
 
@@ -43,11 +43,7 @@ eDVBCI_UI *eDVBCI_UI::getInstance()
 int eDVBCI_UI::getState(int slot)
 {
        if (slot < MAX_SLOTS)
 int eDVBCI_UI::getState(int slot)
 {
        if (slot < MAX_SLOTS)
-       {
-               if (eDVBCIInterfaces::getInstance()->getSlotState(slot) == eDVBCISlot::stateInvalid)
-                       eDVBCIInterfaces::getInstance()->reset(slot);
                return slotdata[slot].state;
                return slotdata[slot].state;
-       }
        return 0;
 }
 
        return 0;
 }
 
index cf9efd102671142708486201ae90b4434c57097f..b3653d214c2a5a95f620bdacd4bf3e7ed375667a 100644 (file)
@@ -273,19 +273,22 @@ class CiSelection(Screen):
                self.dlg = None
                self.state = { }
                self.list = [ ]
                self.dlg = None
                self.state = { }
                self.list = [ ]
-               self["entries"] = MenuList(list)
-               self.clearMenu()
-               self.createMenu(0) # FIXME more than one CI
-               CiHandler.registerCIMessageHandler(0, self.ciStateChanged)
 
 
-       def clearMenu(self):
-               self.list = [ ]
+               for slot in range(4):
+                       state = eDVBCI_UI.getInstance().getState(slot)
+                       self.appendEntries(slot, state) # FIXME more than one CI
+                       CiHandler.registerCIMessageHandler(slot, self.ciStateChanged)
+
+               menuList = MenuList(list)
+               menuList.list = self.list
+               menuList.l.setList(self.list)
+               self["entries"] = menuList
 
 
-       def createMenu(self, slot):
+       def appendEntries(self, slot, state):
+               self.state[slot] = state
                self.list.append( (_("Reset"), 0, slot) )
                self.list.append( (_("Init"), 1, slot) )
 
                self.list.append( (_("Reset"), 0, slot) )
                self.list.append( (_("Init"), 1, slot) )
 
-               self.state[slot] = eDVBCI_UI.getInstance().getState(slot)
                if self.state[slot] == 0:                       #no module
                        self.list.append( (_("no module found"), 2, slot) )
                elif self.state[slot] == 1:             #module in init
                if self.state[slot] == 0:                       #no module
                        self.list.append( (_("no module found"), 2, slot) )
                elif self.state[slot] == 1:             #module in init
@@ -295,8 +298,29 @@ class CiSelection(Screen):
                        appname = eDVBCI_UI.getInstance().getAppName(slot)
                        self.list.append( (appname, 2, slot) )
 
                        appname = eDVBCI_UI.getInstance().getAppName(slot)
                        self.list.append( (appname, 2, slot) )
 
-               self["entries"].list = self.list
-               self["entries"].l.setList(self.list)
+       def updateState(self, slot):
+               state = eDVBCI_UI.getInstance().getState(slot)
+               self.state[slot] = state
+
+               slotidx=0
+               while self.list[slotidx][2] != slot:
+                       slotidx += 1
+
+               slotidx += 1 # do not change Reset
+               slotidx += 1 # do not change Init
+
+               if state == 0:                  #no module
+                       self.list[slotidx] = (_("no module found"), 2, slot)
+               elif state == 1:                #module in init
+                       self.list[slotidx] = (_("init module"), 2, slot)
+               elif state == 2:                #module ready
+                       #get appname
+                       appname = eDVBCI_UI.getInstance().getAppName(slot)
+                       self.list[slotidx] = (appname, 2, slot)
+
+               lst = self["entries"]
+               lst.list = self.list
+               lst.l.setList(self.list)
 
        def ciStateChanged(self, slot):
                if self.dlg:
 
        def ciStateChanged(self, slot):
                if self.dlg:
@@ -306,8 +330,7 @@ class CiSelection(Screen):
                        if self.state[slot] != state:
                                #print "something happens"
                                self.state[slot] = state
                        if self.state[slot] != state:
                                #print "something happens"
                                self.state[slot] = state
-                               self.clearMenu()
-                               self.createMenu(slot)
+                               self.updateState(slot)
 
        def dlgClosed(self, slot):
                self.dlg = None
 
        def dlgClosed(self, slot):
                self.dlg = None
@@ -324,13 +347,6 @@ class CiSelection(Screen):
                        elif self.state[slot] == 2:
                                self.dlg = self.session.openWithCallback(self.dlgClosed, CiMmi, slot, action)
 
                        elif self.state[slot] == 2:
                                self.dlg = self.session.openWithCallback(self.dlgClosed, CiMmi, slot, action)
 
-               #generate menu / list
-               #list = [ ]
-               #list.append( ("TEXT", "CA-Info") )
-               #list.append( ("TEXT", "Card Status") )
-               #list.append( ("PIN", 6, "Card Pin", 1) )
-               #self.session.open(CiMmi, 0, 0, "Wichtiges CI", "Mainmenu", "Footer", list)
-
        def cancel(self):
                CiHandler.unregisterCIMessageHandler(0)
                self.close()
        def cancel(self):
                CiHandler.unregisterCIMessageHandler(0)
                self.close()