WirelessLanSetup : fix skin for 750S
[vuplus_dvbapp] / lib / python / Plugins / SystemPlugins / Blindscan / plugin.py
1 from Plugins.Plugin import PluginDescriptor
2
3 from Screens.Screen import Screen
4 from Screens.ServiceScan import ServiceScan
5 from Screens.MessageBox import MessageBox
6 from Screens.DefaultWizard import DefaultWizard
7
8 from Components.Label import Label
9 from Components.TuneTest import Tuner
10 from Components.ConfigList import ConfigListScreen
11 from Components.Sources.StaticText import StaticText
12 from Components.ActionMap import NumberActionMap, ActionMap
13 from Components.NimManager import nimmanager, getConfigSatlist
14 from Components.config import config, ConfigSubsection, ConfigSelection, ConfigYesNo, ConfigInteger, getConfigListEntry, ConfigSlider, ConfigEnableDisable
15
16 from Tools.HardwareInfo import HardwareInfo
17 from Tools.Directories import resolveFilename, SCOPE_DEFAULTPARTITIONMOUNTDIR, SCOPE_DEFAULTDIR, SCOPE_DEFAULTPARTITION
18
19 from enigma import eTimer, eDVBFrontendParametersSatellite, eComponentScan, eDVBSatelliteEquipmentControl, eDVBFrontendParametersTerrestrial, eDVBFrontendParametersCable, eConsoleAppContainer, eDVBResourceManager
20
21 class Blindscan(ConfigListScreen, Screen):
22         skin="""
23                 <screen name="Blindscan" position="center,center" size="560,370" title="Blindscan">
24                         <ePixmap pixmap="Vu_HD/buttons/red.png" position="5,0" size="80,40" alphatest="on" />
25                         <ePixmap pixmap="Vu_HD/buttons/green.png" position="186,0" size="80,40" alphatest="on" />
26                         <ePixmap pixmap="Vu_HD/buttons/blue.png" position="372,0" size="80,40" alphatest="on" />
27
28                         <widget source="key_red" render="Label" position="28,0" zPosition="1" size="160,30" font="Regular;20" halign="center" valign="center" transparent="1"/>
29                         <widget source="key_green" render="Label" position="213,0" zPosition="1" size="160,30" font="Regular;20" halign="center" valign="center" transparent="1"/>
30                         <widget source="key_blue" render="Label" position="400,0" zPosition="1" size="160,30" font="Regular;20" halign="center" valign="center" transparent="1"/>
31
32                         <widget name="config" position="5,50" size="550,280" scrollbarMode="showOnDemand" />
33                         <widget name="introduction" position="0,345" size="560,20" font="Regular;20" halign="center" />
34                 </screen>
35                 """
36         def __init__(self, session): 
37                 Screen.__init__(self, session)
38
39                 self.current_play_service = self.session.nav.getCurrentlyPlayingServiceReference()
40
41                 # update sat list
42                 self.satList = []
43                 for slot in nimmanager.nim_slots:
44                         if slot.isCompatible("DVB-S"):
45                                 self.satList.append(nimmanager.getSatListForNim(slot.slot))
46                         else:
47                                 self.satList.append(None)
48
49                 # make config
50                 self.createConfig()
51
52                 self.list = []
53                 self.status = ""
54
55                 ConfigListScreen.__init__(self, self.list)
56                 if self.scan_nims.value != None and self.scan_nims.value != "" :
57                         self["actions"] = ActionMap(["OkCancelActions", "ShortcutActions", "WizardActions", "ColorActions", "SetupActions", ],
58                         {
59                                 "red": self.keyCancel,
60                                 "green": self.keyGo,
61                                 "blue":self.keyGoAll,
62                                 "ok": self.keyGo,
63                                 "cancel": self.keyCancel,
64                         }, -2)
65                         self["key_red"] = StaticText(_("Exit"))
66                         self["key_green"] = StaticText("Scan")
67                         self["key_blue"] = StaticText("Scan All")
68                         self["introduction"] = Label(_("Press Green/OK to start the scan"))
69                         self.createSetup()
70                 else :
71                         self["actions"] = ActionMap(["OkCancelActions", "ShortcutActions", "WizardActions", "ColorActions", "SetupActions", ],
72                         {
73                                 "red": self.keyCancel,
74                                 "green": self.keyNone,
75                                 "blue":self.keyNone,
76                                 "ok": self.keyNone,
77                                 "cancel": self.keyCancel,
78                         }, -2)
79                         self["key_red"] = StaticText(_("Exit"))
80                         self["key_green"] = StaticText(" ")
81                         self["key_blue"] = StaticText(" ")
82                         self["introduction"] = Label(_("Please setup your tuner configuration."))
83
84                 self.i2c_mapping_table = None
85                 self.makeNimSocket()
86
87         def makeNimSocket(self):
88                 self.i2c_mapping_table = {0:2, 1:3, 2:1, 3:0}
89
90         def getNimSocket(self, slot_number):
91                 if slot_number < 0 or slot_number > 3:
92                         return -1
93                 return self.i2c_mapping_table[slot_number]
94
95         def keyNone(self):
96                 None
97         def callbackNone(self, *retval):
98                 None
99
100         def openFrontend(self):
101                 res_mgr = eDVBResourceManager.getInstance()
102                 if res_mgr:
103                         self.raw_channel = res_mgr.allocateRawChannel(self.feid)
104                         if self.raw_channel:
105                                 self.frontend = self.raw_channel.getFrontend()
106                                 if self.frontend:
107                                         return True
108                                 else:
109                                         print "getFrontend failed"
110                         else:
111                                 print "getRawChannel failed"
112                 else:
113                         print "getResourceManager instance failed"
114                 return False
115
116         def createConfig(self):
117                 self.feinfo = None
118                 frontendData = None
119                 defaultSat = {
120                         "orbpos": 192,
121                         "system": eDVBFrontendParametersSatellite.System_DVB_S,
122                         "frequency": 11836,
123                         "inversion": eDVBFrontendParametersSatellite.Inversion_Unknown,
124                         "symbolrate": 27500,
125                         "polarization": eDVBFrontendParametersSatellite.Polarisation_Horizontal,
126                         "fec": eDVBFrontendParametersSatellite.FEC_Auto,
127                         "fec_s2": eDVBFrontendParametersSatellite.FEC_9_10,
128                         "modulation": eDVBFrontendParametersSatellite.Modulation_QPSK 
129                 }
130
131                 self.service = self.session.nav.getCurrentService()
132                 if self.service is not None:
133                         self.feinfo = self.service.frontendInfo()
134                         frontendData = self.feinfo and self.feinfo.getAll(True)
135                 if frontendData is not None:
136                         ttype = frontendData.get("tuner_type", "UNKNOWN")
137                         if ttype == "DVB-S":
138                                 defaultSat["system"] = frontendData.get("system", eDVBFrontendParametersSatellite.System_DVB_S)
139                                 defaultSat["frequency"] = frontendData.get("frequency", 0) / 1000
140                                 defaultSat["inversion"] = frontendData.get("inversion", eDVBFrontendParametersSatellite.Inversion_Unknown)
141                                 defaultSat["symbolrate"] = frontendData.get("symbol_rate", 0) / 1000
142                                 defaultSat["polarization"] = frontendData.get("polarization", eDVBFrontendParametersSatellite.Polarisation_Horizontal)
143                                 if defaultSat["system"] == eDVBFrontendParametersSatellite.System_DVB_S2:
144                                         defaultSat["fec_s2"] = frontendData.get("fec_inner", eDVBFrontendParametersSatellite.FEC_Auto)
145                                         defaultSat["rolloff"] = frontendData.get("rolloff", eDVBFrontendParametersSatellite.RollOff_alpha_0_35)
146                                         defaultSat["pilot"] = frontendData.get("pilot", eDVBFrontendParametersSatellite.Pilot_Unknown)
147                                 else:
148                                         defaultSat["fec"] = frontendData.get("fec_inner", eDVBFrontendParametersSatellite.FEC_Auto)
149                                 defaultSat["modulation"] = frontendData.get("modulation", eDVBFrontendParametersSatellite.Modulation_QPSK)
150                                 defaultSat["orbpos"] = frontendData.get("orbital_position", 0)
151                 del self.feinfo
152                 del self.service
153                 del frontendData
154                 
155                 self.scan_sat = ConfigSubsection()
156                 self.scan_networkScan = ConfigYesNo(default = False)
157                 
158                 # blindscan add
159                 self.blindscan_hi = ConfigSelection(default = "hi_low", choices = [("low", _("low")), ("high", _("high")), ("hi_low", _("hi_low"))])
160
161                 #ConfigYesNo(default = True)
162                 self.blindscan_start_frequency = ConfigInteger(default = 950*1000000)
163                 self.blindscan_stop_frequency = ConfigInteger(default = 2150*1000000)
164                 self.blindscan_start_symbol = ConfigInteger(default = 2*1000000)
165                 self.blindscan_stop_symbol = ConfigInteger(default = 45*1000000)
166                 self.scan_clearallservices = ConfigYesNo(default = False)
167                 self.scan_onlyfree = ConfigYesNo(default = False)
168
169                 # collect all nims which are *not* set to "nothing"
170                 nim_list = []
171                 for n in nimmanager.nim_slots:
172                         if n.config_mode == "nothing":
173                                 continue
174                         if n.config_mode == "advanced" and len(nimmanager.getSatListForNim(n.slot)) < 1:
175                                 continue
176                         if n.config_mode in ("loopthrough", "satposdepends"):
177                                 root_id = nimmanager.sec.getRoot(n.slot_id, int(n.config.connectedTo.value))
178                                 if n.type == nimmanager.nim_slots[root_id].type: # check if connected from a DVB-S to DVB-S2 Nim or vice versa
179                                         continue
180                         if n.isCompatible("DVB-S"):
181                                 nim_list.append((str(n.slot), n.friendly_full_description))
182                 self.scan_nims = ConfigSelection(choices = nim_list)
183
184                 # sat
185                 self.scan_sat.frequency = ConfigInteger(default = defaultSat["frequency"], limits = (1, 99999))
186                 #self.scan_sat.polarization = ConfigSelection(default = defaultSat["polarization"], choices = [
187                 self.scan_sat.polarization = ConfigSelection(default = eDVBFrontendParametersSatellite.Polarisation_CircularRight + 1, choices = [
188                         (eDVBFrontendParametersSatellite.Polarisation_CircularRight + 1, _("horizontal_vertical")),
189                         (eDVBFrontendParametersSatellite.Polarisation_Horizontal, _("horizontal")),
190                         (eDVBFrontendParametersSatellite.Polarisation_Vertical, _("vertical")),
191                         (eDVBFrontendParametersSatellite.Polarisation_CircularLeft, _("circular left")),
192                         (eDVBFrontendParametersSatellite.Polarisation_CircularRight, _("circular right"))])
193                 self.scan_scansat = {}
194                 for sat in nimmanager.satList:
195                         self.scan_scansat[sat[0]] = ConfigYesNo(default = False)
196                 
197                 self.scan_satselection = []
198                 for slot in nimmanager.nim_slots:
199                         if slot.isCompatible("DVB-S"):
200                                 self.scan_satselection.append(getConfigSatlist(defaultSat["orbpos"], self.satList[slot.slot]))
201                 return True
202
203         def getSelectedSatIndex(self, v):
204                 index    = 0
205                 none_cnt = 0
206                 for n in self.satList:
207                         if self.satList[index] == None:
208                                 none_cnt = none_cnt + 1
209                         if index == int(v):
210                                 return (index-none_cnt)
211                         index = index + 1
212                 return -1
213
214         def createSetup(self):
215                 self.list = []
216                 self.multiscanlist = []
217                 index_to_scan = int(self.scan_nims.value)
218                 print "ID: ", index_to_scan
219
220                 self.tunerEntry = getConfigListEntry(_("Tuner"), self.scan_nims)
221                 self.list.append(self.tunerEntry)
222                 
223                 if self.scan_nims == [ ]:
224                         return
225                 
226                 self.systemEntry = None
227                 self.modulationEntry = None
228                 nim = nimmanager.nim_slots[index_to_scan]
229
230                 self.scan_networkScan.value = False
231                 if nim.isCompatible("DVB-S") :
232                         self.list.append(getConfigListEntry(_('Satellite'), self.scan_satselection[self.getSelectedSatIndex(index_to_scan)]))
233                         self.list.append(getConfigListEntry(_('Scan start frequency'), self.blindscan_start_frequency))
234                         self.list.append(getConfigListEntry(_('Scan stop frequency'), self.blindscan_stop_frequency))
235                         self.list.append(getConfigListEntry(_("Polarity"), self.scan_sat.polarization))
236                         self.list.append(getConfigListEntry(_("Scan band"), self.blindscan_hi))
237                         self.list.append(getConfigListEntry(_('Scan start symbolrate'), self.blindscan_start_symbol))
238                         self.list.append(getConfigListEntry(_('Scan stop symbolrate'), self.blindscan_stop_symbol))
239                         self.list.append(getConfigListEntry(_("Clear before scan"), self.scan_clearallservices))
240                         self.list.append(getConfigListEntry(_("Only Free scan"), self.scan_onlyfree))
241                         self["config"].list = self.list
242                         self["config"].l.setList(self.list)
243                         
244         def newConfig(self):
245                 cur = self["config"].getCurrent()
246                 print "cur is", cur
247                 if cur == self.tunerEntry or \
248                         cur == self.systemEntry or \
249                         (self.modulationEntry and self.systemEntry[1].value == eDVBFrontendParametersSatellite.System_DVB_S2 and cur == self.modulationEntry):
250                         self.createSetup()
251
252         def checkSettings(self):
253                 if self.blindscan_start_frequency.value < 950*1000000 or self.blindscan_start_frequency.value > 2150*1000000 :
254                         self.session.open(MessageBox, _("Please check again.\nStart frequency must be between 950 and 2150."), MessageBox.TYPE_ERROR)
255                         return False
256                 if self.blindscan_stop_frequency.value < 950*1000000 or self.blindscan_stop_frequency.value > 2150*1000000 :
257                         self.session.open(MessageBox, _("Please check again.\nStop frequency must be between 950 and 2150."), MessageBox.TYPE_ERROR)
258                         return False
259                 if self.blindscan_start_frequency.value > self.blindscan_stop_frequency.value :
260                         self.session.open(MessageBox, _("Please check again.\nFrequency : start value is larger than stop value."), MessageBox.TYPE_ERROR)
261                         return False
262                 if self.blindscan_start_symbol.value < 2*1000000 or self.blindscan_start_symbol.value > 45*1000000 :
263                         self.session.open(MessageBox, _("Please check again.\nStart symbolrate must be between 2MHz and 45MHz."), MessageBox.TYPE_ERROR)
264                         return False
265                 if self.blindscan_stop_symbol.value < 2*1000000 or self.blindscan_stop_symbol.value > 45*1000000 :
266                         self.session.open(MessageBox, _("Please check again.\nStop symbolrate must be between 2MHz and 45MHz."), MessageBox.TYPE_ERROR)
267                         return False
268                 if self.blindscan_start_symbol.value > self.blindscan_stop_symbol.value :
269                         self.session.open(MessageBox, _("Please check again.\nSymbolrate : start value is larger than stop value."), MessageBox.TYPE_ERROR)
270                         return False
271                 return True
272
273         def keyLeft(self):
274                 ConfigListScreen.keyLeft(self)
275                 self.newConfig()
276
277         def keyRight(self):
278                 ConfigListScreen.keyRight(self)
279                 self.newConfig()
280                         
281         def keyCancel(self):
282                 self.session.nav.playService(self.current_play_service)
283                 for x in self["config"].list:
284                         x[1].cancel()
285                 self.close()
286
287         def keyGo(self):
288                 if self.checkSettings() == False:
289                         return
290
291                 tab_pol = {
292                         eDVBFrontendParametersSatellite.Polarisation_Horizontal : "horizontal", 
293                         eDVBFrontendParametersSatellite.Polarisation_Vertical : "vertical",
294                         eDVBFrontendParametersSatellite.Polarisation_CircularLeft : "circular left",
295                         eDVBFrontendParametersSatellite.Polarisation_CircularRight : "circular right",
296                         eDVBFrontendParametersSatellite.Polarisation_CircularRight + 1 : "horizontal_vertical"
297                 }
298
299                 self.tmp_tplist=[]
300                 tmp_pol = []
301                 tmp_band = []
302                 idx_selected_sat = int(self.getSelectedSatIndex(self.scan_nims.value))
303                 tmp_list=[self.satList[int(self.scan_nims.value)][self.scan_satselection[idx_selected_sat].index]]
304
305                 if self.blindscan_hi.value == "hi_low" :
306                         tmp_band=["low","high"]
307                 else:
308                         tmp_band=[self.blindscan_hi.value]
309                         
310                 if self.scan_sat.polarization.value ==  eDVBFrontendParametersSatellite.Polarisation_CircularRight + 1 : 
311                         tmp_pol=["horizontal","vertical"]
312                 else:
313                         tmp_pol=[tab_pol[self.scan_sat.polarization.value]]
314
315                 self.doRun(tmp_list, tmp_pol, tmp_band)
316                 
317         def keyGoAll(self):
318                 if self.checkSettings() == False:
319                         return
320                 self.tmp_tplist=[]
321                 tmp_list=[]
322                 tmp_band=["low","high"]
323                 tmp_pol=["horizontal","vertical"]
324                 
325                 for slot in nimmanager.nim_slots:
326                         device_name = "/dev/dvb/adapter0/frontend%d" % (slot.slot)
327                         if slot.isCompatible("DVB-S") and int(self.scan_nims.value) == slot.slot:
328                                 for s in self.satList[slot.slot]:
329                                         tmp_list.append(s)
330                 self.doRun(tmp_list, tmp_pol, tmp_band)
331                 
332         def doRun(self, tmp_list, tmp_pol, tmp_band):
333                 self.full_data = ""
334                 self.total_list=[]
335                 for x in tmp_list:
336                         for y in tmp_pol:
337                                 for z in tmp_band:
338                                         self.total_list.append([x,y,z])
339                                         print "add scan item : ", x, ", ", y, ", ", z
340
341                 self.max_count = len(self.total_list)
342                 self.is_runable = True
343                 self.running_count = 0
344                 self.clockTimer = eTimer()
345                 self.clockTimer.callback.append(self.doClock)
346                 self.clockTimer.start(1000)
347
348         def doClock(self):
349                 is_scan = False
350                 if self.is_runable :
351                         if self.running_count >= self.max_count:
352                                 self.clockTimer.stop()
353                                 del self.clockTimer
354                                 self.clockTimer = None
355                                 print "Done"
356                                 return
357                         orb = self.total_list[self.running_count][0]
358                         pol = self.total_list[self.running_count][1]
359                         band = self.total_list[self.running_count][2]
360                         self.running_count = self.running_count + 1
361                         print "running status-[%d] : [%d][%s][%s]" %(self.running_count, orb[0], pol, band)
362                         if self.running_count == self.max_count:
363                                 is_scan = True
364                         self.prepareScanData(orb, pol, band, is_scan)
365
366         def prepareScanData(self, orb, pol, band, is_scan):
367                 self.is_runable = False
368                 self.orb_position = orb[0]
369                 self.feid = int(self.scan_nims.value)
370                 tab_hilow = {"high" : 1, "low" : 0}
371                 tab_pol = {
372                         "horizontal" : eDVBFrontendParametersSatellite.Polarisation_Horizontal, 
373                         "vertical" : eDVBFrontendParametersSatellite.Polarisation_Vertical,
374                         "circular left" : eDVBFrontendParametersSatellite.Polarisation_CircularLeft,
375                         "circular right" : eDVBFrontendParametersSatellite.Polarisation_CircularRight
376                 }
377
378                 returnvalue = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
379
380                 if not self.openFrontend():
381                         self.oldref = self.session.nav.getCurrentlyPlayingServiceReference()
382                         self.session.nav.stopService()
383                         if not self.openFrontend():
384                                 if self.session.pipshown:
385                                         self.session.pipshown = False
386                                         del self.session.pip
387                                         if not self.openFrontend():
388                                                 self.frontend = None
389                 self.tuner = Tuner(self.frontend)
390
391                 if tab_hilow[band]:
392                         self.scan_sat.frequency.value = 12515
393                 else:
394                         self.scan_sat.frequency.value = 11015
395                 returnvalue = (self.scan_sat.frequency.value,
396                                          0,
397                                          tab_pol[pol],
398                                          0,
399                                          0,
400                                          orb[0],
401                                          eDVBFrontendParametersSatellite.System_DVB_S,
402                                          0,
403                                          0,
404                                          0)
405                 self.tuner.tune(returnvalue)
406
407                 if self.getNimSocket(self.feid) < 0:
408                         print "can't find i2c number!!"
409                         return
410
411                 cmd = "vuplus_blindscan %d %d %d %d %d %d %d %d" % (self.blindscan_start_frequency.value/1000000, self.blindscan_stop_frequency.value/1000000, self.blindscan_start_symbol.value/1000000, self.blindscan_stop_symbol.value/1000000, tab_pol[pol], tab_hilow[band], self.feid, self.getNimSocket(self.feid))
412                 print "prepared command : [%s]" % (cmd)
413                 self.blindscan_container = eConsoleAppContainer()
414                 self.blindscan_container.appClosed.append(self.blindscanContainerClose)
415                 self.blindscan_container.dataAvail.append(self.blindscanContainerAvail)
416                 self.blindscan_container.execute(cmd)
417
418                 tmpstr = "Look for available transponders.\nThis works will take several minutes.\n\n   - Current Status : %d/%d\n   - Orbital Positions : %s\n   - Polarization : %s\n   - Bandwidth : %s" %(self.running_count, self.max_count, orb[1], pol, band)
419                 if is_scan :
420                         self.blindscan_session = self.session.openWithCallback(self.blindscanSessionClose, MessageBox, _(tmpstr), MessageBox.TYPE_INFO)
421                 else:
422                         self.blindscan_session = self.session.openWithCallback(self.blindscanSessionNone, MessageBox, _(tmpstr), MessageBox.TYPE_INFO)
423
424         def blindscanContainerClose(self, retval):
425                 lines = self.full_data.split('\n')
426                 for line in lines:
427                         data = line.split()
428                         print "cnt :", len(data), ", data :", data
429                         if len(data) >= 10:
430                                 if data[0] == 'OK':
431                                         parm = eDVBFrontendParametersSatellite()
432                                         sys = { "DVB-S" : eDVBFrontendParametersSatellite.System_DVB_S,
433                                                 "DVB-S2" : eDVBFrontendParametersSatellite.System_DVB_S2}
434                                         qam = { "QPSK" : parm.Modulation_QPSK,
435                                                 "8PSK" : parm.Modulation_8PSK}
436                                         inv = { "INVERSION_OFF" : parm.Inversion_Off,
437                                                 "INVERSION_ON" : parm.Inversion_On,
438                                                 "INVERSION_AUTO" : parm.Inversion_Unknown}
439                                         fec = { "FEC_AUTO" : parm.FEC_Auto,
440                                                 "FEC_1_2" : parm.FEC_1_2,
441                                                 "FEC_2_3" : parm.FEC_2_3,
442                                                 "FEC_3_4" : parm.FEC_3_4,
443                                                 "FEC_5_6": parm.FEC_5_6,
444                                                 "FEC_7_8" : parm.FEC_7_8,
445                                                 "FEC_8_9" : parm.FEC_8_9,
446                                                 "FEC_3_5" : parm.FEC_3_5,
447                                                 "FEC_9_10" : parm.FEC_9_10,
448                                                 "FEC_NONE" : parm.FEC_None}
449                                         roll ={ "ROLLOFF_20" : parm.RollOff_alpha_0_20,
450                                                 "ROLLOFF_25" : parm.RollOff_alpha_0_25,
451                                                 "ROLLOFF_35" : parm.RollOff_alpha_0_35}
452                                         pilot={ "PILOT_ON" : parm.Pilot_On,
453                                                 "PILOT_OFF" : parm.Pilot_Off}
454                                         pol = { "HORIZONTAL" : parm.Polarisation_Horizontal,
455                                                 "VERTICAL" : parm.Polarisation_Vertical}
456                                         try :
457                                                 parm.orbital_position = self.orb_position
458                                                 parm.polarisation = pol[data[1]]
459                                                 parm.frequency = int(data[2])
460                                                 parm.symbol_rate = int(data[3])
461                                                 parm.system = sys[data[4]]
462                                                 parm.inversion = inv[data[5]]
463                                                 parm.pilot = pilot[data[6]]
464                                                 parm.fec = fec[data[7]]
465                                                 parm.modulation = qam[data[8]]
466                                                 parm.rolloff = roll[data[9]]
467                                                 self.tmp_tplist.append(parm)
468                                         except:
469                                                 pass
470                 self.blindscan_session.close(True)
471
472         def blindscanContainerAvail(self, str):
473                 print str
474                 #if str.startswith("OK"):
475                 self.full_data = self.full_data + str
476
477         def blindscanSessionNone(self, *val):
478                 import time
479                 self.blindscan_container.sendCtrlC()
480                 self.blindscan_container = None
481                 time.sleep(2)
482
483                 if self.frontend:
484                         self.frontend = None
485                         del self.raw_channel
486
487                 if val[0] == False:
488                         self.tmp_tplist = []
489                         self.running_count = self.max_count
490
491                 self.is_runable = True
492
493         def blindscanSessionClose(self, *val):
494                 self.blindscanSessionNone(val[0])
495
496                 if self.tmp_tplist != None and self.tmp_tplist != []:
497                         for p in self.tmp_tplist:
498                                 print "data : [%d][%d][%d][%d][%d][%d][%d][%d][%d][%d]" % (p.orbital_position, p.polarisation, p.frequency, p.symbol_rate, p.system, p.inversion, p.pilot, p.fec, p.modulation, p.modulation)
499
500                         self.startScan(self.tmp_tplist, self.feid)
501                 else:
502                         msg = "No found transponders!!\nPlease check the satellite connection, or scan other search condition." 
503                         if val[0] == False:
504                                 msg = "Blindscan was canceled by the user."
505                         self.session.openWithCallback(self.callbackNone, MessageBox, _(msg), MessageBox.TYPE_INFO, timeout=10)
506                         self.tmp_tplist = []
507
508         def startScan(self, tlist, feid, networkid = 0):
509                 self.scan_session = None
510
511                 flags = 0
512                 if self.scan_clearallservices.value:
513                         flags |= eComponentScan.scanRemoveServices
514                 else:
515                         flags |= eComponentScan.scanDontRemoveUnscanned
516                 if self.scan_onlyfree.value:
517                         flags |= eComponentScan.scanOnlyFree
518                 self.session.open(ServiceScan, [{"transponders": tlist, "feid": feid, "flags": flags, "networkid": networkid}])
519
520 def main(session, **kwargs):
521         session.open(Blindscan)
522                                                            
523 def Plugins(**kwargs):            
524         return PluginDescriptor(name=_("Blindscan"), description="scan type(DVB-S)", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=main)
525