Commit 29ab8c8e authored by Mateus Goto's avatar Mateus Goto

[Fixed] minors issues 2

parent fa51a0e2
......@@ -8,15 +8,14 @@ from Utility.IPFinder import IPFinder
class controlInterface:
def __init__(self):
self.__listIp = []
self.__listIp = IPFinder().getList()
self.__listUsedIp = []
self.__nhr9410 = []
self.__nhr9430 = []
#refresh the list of ip
def refresh(self):
ipfinder = IPFinder()
self.__listIp = ipfinder.getList()
self.__listIp = IPFinder().getList()
for ip in self.__listUsedIp:
self.__listIp.remove(ip)
......@@ -25,22 +24,28 @@ class controlInterface:
new = NHR9410()
new.__init__()
new.locateIp(self.__listIp)
print(self.getListIp())
usedIp = new.getIp()
print(type(usedIp))
try:
self.__listIp.remove(usedIp)
self.__listUsedIp.append(usedIp)
self.__nhr9410.append(new)
self.__nhr9430.append(new)
except:
print("Any IP adress matched")
#create a NHR9430 object
def newNhr9430(self):
new = NHR9430()
new.__init__()
new.locateIp(self.__listIp)
usedIp = new.getIp()
usedIp = new.locateIp(self.__listIp)
#print(usedIp)
try:
self.__listIp.remove(usedIp)
self.__listUsedIp.append(usedIp)
self.__nhr9430.append(new)
except:
print("Any IP adress matched")
def getNhr9410(self):
return self.__nhr9410
......
usedIp = new.getIp()
\ No newline at end of file
......@@ -16,13 +16,12 @@ class NHR9410(NHR9400):
if recv.find("NH Research,9410-") != -1: #if find this subtring
self.__ip = client
print("Connection successfully")
break
return self.__ip
else:
print("Connection failed 1")
self.__s.close()
except:
print("Connection failed 2")
pass
......
......@@ -73,7 +73,7 @@ class NHR9430(NHR9400):
if recv.find("NH Research,9430-") != -1: #if find this subtring
self.__ip = client
print("Connection successfully")
break
return self.__ip
else:
print("Connection failed 1")
self.__s.close()
......
......@@ -23,8 +23,7 @@ class IPFinder:
result = srp(packet, timeout=3,retry = 1, verbose = 0)[0]
clients = []
for sent, received in result:
clients.append({"ip": received.psrc})
print(clients)
clients.append(received.psrc)
self.__clients = clients
......
......@@ -2,20 +2,14 @@ from Control_Interface.controlInterface import controlInterface
from Utility.IPFinder import IPFinder
interface = controlInterface()
ips = []
ips = IPFinder().getList()
print(ips)
interface.__init__()
interface.newNhr9410()
interface.newNhr9430()
#interface.newNhr9430()
nhr10 = []
print(nhr10)
nhr30 = []
nhr10 = interface.getNhr9410()
nhr30 = interface.getNhr9430()
print(nhr10)
print(nhr30)
\ No newline at end of file
nhr10[0].getIp
nhr30[0].getIp
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