Commit 27d89fb0f95 by Julien Salort

Separate interface_from_string and interface_classname_from_string

parent c3bb13164bd
......@@ -89,18 +89,7 @@ def set_default_interface(interface_type, interface_classname):
"""
default_interface[interface_type] = interface_classname
def interface_from_string(name, default_physical_interface=None, **kwargs):
"""
Infer physical_interface from name if possible, or use the default provided
physical_interface otherwise.
i.e. if the names contains the physical interface explicitely,
then we use it,
eg.
GPIB0::1::INSTR is GPIB physical interface
ASRL0::INSTR is a VISA Serial address
192.168.0.1 is a IP address, so Ethernet interface
"""
def interface_classname_from_string(name, default_physical_interface=None, **kwargs):
classname = None
physical_interface = None
if "GPIB" in name:
......@@ -125,6 +114,20 @@ def interface_from_string(name, default_physical_interface=None, **kwargs):
physical_interface = default_physical_interface
if classname is None:
classname = default_interface[physical_interface]
return classname, physical_interface
def interface_from_string(name, default_physical_interface=None, **kwargs):
"""
Infer physical_interface from name if possible, or use the default provided
physical_interface otherwise.
i.e. if the names contains the physical interface explicitely,
then we use it,
eg.
GPIB0::1::INSTR is GPIB physical interface
ASRL0::INSTR is a VISA Serial address
192.168.0.1 is a IP address, so Ethernet interface
"""
classname, physical_interface = interface_classname_from_string(name, default_physical_interface)
if classname == "VISAInterface":
from fluidlab.interfaces.visa_inter import VISAInterface
......
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