add lost line
[enigma2-plugins.git] / wirelesslan / src / Wlan.py
1 # for localized messages
2 from __init__ import _
3
4 from enigma import eListboxPythonMultiContent, eListbox, gFont, RT_HALIGN_LEFT, RT_HALIGN_RIGHT, RT_HALIGN_CENTER
5 from Components.MultiContent import MultiContentEntryText
6 from Components.GUIComponent import GUIComponent
7 from Components.HTMLComponent import HTMLComponent
8 from Components.config import config, ConfigYesNo, NoSave, ConfigSubsection, ConfigText, ConfigSelection, ConfigPassword
9 from Components.Console import Console
10
11 from os import system
12 from string import maketrans, strip
13 import sys
14 import types
15 from re import compile as re_compile, search as re_search
16 from iwlibs import getNICnames, Wireless, Iwfreq
17
18 list = []
19 list.append("WEP")
20 list.append("WPA")
21 list.append("WPA2")
22 list.append("WPA/WPA2")
23
24 weplist = []
25 weplist.append("ASCII")
26 weplist.append("HEX")
27
28 config.plugins.wlan = ConfigSubsection()
29 config.plugins.wlan.essid = NoSave(ConfigText(default = "home", fixed_size = False))
30 config.plugins.wlan.hiddenessid = NoSave(ConfigText(default = "home", fixed_size = False))
31
32 config.plugins.wlan.encryption = ConfigSubsection()
33 config.plugins.wlan.encryption.enabled = NoSave(ConfigYesNo(default = True))
34 config.plugins.wlan.encryption.type = NoSave(ConfigSelection(list, default = "WPA/WPA2"))
35 config.plugins.wlan.encryption.wepkeytype = NoSave(ConfigSelection(weplist, default = "ASCII"))
36 config.plugins.wlan.encryption.psk = NoSave(ConfigPassword(default = "mysecurewlan", fixed_size = False))
37
38 class Wlan:
39         def __init__(self, iface):
40                 a = ''; b = ''
41                 
42                 for i in range(0, 255):
43                     a = a + chr(i)
44                     if i < 32 or i > 127:
45                         b = b + ' '
46                     else:
47                         b = b + chr(i)
48                 
49                 self.iface = iface
50                 self.wlaniface = {}
51                 self.WlanConsole = Console()
52                 self.asciitrans = maketrans(a, b)
53
54         def stopWlanConsole(self):
55                 if self.WlanConsole is not None:
56                         print "killing self.WlanConsole"
57                         self.WlanConsole = None
58                         del self.WlanConsole
59                         
60         def getDataForInterface(self, callback = None):
61                 #get ip out of ip addr, as avahi sometimes overrides it in ifconfig.
62                 print "self.iface im getDataForInterface",self.iface
63                 if len(self.WlanConsole.appContainers) == 0:
64                         self.WlanConsole = Console()
65                         cmd = "iwconfig " + self.iface
66                         self.WlanConsole.ePopen(cmd, self.iwconfigFinished, callback)
67
68         def iwconfigFinished(self, result, retval, extra_args):
69                 print "self.iface im iwconfigFinished",self.iface
70                 callback = extra_args
71                 data = { 'essid': False, 'frequency': False, 'acesspoint': False, 'bitrate': False, 'encryption': False, 'quality': False, 'signal': False }
72                 #print "result im iwconfigFinished",result
73                 
74                 for line in result.splitlines():
75                         #print "line",line
76                         line = line.strip()
77                         if "ESSID" in line:
78                                 if "off/any" in line:
79                                         ssid = _("No Connection")
80                                 else:
81                                         tmpssid=(line[line.index('ESSID')+7:len(line)-1])
82                                         if tmpssid == '':
83                                                 ssid = _("Hidden networkname")
84                                         elif tmpssid ==' ':
85                                                 ssid = _("Hidden networkname")
86                                         else:
87                                             ssid = tmpssid
88                                 #print "SSID->",ssid
89                                 if ssid is not None:
90                                         data['essid'] = ssid
91                         if 'Frequency' in line:
92                                 frequency = line[line.index('Frequency')+10 :line.index(' GHz')]
93                                 #print "Frequency",frequency   
94                                 if frequency is not None:
95                                         data['frequency'] = frequency
96                         if "Access Point" in line:
97                                 ap=line[line.index('Access Point')+14:len(line)-1]
98                                 #print "AP",ap
99                                 if ap is not None:
100                                         data['acesspoint'] = ap
101                         if "Bit Rate" in line:
102                                 br = line[line.index('Bit Rate')+9 :line.index(' Mb/s')]
103                                 #print "Bitrate",br
104                                 if br is not None:
105                                         data['bitrate'] = br
106                         if 'Encryption key' in line:
107                                 if ":off" in line:
108                                     enc = _("Disabled")
109                                 else:
110                                     enc = line[line.index('Encryption key')+15 :line.index('   Security')]
111                                 #print "Encryption key",enc 
112                                 if enc is not None:
113                                         data['encryption'] = _("Enabled")
114                         if 'Quality' in line:
115                                 if "/100" in line:
116                                         qual = line[line.index('Quality')+8:line.index('/100')]
117                                 else:
118                                         qual = line[line.index('Quality')+8:line.index('Sig')]
119                                 #print "Quality",qual
120                                 if qual is not None:
121                                         data['quality'] = qual
122                         if 'Signal level' in line:
123                                 signal = line[line.index('Signal level')+14 :line.index(' dBm')]
124                                 #print "Signal level",signal            
125                                 if signal is not None:
126                                         data['signal'] = signal
127
128                 self.wlaniface[self.iface] = data
129                 
130                 if len(self.WlanConsole.appContainers) == 0:
131                         print "self.wlaniface after loading:", self.wlaniface
132                         self.WlanConsole = None
133                         if callback is not None:
134                                 callback(True,self.wlaniface)
135
136         def getAdapterAttribute(self, attribute):
137                 print "im getAdapterAttribute"
138                 if self.wlaniface.has_key(self.iface):
139                         print "self.wlaniface.has_key",self.iface
140                         if self.wlaniface[self.iface].has_key(attribute):
141                                 return self.wlaniface[self.iface][attribute]
142                 return None
143                 
144         def asciify(self, str):
145                 return str.translate(self.asciitrans)
146
147         
148         def getWirelessInterfaces(self):
149                 iwifaces = None
150                 try:
151                         iwifaces = getNICnames()
152                 except:
153                         print "[Wlan.py] No Wireless Networkcards could be found"
154                 
155                 return iwifaces
156
157         
158         def getNetworkList(self):
159                 system("ifconfig "+self.iface+" up")
160                 ifobj = Wireless(self.iface) # a Wireless NIC Object
161                 
162                 #Association mappings
163                 stats, quality, discard, missed_beacon = ifobj.getStatistics()
164                 snr = quality.signallevel - quality.noiselevel
165
166                 try:
167                         scanresults = ifobj.scan()
168                 except:
169                         scanresults = None
170                         print "[Wlan.py] No Wireless Networks could be found"
171                 
172                 if scanresults is not None:
173                         aps = {}
174                         for result in scanresults:
175                         
176                                 bssid = result.bssid
177                 
178                                 encryption = map(lambda x: hex(ord(x)), result.encode)
179                 
180                                 if encryption[-1] == "0x8":
181                                         encryption = True
182                                 else:
183                                         encryption = False
184                 
185                                 extra = []
186                                 for element in result.custom:
187                                         element = element.encode()
188                                         extra.append( strip(self.asciify(element)) )
189                                 
190                                 if result.quality.sl is 0 and len(extra) > 0:
191                                         begin = extra[0].find('SignalStrength=')+15
192                                                                         
193                                         done = False
194                                         end = begin+1
195                                         
196                                         while not done:
197                                                 if extra[0][begin:end].isdigit():
198                                                         end += 1
199                                                 else:
200                                                         done = True
201                                                         end -= 1
202                                         
203                                         signal = extra[0][begin:end]
204                                         #print "[Wlan.py] signal is:" + str(signal)
205
206                                 else:
207                                         signal = str(result.quality.sl)
208                                 
209                                 aps[bssid] = {
210                                         'active' : True,
211                                         'bssid': result.bssid,
212                                         'channel': result.frequency.getChannel(result.frequency.getFrequency()),
213                                         'encrypted': encryption,
214                                         'essid': strip(self.asciify(result.essid)),
215                                         'iface': self.iface,
216                                         'maxrate' : result.rate[-1],
217                                         'noise' : result.quality.getNoiselevel(),
218                                         'quality' : str(result.quality.quality),
219                                         'signal' : signal,
220                                         'custom' : extra,
221                                 }
222                                 print aps[bssid]
223                         return aps
224
225                 
226         def getStatus(self):
227                 ifobj = Wireless(self.iface)
228                 fq = Iwfreq()
229                 try:
230                         self.channel = str(fq.getChannel(str(ifobj.getFrequency()[0:-3])))
231                 except:
232                         self.channel = 0
233                 #print ifobj.getStatistics()
234                 status = {
235                                   'BSSID': str(ifobj.getAPaddr()),
236                                   'ESSID': str(ifobj.getEssid()),
237                                   'quality': str(ifobj.getStatistics()[1].quality),
238                                   'signal': str(ifobj.getStatistics()[1].sl),
239                                   'bitrate': str(ifobj.getBitrate()),
240                                   'channel': str(self.channel),
241                                   #'channel': str(fq.getChannel(str(ifobj.getFrequency()[0:-3]))),
242                 }
243                 
244                 for (key, item) in status.items():
245                         if item is "None" or item is "":
246                                         status[key] = _("N/A")
247                                 
248                 return status
249
250
251
252 class WlanList(HTMLComponent, GUIComponent):
253         def __init__(self, session, iface):
254                 
255                 GUIComponent.__init__(self)
256                 self.w = Wlan(iface)
257                 self.iface = iface
258                 
259                 self.length = 0
260                 self.aplist = None
261                 self.l = None
262                 self.l = eListboxPythonMultiContent()
263                 
264                 self.l.setFont(0, gFont("Regular", 32))
265                 self.l.setFont(1, gFont("Regular", 18))
266                 self.l.setFont(2, gFont("Regular", 16))
267                 self.l.setBuildFunc(self.buildWlanListEntry)            
268                                 
269                 self.reload()
270         
271         def buildWlanListEntry(self, essid, bssid, encrypted, iface, maxrate, signal):                                                                                                 
272                 
273                 res = [ (essid, encrypted, iface) ]
274                 
275                 if essid == "":
276                         essid = bssid
277                 
278                 e = encrypted and _("Yes") or _("No")
279                 res.append( MultiContentEntryText(pos=(0, 0), size=(470, 35), font=0, flags=RT_HALIGN_LEFT, text=essid) )
280                 res.append( MultiContentEntryText(pos=(425, 0), size=(60, 20), font=1, flags=RT_HALIGN_LEFT, text=_("Signal: ")))
281                 res.append( MultiContentEntryText(pos=(480, 0), size=(70, 35), font=0, flags=RT_HALIGN_RIGHT, text="%s" %signal))
282                 res.append( MultiContentEntryText(pos=(0, 40), size=(180, 20), font=1, flags=RT_HALIGN_LEFT, text=_("Max. Bitrate: %s") %maxrate ))
283                 res.append( MultiContentEntryText(pos=(190, 40), size=(180, 20), font=1, flags=RT_HALIGN_CENTER, text=_("Encrypted: %s") %e ))
284                 res.append( MultiContentEntryText(pos=(360, 40), size=(190, 20), font=1, flags=RT_HALIGN_RIGHT, text=_("Interface: %s") %iface ))
285                 return res
286                 
287                         
288         def reload(self):
289                 aps = self.w.getNetworkList()
290                 list = []
291                 self.aplist = []
292                 if aps is not None:
293                         print "[Wlan.py] got Accespoints!"
294                         for ap in aps:
295                                 a = aps[ap]
296                                 if a['active']:
297                                         if a['essid'] == "":
298                                                 a['essid'] = a['bssid']
299                                         list.append( (a['essid'], a['bssid'], a['encrypted'], a['iface'], a['maxrate'], a['signal']) )
300                                         self.aplist.append( a['essid'])
301                 
302                 self.length = len(list)
303                 self.l.setList([])
304                 self.l.setList(list)
305                         
306         GUI_WIDGET = eListbox
307
308
309         def getCurrent(self):
310                 return self.l.getCurrentSelection()
311         
312         
313         def postWidgetCreate(self, instance):
314                 instance.setContent(self.l)
315                 instance.setItemHeight(60)
316         
317         
318         def getLength(self):
319                 return self.length
320         
321         def getList(self):
322                 return self.aplist
323
324
325 class wpaSupplicant:
326         def __init__(self):
327                 pass
328         
329                 
330         def writeConfig(self):  
331                         
332                         essid = config.plugins.wlan.essid.value
333                         hiddenessid = config.plugins.wlan.hiddenessid.value
334                         encrypted = config.plugins.wlan.encryption.enabled.value
335                         encryption = config.plugins.wlan.encryption.type.value
336                         wepkeytype = config.plugins.wlan.encryption.wepkeytype.value
337                         psk = config.plugins.wlan.encryption.psk.value
338                         fp = file('/etc/wpa_supplicant.conf', 'w')
339                         fp.write('#WPA Supplicant Configuration by enigma2\n')
340                         fp.write('ctrl_interface=/var/run/wpa_supplicant\n')
341                         fp.write('eapol_version=1\n')
342                         fp.write('fast_reauth=1\n')     
343                         if essid == 'hidden...':
344                                 fp.write('ap_scan=2\n')
345                         else:
346                                 fp.write('ap_scan=1\n')
347                         fp.write('network={\n')
348                         if essid == 'hidden...':
349                                 fp.write('\tssid="'+hiddenessid+'"\n')
350                         else:
351                                 fp.write('\tssid="'+essid+'"\n')
352                         fp.write('\tscan_ssid=0\n')                     
353                         if encrypted:
354                                 if encryption == 'WPA' or encryption == 'WPA2' or encryption == 'WPA/WPA2' :
355                                         fp.write('\tkey_mgmt=WPA-PSK\n')
356                                         
357                                         if encryption == 'WPA':
358                                                 fp.write('\tproto=WPA\n')
359                                                 fp.write('\tpairwise=TKIP\n')
360                                                 fp.write('\tgroup=TKIP\n')
361                                         elif encryption == 'WPA2':
362                                                 fp.write('\tproto=WPA RSN\n')
363                                                 fp.write('\tpairwise=CCMP TKIP\n')
364                                                 fp.write('\tgroup=CCMP TKIP\n')                                         
365                                         else:
366                                                 fp.write('\tproto=WPA WPA2\n')
367                                                 fp.write('\tpairwise=CCMP\n')
368                                                 fp.write('\tgroup=TKIP\n')                                      
369                                         fp.write('\tpsk="'+psk+'"\n')
370                                                 
371                                 elif encryption == 'WEP':
372                                         fp.write('\tkey_mgmt=NONE\n')
373                                         if wepkeytype == 'ASCII':
374                                                 fp.write('\twep_key0="'+psk+'"\n')
375                                         else:
376                                                 fp.write('\twep_key0='+psk+'\n')
377                         else:
378                                 fp.write('\tkey_mgmt=NONE\n')                   
379                         fp.write('}')
380                         fp.write('\n')
381                         fp.close()
382                         system("cat /etc/wpa_supplicant.conf")
383                 
384         def loadConfig(self):
385                 try:
386                         #parse the wpasupplicant configfile
387                         fp = file('/etc/wpa_supplicant.conf', 'r')
388                         supplicant = fp.readlines()
389                         fp.close()
390                         ap_scan = False
391                         essid = None
392
393                         for s in supplicant:
394                                 split = s.strip().split('=',1)
395                                 if split[0] == 'ap_scan':
396                                         print "[Wlan.py] Got Hidden SSID Scan  Value "+split[1]
397                                         if split[1] == '2':
398                                                 ap_scan = True
399                                         else:
400                                                 ap_scan = False
401                                                 
402                                 elif split[0] == 'ssid':
403                                         print "[Wlan.py] Got SSID "+split[1][1:-1]
404                                         essid = split[1][1:-1]
405                                         
406                                 elif split[0] == 'proto':
407                                         print "split[1]",split[1]
408                                         config.plugins.wlan.encryption.enabled.value = True
409                                         if split[1] == "WPA" :
410                                                 mode = 'WPA'
411                                         if split[1] == "WPA WPA2" :
412                                                 mode = 'WPA/WPA2'
413                                         if split[1] == "WPA RSN" :
414                                                 mode = 'WPA2'
415                                         config.plugins.wlan.encryption.type.value = mode
416                                         print "[Wlan.py] Got Encryption: "+mode
417                                         
418                                 #currently unused !
419                                 #elif split[0] == 'key_mgmt':
420                                 #       print "split[1]",split[1]
421                                 #       if split[1] == "WPA-PSK" :
422                                 #               config.plugins.wlan.encryption.enabled.value = True
423                                 #               config.plugins.wlan.encryption.type.value = "WPA/WPA2"
424                                 #       print "[Wlan.py] Got Encryption: "+ config.plugins.wlan.encryption.type.value
425                                         
426                                 elif split[0] == 'wep_key0':
427                                         config.plugins.wlan.encryption.enabled.value = True
428                                         config.plugins.wlan.encryption.type.value = 'WEP'
429                                         if split[1].startswith('"') and split[1].endswith('"'):
430                                                 config.plugins.wlan.encryption.wepkeytype.value = 'ASCII'
431                                                 config.plugins.wlan.encryption.psk.value = split[1][1:-1]
432                                         else:
433                                                 config.plugins.wlan.encryption.wepkeytype.value = 'HEX'
434                                                 config.plugins.wlan.encryption.psk.value = split[1]                                             
435                                         print "[Wlan.py] Got Encryption: WEP - keytype is: "+config.plugins.wlan.encryption.wepkeytype.value
436                                         print "[Wlan.py] Got Encryption: WEP - key0 is: "+config.plugins.wlan.encryption.psk.value
437                                         
438                                 elif split[0] == 'psk':
439                                         config.plugins.wlan.encryption.psk.value = split[1][1:-1]
440                                         print "[Wlan.py] Got PSK: "+split[1][1:-1]
441                                 else:
442                                         pass
443                                 
444                         if ap_scan is True:
445                                 config.plugins.wlan.hiddenessid.value = essid
446                                 config.plugins.wlan.essid.value = 'hidden...'
447                         else:
448                                 config.plugins.wlan.hiddenessid.value = essid
449                                 config.plugins.wlan.essid.value = essid
450                         wsconfig = {
451                                         'hiddenessid': config.plugins.wlan.hiddenessid.value,
452                                         'ssid': config.plugins.wlan.essid.value,
453                                         'encryption': config.plugins.wlan.encryption.enabled.value,
454                                         'encryption_type': config.plugins.wlan.encryption.type.value,
455                                         'encryption_wepkeytype': config.plugins.wlan.encryption.wepkeytype.value,
456                                         'key': config.plugins.wlan.encryption.psk.value,
457                                 }
458                 
459                         for (key, item) in wsconfig.items():
460                                 if item is "None" or item is "":
461                                         if key == 'hiddenessid':
462                                                 wsconfig['hiddenessid'] = "home"
463                                         if key == 'ssid':
464                                                 wsconfig['ssid'] = "home"
465                                         if key == 'encryption':
466                                                 wsconfig['encryption'] = True                           
467                                         if key == 'encryption':
468                                                 wsconfig['encryption_type'] = "WPA/WPA2"
469                                         if key == 'encryption':
470                                                 wsconfig['encryption_wepkeytype'] = "ASCII"
471                                         if key == 'encryption':
472                                                 wsconfig['key'] = "mysecurewlan"
473
474                 except:
475                         print "[Wlan.py] Error parsing /etc/wpa_supplicant.conf"
476                         wsconfig = {
477                                         'hiddenessid': "home",
478                                         'ssid': "home",
479                                         'encryption': True,
480                                         'encryption_type': "WPA/WPA2",
481                                         'encryption_wepkeytype': "ASCII",
482                                         'key': "mysecurewlan",
483                                 }
484                 print "[Wlan.py] WS-CONFIG-->",wsconfig
485                 return wsconfig
486
487         
488         def restart(self, iface):
489                 system("start-stop-daemon -K -x /usr/sbin/wpa_supplicant")
490                 system("start-stop-daemon -S -x /usr/sbin/wpa_supplicant -- -B -i"+iface+" -c/etc/wpa_supplicant.conf")
491
492 class Status:
493         def __init__(self):
494                 self.wlaniface = {}
495                 self.backupwlaniface = {}
496                 self.WlanConsole = Console()
497
498         def stopWlanConsole(self):
499                 if self.WlanConsole is not None:
500                         print "killing self.WlanConsole"
501                         self.WlanConsole = None
502                         
503         def getDataForInterface(self, iface, callback = None):
504                 self.WlanConsole = Console()
505                 cmd = "iwconfig " + iface
506                 self.WlanConsole.ePopen(cmd, self.iwconfigFinished, [iface, callback])
507
508         def iwconfigFinished(self, result, retval, extra_args):
509                 (iface, callback) = extra_args
510                 data = { 'essid': False, 'frequency': False, 'acesspoint': False, 'bitrate': False, 'encryption': False, 'quality': False, 'signal': False }
511                 for line in result.splitlines():
512                         line = line.strip()
513                         if "ESSID" in line:
514                                 if "off/any" in line:
515                                         ssid = _("No Connection")
516                                 else:
517                                         tmpssid=(line[line.index('ESSID')+7:len(line)-1])
518                                         if tmpssid == '':
519                                                 ssid = _("Hidden networkname")
520                                         elif tmpssid ==' ':
521                                                 ssid = _("Hidden networkname")
522                                         else:
523                                             ssid = tmpssid
524                                 #print "SSID->",ssid
525                                 if ssid is not None:
526                                         data['essid'] = ssid
527                         if 'Frequency' in line:
528                                 frequency = line[line.index('Frequency')+10 :line.index(' GHz')]
529                                 #print "Frequency",frequency   
530                                 if frequency is not None:
531                                         data['frequency'] = frequency
532                         if "Access Point" in line:
533                                 ap=line[line.index('Access Point')+14:len(line)]
534                                 #print "AP",ap
535                                 if ap is not None:
536                                         data['acesspoint'] = ap
537                                         if ap == "Not-Associated":
538                                                 data['essid'] = _("No Connection")
539                         if "Bit Rate" in line:
540                                 if "kb" in line:
541                                         br = line[line.index('Bit Rate')+9 :line.index(' kb/s')]
542                                         if br == '0':
543                                                 br = _("Unsupported")
544                                         else:
545                                                 br += " Mb/s"
546                                 else:
547                                         br = line[line.index('Bit Rate')+9 :line.index(' Mb/s')] + " Mb/s"
548                                 #print "Bitrate",br
549                                 if br is not None:
550                                         data['bitrate'] = br
551                         if 'Encryption key' in line:
552                                 if ":off" in line:
553                                         if data['acesspoint'] is not "Not-Associated":
554                                                 enc = _("Unsupported")
555                                         else:
556                                                 enc = _("Disabled")
557                                 else:
558                                         enc = line[line.index('Encryption key')+15 :line.index('   Security')]
559                                         if enc is not None:
560                                                 enc = _("Enabled")
561                                 #print "Encryption key",enc 
562                                 if enc is not None:
563                                         data['encryption'] = enc
564                         if 'Quality' in line:
565                                 if "/100" in line:
566                                         qual = line[line.index('Quality')+8:line.index('/100')]
567                                 else:
568                                         qual = line[line.index('Quality')+8:line.index('Sig')]
569                                 #print "Quality",qual
570                                 if qual is not None:
571                                         data['quality'] = qual
572                         if 'Signal level' in line:
573                                 if "dBm" in line:
574                                         signal = line[line.index('Signal level')+14 :line.index(' dBm')]
575                                         signal += " dBm"
576                                 elif "/100" in line:
577                                         signal = line[line.index('Signal level')+13:line.index('/100  Noise')]
578                                         signal += "%"
579                                 else:
580                                         signal = line[line.index('Signal level')+13:line.index('  Noise')]
581                                         signal += "%"
582                                 #print "Signal level",signal            
583                                 if signal is not None:
584                                         data['signal'] = signal
585
586                 self.wlaniface[iface] = data
587                 self.backupwlaniface = self.wlaniface
588                 
589                 if self.WlanConsole is not None:
590                         if len(self.WlanConsole.appContainers) == 0:
591                                 print "self.wlaniface after loading:", self.wlaniface
592                                 if callback is not None:
593                                         callback(True,self.wlaniface)
594
595         def getAdapterAttribute(self, iface, attribute):
596                 print "im getAdapterAttribute"
597                 self.iface = iface
598                 if self.wlaniface.has_key(self.iface):
599                         print "self.wlaniface.has_key",self.iface
600                         if self.wlaniface[self.iface].has_key(attribute):
601                                 return self.wlaniface[self.iface][attribute]
602                 return None
603         
604 iStatus = Status()