add cancelenq
[enigma2.git] / lib / dvb_ci / dvbci.cpp
index 82d3349..3ddd9bb 100644 (file)
@@ -116,14 +116,24 @@ int eDVBCIInterfaces::answerText(int slotid, int answer)
        return slot->answerText(answer);
 }
 
-int eDVBCIInterfaces::answerEnq(int slotid, int answer, char *value)
+int eDVBCIInterfaces::answerEnq(int slotid, char *value)
 {
        eDVBCISlot *slot;
 
        if( (slot = getSlot(slotid)) == 0 )
                return -1;
        
-       return slot->answerEnq(answer, value);
+       return slot->answerEnq(value);
+}
+
+int eDVBCIInterfaces::cancelEnq(int slotid)
+{
+       eDVBCISlot *slot;
+
+       if( (slot = getSlot(slotid)) == 0 )
+               return -1;
+       
+       return slot->cancelEnq();
 }
 
 void eDVBCIInterfaces::addPMTHandler(eDVBServicePMTHandler *pmthandler)
@@ -193,6 +203,7 @@ void eDVBCIInterfaces::gotPMT(eDVBServicePMTHandler *pmthandler)
                                *usedby = ci_it;
                                (*usedby)->resetPrevSentCAPMTVersion();
                                break;
+                               
                        }
                }
                if (it->usedby)
@@ -366,9 +377,19 @@ int eDVBCISlot::getMMIState()
        return 0;
 }
 
-int eDVBCISlot::answerEnq(int answer, char *value)
+int eDVBCISlot::answerEnq(char *value)
 {
-       printf("edvbcislot: answerMMI(%d,%s)\n", answer, value);
+       printf("edvbcislot: answerENQ(%s)\n", value);
+       return 0;
+}
+
+int eDVBCISlot::cancelEnq()
+{
+       printf("edvbcislot: cancelENQ\n");
+
+       if(mmi_session)
+               mmi_session->cancelEnq();
+
        return 0;
 }
 
@@ -404,6 +425,7 @@ int eDVBCISlot::sendCAPMT(eDVBServicePMTHandler *pmthandler, const std::vector<u
 #if 1
 // begin calc capmt length
                        int wp=0;
+                       int hlen;
                        if ( raw_data[3] & 0x80 )
                        {
                                int i=0;
@@ -412,11 +434,13 @@ int eDVBCISlot::sendCAPMT(eDVBServicePMTHandler *pmthandler, const std::vector<u
                                        wp |= (raw_data[4+i] << (8 * i++));
                                wp+=4;
                                wp+=lenbytes;
+                               hlen = 4 + lenbytes;
                        }
                        else
                        {
                                wp = raw_data[3];
                                wp+=4;
+                               hlen = 4;
                        }
 // end calc capmt length
                        if (!ca_manager)
@@ -429,7 +453,8 @@ int eDVBCISlot::sendCAPMT(eDVBServicePMTHandler *pmthandler, const std::vector<u
 #endif
                        if (ca_manager)
                        {
-                               // TODO SEND buffer to CI ( add session number, add tag )
+                               //dont need tag and lenfield
+                               ca_manager->sendCAPMT(raw_data + hlen, wp - hlen);
                                prev_sent_capmt_version = pmt_version;
                        }
                }