1 #include <lib/dvb_ci/dvbci_ui.h>
2 #include <lib/dvb_ci/dvbci.h>
10 #include <lib/base/init.h>
11 #include <lib/base/init_num.h>
12 #include <lib/base/econfig.h>
13 #include <lib/base/eerror.h>
15 eDVBCI_UI *eDVBCI_UI::instance = 0;
17 eDVBCI_UI::eDVBCI_UI()
21 for(i=0;i<MAX_SLOTS;i++)
22 state[i] = 0; //no module
29 eDVBCI_UI::~eDVBCI_UI()
33 eDVBCI_UI *eDVBCI_UI::getInstance()
38 int eDVBCI_UI::getState(int slot)
40 return state[slot]; //exploit me ;)
43 void eDVBCI_UI::setState(int slot, int newState)
45 state[slot] = newState;
48 std::string eDVBCI_UI::getAppName(int slot)
53 void eDVBCI_UI::setAppName(int slot, const char *name)
55 //printf("set name to -%c-\n", name);
59 void eDVBCI_UI::setReset(int slot)
61 eDVBCIInterfaces::getInstance()->reset(slot);
64 int eDVBCI_UI::startMMI(int slot)
66 eDVBCIInterfaces::getInstance()->startMMI(slot);
69 int eDVBCI_UI::stopMMI(int slot)
71 eDVBCIInterfaces::getInstance()->stopMMI(slot);
74 int eDVBCI_UI::initialize(int slot)
76 eDVBCIInterfaces::getInstance()->initialize(slot);
79 int eDVBCI_UI::answerMenu(int slot, int answer)
81 eDVBCIInterfaces::getInstance()->answerText(slot, answer);
84 int eDVBCI_UI::answerEnq(int slot, char *value)
86 eDVBCIInterfaces::getInstance()->answerEnq(slot, value);
89 int eDVBCI_UI::cancelEnq(int slot)
91 eDVBCIInterfaces::getInstance()->cancelEnq(slot);
94 int eDVBCI_UI::availableMMI(int slot)
96 return mmiScreenReady;
99 int eDVBCI_UI::mmiScreenEnq(int slot, int blind, int answerLen, char *text)
103 mmiScreen = PyList_New(2);
105 PyObject *tuple = PyTuple_New(1);
106 PyTuple_SetItem(tuple, 0, PyString_FromString("ENQ"));
107 PyList_SetItem(mmiScreen, 0, tuple);
109 tuple = PyTuple_New(4);
111 PyTuple_SetItem(tuple, 0, PyString_FromString("PIN"));
112 PyTuple_SetItem(tuple, 1, PyInt_FromLong(answerLen));
113 PyTuple_SetItem(tuple, 2, PyString_FromString(text));
114 PyTuple_SetItem(tuple, 3, PyInt_FromLong(blind));
115 PyList_SetItem(mmiScreen, 1, tuple);
122 int eDVBCI_UI::mmiScreenBegin(int slot, int listmenu)
124 printf("eDVBCI_UI::mmiScreenBegin\n");
128 mmiScreen = PyList_New(1);
130 PyObject *tuple = PyTuple_New(1);
131 if(listmenu == 0) //menu
132 PyTuple_SetItem(tuple, 0, PyString_FromString("MENU"));
134 PyTuple_SetItem(tuple, 0, PyString_FromString("LIST"));
136 PyList_SetItem(mmiScreen, 0, tuple);
143 int eDVBCI_UI::mmiScreenAddText(int slot, int type, char *value)
145 printf("eDVBCI_UI::mmiScreenAddText(%s)\n",value);
147 PyObject *tuple = PyTuple_New(3);
149 if(type == 0) //title
150 PyTuple_SetItem(tuple, 0, PyString_FromString("TITLE"));
151 else if(type == 1) //subtitle
152 PyTuple_SetItem(tuple, 0, PyString_FromString("SUBTITLE"));
153 else if(type == 2) //bottom
154 PyTuple_SetItem(tuple, 0, PyString_FromString("BOTTOM"));
156 PyTuple_SetItem(tuple, 0, PyString_FromString("TEXT"));
158 printf("addText %s with id %d\n", value, type);
160 PyTuple_SetItem(tuple, 1, PyString_FromString(value));
163 PyTuple_SetItem(tuple, 2, PyInt_FromLong(type-2));
165 PyTuple_SetItem(tuple, 2, PyInt_FromLong(-1));
167 PyList_Append(mmiScreen, tuple);
172 int eDVBCI_UI::mmiScreenFinish(int slot)
174 printf("eDVBCI_UI::mmiScreenFinish\n");
181 int eDVBCI_UI::getMMIState(int slot)
183 return eDVBCIInterfaces::getInstance()->getMMIState(slot);
186 PyObject *eDVBCI_UI::getMMIScreen(int slot)
188 if(mmiScreenReady != 1)
196 //FIXME: correct "run/startlevel"
197 eAutoInitP0<eDVBCI_UI> init_dvbciui(eAutoInitNumbers::rc, "DVB-CI UI");