5 #include <lib/base/i18n.h>
6 #include <lib/driver/rc.h>
7 #include <lib/dvb/dvbservice.h>
8 #include <lib/dvb/dvbci.h>
9 #include <lib/gui/echeckbox.h>
10 #include <lib/gui/ebutton.h>
11 #include <lib/gui/statusbar.h>
12 #include <lib/gui/eskin.h>
13 #include <lib/gdi/font.h>
14 #include <lib/system/econfig.h>
15 #include <lib/system/info.h>
16 #include <lib/system/init.h>
17 #include <lib/system/init_num.h>
20 :ci_messages(eApp
,1), ci2_messages(eApp
,1)
25 void enigmaCI::init_enigmaCI()
27 CONNECT(ci_messages
.recv_msg
, enigmaCI::updateCIinfo
);
28 int fd
=eSkin::getActive()->queryValue("fontsize", 20);
30 DVBCI
=eDVB::getInstance()->DVBCI
;
32 if( eSystemInfo::getInstance()->hasCI() > 1 )
34 setText(_("Common Interface Modules"));
35 move(ePoint(160, 90));
36 cresize(eSize(350, 330));
37 DVBCI2
=eDVB::getInstance()->DVBCI2
;
38 CONNECT(ci2_messages
.recv_msg
, enigmaCI::updateCI2info
);
42 setText(_("Common Interface Module"));
43 move(ePoint(160, 120));
44 cresize(eSize(350, 250));
47 reset
=new eButton(this);
48 reset
->setText(_("Reset"));
49 reset
->move(ePoint(10, 13));
50 reset
->resize(eSize(330, fd
+10));
51 reset
->setHelpText(_("reset the Common Interface module"));
54 CONNECT(reset
->selected
, enigmaCI::resetPressed
);
56 init
=new eButton(this);
57 init
->setText(_("Init"));
58 init
->move(ePoint(10, 53));
59 init
->resize(eSize(330, fd
+10));
60 init
->setHelpText(_("send the ca-pmt to CI"));
63 CONNECT(init
->selected
, enigmaCI::initPressed
);
65 app
=new eButton(this);
66 app
->setText(_("waiting for module"));
67 app
->move(ePoint(10, 93));
68 app
->resize(eSize(330, fd
+10));
69 app
->setHelpText(_("enter Common Interface menu (mmi)"));
72 CONNECT(app
->selected
, enigmaCI::appPressed
);
74 if( eSystemInfo::getInstance()->hasCI() > 1 )
76 reset2
=new eButton(this);
77 reset2
->setText(_("Reset"));
78 reset2
->move(ePoint(10, 143));
79 reset2
->resize(eSize(330, fd
+10));
80 reset2
->setHelpText(_("reset the Common Interface module"));
83 CONNECT(reset2
->selected
, enigmaCI::reset2Pressed
);
85 init2
=new eButton(this);
86 init2
->setText(_("Init"));
87 init2
->move(ePoint(10, 183));
88 init2
->resize(eSize(330, fd
+10));
89 init2
->setHelpText(_("send the ca-pmt to CI"));
92 CONNECT(init2
->selected
, enigmaCI::init2Pressed
);
94 app2
=new eButton(this);
95 app2
->setText(_("waiting for module"));
96 app2
->move(ePoint(10, 223));
97 app2
->resize(eSize(330, fd
+10));
98 app2
->setHelpText(_("enter Common Interface menu (mmi)"));
101 CONNECT(app2
->selected
, enigmaCI::app2Pressed
);
106 eConfig::getInstance()->getKey("/ezap/ci/handleTwoServices", handleTwo
);
107 twoServices
= new eCheckbox(this);
108 twoServices
->move(ePoint(10,128));
109 twoServices
->resize(eSize(330,(fd
+10)*2));
110 twoServices
->setCheck(handleTwo
);
111 twoServices
->setFlags(RS_WRAP
|eLabel::flagVCenter
);
112 twoServices
->setText(_("can handle two services"));
113 twoServices
->setHelpText(_("can your CI descramble two services at the same time?"));
114 CONNECT(twoServices
->checked
, enigmaCI::handleTwoServicesChecked
);
117 status
= new eStatusBar(this);
118 status
->move( ePoint(0, clientrect
.height()-50) );
119 status
->resize( eSize( clientrect
.width(), 50) );
122 CONNECT(DVBCI
->ci_progress
, enigmaCI::gotCIinfoText
);
123 DVBCI
->messages
.send(eDVBCI::eDVBCIMessage(eDVBCI::eDVBCIMessage::getAppName
));
125 if( eSystemInfo::getInstance()->hasCI() > 1 )
127 CONNECT(DVBCI2
->ci_progress
, enigmaCI::gotCI2infoText
);
128 DVBCI2
->messages
.send(eDVBCI::eDVBCIMessage(eDVBCI::eDVBCIMessage::getAppName
));
132 enigmaCI::~enigmaCI()
138 void enigmaCI::handleTwoServicesChecked(int val
)
140 eConfig::getInstance()->setKey("/ezap/ci/handleTwoServices", val
);
143 void enigmaCI::gotCIinfoText(const char *text
)
145 // called from CI thread !!
147 ci_messages
.send(text
);
150 void enigmaCI::gotCI2infoText(const char *text
)
152 // called from CI2 thread !!
154 ci2_messages
.send(text
);
157 void enigmaCI::updateCIinfo(const char * const &buffer
)
159 eDebug("new info %s",buffer
);
160 app
->setText(buffer
);
163 void enigmaCI::updateCI2info(const char * const &buffer
)
165 eDebug("new info %s",buffer
);
166 app2
->setText(buffer
);
169 void enigmaCI::resetPressed()
171 app
->setText(_("resetting....please wait"));
172 DVBCI
->messages
.send(eDVBCI::eDVBCIMessage(eDVBCI::eDVBCIMessage::reset
));
175 void enigmaCI::reset2Pressed()
177 app2
->setText(_("resetting....please wait"));
178 DVBCI2
->messages
.send(eDVBCI::eDVBCIMessage(eDVBCI::eDVBCIMessage::reset
));
181 void enigmaCI::initPressed()
183 DVBCI
->messages
.send(eDVBCI::eDVBCIMessage(eDVBCI::eDVBCIMessage::init
));
186 void enigmaCI::init2Pressed()
188 DVBCI2
->messages
.send(eDVBCI::eDVBCIMessage(eDVBCI::eDVBCIMessage::init
));
191 void enigmaCI::appPressed()
194 DVBCI
->messages
.send(eDVBCI::eDVBCIMessage(eDVBCI::eDVBCIMessage::mmi_begin
));
195 enigmaCIMMI::getInstance(DVBCI
)->exec();
196 DVBCI
->messages
.send(eDVBCI::eDVBCIMessage(eDVBCI::eDVBCIMessage::mmi_end
));
200 void enigmaCI::app2Pressed()
203 DVBCI2
->messages
.send(eDVBCI::eDVBCIMessage(eDVBCI::eDVBCIMessage::mmi_begin
));
204 enigmaCIMMI::getInstance(DVBCI2
)->exec();
205 DVBCI2
->messages
.send(eDVBCI::eDVBCIMessage(eDVBCI::eDVBCIMessage::mmi_end
));
209 // ----------- CI MMI ----------------
210 std::map
<eDVBCI
*,enigmaCIMMI
*> enigmaCIMMI::exist
;
212 enigmaCIMMI
* enigmaCIMMI::getInstance( eDVBCI
* ci
)
214 std::map
<eDVBCI
*, enigmaCIMMI
*>::iterator it
= exist
.find(ci
);
215 if ( it
== exist
.end() )
216 exist
[ci
]=new enigmaCIMMI(ci
);
220 enigmaCIMMI::enigmaCIMMI( eDVBCI
*ci
)
223 setText(_("Common Interface Module - mmi"));
224 lText
->setText(_("waiting for CI answer..."));
225 int newHeight
= size
.height() - getClientSize().height() + lText
->getExtend().height() + 10 + 20;
226 resize( eSize( size
.width(), newHeight
) );
229 void enigmaCIMMI::sendAnswer( AnswerType ans
, int param
, unsigned char *data
)
234 ci
->messages
.send( eDVBCI::eDVBCIMessage(eDVBCI::eDVBCIMessage::mmi_enqansw
, param
, data
));
238 ci
->messages
.send( eDVBCI::eDVBCIMessage(eDVBCI::eDVBCIMessage::mmi_menuansw
,param
));
243 void enigmaCIMMI::beginExec()
245 conn
= CONNECT(ci
->ci_mmi_progress
, enigmaMMI::gotMMIData
);