WirelessLan Plugin: - replace labels and buttons through StaticText for better skinab...
[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.list = None
262                 self.oldlist = None
263                 self.l = None
264                 self.l = eListboxPythonMultiContent()
265                 
266                 self.l.setFont(0, gFont("Regular", 32))
267                 self.l.setFont(1, gFont("Regular", 18))
268                 self.l.setFont(2, gFont("Regular", 16))
269                 self.l.setBuildFunc(self.buildWlanListEntry)            
270                                 
271                 self.reload()
272         
273         def buildWlanListEntry(self, essid, bssid, encrypted, iface, maxrate, signal):                                                                                                 
274                 
275                 res = [ (essid, encrypted, iface) ]
276                 
277                 if essid == "":
278                         essid = bssid
279                 
280                 e = encrypted and _("Yes") or _("No")
281                 res.append( MultiContentEntryText(pos=(0, 0), size=(470, 35), font=0, flags=RT_HALIGN_LEFT, text=essid) )
282                 res.append( MultiContentEntryText(pos=(425, 0), size=(60, 20), font=1, flags=RT_HALIGN_LEFT, text=_("Signal: ")))
283                 res.append( MultiContentEntryText(pos=(480, 0), size=(70, 35), font=0, flags=RT_HALIGN_RIGHT, text="%s" %signal))
284                 res.append( MultiContentEntryText(pos=(0, 40), size=(180, 20), font=1, flags=RT_HALIGN_LEFT, text=_("Max. Bitrate: %s") %maxrate ))
285                 res.append( MultiContentEntryText(pos=(190, 40), size=(180, 20), font=1, flags=RT_HALIGN_CENTER, text=_("Encrypted: %s") %e ))
286                 res.append( MultiContentEntryText(pos=(345, 40), size=(190, 20), font=1, flags=RT_HALIGN_RIGHT, text=_("Interface: %s") %iface ))
287                 return res
288                 
289                         
290         def reload(self):
291                 aps = self.w.getNetworkList()
292
293                 self.list = []
294                 self.aplist = []
295                 if aps is not None:
296                         print "[Wlan.py] got Accespoints!"
297                         for ap in aps:
298                                 a = aps[ap]
299                                 if a['active']:
300                                         if a['essid'] != '':
301                                         #       a['essid'] = a['bssid']
302                                                 self.list.append( (a['essid'], a['bssid'], a['encrypted'], a['iface'], a['maxrate'], a['signal']) )
303                                         #self.aplist.append( a['essid'])
304                 if self.oldlist is not None:
305                         for entry in self.oldlist:
306                                 if entry not in self.list:
307                                         self.list.append(entry)
308                 
309                 if len(self.list):
310                         for entry in self.list:
311                                 self.aplist.append( entry[0])
312                 self.length = len(self.list)
313                 self.oldlist = self.list
314                 self.l.setList([])
315                 self.l.setList(self.list)
316                         
317         GUI_WIDGET = eListbox
318
319
320         def getCurrent(self):
321                 return self.l.getCurrentSelection()
322         
323         
324         def postWidgetCreate(self, instance):
325                 instance.setContent(self.l)
326                 instance.setItemHeight(60)
327         
328         
329         def getLength(self):
330                 return self.length
331         
332         def getList(self):
333                 return self.aplist
334
335
336 class wpaSupplicant:
337         def __init__(self):
338                 pass
339         
340                 
341         def writeConfig(self):  
342                         
343                         essid = config.plugins.wlan.essid.value
344                         hiddenessid = config.plugins.wlan.hiddenessid.value
345                         encrypted = config.plugins.wlan.encryption.enabled.value
346                         encryption = config.plugins.wlan.encryption.type.value
347                         wepkeytype = config.plugins.wlan.encryption.wepkeytype.value
348                         psk = config.plugins.wlan.encryption.psk.value
349                         fp = file('/etc/wpa_supplicant.conf', 'w')
350                         fp.write('#WPA Supplicant Configuration by enigma2\n')
351                         fp.write('ctrl_interface=/var/run/wpa_supplicant\n')
352                         fp.write('eapol_version=1\n')
353                         fp.write('fast_reauth=1\n')     
354                         if essid == 'hidden...':
355                                 fp.write('ap_scan=2\n')
356                         else:
357                                 fp.write('ap_scan=1\n')
358                         fp.write('network={\n')
359                         if essid == 'hidden...':
360                                 fp.write('\tssid="'+hiddenessid+'"\n')
361                         else:
362                                 fp.write('\tssid="'+essid+'"\n')
363                         fp.write('\tscan_ssid=0\n')                     
364                         if encrypted:
365                                 if encryption == 'WPA' or encryption == 'WPA2' or encryption == 'WPA/WPA2' :
366                                         fp.write('\tkey_mgmt=WPA-PSK\n')
367                                         
368                                         if encryption == 'WPA':
369                                                 fp.write('\tproto=WPA\n')
370                                                 fp.write('\tpairwise=TKIP\n')
371                                                 fp.write('\tgroup=TKIP\n')
372                                         elif encryption == 'WPA2':
373                                                 fp.write('\tproto=WPA RSN\n')
374                                                 fp.write('\tpairwise=CCMP TKIP\n')
375                                                 fp.write('\tgroup=CCMP TKIP\n')                                         
376                                         else:
377                                                 fp.write('\tproto=WPA WPA2\n')
378                                                 fp.write('\tpairwise=CCMP\n')
379                                                 fp.write('\tgroup=TKIP\n')                                      
380                                         fp.write('\tpsk="'+psk+'"\n')
381                                                 
382                                 elif encryption == 'WEP':
383                                         fp.write('\tkey_mgmt=NONE\n')
384                                         if wepkeytype == 'ASCII':
385                                                 fp.write('\twep_key0="'+psk+'"\n')
386                                         else:
387                                                 fp.write('\twep_key0='+psk+'\n')
388                         else:
389                                 fp.write('\tkey_mgmt=NONE\n')                   
390                         fp.write('}')
391                         fp.write('\n')
392                         fp.close()
393                         system("cat /etc/wpa_supplicant.conf")
394                 
395         def loadConfig(self):
396                 try:
397                         #parse the wpasupplicant configfile
398                         fp = file('/etc/wpa_supplicant.conf', 'r')
399                         supplicant = fp.readlines()
400                         fp.close()
401                         ap_scan = False
402                         essid = None
403
404                         for s in supplicant:
405                                 split = s.strip().split('=',1)
406                                 if split[0] == 'ap_scan':
407                                         print "[Wlan.py] Got Hidden SSID Scan  Value "+split[1]
408                                         if split[1] == '2':
409                                                 ap_scan = True
410                                         else:
411                                                 ap_scan = False
412                                                 
413                                 elif split[0] == 'ssid':
414                                         print "[Wlan.py] Got SSID "+split[1][1:-1]
415                                         essid = split[1][1:-1]
416                                         
417                                 elif split[0] == 'proto':
418                                         print "split[1]",split[1]
419                                         config.plugins.wlan.encryption.enabled.value = True
420                                         if split[1] == "WPA" :
421                                                 mode = 'WPA'
422                                         if split[1] == "WPA WPA2" :
423                                                 mode = 'WPA/WPA2'
424                                         if split[1] == "WPA RSN" :
425                                                 mode = 'WPA2'
426                                         config.plugins.wlan.encryption.type.value = mode
427                                         print "[Wlan.py] Got Encryption: "+mode
428                                         
429                                 #currently unused !
430                                 #elif split[0] == 'key_mgmt':
431                                 #       print "split[1]",split[1]
432                                 #       if split[1] == "WPA-PSK" :
433                                 #               config.plugins.wlan.encryption.enabled.value = True
434                                 #               config.plugins.wlan.encryption.type.value = "WPA/WPA2"
435                                 #       print "[Wlan.py] Got Encryption: "+ config.plugins.wlan.encryption.type.value
436                                         
437                                 elif split[0] == 'wep_key0':
438                                         config.plugins.wlan.encryption.enabled.value = True
439                                         config.plugins.wlan.encryption.type.value = 'WEP'
440                                         if split[1].startswith('"') and split[1].endswith('"'):
441                                                 config.plugins.wlan.encryption.wepkeytype.value = 'ASCII'
442                                                 config.plugins.wlan.encryption.psk.value = split[1][1:-1]
443                                         else:
444                                                 config.plugins.wlan.encryption.wepkeytype.value = 'HEX'
445                                                 config.plugins.wlan.encryption.psk.value = split[1]                                             
446                                         print "[Wlan.py] Got Encryption: WEP - keytype is: "+config.plugins.wlan.encryption.wepkeytype.value
447                                         print "[Wlan.py] Got Encryption: WEP - key0 is: "+config.plugins.wlan.encryption.psk.value
448                                         
449                                 elif split[0] == 'psk':
450                                         config.plugins.wlan.encryption.psk.value = split[1][1:-1]
451                                         print "[Wlan.py] Got PSK: "+split[1][1:-1]
452                                 else:
453                                         pass
454                                 
455                         if ap_scan is True:
456                                 config.plugins.wlan.hiddenessid.value = essid
457                                 config.plugins.wlan.essid.value = 'hidden...'
458                         else:
459                                 config.plugins.wlan.hiddenessid.value = essid
460                                 config.plugins.wlan.essid.value = essid
461                         wsconfig = {
462                                         'hiddenessid': config.plugins.wlan.hiddenessid.value,
463                                         'ssid': config.plugins.wlan.essid.value,
464                                         'encryption': config.plugins.wlan.encryption.enabled.value,
465                                         'encryption_type': config.plugins.wlan.encryption.type.value,
466                                         'encryption_wepkeytype': config.plugins.wlan.encryption.wepkeytype.value,
467                                         'key': config.plugins.wlan.encryption.psk.value,
468                                 }
469                 
470                         for (key, item) in wsconfig.items():
471                                 if item is "None" or item is "":
472                                         if key == 'hiddenessid':
473                                                 wsconfig['hiddenessid'] = "home"
474                                         if key == 'ssid':
475                                                 wsconfig['ssid'] = "home"
476                                         if key == 'encryption':
477                                                 wsconfig['encryption'] = True                           
478                                         if key == 'encryption':
479                                                 wsconfig['encryption_type'] = "WPA/WPA2"
480                                         if key == 'encryption':
481                                                 wsconfig['encryption_wepkeytype'] = "ASCII"
482                                         if key == 'encryption':
483                                                 wsconfig['key'] = "mysecurewlan"
484
485                 except:
486                         print "[Wlan.py] Error parsing /etc/wpa_supplicant.conf"
487                         wsconfig = {
488                                         'hiddenessid': "home",
489                                         'ssid': "home",
490                                         'encryption': True,
491                                         'encryption_type': "WPA/WPA2",
492                                         'encryption_wepkeytype': "ASCII",
493                                         'key': "mysecurewlan",
494                                 }
495                 print "[Wlan.py] WS-CONFIG-->",wsconfig
496                 return wsconfig
497
498         
499         def restart(self, iface):
500                 system("start-stop-daemon -K -x /usr/sbin/wpa_supplicant")
501                 system("start-stop-daemon -S -x /usr/sbin/wpa_supplicant -- -B -i"+iface+" -c/etc/wpa_supplicant.conf")
502
503 class Status:
504         def __init__(self):
505                 self.wlaniface = {}
506                 self.backupwlaniface = {}
507                 self.WlanConsole = Console()
508
509         def stopWlanConsole(self):
510                 if self.WlanConsole is not None:
511                         print "killing self.WlanConsole"
512                         self.WlanConsole = None
513                         
514         def getDataForInterface(self, iface, callback = None):
515                 self.WlanConsole = Console()
516                 cmd = "iwconfig " + iface
517                 self.WlanConsole.ePopen(cmd, self.iwconfigFinished, [iface, callback])
518
519         def iwconfigFinished(self, result, retval, extra_args):
520                 (iface, callback) = extra_args
521                 data = { 'essid': False, 'frequency': False, 'acesspoint': False, 'bitrate': False, 'encryption': False, 'quality': False, 'signal': False }
522                 for line in result.splitlines():
523                         line = line.strip()
524                         if "ESSID" in line:
525                                 if "off/any" in line:
526                                         ssid = _("No Connection")
527                                 else:
528                                         tmpssid=(line[line.index('ESSID')+7:len(line)-1])
529                                         if tmpssid == '':
530                                                 ssid = _("Hidden networkname")
531                                         elif tmpssid ==' ':
532                                                 ssid = _("Hidden networkname")
533                                         else:
534                                             ssid = tmpssid
535                                 #print "SSID->",ssid
536                                 if ssid is not None:
537                                         data['essid'] = ssid
538                         if 'Frequency' in line:
539                                 frequency = line[line.index('Frequency')+10 :line.index(' GHz')]
540                                 #print "Frequency",frequency   
541                                 if frequency is not None:
542                                         data['frequency'] = frequency
543                         if "Access Point" in line:
544                                 ap=line[line.index('Access Point')+14:len(line)]
545                                 #print "AP",ap
546                                 if ap is not None:
547                                         data['acesspoint'] = ap
548                                         if ap == "Not-Associated":
549                                                 data['essid'] = _("No Connection")
550                         if "Bit Rate" in line:
551                                 if "kb" in line:
552                                         br = line[line.index('Bit Rate')+9 :line.index(' kb/s')]
553                                         if br == '0':
554                                                 br = _("Unsupported")
555                                         else:
556                                                 br += " Mb/s"
557                                 else:
558                                         br = line[line.index('Bit Rate')+9 :line.index(' Mb/s')] + " Mb/s"
559                                 #print "Bitrate",br
560                                 if br is not None:
561                                         data['bitrate'] = br
562                         if 'Encryption key' in line:
563                                 if ":off" in line:
564                                         if data['acesspoint'] is not "Not-Associated":
565                                                 enc = _("Unsupported")
566                                         else:
567                                                 enc = _("Disabled")
568                                 else:
569                                         enc = line[line.index('Encryption key')+15 :line.index('   Security')]
570                                         if enc is not None:
571                                                 enc = _("Enabled")
572                                 #print "Encryption key",enc 
573                                 if enc is not None:
574                                         data['encryption'] = enc
575                         if 'Quality' in line:
576                                 if "/100" in line:
577                                         qual = line[line.index('Quality')+8:line.index('/100')]
578                                 else:
579                                         qual = line[line.index('Quality')+8:line.index('Sig')]
580                                 #print "Quality",qual
581                                 if qual is not None:
582                                         data['quality'] = qual
583                         if 'Signal level' in line:
584                                 if "dBm" in line:
585                                         signal = line[line.index('Signal level')+14 :line.index(' dBm')]
586                                         signal += " dBm"
587                                 elif "/100" in line:
588                                         signal = line[line.index('Signal level')+13:line.index('/100  Noise')]
589                                         signal += "%"
590                                 else:
591                                         signal = line[line.index('Signal level')+13:line.index('  Noise')]
592                                         signal += "%"
593                                 #print "Signal level",signal            
594                                 if signal is not None:
595                                         data['signal'] = signal
596
597                 self.wlaniface[iface] = data
598                 self.backupwlaniface = self.wlaniface
599                 
600                 if self.WlanConsole is not None:
601                         if len(self.WlanConsole.appContainers) == 0:
602                                 print "self.wlaniface after loading:", self.wlaniface
603                                 if callback is not None:
604                                         callback(True,self.wlaniface)
605
606         def getAdapterAttribute(self, iface, attribute):
607                 print "im getAdapterAttribute"
608                 self.iface = iface
609                 if self.wlaniface.has_key(self.iface):
610                         print "self.wlaniface.has_key",self.iface
611                         if self.wlaniface[self.iface].has_key(attribute):
612                                 return self.wlaniface[self.iface][attribute]
613                 return None
614         
615 iStatus = Status()