fix for old api
[enigma2.git] / lib / dvb_ci / dvbci.cpp
index 9a551df0e5ddfa81ab16e59ba7d083cb3b33c106..c3f91482ba852ab47e8d54b41cea5428671016ca 100644 (file)
@@ -73,6 +73,8 @@ int eDVBCIInterfaces::reset(int slotid)
        if( (slot = getSlot(slotid)) == 0 )
                return -1;
 
+       eDVBCISession::deleteSessions(slot);
+
        return slot->reset();
 }
 
@@ -83,22 +85,32 @@ int eDVBCIInterfaces::enableTS(int slotid, int enable)
        if( (slot = getSlot(slotid)) == 0 )
                return -1;
 
-       if (enable)
+       return slot->enableTS(enable);
+}
+
+int eDVBCIInterfaces::initialize(int slotid)
+{
+       eDVBCISlot *slot;
+
+       if( (slot = getSlot(slotid)) == 0 )
+               return -1;
+
+       slot->resetPrevSentCAPMTVersion();
+       PMTHandlerList::iterator it = m_pmt_handlers.begin();
+       while (it != m_pmt_handlers.end())
        {
-               slot->resetPrevSentCAPMTVersion();
-               PMTHandlerList::iterator it = m_pmt_handlers.begin();
-               while (it != m_pmt_handlers.end())
+               if ( it->cislot == slot )
                {
-                       if ( it->cislot == slot )
-                               slot->sendCAPMT(it->pmthandler);  // send capmt
-                       ++it;
+                       slot->sendCAPMT(it->pmthandler);  // send capmt
+                       break;
                }
+               ++it;
        }
 
-       return slot->enableTS(enable);
+       return slot->initialize();
 }
 
-int eDVBCIInterfaces::initialize(int slotid)
+int eDVBCIInterfaces::sendCAPMT(int slotid)
 {
        eDVBCISlot *slot;
 
@@ -110,11 +122,14 @@ int eDVBCIInterfaces::initialize(int slotid)
        while (it != m_pmt_handlers.end())
        {
                if ( it->cislot == slot )
+               {
                        slot->sendCAPMT(it->pmthandler);  // send capmt
+                       return 0;
+               }
                ++it;
        }
 
-       return slot->initialize();
+       return -1;
 }
 
 int eDVBCIInterfaces::startMMI(int slotid)
@@ -213,7 +228,7 @@ void eDVBCIInterfaces::removePMTHandler(eDVBServicePMTHandler *pmthandler)
        if (it != m_pmt_handlers.end())
        {
                eDVBCISlot *slot = it->cislot;
-               eDVBServicePMTHandler *pmthandler = it->pmthandler;
+//             eDVBServicePMTHandler *pmthandler = it->pmthandler;
                m_pmt_handlers.erase(it);
                if (slot && !--slot->use_count)
                {
@@ -286,6 +301,7 @@ void eDVBCISlot::data(int what)
                        state = stateRemoved;
                        enableTS(0);
                        printf("ci removed\n");
+                       eDVBCISession::deleteSessions(this);
                        notifier->setRequested(eSocketNotifier::Read);
                        //HACK
                        eDVBCI_UI::getInstance()->setState(0,0);
@@ -362,6 +378,21 @@ eDVBCISlot::~eDVBCISlot()
        enableTS(0);
 }
 
+void eDVBCISlot::setAppManager( eDVBCIApplicationManagerSession *session )
+{
+       application_manager=session;
+}
+
+void eDVBCISlot::setMMIManager( eDVBCIMMISession *session )
+{
+       mmi_session = session;
+}
+
+void eDVBCISlot::setCAManager( eDVBCICAManagerSession *session )
+{
+       ca_manager = session;
+}
+
 int eDVBCISlot::getSlotID()
 {
        return slotid;
@@ -445,7 +476,7 @@ int eDVBCISlot::sendCAPMT(eDVBServicePMTHandler *pmthandler, const std::vector<u
                eDebug("no ca_manager (no CI plugged?)");
                return -1;
        }
-       const std::vector<uint16_t> &caids = ids.empty() && ca_manager ? ca_manager->getCAIDs() : ids;
+       const std::vector<uint16_t> &caids = ids.empty() ? ca_manager->getCAIDs() : ids;
        ePtr<eTable<ProgramMapSection> > ptr;
        if (pmthandler->getPMT(ptr))
                return -1;
@@ -503,7 +534,7 @@ int eDVBCISlot::sendCAPMT(eDVBServicePMTHandler *pmthandler, const std::vector<u
                        prev_sent_capmt_version = pmt_version;
                }
        }
-       
+       return 0;
 }
 
 int eDVBCISlot::enableTS(int enable)
@@ -523,5 +554,9 @@ int eDVBCISlot::enableTS(int enable)
        return 0;
 }
 
+void eDVBCISlot::resendCAPMT()
+{
+       eDVBCIInterfaces::getInstance()->sendCAPMT(slotid);
+}
 
 eAutoInitP0<eDVBCIInterfaces> init_eDVBCIInterfaces(eAutoInitNumbers::dvb, "CI Slots");