本文整理匯總了Python中pythonwifi.iwlibs.Wireless.getQualityMax方法的典型用法代碼示例。如果您正苦於以下問題:Python Wireless.getQualityMax方法的具體用法?Python Wireless.getQualityMax怎麽用?Python Wireless.getQualityMax使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pythonwifi.iwlibs.Wireless
的用法示例。
在下文中一共展示了Wireless.getQualityMax方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: collectDataForInterface
# 需要導入模塊: from pythonwifi.iwlibs import Wireless [as 別名]
# 或者: from pythonwifi.iwlibs.Wireless import getQualityMax [as 別名]
def collectDataForInterface(self, iface):
w = Wireless(iface)
wsconfig = { }
simpleConfigs = (
("essid", w.getEssid, "off"),
("frequency", w.getFrequency, ""),
("accesspoint", w.getAPaddr, "Not-Associated"),
("bitrate", w.getBitrate, "0"),
("encryption", w.getEncryption, "off"),
)
for name, func, default in simpleConfigs:
try:
wsconfig[name] = func()
except:
wsconfig[name] = default
try:
wsconfig["quality"] = str(Iwstats("wlan0").qual.quality) + "/" + str(w.getQualityMax().quality)
except:
wsconfig["quality"] = ""
try:
wsconfig["signal"] = str(w.getQualityAvg().siglevel-128) + " dBm"
except:
wsconfig["signal"] = ""
return wsconfig
示例2: getNetworkList
# 需要導入模塊: from pythonwifi.iwlibs import Wireless [as 別名]
# 或者: from pythonwifi.iwlibs.Wireless import getQualityMax [as 別名]
def getNetworkList(self):
if self.oldInterfaceState is None:
self.oldInterfaceState = iNetwork.getAdapterAttribute(self.iface, "up")
if self.oldInterfaceState is False:
if iNetwork.getAdapterAttribute(self.iface, "up") is False:
iNetwork.setAdapterAttribute(self.iface, "up", True)
enigma.eConsoleAppContainer().execute("ifconfig %s up" % self.iface)
ifobj = Wireless(self.iface) # a Wireless NIC Object
try:
scanresults = ifobj.scan()
except:
scanresults = None
print "[Wlan.py] No wireless networks could be found"
aps = {}
if scanresults is not None:
(num_channels, frequencies) = ifobj.getChannelInfo()
index = 1
for result in scanresults:
bssid = result.bssid
if result.encode.flags & wififlags.IW_ENCODE_DISABLED > 0:
encryption = False
elif result.encode.flags & wififlags.IW_ENCODE_NOKEY > 0:
encryption = True
else:
encryption = None
signal = str(result.quality.siglevel-0x100) + " dBm"
quality = "%s/%s" % (result.quality.quality,ifobj.getQualityMax().quality)
extra = []
for element in result.custom:
element = element.encode()
extra.append( strip(self.asciify(element)) )
for element in extra:
if 'SignalStrength' in element:
signal = element[element.index('SignalStrength')+15:element.index(',L')]
if 'LinkQuality' in element:
quality = element[element.index('LinkQuality')+12:len(element)]
# noinspection PyProtectedMember
aps[bssid] = {
'active' : True,
'bssid': result.bssid,
'channel': frequencies.index(ifobj._formatFrequency(result.frequency.getFrequency())) + 1,
'encrypted': encryption,
'essid': strip(self.asciify(result.essid)),
'iface': self.iface,
'maxrate' : ifobj._formatBitrate(result.rate[-1][-1]),
'noise' : '',#result.quality.nlevel-0x100,
'quality' : str(quality),
'signal' : str(signal),
'custom' : extra,
}
index += 1
return aps
示例3: getNetworkList
# 需要導入模塊: from pythonwifi.iwlibs import Wireless [as 別名]
# 或者: from pythonwifi.iwlibs.Wireless import getQualityMax [as 別名]
def getNetworkList(self):
if self.oldInterfaceState is None:
self.oldInterfaceState = iNetwork.getAdapterAttribute(self.iface, "up")
if self.oldInterfaceState is False:
if iNetwork.getAdapterAttribute(self.iface, "up") is False:
iNetwork.setAdapterAttribute(self.iface, "up", True)
system("ifconfig " + self.iface + " up")
ifobj = Wireless(self.iface) # a Wireless NIC Object
try:
scanresults = ifobj.scan()
except:
scanresults = None
print "[Wlan.py] No wireless networks could be found"
aps = {}
if scanresults is not None:
(num_channels, frequencies) = ifobj.getChannelInfo()
index = 1
for result in scanresults:
bssid = result.bssid
if result.encode.flags & wififlags.IW_ENCODE_DISABLED > 0:
encryption = False
elif result.encode.flags & wififlags.IW_ENCODE_NOKEY > 0:
encryption = True
else:
encryption = None
signal = str(result.quality.siglevel - 0x100) + " dBm"
quality = "%s/%s" % (result.quality.quality, ifobj.getQualityMax().quality)
extra = []
for element in result.custom:
element = element.encode()
extra.append(strip(self.asciify(element)))
for element in extra:
if "SignalStrength" in element:
signal = element[element.index("SignalStrength") + 15 : element.index(",L")]
if "LinkQuality" in element:
quality = element[element.index("LinkQuality") + 12 : len(element)]
# noinspection PyProtectedMember
aps[bssid] = {
"active": True,
"bssid": result.bssid,
"channel": frequencies.index(ifobj._formatFrequency(result.frequency.getFrequency())) + 1,
"encrypted": encryption,
"essid": strip(self.asciify(result.essid)),
"iface": self.iface,
"maxrate": ifobj._formatBitrate(result.rate[-1][-1]),
"noise": "", # result.quality.nlevel-0x100,
"quality": str(quality),
"signal": str(signal),
"custom": extra,
}
index += 1
return aps
示例4: getNetworkList
# 需要導入模塊: from pythonwifi.iwlibs import Wireless [as 別名]
# 或者: from pythonwifi.iwlibs.Wireless import getQualityMax [as 別名]
def getNetworkList(self):
system("ifconfig "+self.iface+" up")
ifobj = Wireless(self.iface) # a Wireless NIC Object
#Association mappings
#stats, quality, discard, missed_beacon = ifobj.getStatistics()
#snr = quality.signallevel - quality.noiselevel
try:
scanresults = ifobj.scan()
except:
scanresults = None
print "[Wlan.py] No Wireless Networks could be found"
if scanresults is not None:
aps = {}
(num_channels, frequencies) = ifobj.getChannelInfo()
index = 1
for result in scanresults:
bssid = result.bssid
if result.encode.flags & wififlags.IW_ENCODE_DISABLED > 0:
encryption = False
elif result.encode.flags & wififlags.IW_ENCODE_NOKEY > 0:
encryption = True
else:
encryption = None
signal = str(result.quality.siglevel-0x100) + " dBm"
quality = "%s/%s" % (result.quality.quality,ifobj.getQualityMax().quality)
extra = []
for element in result.custom:
element = element.encode()
extra.append( strip(self.asciify(element)) )
for element in extra:
print element
if 'SignalStrength' in element:
signal = element[element.index('SignalStrength')+15:element.index(',L')]
if 'LinkQuality' in element:
quality = element[element.index('LinkQuality')+12:len(element)]
aps[bssid] = {
'active' : True,
'bssid': result.bssid,
'channel': frequencies.index(ifobj._formatFrequency(result.frequency.getFrequency())) + 1,
'encrypted': encryption,
'essid': strip(self.asciify(result.essid)),
'iface': self.iface,
'maxrate' : ifobj._formatBitrate(result.rate[-1][-1]),
'noise' : '',#result.quality.nlevel-0x100,
'quality' : str(quality),
'signal' : str(signal),
'custom' : extra,
}
#print "GOT APS ENTRY:",aps[bssid]
index = index + 1
return aps
示例5: getStatus
# 需要導入模塊: from pythonwifi.iwlibs import Wireless [as 別名]
# 或者: from pythonwifi.iwlibs.Wireless import getQualityMax [as 別名]
def getStatus(self):
ifobj = Wireless(self.iface)
fq = Iwfreq()
try:
self.channel = str(fq.getChannel(str(ifobj.getFrequency()[0:-3])))
except:
self.channel = 0
status = {
'BSSID': str(ifobj.getAPaddr()), #ifobj.getStatistics()
'ESSID': str(ifobj.getEssid()),
'quality': "%s/%s" % (ifobj.getStatistics()[1].quality,ifobj.getQualityMax().quality),
'signal': str(ifobj.getStatistics()[1].siglevel-0x100) + " dBm",
'bitrate': str(ifobj.getBitrate()),
'channel': str(self.channel),
#'channel': str(fq.getChannel(str(ifobj.getFrequency()[0:-3]))),
}
for (key, item) in status.items():
if item is "None" or item is "":
status[key] = _("N/A")
return status
示例6: linkMax
# 需要導入模塊: from pythonwifi.iwlibs import Wireless [as 別名]
# 或者: from pythonwifi.iwlibs.Wireless import getQualityMax [as 別名]
def linkMax(self):
ifobj = Wireless('wlan0')
return int(ifobj.getQualityMax().quality)