How to use the niswitch.visatype 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, expected_value):
        _ScalarMatcher.__init__(self, visatype.ViSession, expected_value)
github ni / nimi-python / generated / niswitch / unit_tests / matchers.py View on Github external
def __init__(self, expected_value):
        _ScalarMatcher.__init__(self, visatype.ViInt64, expected_value)
github ni / nimi-python / generated / niswitch / session.py View on Github external
this function retrieves and then clears the error information for the
        current execution thread. If the InstrumentHandle parameter is an
        invalid session, the function does nothing and returns an error.
        Normally, the error information describes the first error that occurred
        since the user last called _get_error or ClearError.

        Note:
        One or more of the referenced functions are not in the Python API for this driver.

        Returns:
            code (int): Returns the error code for the session or execution thread. If you pass
                0 for the Buffer Size, you can pass VI_NULL for this parameter.

        '''
        vi_ctype = visatype.ViSession(self._vi)  # case S110
        code_ctype = visatype.ViStatus()  # case S200
        buffer_size_ctype = visatype.ViInt32()  # case S170
        description_ctype = None  # case C050
        error_code = self._library.niSwitch_GetError(vi_ctype, None if code_ctype is None else (ctypes.pointer(code_ctype)), buffer_size_ctype, description_ctype)
        errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=True)
        buffer_size_ctype = visatype.ViInt32(error_code)  # case S180
        description_ctype = (visatype.ViChar * buffer_size_ctype.value)()  # case C060
        error_code = self._library.niSwitch_GetError(vi_ctype, None if code_ctype is None else (ctypes.pointer(code_ctype)), buffer_size_ctype, description_ctype)
        errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True)
        return int(code_ctype.value), description_ctype.value.decode(self._encoding)
github ni / nimi-python / generated / niswitch / session.py View on Github external
ch0, ab0, 1wire, hlselect Refer to Devices Overview for a list of valid
                relay names for the switch module.

            relay_action (enums.RelayAction): Specifies whether to open or close a given relay. Default value: Relay
                Close Defined values: NISWITCH_VAL_OPEN_RELAY
                NISWITCH_VAL_CLOSE_RELAY (Default Value)

                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.

        '''
        if type(relay_action) is not enums.RelayAction:
            raise TypeError('Parameter mode must be of type ' + str(enums.RelayAction))
        vi_ctype = visatype.ViSession(self._vi)  # case S110
        relay_name_ctype = ctypes.create_string_buffer(relay_name.encode(self._encoding))  # case C020
        relay_action_ctype = visatype.ViInt32(relay_action.value)  # case S130
        error_code = self._library.niSwitch_RelayControl(vi_ctype, relay_name_ctype, relay_action_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
Note:
        One or more of the referenced functions are not in the Python API for this driver.

        Returns:
            code (int): Returns the error code for the session or execution thread. If you pass
                0 for the Buffer Size, you can pass VI_NULL for this parameter.

        '''
        vi_ctype = visatype.ViSession(self._vi)  # case S110
        code_ctype = visatype.ViStatus()  # case S200
        buffer_size_ctype = visatype.ViInt32()  # case S170
        description_ctype = None  # case C050
        error_code = self._library.niSwitch_GetError(vi_ctype, None if code_ctype is None else (ctypes.pointer(code_ctype)), buffer_size_ctype, description_ctype)
        errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=True)
        buffer_size_ctype = visatype.ViInt32(error_code)  # case S180
        description_ctype = (visatype.ViChar * buffer_size_ctype.value)()  # case C060
        error_code = self._library.niSwitch_GetError(vi_ctype, None if code_ctype is None else (ctypes.pointer(code_ctype)), buffer_size_ctype, description_ctype)
        errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True)
        return int(code_ctype.value), description_ctype.value.decode(self._encoding)
github ni / nimi-python / generated / niswitch / session.py View on Github external
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 .


        Returns:
            attribute_value (bool): Returns the current value of the attribute. Pass the address of a
                ViBoolean variable. 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 .

        '''
        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()  # case S200
        error_code = self._library.niSwitch_GetAttributeViBoolean(vi_ctype, channel_name_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype)))
        errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
        return bool(attribute_value_ctype.value)
github ni / nimi-python / generated / niswitch / session.py View on Github external
constants by moving to the Attribute Value control and pressing .


        Returns:
            attribute_value (int): Returns the current value of the attribute. Pass the address of a
                ViInt32 variable. 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 .

        '''
        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.ViInt32()  # case S200
        error_code = self._library.niSwitch_GetAttributeViInt32(vi_ctype, channel_name_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype)))
        errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
        return int(attribute_value_ctype.value)
github ni / nimi-python / generated / niswitch / session.py View on Github external
Returns:
            vi (int): A particular NI-SWITCH session established with
                _init_with_topology, InitWithOptions, or init
                and used for all subsequent NI-SWITCH calls.

                Note:
                One or more of the referenced functions are not in the Python API for this driver.

        '''
        resource_name_ctype = ctypes.create_string_buffer(resource_name.encode(self._encoding))  # case C020
        topology_ctype = ctypes.create_string_buffer(topology.encode(self._encoding))  # case C020
        simulate_ctype = visatype.ViBoolean(simulate)  # case S150
        reset_device_ctype = visatype.ViBoolean(reset_device)  # case S150
        vi_ctype = visatype.ViSession()  # case S200
        error_code = self._library.niSwitch_InitWithTopology(resource_name_ctype, topology_ctype, simulate_ctype, reset_device_ctype, None if vi_ctype is None else (ctypes.pointer(vi_ctype)))
        errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
        return int(vi_ctype.value)