Commit 2878fb7c authored by Mateus Goto's avatar Mateus Goto

[MODIFIED] IPfinder with a more general form

parent 6af36fa2
......@@ -51,16 +51,6 @@ class NHR9400:
def setVoltageC(self,voltage):
self.__s.send("SOUR:VOLT:CPHase " + voltage + "\n")
#set the current of all phases ** Available only to NHR9430-12
def setCurrent(self, current):
self.__s.send("SOUR:CURR " + current + "\n")
#Functions that sets the limite currents on one phase (A, B or C)
def setCurrentA(self, current):
self.__s.send("SOUR:CURR:APHase " + current + "\n")
def setCurrentB(self, current):
self.__s.send("SOUR:CURR:BPHase " + current + "\n")
def setCurrentC(self, current):
self.__s.send("SOUR:CURR:CPHase " + current + "\n")
#Command establishes the True Power limit (W) as a positive value for the selected instrument.
def setPower(self, pow):
self.__s.send("SOUR:POW " + pow + "\n")
......
......@@ -6,6 +6,17 @@ class NHR9430(NHR9400):
def __init__(self):
super().__init__("NHR9410")
#set the current of all phases ** Available only to NHR9430-12
def setCurrent(self, current):
self.__s.send("SOUR:CURR " + current + "\n")
#Functions that sets the limite currents on one phase (A, B or C)
def setCurrentA(self, current):
self.__s.send("SOUR:CURR:APHase " + current + "\n")
def setCurrentB(self, current):
self.__s.send("SOUR:CURR:BPHase " + current + "\n")
def setCurrentC(self, current):
self.__s.send("SOUR:CURR:CPHase " + current + "\n")
def locateIp(self,clients = []):
for client in clients:
try:
......
......@@ -15,7 +15,12 @@ class IPFinder:
s.connect(("10.255.255.255",1))
local_ip = s.getsockname()[0]
local_ip = local_ip[:-1] + "/24"
splited = local_ip.split('.')
splited = local_ip.split('.')
splited.pop()
splited.append("1/24")
local_ip = ".".join(splited)
arp = ARP(pdst=local_ip)
ether = Ether(dst="ff:ff:ff:ff:ff:ff")
packet = ether/arp
......
......@@ -9,8 +9,11 @@ def getAllIp():
s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
s.connect(("10.255.255.255",1))
local_ip = s.getsockname()[0]
print(local_ip)
local_ip = local_ip[:-1] + "/24"
splited = local_ip.split('.')
splited = local_ip.split('.')
splited.pop()
splited.append("1/24")
local_ip = ".".join(splited)
print(local_ip)
print(type(local_ip))
arp = ARP(pdst=local_ip)
......
read = str("192.168.150.5")
splited = read.split('.')
print(splited)
splited.pop()
print(splited)
splited.append("1/24")
read = ".".join(splited)
print(read)
\ No newline at end of file
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