begin prologix class
This commit is contained in:
parent
260940e0ea
commit
c3c125fe19
|
@ -197,8 +197,12 @@ def main():
|
||||||
else:
|
else:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
eth_addr = eth_addr.strip().replace(":", "").replace("-", "")
|
#eth_addr = eth_addr.strip().replace(":", "").replace("-", "")
|
||||||
eth_addr = eth_addr.decode('hex')
|
#eth_addr = eth_addr.decode('hex')
|
||||||
|
eth_addr = eth_addr.replace(" ", "")
|
||||||
|
eth_addr = eth_addr.replace(":", "")
|
||||||
|
eth_addr = eth_addr.replace("-", "")
|
||||||
|
eth_addr = bytes.fromhex(eth_addr)
|
||||||
except:
|
except:
|
||||||
print("Invalid Ethernet address.")
|
print("Invalid Ethernet address.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
|
@ -731,7 +731,13 @@ def SetEthernetAddress(s, r, eth_addr, new_eth_addr):
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
def FormatEthAddr(a):
|
def FormatEthAddr(a):
|
||||||
return "%02X-%02X-%02X-%02X-%02X-%02X" % (ord(a[0]), ord(a[1]), ord(a[2]), ord(a[3]), ord(a[4]), ord(a[5]))
|
return "%02X-%02X-%02X-%02X-%02X-%02X" % (ord(a[0]),
|
||||||
|
ord(a[1]),
|
||||||
|
ord(a[2]),
|
||||||
|
ord(a[3]),
|
||||||
|
ord(a[4]),
|
||||||
|
ord(a[5])
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
|
@ -774,3 +780,24 @@ def PrintDetails(d):
|
||||||
else:
|
else:
|
||||||
print('Unknown')
|
print('Unknown')
|
||||||
|
|
||||||
|
|
||||||
|
class ProGPIB:
|
||||||
|
"""
|
||||||
|
=====
|
||||||
|
ProGPIB
|
||||||
|
=====
|
||||||
|
|
||||||
|
Provides an interface to Prologix GPIB adapters
|
||||||
|
"""
|
||||||
|
|
||||||
|
from bits import Bytes
|
||||||
|
import time
|
||||||
|
|
||||||
|
def __init__(self, MAC="02:01:01:01:01:01", Virtual=False, IP="0.0.0.0"):
|
||||||
|
"""
|
||||||
|
MAC: Media Access Control (MAC) Address of device
|
||||||
|
Virtual: (bool) Set True to emulate a Prologix GPIB device
|
||||||
|
IP: The IPv4 address of the device
|
||||||
|
"""
|
||||||
|
self.__start = time.time()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue