reorder structure
This commit is contained in:
committed by
Thomas Klaehn
parent
2fc4339f61
commit
4d76bc4e88
0
src/wifi_fieldstrength/__init__.py
Normal file
0
src/wifi_fieldstrength/__init__.py
Normal file
23
src/wifi_fieldstrength/wifi_fieldstrength.py
Normal file
23
src/wifi_fieldstrength/wifi_fieldstrength.py
Normal file
@@ -0,0 +1,23 @@
|
||||
|
||||
from re import match, sub
|
||||
|
||||
class wifi_fieldstrength:
|
||||
def __init__(self, name = "wlan0"):
|
||||
self._name = name
|
||||
self.wf_name = "/proc/net/wireless"
|
||||
|
||||
def name(self):
|
||||
return self._name
|
||||
|
||||
def read(self):
|
||||
ret = False
|
||||
f = open(self.wf_name, "r")
|
||||
for line in f:
|
||||
line = line.strip()
|
||||
mstr = "^" + self._name
|
||||
if match(mstr, line):
|
||||
line = sub("\s+", " ", line)
|
||||
tmp = line.split(" ")
|
||||
tmp[3] = sub("\.", "", tmp[3])
|
||||
ret = int(tmp[3])
|
||||
return ret
|
Reference in New Issue
Block a user