Commit 5a837555 authored by Pete Tucker's avatar Pete Tucker
Browse files

Replace hard coded MAC ID with code that reads Gateway's eth0 MAC

parent d3fd3a32
...@@ -291,7 +291,7 @@ class WifiSsidChrc(Characteristic): ...@@ -291,7 +291,7 @@ class WifiSsidChrc(Characteristic):
global flag global flag
if flag == 0: if flag == 0:
print("taking message path") print("taking message path")
mac = 'VTBR_70B3D59AE0EC' mac = get_mac()
message='{"id":' + mac + ',"key":-1}' message='{"id":' + mac + ',"key":-1}'
UDP_IP = '127.0.0.1' UDP_IP = '127.0.0.1'
UDP_PORT = 6789 UDP_PORT = 6789
...@@ -314,7 +314,7 @@ class WifiPasswordChrc(Characteristic): ...@@ -314,7 +314,7 @@ class WifiPasswordChrc(Characteristic):
global flag global flag
if flag == 0: if flag == 0:
print("taking message path") print("taking message path")
mac = 'VTBR_70B3D59AE0EC' mac = get_mac()
message='{"id":' + mac + ',"key":-1}' message='{"id":' + mac + ',"key":-1}'
UDP_IP = '127.0.0.1' UDP_IP = '127.0.0.1'
UDP_PORT = 6789 UDP_PORT = 6789
...@@ -337,7 +337,7 @@ class WifiCapabilityChrc(Characteristic): ...@@ -337,7 +337,7 @@ class WifiCapabilityChrc(Characteristic):
global flag global flag
if flag == 0: if flag == 0:
print("taking message path") print("taking message path")
mac = 'VTBR_70B3D59AE0EC' mac = get_mac()
message='{"id":' + mac + ',"key":-1}' message='{"id":' + mac + ',"key":-1}'
UDP_IP = '127.0.0.1' UDP_IP = '127.0.0.1'
UDP_PORT = 6789 UDP_PORT = 6789
...@@ -360,7 +360,7 @@ class InterfaceTypeChrc(Characteristic): ...@@ -360,7 +360,7 @@ class InterfaceTypeChrc(Characteristic):
global flag global flag
if flag == 0: if flag == 0:
print("taking message path") print("taking message path")
mac = 'VTBR_70B3D59AE0EC' mac = get_mac()
message='{"id":' + mac + ',"key":-1}' message='{"id":' + mac + ',"key":-1}'
UDP_IP = '127.0.0.1' UDP_IP = '127.0.0.1'
UDP_PORT = 6789 UDP_PORT = 6789
...@@ -389,6 +389,13 @@ def find_adapter(bus): ...@@ -389,6 +389,13 @@ def find_adapter(bus):
return None return None
def get_mac():
f = open('/sys/class/net/eth0/address', 'r')
mac = f.read().replace(':','').replace('\n','').upper()
f.close()
mac='VTBR_' + mac
return mac
def main(): def main():
global mainloop global mainloop
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment