53 lines
1.2 KiB
Python
53 lines
1.2 KiB
Python
#!/usr/env python3
|
|
|
|
import time
|
|
import socket
|
|
|
|
|
|
class ProGPIB:
|
|
"""
|
|
=====
|
|
ProGPIB
|
|
=====
|
|
|
|
Provides an interface to Prologix GPIB adapters
|
|
"""
|
|
|
|
#from bits import Bytes
|
|
|
|
def __init__(self, IP="0.0.0.0", MAC="02:01:01:01:01:01", Virtual=False):
|
|
"""
|
|
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()
|
|
self.__socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM, socket.IPPROTO_TCP)
|
|
self.__socket.settimeout(0.1)
|
|
self.__ipaddr = IP
|
|
self.__netaddr = MAC
|
|
self.__virtual = Virtual
|
|
# Prologix configurables
|
|
self.__addr = None
|
|
self.__auto = None
|
|
self.__eoi = None
|
|
self.__eos = None
|
|
self.__eot_enable = None
|
|
self.__eot_char = None
|
|
self.__mode = None
|
|
self.__read_tmo_ms = None
|
|
self.__savecfg = None
|
|
self.__ver = None
|
|
# Prologix commands
|
|
# clr
|
|
# ifc
|
|
# llo
|
|
# loc
|
|
# lon
|
|
# read
|
|
# rst
|
|
# spoll
|
|
# srq
|
|
# status
|
|
# trg
|
|
# help |