Commit b63a2131 authored by Mateus Goto's avatar Mateus Goto

[ADDED] Initial getter and setter

parent 73cbb70c
import random
import socket
from Utility import IPFinder
class NHR9400:
def __init__(self, name):
self.__id = random.randrange(100, 300, 2)
self.__name = name
self.__s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
self.__s.timeout(1)
def setIp(self):
pass
#Function to see if exist any error in the carry
def checkErrors(self):
self.__s.send("SYSTem:ERRor?")
#set limit voltage of all channels
def setVoltage(self,voltage):
self.__s.send("VOLT " + voltage + "\n")
def setCurrent(self, current):
self.__s.send("CURR " + current + "\n")
def setPower():
def setFreq():
def getVoltage(self):
value = self.__s.send("FETCh:VOLTage?")
def getCurrent():
def start(void):
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.timeout(1)
\ No newline at end of file
def getPower():
def getFreq():
\ No newline at end of file
......@@ -4,7 +4,7 @@ from scapy.all import ARP, Ether, srp
class IPFinder:
#uses socket and scapy to scan the entire local network and returns all the IPs adresses of the devices connects in this networok
def getAllIp():
s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
......@@ -12,8 +12,6 @@ class IPFinder:
local_ip = s.getsockname()[0]
local_ip = local_ip[:-1] + "/24"
print(local_ip)
print(type(local_ip))
arp = ARP(pdst=local_ip)
ether = Ether(dst="ff:ff:ff:ff:ff:ff")
packet = ether/arp
......@@ -22,5 +20,4 @@ class IPFinder:
clients = []
for sent, received in result:
clients.append({"ip": received.psrc})
for client in clients:
print(client['ip'])
\ No newline at end of file
return clients
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