Exemple #1
0
def instrument(resource_name, **keyw):
    """Factory function for instrument instances.

    :param resource_name: the VISA resource name of the device.
                          It may be an alias.
    :param **keyw: keyword argument for the class constructor of the device instance
                   to be generated.  See the class Instrument for further information.

    :return: The generated instrument instance.

    """
    interface_type, _ = vpp43.parse_resource(resource_manager.session,
                                             resource_name)
    if interface_type == VI_INTF_GPIB:
        return GpibInstrument(resource_name, **keyw)
    elif interface_type == VI_INTF_ASRL:
        return SerialInstrument(resource_name, **keyw)
    else:
        return Instrument(resource_name, **keyw)
Exemple #2
0
def instrument(resource_name, **keyw):
    """Factory function for instrument instances.

    Parameters:
    resource_name -- the VISA resource name of the device.  It may be an
        alias.
    keyw -- keyword argument for the class constructor of the device instance
        to be generated.  See the class Instrument for further information.

    Return value:
    The generated instrument instance.

    """
    interface_type, _ = \
        vpp43.parse_resource(resource_manager.session, resource_name)
    if interface_type == VI_INTF_GPIB:
        return GpibInstrument(resource_name, **keyw)
    elif interface_type == VI_INTF_ASRL:
        return SerialInstrument(resource_name, **keyw)
    else:
        return Instrument(resource_name, **keyw)
Exemple #3
0
 def __get_interface_type(self):
     interface_type, _ = \
         vpp43.parse_resource(resource_manager.session,
                              self.resource_name)
     return interface_type
Exemple #4
0
 def interface_type(self):
     """The interface type of the resource as a number."""
     interface_type, _ = vpp43.parse_resource(resource_manager.session,
                                              self.resource_name)
     return interface_type
Exemple #5
0
 def __get_interface_type(self):
     interface_type, _ = \
         vpp43.parse_resource(resource_manager.session,
                              self.resource_name)
     return interface_type