X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/3aa6b1d96621b432f0c9028d8a3311440b3393f1..f0c5ac102ddaf0bfbf86743a5aec0ea4accc605c:/lib/dvb_ci/dvbci_appmgr.cpp diff --git a/lib/dvb_ci/dvbci_appmgr.cpp b/lib/dvb_ci/dvbci_appmgr.cpp index 92472d87..b3e9ca14 100644 --- a/lib/dvb_ci/dvbci_appmgr.cpp +++ b/lib/dvb_ci/dvbci_appmgr.cpp @@ -1,13 +1,26 @@ /* DVB CI Application Manager */ +#include #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) { - printf("SESSION(%d)/APP %02x %02x %02x: ", session_nb, tag[0], tag[1], tag[2]); + eDebugNoNewLine("SESSION(%d)/APP %02x %02x %02x: ", session_nb, tag[0], tag[1], tag[2]); for (int i=0; i len) { - printf("warning, invalid length (%d vs %d)\n", dl+6, len); + eDebug("warning, invalid length (%d vs %d)", 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"); + eDebugNoNewLine("%c", ((unsigned char*)data)[i+6]); + eDebug(""); + + eDVBCI_UI::getInstance()->setAppName(slot->getSlotID(), str); + + eDVBCI_UI::getInstance()->setState(slot->getSlotID(), 2); break; } default: - printf("unknown APDU tag 9F 80 %02x\n", tag[2]); + eDebug("unknown APDU tag 9F 80 %02x", tag[2]); break; } } 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: + eDebug("in final state."); + wantmenu = 0; + if (wantmenu) + { + eDebug("wantmenu: sending Tenter_menu"); + 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() +{ + eDebug("in appmanager -> startmmi()"); + const unsigned char tag[3]={0x9F, 0x80, 0x22}; // Tenter_menu + sendAPDU(tag); + return 0; +} +