Extend AudioSelection width, fix mediaplayer subtitle selection key
[enigma2.git] / lib / dvb_ci / dvbci_camgr.cpp
1 /* DVB CI CA Manager */
2
3 #include <lib/base/eerror.h>
4 #include <lib/dvb_ci/dvbci_camgr.h>
5
6 eDVBCICAManagerSession::eDVBCICAManagerSession(eDVBCISlot *tslot)
7 {
8         slot = tslot;
9         slot->setCAManager(this);
10 }
11
12 eDVBCICAManagerSession::~eDVBCICAManagerSession()
13 {
14         slot->setCAManager(NULL);
15 }
16
17 int eDVBCICAManagerSession::receivedAPDU(const unsigned char *tag, const void *data, int len)
18 {
19         eDebugNoNewLine("SESSION(%d)/CA %02x %02x %02x: ", session_nb, tag[0], tag[1],tag[2]);
20         for (int i=0; i<len; i++)
21                 eDebugNoNewLine("%02x ", ((const unsigned char*)data)[i]);
22         eDebug("");
23
24         if ((tag[0]==0x9f) && (tag[1]==0x80))
25         {
26                 switch (tag[2])
27                 {
28                 case 0x31:
29                         eDebug("ca info:");
30                         for (int i=0; i<len; i+=2)
31                         {
32                                 eDebugNoNewLine("%04x ", (((const unsigned char*)data)[i]<<8)|(((const unsigned char*)data)[i+1]));
33                                 caids.push_back((((const unsigned char*)data)[i]<<8)|(((const unsigned char*)data)[i+1]));
34                         }
35                         std::sort(caids.begin(), caids.end());
36                         eDebug("");
37                         eDVBCIInterfaces::getInstance()->recheckPMTHandlers();
38                         break;
39                 default:
40                         eDebug("unknown APDU tag 9F 80 %02x", tag[2]);
41                         break;
42                 }
43         }
44         return 0;
45 }
46
47 int eDVBCICAManagerSession::doAction()
48 {
49         switch (state)
50         {
51         case stateStarted:
52         {
53                 const unsigned char tag[3]={0x9F, 0x80, 0x30}; // ca info enq
54                 sendAPDU(tag);
55                 state=stateFinal;
56                 return 0;
57         }
58         case stateFinal:
59                 eDebug("stateFinal und action! kann doch garnicht sein ;)");
60         default:
61                 return 0;
62         }
63 }
64
65 int eDVBCICAManagerSession::sendCAPMT(unsigned char *data, int len)
66 {
67         const unsigned char tag[3]={0x9F, 0x80, 0x32}; // ca_pmt
68
69         sendAPDU(tag, data, len);
70
71         return 0;
72 }
73