3 #include <lib/dvb_ci/dvbci_mmi.h>
4 #include <lib/dvb_ci/dvbci_ui.h>
7 PyObject *list = PyList_New(len);
8 for (i=0; i<len; ++i) {
9 PyObject *tuple = PyTuple_New(3); // 3 eintrge im tuple
10 PyTuple_SetItem(tuple, 0, PyString_FromString("eintrag 1"))
11 PyTuple_SetItem(tuple, 1, PyInt_FromLong(31337));
12 PyTuple_SetItem(tuple, 2, PyString_FromString("eintrag 3"))
13 PyList_SetItem(list, i, tuple);
18 eDVBCIMMISession::eDVBCIMMISession(eDVBCISlot *tslot)
21 slot->mmi_session = this;
24 eDVBCIMMISession::~eDVBCIMMISession()
26 slot->mmi_session = 0;
29 int eDVBCIMMISession::receivedAPDU(const unsigned char *tag, const void *data, int len)
31 printf("SESSION(%d)/MMI %02x %02x %02x: ", session_nb, tag[0], tag[1],tag[2]);
32 for (int i=0; i<len; i++)
33 printf("%02x ", ((const unsigned char*)data)[i]);
36 if ((tag[0]==0x9f) && (tag[1]==0x88))
41 printf("MMI display control\n");
42 if (((unsigned char*)data)[0] != 1)
43 printf("kann ich nicht. aber das sag ich dem modul nicht.\n");
44 state=stateDisplayReply;
46 case 0x07: //Tmenu_enq
48 unsigned char *d=(unsigned char*)data;
49 unsigned char *max=((unsigned char*)d) + len;
50 int textlen = len - 2;
61 printf("%d bytes text\n", textlen);
62 if ((d+textlen) > max)
65 char str[textlen + 1];
66 memcpy(str, ((char*)d), textlen);
69 printf("enq-text: %s\n",str);
71 eDVBCI_UI::getInstance()->mmiScreenEnq(0, blind, alen, str);
75 case 0x09: //Tmenu_last
76 case 0x0c: //Tlist_last
78 unsigned char *d=(unsigned char*)data;
79 unsigned char *max=((unsigned char*)d) + len;
81 printf("Tmenu_last\n");
87 if(tag[2] == 0x09) //menu
88 eDVBCI_UI::getInstance()->mmiScreenBegin(0, 0);
90 eDVBCI_UI::getInstance()->mmiScreenBegin(0, 1);
96 printf("%d texts\n", n);
97 for (int i=0; i < (n+3); ++i)
102 printf("text tag: %02x %02x %02x\n", d[0], d[1], d[2]);
104 d+=parseLengthField(d, textlen);
105 printf("%d bytes text\n", textlen);
106 if ((d+textlen) > max)
109 char str[textlen + 1];
110 memcpy(str, ((char*)d), textlen);
113 eDVBCI_UI::getInstance()->mmiScreenAddText(0, pos++, str);
120 eDVBCI_UI::getInstance()->mmiScreenFinish(0);
124 printf("unknown APDU tag 9F 88 %02x\n", tag[2]);
131 int eDVBCIMMISession::doAction()
138 case stateDisplayReply:
140 unsigned char tag[]={0x9f, 0x88, 0x02};
141 unsigned char data[]={0x01, 0x01};
142 sendAPDU(tag, data, 2);
149 unsigned char tag[]={0x9f, 0x88, 0x0b};
150 unsigned char data[]={5};
151 sendAPDU(tag, data, 1);
163 int eDVBCIMMISession::stopMMI()
165 printf("eDVBCIMMISession::stopMMI()\n");
167 unsigned char tag[]={0x9f, 0x88, 0x00};
168 unsigned char data[]={0x00};
169 sendAPDU(tag, data, 1);
172 int eDVBCIMMISession::answerText(int answer)
174 printf("eDVBCIMMISession::answerText(%d)\n",answer);
176 unsigned char tag[]={0x9f, 0x88, 0x0B};
177 unsigned char data[]={0x00};
178 data[0] = answer & 0xff;
179 sendAPDU(tag, data, 1);
182 int eDVBCIMMISession::cancelEnq()
184 printf("eDVBCIMMISession::cancelEnq()\n");
186 unsigned char tag[]={0x9f, 0x88, 0x08};
187 unsigned char data[]={0x00};
188 sendAPDU(tag, data, 1);