add ServiceInfo.py
[enigma2.git] / lib / dvb_ci / dvbci_camgr.cpp
index eb30c41..2ad1f1e 100644 (file)
@@ -2,3 +2,48 @@
 
 #include <lib/dvb_ci/dvbci_camgr.h>
 
+int eDVBCICAManagerSession::receivedAPDU(const unsigned char *tag, const void *data, int len)
+{
+       printf("SESSION(%d)/CA %02x %02x %02x: ", session_nb, tag[0], tag[1],tag[2]);
+       for (int i=0; i<len; i++)
+               printf("%02x ", ((const unsigned char*)data)[i]);
+       printf("\n");
+
+       if ((tag[0]==0x9f) && (tag[1]==0x80))
+       {
+               switch (tag[2])
+               {
+               case 0x31:
+                       printf("ca info:\n");
+                       for (int i=0; i<len; i+=2)
+                       {
+                               printf("%04x ", (((const unsigned char*)data)[i]<<8)|(((const unsigned char*)data)[i+1]));
+                               caids.insert((((const unsigned char*)data)[i]<<8)|(((const unsigned char*)data)[i+1]));
+                       }
+                       printf("\n");
+                       break;
+               default:
+                       printf("unknown APDU tag 9F 80 %02x\n", tag[2]);
+                       break;
+               }
+       }
+       return 0;
+}
+
+int eDVBCICAManagerSession::doAction()
+{
+       switch (state)
+       {
+       case stateStarted:
+       {
+               const unsigned char tag[3]={0x9F, 0x80, 0x30}; // ca info enq
+               sendAPDU(tag);
+               state=stateFinal;
+               return 0;
+       }
+       case stateFinal:
+               printf("stateFinal und action! kann doch garnicht sein ;)\n");
+       default:
+               return 0;
+       }
+}