Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
IC-Interface Control
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mateus Goto
IC-Interface Control
Commits
b63a2131
Commit
b63a2131
authored
Jun 17, 2022
by
Mateus Goto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ADDED] Initial getter and setter
parent
73cbb70c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
10 deletions
+32
-10
NHR9400/NRH9400.py
NHR9400/NRH9400.py
+30
-5
Utility/IPFinder.py
Utility/IPFinder.py
+2
-5
No files found.
NHR9400/NRH9400.py
View file @
b63a2131
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
getPower
():
def
getFreq
():
def
start
(
void
):
s
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
s
.
timeout
(
1
)
\ No newline at end of file
Utility/IPFinder.py
View file @
b63a2131
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment