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