diff --git a/udp_socket_client.py b/udp_socket_client.py index 0ef63fb..0277583 100755 --- a/udp_socket_client.py +++ b/udp_socket_client.py @@ -2,12 +2,15 @@ import socket import time +import wireless target = "192.168.178.21" port = 5005 s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) +w = wireless.wireless("wlan0") while 1: - s.sendto("test", (target, port)) + msg = "#WIFI:LEVEL:" + w.level() + s.sendto(msg, (target, port)) time.sleep(1) diff --git a/wireless.py b/wireless.py index 5a9d458..515ec8a 100644 --- a/wireless.py +++ b/wireless.py @@ -16,6 +16,8 @@ class wireless: lst = line.split(" ") self.__link = lst[2] self.__level = lst[3] + if re.match(".*\.$", self.__level): + self.__level = re.sub("\.", "", self.__level) self.__noise = lst[4] break f.close()