Public Member Functions | |
| def | __init__ |
| def | commit |
| def | getAPaddr |
| def | getBitrate |
| def | getBitrates |
| def | getChannelInfo |
| def | getEncryption |
| def | getEssid |
| def | getFragmentation |
| def | getFrequency |
| def | getKey |
| def | getKeys |
| def | getMode |
| def | getPowermanagement |
| def | getQualityAvg |
| def | getQualityMax |
| def | getRetrylimit |
| def | getRTS |
| def | getSensitivity |
| def | getStatistics |
| def | getTXPower |
| def | getWirelessName |
| def | scan |
| def | setAPaddr |
| def | setEncryption |
| def | setEssid |
| def | setFrequency |
| def | setKey |
| def | setMode |
Public Attributes | |
| ifname | |
| iwstruct | |
| sockfd | |
| wireless_info | |
Private Member Functions | |
| def | _formatBitrate |
| def | _formatFrequency |
Provides high-level access to wireless interfaces.
This class uses WirelessInfo for most access.
| def rocon_python_wifi.iwlibs.Wireless.__init__ | ( | self, | |
| ifname | |||
| ) |
| def rocon_python_wifi.iwlibs.Wireless._formatBitrate | ( | self, | |
| raw_bitrate | |||
| ) | [private] |
| def rocon_python_wifi.iwlibs.Wireless._formatFrequency | ( | self, | |
| raw_frequency | |||
| ) | [private] |
| def rocon_python_wifi.iwlibs.Wireless.commit | ( | self | ) |
| def rocon_python_wifi.iwlibs.Wireless.getAPaddr | ( | self | ) |
Returns the access point MAC address.
>>> from iwlibs import Wireless, getNICnames
>>> ifnames = getNICnames()
>>> ifnames
['eth1', 'wifi0']
>>> wifi = Wireless(ifnames[0])
>>> wifi.getAPaddr()
'00:0D:88:8E:4E:93'
Test with non-wifi card:
>>> wifi = Wireless('eth0')
>>> wifi.getAPaddr()
(95, 'Operation not supported')
Test with non-existant card:
>>> wifi = Wireless('eth2')
>>> wifi.getAPaddr()
(19, 'No such device')
| def rocon_python_wifi.iwlibs.Wireless.getBitrate | ( | self | ) |
| def rocon_python_wifi.iwlibs.Wireless.getBitrates | ( | self | ) |
| def rocon_python_wifi.iwlibs.Wireless.getChannelInfo | ( | self | ) |
| def rocon_python_wifi.iwlibs.Wireless.getEncryption | ( | self | ) |
Get the association mode, which is probably a string of '*',
'open', 'private', 'off'.
As a normal user, you will get an 'Operation not permitted'
error:
>>> from iwlibs import Wireless
>>> wifi = Wireless('eth1')
>>> wifi.getEncryption()
(1, 'Operation not permitted')
| def rocon_python_wifi.iwlibs.Wireless.getEssid | ( | self | ) |
Returns the fragmentation threshold.
It depends on what the driver says. If you have fragmentation
threshold turned on, you'll get an int. If it's turned off
you'll get a string: 'off'.
>>> from iwlibs import Wireless
>>> wifi = Wireless('eth1')
>>> wifi.getFragmentation()
'off'
| def rocon_python_wifi.iwlibs.Wireless.getFrequency | ( | self | ) |
| def rocon_python_wifi.iwlibs.Wireless.getKey | ( | self, | |
key = 0, |
|||
formatted = True |
|||
| ) |
| def rocon_python_wifi.iwlibs.Wireless.getKeys | ( | self | ) |
Get all encryption keys.
Returns a list of tuples.
As a normal user, you will get a 'Operation not permitted'
error:
>>> from iwlibs import Wireless
>>> wifi = Wireless('eth1')
>>> wifi.getKeys()
[(1, '1234-5678-91'), (2, None), (3, 'ABCD-EFAB-CD'), (4, None)]
| def rocon_python_wifi.iwlibs.Wireless.getMode | ( | self | ) |
| def rocon_python_wifi.iwlibs.Wireless.getQualityAvg | ( | self | ) |
Returns an Iwquality object with average quality information.
>>> from iwlibs import Wireless
>>> wifi = Wireless('eth1')
>>> aq = wifi.getQualityAvg()
>>> print "quality:", aq.quality, "signal:", aq.siglevel, "noise:", aq.nlevel
quality: 38 signal: 13 noise: 0
| def rocon_python_wifi.iwlibs.Wireless.getQualityMax | ( | self | ) |
Returns an Iwquality object with maximum quality information.
>>> from iwlibs import Wireless
>>> wifi = Wireless('eth1')
>>> mq = wifi.getQualityMax()
>>> print "quality:", mq.quality, "signal:", mq.siglevel, "noise:", mq.nlevel
quality: 38 signal: 13 noise: 0
| def rocon_python_wifi.iwlibs.Wireless.getRetrylimit | ( | self | ) |
| def rocon_python_wifi.iwlibs.Wireless.getRTS | ( | self | ) |
Returns the RTS threshold, likely to be int, 'auto',
'fixed', 'off'
man iwconfig:
"RTS/CTS adds a handshake before each packet transmission to
make sure that the channel is clear. This adds overhead, but
increases performance in case of hidden nodes or a large
number of active nodes. This parameter sets the size of the
smallest packet for which the node sends RTS; a value equal
to the maximum packet size disable the mechanism."
>>> from iwlibs import Wireless
>>> wifi = Wireless('eth1')
>>> wifi.getRTS()
'off'
| def rocon_python_wifi.iwlibs.Wireless.getSensitivity | ( | self | ) |
Returns sensitivity information.
man iwconfig:
"This is the lowest signal level for which the hardware
attempt packet reception, signals weaker than this are
ignored. This is used to avoid receiving background noise,
so you should set it according to the average noise
level. Positive values are assumed to be the raw value used
by the hardware or a percentage, negative values are
assumed to be dBm."
>>> from iwlibs import Wireless
>>> wifi = Wireless('eth1')
>>> wifi.getSensitivity()
'off'
| def rocon_python_wifi.iwlibs.Wireless.getStatistics | ( | self | ) |
| def rocon_python_wifi.iwlibs.Wireless.getTXPower | ( | self | ) |
| def rocon_python_wifi.iwlibs.Wireless.scan | ( | self | ) |
| def rocon_python_wifi.iwlibs.Wireless.setAPaddr | ( | self, | |
| addr | |||
| ) |
| def rocon_python_wifi.iwlibs.Wireless.setEncryption | ( | self, | |
| mode | |||
| ) |
| def rocon_python_wifi.iwlibs.Wireless.setEssid | ( | self, | |
| essid | |||
| ) |
| def rocon_python_wifi.iwlibs.Wireless.setFrequency | ( | self, | |
| freq | |||
| ) |
| def rocon_python_wifi.iwlibs.Wireless.setKey | ( | self, | |
| key, | |||
index = 1 |
|||
| ) |
| def rocon_python_wifi.iwlibs.Wireless.setMode | ( | self, | |
| mode | |||
| ) |