add stuff to find a slot and call stuff from there
[enigma2.git] / lib / dvb_ci / dvbci_datetimemgr.cpp
1 /* DVB CI DateTime Manager */
2
3 #include <lib/dvb_ci/dvbci_datetimemgr.h>
4
5 int eDVBCIDateTimeSession::receivedAPDU(const unsigned char *tag,const void *data, int len)
6 {
7         printf("SESSION(%d)/DATETIME %02x %02x %02x: ", session_nb, tag[0],tag[1], tag[2]);
8         for (int i=0; i<len; i++)
9                 printf("%02x ", ((const unsigned char*)data)[i]);
10         printf("\n");
11
12         if ((tag[0]==0x9f) && (tag[1]==0x84))
13         {
14                 switch (tag[2])
15                 {
16                 case 0x40:
17                         state=stateSendDateTime;
18                         return 1;
19                         break;
20                 default:
21                         printf("unknown APDU tag 9F 84 %02x\n", tag[2]);
22                         break;
23                 }
24         }
25         return 0;
26 }
27
28 int eDVBCIDateTimeSession::doAction()
29 {
30         switch (state)
31         {
32         case stateStarted:
33                 return 0;
34         case stateSendDateTime:
35         {
36                 unsigned char tag[3]={0x9f, 0x84, 0x41}; // date_time_response
37                 unsigned char msg[7]={0, 0, 0, 0, 0, 0, 0};
38                 sendAPDU(tag, msg, 7);
39                 return 0;
40         }
41         case stateFinal:
42                 printf("stateFinal und action! kann doch garnicht sein ;)\n");
43         default:
44                 return 0;
45         }
46 }