How to use the niswitch.visatype.ViSession function in niswitch

To help you get started, we’ve selected a few niswitch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ni / nimi-python / generated / niswitch / unit_tests / matchers.py View on Github external
def __init__(self):
        _PointerMatcher.__init__(self, visatype.ViSession)
github ni / nimi-python / generated / niswitch / session.py View on Github external
def commit(self):
        '''commit

        Downloads the configured scan list and trigger settings to hardware.
        Calling commit optional as it is implicitly called during
        _initiate_scan. Use commit to arm triggers in a given
        order or to control when expensive hardware operations are performed.
        '''
        vi_ctype = visatype.ViSession(self._vi)  # case S110
        error_code = self._library.niSwitch_Commit(vi_ctype)
        errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
        return
github ni / nimi-python / generated / niswitch / session.py View on Github external
def _close(self):
        '''_close

        Terminates the NI-SWITCH session and all of its attributes and
        deallocates any memory resources the driver uses. Notes: (1) You must
        unlock the session before calling _close. (2) After calling
        _close, you cannot use the instrument driver again until you
        call init or InitWithOptions.

        Note:
        One or more of the referenced functions are not in the Python API for this driver.
        '''
        vi_ctype = visatype.ViSession(self._vi)  # case S110
        error_code = self._library.niSwitch_close(vi_ctype)
        errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
        return
github ni / nimi-python / generated / niswitch / session.py View on Github external
ScanAdvancedOutput.TTL0 ScanAdvancedOutput.TTL1 ScanAdvancedOutput.TTL2
                ScanAdvancedOutput.TTL3 ScanAdvancedOutput.TTL4 ScanAdvancedOutput.TTL5
                ScanAdvancedOutput.TTL6 ScanAdvancedOutput.TTL7

                Note:
                One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed.

            invert (bool): If VI_TRUE, inverts the input trigger signal from falling to rising or
                vice versa. Default value: VI_FALSE

        '''
        if type(scan_advanced_output_connector) is not enums.ScanAdvancedOutput:
            raise TypeError('Parameter mode must be of type ' + str(enums.ScanAdvancedOutput))
        if type(scan_advanced_output_bus_line) is not enums.ScanAdvancedOutput:
            raise TypeError('Parameter mode must be of type ' + str(enums.ScanAdvancedOutput))
        vi_ctype = visatype.ViSession(self._vi)  # case S110
        scan_advanced_output_connector_ctype = visatype.ViInt32(scan_advanced_output_connector.value)  # case S130
        scan_advanced_output_bus_line_ctype = visatype.ViInt32(scan_advanced_output_bus_line.value)  # case S130
        invert_ctype = visatype.ViBoolean(invert)  # case S150
        error_code = self._library.niSwitch_RouteScanAdvancedOutput(vi_ctype, scan_advanced_output_connector_ctype, scan_advanced_output_bus_line_ctype, invert_ctype)
        errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
        return
github ni / nimi-python / generated / niswitch / session.py View on Github external
def disconnect_all(self):
        '''disconnect_all

        Breaks all existing paths. If the switch module cannot break all paths,
        NISWITCH_WARN_PATH_REMAINS warning is returned.
        '''
        vi_ctype = visatype.ViSession(self._vi)  # case S110
        error_code = self._library.niSwitch_DisconnectAll(vi_ctype)
        errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
        return
github ni / nimi-python / generated / niswitch / session.py View on Github external
the corresponding function that is consistent with the data type. - If
                you want to enter a variable name, press to change this ring control to
                a manual input box. - If the attribute in this ring control has
                constants as valid values, you can view the constants by moving to the
                Attribute Value control and pressing .

            attribute_value (bool): Pass the value to which you want to set the attribute. From the function
                panel window, you can use this control as follows. - If the attribute
                currently showing in the Attribute ID ring control has constants as
                valid values, you can view a list of the constants by pressing on this
                control. Select a value by double-clicking on it or by selecting it and
                then pressing . Note: Some of the values might not be valid depending on
                the current settings of the instrument session. Default Value: none

        '''
        vi_ctype = visatype.ViSession(self._vi)  # case S110
        channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding))  # case C010
        attribute_id_ctype = visatype.ViAttr(attribute_id)  # case S150
        attribute_value_ctype = visatype.ViBoolean(attribute_value)  # case S150
        error_code = self._library.niSwitch_SetAttributeViBoolean(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype)
        errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
        return
github ni / nimi-python / generated / niswitch / session.py View on Github external
Connects two channels by specifying an explicit path in the path list
        parameter. set_path is particularly useful where path
        repeatability is important, such as in calibrated signal paths. If this
        is not necessary, use connect.

        Args:
            path_list (str): A string composed of comma-separated paths between channel 1 and channel
                2. The first and last names in the path are the endpoints of the path.
                Every other channel in the path are configuration channels. Example of a
                valid path list string: ch0->com0, com0->ab0. In this example, com0 is a
                configuration channel. Default value: None Obtain the path list for a
                previously created path with get_path.

        '''
        vi_ctype = visatype.ViSession(self._vi)  # case S110
        path_list_ctype = ctypes.create_string_buffer(path_list.encode(self._encoding))  # case C020
        error_code = self._library.niSwitch_SetPath(vi_ctype, path_list_ctype)
        errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
        return
github ni / nimi-python / generated / niswitch / session.py View on Github external
scan_advanced_output topic in the NI Switches Help for
                a list of valid values.

            scan_delay (float): The minimum length of time you want the switch device to wait after it
                creates a path until it asserts a trigger on the scan advanced output
                line. The driver uses this value to set the Scan Delay attribute. The
                scan delay is in addition to the settling time.The driver uses this
                value to set the scan_delay attribute. Express this
                value in seconds. Default value: 0.0 s

        '''
        if type(trigger_input) is not enums.TriggerInput:
            raise TypeError('Parameter mode must be of type ' + str(enums.TriggerInput))
        if type(scan_advanced_output) is not enums.ScanAdvancedOutput:
            raise TypeError('Parameter mode must be of type ' + str(enums.ScanAdvancedOutput))
        vi_ctype = visatype.ViSession(self._vi)  # case S110
        scan_delay_ctype = visatype.ViReal64(scan_delay)  # case S150
        trigger_input_ctype = visatype.ViInt32(trigger_input.value)  # case S130
        scan_advanced_output_ctype = visatype.ViInt32(scan_advanced_output.value)  # case S130
        error_code = self._library.niSwitch_ConfigureScanTrigger(vi_ctype, scan_delay_ctype, trigger_input_ctype, scan_advanced_output_ctype)
        errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
        return