wireless level udp transmission

This commit is contained in:
tkl 2016-08-14 09:21:43 +00:00
parent d105436a13
commit 8f80e3f1a8
2 changed files with 6 additions and 1 deletions

View File

@ -2,12 +2,15 @@
import socket import socket
import time import time
import wireless
target = "192.168.178.21" target = "192.168.178.21"
port = 5005 port = 5005
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
w = wireless.wireless("wlan0")
while 1: while 1:
s.sendto("test", (target, port)) msg = "#WIFI:LEVEL:" + w.level()
s.sendto(msg, (target, port))
time.sleep(1) time.sleep(1)

View File

@ -16,6 +16,8 @@ class wireless:
lst = line.split(" ") lst = line.split(" ")
self.__link = lst[2] self.__link = lst[2]
self.__level = lst[3] self.__level = lst[3]
if re.match(".*\.$", self.__level):
self.__level = re.sub("\.", "", self.__level)
self.__noise = lst[4] self.__noise = lst[4]
break break
f.close() f.close()