Skip to content

Commit d412a99

Browse files
committed
resolve the devices I happen to have to test with into their correct subclasses in this example
1 parent b6da97c commit d412a99

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

examples/prologix_usb.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
from scpi import SCPIDevice
88
from scpi.transports.gpib import prologix
99
from scpi.wrapper import AIOWrapper
10+
from scpi.devices.hp6632b import HP6632B
11+
from scpi.devices.generic import MultiMeter
1012

1113
if __name__ == "__main__":
1214
if len(sys.argv) < 2:
@@ -24,10 +26,16 @@
2426
devlist = gpib.scan_devices()
2527
devdict = {}
2628
for addr, idstr in devlist:
29+
man, model, _, _ = idstr.split(",")
2730
# Get device specific transport instance
2831
dtransport = aiogpib.get_device_transport(addr)
2932
# Get the device class with the transport
3033
aiodev = SCPIDevice(dtransport)
34+
if man == "HEWLETT-PACKARD":
35+
if model == "6632B":
36+
aiodev = HP6632B(dtransport)
37+
if model == "34401A":
38+
aiodev = MultiMeter(dtransport)
3139
# And get the mapper that handles asyncio transparently
3240
devdict[addr] = AIOWrapper(aiodev)
3341
print("Added {:s} as devdict[{:d}]".format(idstr, addr))

0 commit comments

Comments
 (0)