fix LCD in MoviePlayer
[enigma2.git] / lib / dvb_ci / dvbci_appmgr.cpp
index 92472d87ce2b5a4386265912d85c22049fe0aab2..28e0659da8ec4178f59c5987244d9d40584d7123 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:
@@ -40,3 +58,40 @@ int eDVBCIApplicationManagerSession::receivedAPDU(const unsigned char *tag,const
        }
        return 0;
 }
+
+int eDVBCIApplicationManagerSession::doAction()
+{
+  switch (state)
+  {
+  case stateStarted:
+  {
+    const unsigned char tag[3]={0x9F, 0x80, 0x20}; // application manager info e    sendAPDU(tag);
+               sendAPDU(tag);
+    state=stateFinal;
+    return 1;
+  }
+  case stateFinal:
+    printf("in final state.\n");
+               wantmenu = 0;
+    if (wantmenu)
+    {
+      printf("wantmenu: sending Tenter_menu\n");
+      const unsigned char tag[3]={0x9F, 0x80, 0x22};  // Tenter_menu
+      sendAPDU(tag);
+      wantmenu=0;
+      return 0;
+    } else
+      return 0;
+  default:
+    return 0;
+  }
+}
+
+int eDVBCIApplicationManagerSession::startMMI()
+{
+       printf("in appmanager -> startmmi()\n");
+       const unsigned char tag[3]={0x9F, 0x80, 0x22};  // Tenter_menu
+       sendAPDU(tag);
+       return 0;
+}
+