X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=blobdiff_plain;f=lib%2Fdvb_ci%2Fdvbci_appmgr.cpp;h=f81597309558a33c4ca25f5540469ff79ede5898;hp=92472d87ce2b5a4386265912d85c22049fe0aab2;hb=24c472e37de8db4007cdd4c5d67d3fd4e914f0b1;hpb=3aa6b1d96621b432f0c9028d8a3311440b3393f1 diff --git a/lib/dvb_ci/dvbci_appmgr.cpp b/lib/dvb_ci/dvbci_appmgr.cpp index 92472d8..f815973 100644 --- a/lib/dvb_ci/dvbci_appmgr.cpp +++ b/lib/dvb_ci/dvbci_appmgr.cpp @@ -1,6 +1,18 @@ /* DVB CI Application Manager */ #include +#include + +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,16 @@ 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()->setAppName(slot->getSlotID(), str); + + eDVBCI_UI::getInstance()->setState(slot->getSlotID(), 2); break; } default: @@ -40,3 +59,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; +} +