fix for canAllocateChannel
[enigma2.git] / lib / dvb_ci / dvbci_appmgr.cpp
index 4c468a8..f5231fc 100644 (file)
@@ -1,6 +1,18 @@
 /* DVB CI Application Manager */
 
 #include <lib/dvb_ci/dvbci_appmgr.h>
+#include <lib/dvb_ci/dvbci_ui.h>
+
+eDVBCIApplicationManagerSession::eDVBCIApplicationManagerSession(eDVBCISlot *tslot)
+{
+       slot = tslot;
+       slot->setAppManager(this);
+}
+
+eDVBCIApplicationManagerSession::~eDVBCIApplicationManagerSession()
+{
+       slot->setAppManager(NULL);
+}
 
 int eDVBCIApplicationManagerSession::receivedAPDU(const unsigned char *tag,const void *data, int len)
 {
@@ -28,9 +40,15 @@ int eDVBCIApplicationManagerSession::receivedAPDU(const unsigned char *tag,const
                                printf("warning, invalid length (%d vs %d)\n", dl+6, len);
                                dl=len-6;
                        }
+                       char str[dl + 1];
+                       memcpy(str, ((char*)data) + 6, dl);
+                       str[dl] = '\0';
                        for (int i = 0; i < dl; ++i)
                                printf("%c", ((unsigned char*)data)[i+6]);
                        printf("\n");
+                       
+                       eDVBCI_UI::getInstance()->setState(0,2);
+                       eDVBCI_UI::getInstance()->setAppName(0,str);
                        break;
                }
                default:
@@ -68,3 +86,11 @@ int eDVBCIApplicationManagerSession::doAction()
     return 0;
   }
 }
+
+int eDVBCIApplicationManagerSession::startMMI()
+{
+       printf("in appmanager -> startmmi()\n");
+       const unsigned char tag[3]={0x9F, 0x80, 0x22};  // Tenter_menu
+       sendAPDU(tag);
+}
+