diff --git a/CHANGELOG.md b/CHANGELOG.md index dbc978225..9adbe6ed2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,7 @@ All notable changes to this project will be documented in this file. * `runt_high_threshold`, `runt_low_threshold`, `runt_polarity`, `runt_condition`, `runt_time_high_limit`, `runt_time_low_limit` properties and associated enums * `width_condition`, `width_high_threshold`, `width_low_threshold`, `width_polarity` properties and associated enums * #### Changed + * Fixed enum values for `TIME_HISTOGRAM_MEAN_PLUS_STDEV`, `TIME_HISTOGRAM_MEAN_PLUS_2_STDEV`, `HF_REJECT` and `LF_REJECT` * #### Removed * ### NI Switch Executive * #### Added @@ -78,8 +79,12 @@ All notable changes to this project will be documented in this file. `get_number_of_vectors()`, `get_pattern_file_path()`, `get_pin_type()`, `get_time_set_compare_edges()`, `get_time_set_drive_edges()`, `is_pattern_file_modified_since_load()`, `load_levels_internal()`, `load_pattern_internal()`, `load_timing_internal()`, `uncommit()` * Need to determine how to generate this function - `fetch_capture_waveform_u32()` - - +* ### NI-TClk + * #### Added + * Initial support + * #### Changed + * #### Removed + ## 1.1.2 - 2019-06-06 * ### ALL * #### Changed diff --git a/Makefile b/Makefile index ee407e9dd..c986de43f 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # In alphabetical order except put nifake first and nimodinst last # - nifake first to get the most code generator coverage # - nimodinst last so that the version from nimodinst is used for any global versions (docs/conf.py) -ALL_DRIVERS := nifake nidcpower nidigital nidmm nifgen niscope niswitch nise nimodinst +ALL_DRIVERS := nifake nitclk nidcpower nidigital nidmm nifgen niscope niswitch nise nimodinst DRIVERS ?= $(ALL_DRIVERS) ROOT_DIR := $(abspath .) diff --git a/README.rst b/README.rst index cc46632b6..c6b93d418 100644 --- a/README.rst +++ b/README.rst @@ -391,6 +391,47 @@ NI-SWITCH Python API Status :target: https://github.com/ni/nimi-python/pulls?q=is%3Aopen+is%3Aissue+label%3Aniswitch + +NI-TClk Python API Status +------------------------- + ++-------------------------------+-----------------------+ +| NI-TClk (nitclk) | | ++===============================+=======================+ +| Driver Version Tested Against | 18.0.0 | ++-------------------------------+-----------------------+ +| Driver API Version | 255.0.0d0 | ++-------------------------------+-----------------------+ +| PyPI Version | |nitclkLatestVersion| | ++-------------------------------+-----------------------+ +| Supported Python Version | |nitclkPythonVersion| | ++-------------------------------+-----------------------+ +| Open Issues | |nitclkOpenIssues| | ++-------------------------------+-----------------------+ +| Open Pull Requests | |nitclkOpenPRs| | ++-------------------------------+-----------------------+ + + +.. |nitclkLatestVersion| image:: http://img.shields.io/pypi/v/nitclk.svg + :alt: Latest NI-TClk Version + :target: http://pypi.python.org/pypi/nitclk + + +.. |nitclkPythonVersion| image:: http://img.shields.io/pypi/pyversions/nitclk.svg + :alt: NI-TClk supported Python versions + :target: http://pypi.python.org/pypi/nitclk + + +.. |nitclkOpenIssues| image:: https://img.shields.io/github/issues/ni/nimi-python/nitclk.svg + :alt: Open Issues + Pull Requests for NI-TClk + :target: https://github.com/ni/nimi-python/issues?q=is%3Aopen+is%3Aissue+label%3Anitclk + + +.. |nitclkOpenPRs| image:: https://img.shields.io/github/issues-pr/ni/nimi-python/nitclk.svg + :alt: Pull Requests for NI-TClk + :target: https://github.com/ni/nimi-python/pulls?q=is%3Aopen+is%3Aissue+label%3Anitclk + + .. _installation-section: Installation diff --git a/build/helper/codegen_helper.py b/build/helper/codegen_helper.py index 3cae46391..4fa319597 100644 --- a/build/helper/codegen_helper.py +++ b/build/helper/codegen_helper.py @@ -325,10 +325,10 @@ def _get_ctype_variable_definition_snippet_for_scalar(parameter, parameters, ivi for p in corresponding_buffer_parameters: assert p['direction'] == 'out' assert p['size']['mechanism'] != 'fixed-size' - definition = '{0}.{1}({2}) # case S190'.format(module_name, parameter['ctypes_type'], parameter['python_name']) + definition = '{0}.{1}({2}) # case S210'.format(module_name, parameter['ctypes_type'], parameter['python_name']) else: assert parameter['direction'] == 'out' - definition = '{0}.{1}() # case S200'.format(module_name, parameter['ctypes_type']) + definition = '{0}.{1}() # case S220'.format(module_name, parameter['ctypes_type']) if definition is not None: definitions.append(parameter['ctypes_variable_name'] + ' = ' + definition) @@ -348,6 +348,7 @@ def _get_ctype_variable_definition_snippet_for_buffers(parameter, parameters, iv B600. Output buffer with mechanism passed-in: get_ctypes_pointer_for_buffer(value-array.array('d', [0] * buffer_size, library_type=ViInt32) B610. Output buffer with mechanism ivi-dance-with-a-twist, QUERY_SIZE: None B620. Output buffer with mechanism ivi-dance-with-a-twist, GET_DATA: get_ctypes_pointer_for_buffer(value=array.array('d', [0] * buffer_size_ctype.value, library_type=ViInt32) + B630. Input buffer of simple types with converter: get_ctypes_pointer_for_buffer(value=convert(array.array('d', list)), library_type=visatype.ViReal64) Return Value (list): each item in the list will be one line needed for the declaration of that parameter @@ -360,6 +361,19 @@ def _get_ctype_variable_definition_snippet_for_buffers(parameter, parameters, iv if parameter['numpy'] is True and use_numpy_array is True: definition = 'get_ctypes_pointer_for_buffer(value={0}) # case B510'.format(parameter['python_name']) + elif parameter['direction'] == 'in' and 'python_api_converter_name' in parameter: + if custom_type is not None: + assert False, 'Custom type {} is not supported with converters'.format(custom_type) + else: + if parameter['use_array']: + # If the incoming type is array.array, we can just use that, otherwise we need to create an array.array that is initialized with the passed in value, which must be iterable + array_declaration = '{0}_array = get_ctypes_and_array(value=_converters.{2}({0}), array_type="{1}") # case B630'.format(parameter['python_name'], get_array_type_for_api_type(parameter['ctypes_type'], parameter['python_api_converter_name'])) + definitions.append(array_declaration) + definition = 'get_ctypes_pointer_for_buffer(value={0}_array, library_type={1}.{2}) # case B630'.format(parameter['python_name'], module_name, parameter['ctypes_type']) + elif parameter['use_list']: + definition = 'get_ctypes_pointer_for_buffer(value=_converters.{3}({0}), library_type={1}.{2}) # case B630'.format(parameter['python_name'], module_name, parameter['ctypes_type'], parameter['python_api_converter_name']) + else: + assert False, "Expected either 'use_array' or 'use_list' to be True. Both False." elif parameter['direction'] == 'in': if custom_type is not None: definition = 'get_ctypes_pointer_for_buffer([{0}.{1}(c) for c in {2}], library_type={0}.{1}) # case B540'.format(module_name, parameter['ctypes_type'], parameter['python_name'], parameter['python_name']) @@ -1257,14 +1271,14 @@ def test_get_ctype_variable_declaration_snippet_case_s180(): assert snippet == ["string_size_ctype = _visatype.ViInt32(error_code) # case S180"] -def test_get_ctype_variable_declaration_snippet_case_s190(): +def test_get_ctype_variable_declaration_snippet_case_s210(): snippet = get_ctype_variable_declaration_snippet(parameters_for_testing[4], parameters_for_testing, IviDanceStep.NOT_APPLICABLE, config_for_testing, use_numpy_array=False) - assert snippet == ["number_of_elements_ctype = _visatype.ViInt32(number_of_elements) # case S190"] + assert snippet == ["number_of_elements_ctype = _visatype.ViInt32(number_of_elements) # case S210"] -def test_get_ctype_variable_declaration_snippet_case_s200(): +def test_get_ctype_variable_declaration_snippet_case_s220(): snippet = get_ctype_variable_declaration_snippet(parameters_for_testing[1], parameters_for_testing, IviDanceStep.NOT_APPLICABLE, config_for_testing, use_numpy_array=False) - assert snippet == ["output_ctype = _visatype.ViInt64() # case S200"] + assert snippet == ["output_ctype = _visatype.ViInt64() # case S220"] def test_get_ctype_variable_declaration_snippet_case_s210(): diff --git a/build/helper/metadata_add_all.py b/build/helper/metadata_add_all.py index 0adb1f3d4..e1d61961d 100644 --- a/build/helper/metadata_add_all.py +++ b/build/helper/metadata_add_all.py @@ -292,7 +292,7 @@ def _add_is_session_handle(parameter): def _fix_type(parameter): '''Replace any spaces in the parameter type with an underscore.''' - parameter['type'] = parameter['type'].replace('[ ]', '[]').replace(' ', '_') + parameter['type'] = parameter['type'].replace('[ ]', '[]').replace(' []', '[]').replace(' ', '_') def _add_use_in_python_api(p, parameters): @@ -314,7 +314,7 @@ def _setup_init_function(functions, config): # Change the init_function information for generating the docstring # We are assuming the last parameter is vi out for p in init_function['parameters']: - if p['name'] == 'vi': + if p['name'] == config['session_handle_parameter_name']: p['documentation']['description'] = session_return_text p['type_in_documentation'] = config['module_name'] + '.Session' p['python_name'] = 'session' diff --git a/build/templates/__init__.py.mako b/build/templates/__init__.py.mako index 05382e06d..f7cd0d909 100644 --- a/build/templates/__init__.py.mako +++ b/build/templates/__init__.py.mako @@ -1,7 +1,10 @@ ${template_parameters['encoding_tag']} # This file was generated <% +import build.helper as helper + enums = template_parameters['metadata'].enums +functions = helper.filter_codegen_functions(template_parameters['metadata'].functions) config = template_parameters['metadata'].config module_name = config['module_name'] registry_name = config['driver_registry'] if 'driver_registry' in config else config['driver_name'] @@ -14,7 +17,22 @@ from ${module_name}.enums import * # noqa: F403,F401,H303 % endif from ${module_name}.errors import DriverWarning # noqa: F401 from ${module_name}.errors import Error # noqa: F401 +<% +# nitclk is different. It does not have a session class that we open a session on +# Instead it is a bunch of stateless function calls. So if we are NOT building for +# nitclk, we import the Session class like before. If it is nitclk then we will +# import each function and the SessionReference class +%>\ +% if config['module_name'] != 'nitclk': from ${module_name}.session import Session # noqa: F401 +% else: +from ${module_name}.session import SessionReference # noqa: F401 + +# Function imports +% for func_name in sorted([functions[k]['python_name'] for k in functions if not functions[k]['render_in_session_base']]): +from ${module_name}.session import ${func_name} # noqa: F401 +% endfor +% endif <% # Blank lines are to make each import separate so that they do not need to be sorted # Otherwise flake8 test fails diff --git a/build/templates/_attributes.py.mako b/build/templates/_attributes.py.mako index 857629439..9f084dcfa 100644 --- a/build/templates/_attributes.py.mako +++ b/build/templates/_attributes.py.mako @@ -2,6 +2,7 @@ ${template_parameters['encoding_tag']} # This file was generated <% module_name = template_parameters['metadata'].config['module_name'] + config = template_parameters['metadata'].config %>\ import ${module_name}._converters as _converters @@ -112,4 +113,18 @@ class AttributeEnum(object): return self._underlying_attribute.__set__(session, value.value) +% if config['module_name'] == 'nitclk': +# nitclk specific attribute type +class AttributeViInt32SessionReference(Attribute): + + def __get__(self, session, session_type): + # Import here to avoid a circular dependency when initial import happens + from ${module_name}.session import SessionReference + return SessionReference(session._get_attribute_vi_int32(self._attribute_id)) + + def __set__(self, session, value): + session._set_attribute_vi_int32(self._attribute_id, _converters.convert_to_nitclk_session_num(value)) + + +% endif diff --git a/build/templates/_converters.py.mako b/build/templates/_converters.py.mako index 3d4f860ec..01150443c 100644 --- a/build/templates/_converters.py.mako +++ b/build/templates/_converters.py.mako @@ -215,6 +215,36 @@ def convert_init_with_options_dictionary(values, encoding): return init_with_options_string +% if config['module_name'] == 'nitclk': +# nitclk specific converters +def convert_to_nitclk_session_num(item): + '''Convert from supported objects to NI-TClk Session Num + + Supported objects are: + - class with .tclk object of type nitclk.SessionReference + - nitclk.SessionReference + - NI-TClk Session Num + ''' + try: + return item.tclk.get_session_number() + except KeyError: + pass + + try: + return item.get_session_number() + except KeyError: + pass + + # If we haven't gotten a SessionReference, we assume the item is the actual nitclk session num and return it + return item + + +def convert_to_nitclk_session_num_list(item_list): + '''Converts a list of items to nitclk session nums''' + return [convert_to_nitclk_session_num(i) for i in item_list] + + +% endif # Let's run some tests def test_convert_init_with_options_dictionary(): assert convert_init_with_options_dictionary('', 'ascii') == '' diff --git a/docs/_static/nitclk_usage.inc b/docs/_static/nitclk_usage.inc new file mode 100644 index 000000000..29c66add1 --- /dev/null +++ b/docs/_static/nitclk_usage.inc @@ -0,0 +1,13 @@ +Usage +------ + +The following is a basic example of using the **nitclk** module to TBD. + +.. code-block:: python + + import nitclk + # Configure the session. + + +Additional examples for NI-TClk are located in src/nitclk/examples/ directory. + diff --git a/docs/conf.py b/docs/conf.py index b2e6e31e8..e6c48b141 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -63,7 +63,7 @@ # built documents. # # The full version, including alpha/beta/rc tags. -release = '0.1.1.dev0' +release = '0.1.0.dev0' # The short X.Y version. version = release[:3] diff --git a/docs/index.rst b/docs/index.rst index daaa39cbb..fd3f1e2cc 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -36,6 +36,7 @@ Refer to your driver documentation for device-specific information and detailed niswitch nimodinst nise + nitclk Indices and tables ================== diff --git a/docs/nitclk.rst b/docs/nitclk.rst new file mode 100644 index 000000000..3ed949862 --- /dev/null +++ b/docs/nitclk.rst @@ -0,0 +1,10 @@ +nitclk module +============================================================= + +.. include:: nitclk/installation.inc + +.. include:: _static/nitclk_usage.inc + +.. include:: nitclk/toc.inc + + diff --git a/docs/nitclk/class.rst b/docs/nitclk/class.rst new file mode 100644 index 000000000..4dc89edde --- /dev/null +++ b/docs/nitclk/class.rst @@ -0,0 +1,954 @@ +nitclk.Session +============== + +.. py:module:: nitclk + +.. py:class:: Session(self) + + + + TBD + + + + + + + **Properties** + + +------------------------------------------------+----------------------------------------------------------------------------+ + | Property | Datatype | + +================================================+============================================================================+ + | :py:attr:`exported_sync_pulse_output_terminal` | str | + +------------------------------------------------+----------------------------------------------------------------------------+ + | :py:attr:`exported_tclk_output_terminal` | str | + +------------------------------------------------+----------------------------------------------------------------------------+ + | :py:attr:`pause_trigger_master_session` | nimi-python Session class, nitclk.SessionReference, NI-TClk Session Number | + +------------------------------------------------+----------------------------------------------------------------------------+ + | :py:attr:`ref_trigger_master_session` | nimi-python Session class, nitclk.SessionReference, NI-TClk Session Number | + +------------------------------------------------+----------------------------------------------------------------------------+ + | :py:attr:`sample_clock_delay` | float | + +------------------------------------------------+----------------------------------------------------------------------------+ + | :py:attr:`script_trigger_master_session` | nimi-python Session class, nitclk.SessionReference, NI-TClk Session Number | + +------------------------------------------------+----------------------------------------------------------------------------+ + | :py:attr:`sequencer_flag_master_session` | nimi-python Session class, nitclk.SessionReference, NI-TClk Session Number | + +------------------------------------------------+----------------------------------------------------------------------------+ + | :py:attr:`start_trigger_master_session` | nimi-python Session class, nitclk.SessionReference, NI-TClk Session Number | + +------------------------------------------------+----------------------------------------------------------------------------+ + | :py:attr:`sync_pulse_clock_source` | str | + +------------------------------------------------+----------------------------------------------------------------------------+ + | :py:attr:`sync_pulse_sender_sync_pulse_source` | str | + +------------------------------------------------+----------------------------------------------------------------------------+ + | :py:attr:`sync_pulse_source` | str | + +------------------------------------------------+----------------------------------------------------------------------------+ + | :py:attr:`tclk_actual_period` | float | + +------------------------------------------------+----------------------------------------------------------------------------+ + + **Public methods** + + +----------------------------------------------------+ + | Method name | + +====================================================+ + | :py:func:`configure_for_homogeneous_triggers` | + +----------------------------------------------------+ + | :py:func:`finish_sync_pulse_sender_synchronize` | + +----------------------------------------------------+ + | :py:func:`init_for_documentation` | + +----------------------------------------------------+ + | :py:func:`initiate` | + +----------------------------------------------------+ + | :py:func:`is_done` | + +----------------------------------------------------+ + | :py:func:`setup_for_sync_pulse_sender_synchronize` | + +----------------------------------------------------+ + | :py:func:`synchronize` | + +----------------------------------------------------+ + | :py:func:`synchronize_to_sync_pulse_sender` | + +----------------------------------------------------+ + | :py:func:`wait_until_done` | + +----------------------------------------------------+ + + +Properties +---------- + +exported_sync_pulse_output_terminal +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + .. py:currentmodule:: nitclk.Session + + .. py:attribute:: exported_sync_pulse_output_terminal + + Specifies the destination of the Sync Pulse. This property is most often used when synchronizing a multichassis system. + Values + Empty string. Empty string is a valid value, indicating that the signal is not exported. + PXI Devices - 'PXI_Trig0' through 'PXI_Trig7' and device-specific settings + PCI Devices - 'RTSI_0' through 'RTSI_7' and device-specific settings + Examples of Device-Specific Settings + - NI PXI-5122 supports 'PFI0' and 'PFI1' + - NI PXI-5421 supports 'PFI0', 'PFI1', 'PFI4', and 'PFI5' + - NI PXI-6551/6552 supports 'PFI0', 'PFI1', 'PFI2', and 'PFI3' + Default Value is empty string + + The following table lists the characteristics of this property. + + +----------------+------------+ + | Characteristic | Value | + +================+============+ + | Datatype | str | + +----------------+------------+ + | Permissions | read-write | + +----------------+------------+ + | Channel Based | No | + +----------------+------------+ + | Resettable | No | + +----------------+------------+ + + .. tip:: + This property corresponds to the following LabVIEW Property or C Attribute: + + - LabVIEW Property: **Export Sync Pulse Output Terminal** + - C Attribute: **NITCLK_ATTR_EXPORTED_SYNC_PULSE_OUTPUT_TERMINAL** + +exported_tclk_output_terminal +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + .. py:currentmodule:: nitclk.Session + + .. py:attribute:: exported_tclk_output_terminal + + Specifies the destination of the device's TClk signal. + Values + Empty string. Empty string is a valid value, indicating that the signal is not exported. + PXI Devices - 'PXI_Trig0' through 'PXI_Trig7' and device-specific settings + PCI Devices - 'RTSI_0' through 'RTSI_7' and device-specific settings + Examples of Device-Specific Settings + - NI PXI-5122 supports 'PFI0' and 'PFI1' + - NI PXI-5421 supports 'PFI0', 'PFI1', 'PFI4', and 'PFI5' + - NI PXI-6551/6552 supports 'PFI0', 'PFI1', 'PFI2', and 'PFI3' + Default Value is empty string + + The following table lists the characteristics of this property. + + +----------------+------------+ + | Characteristic | Value | + +================+============+ + | Datatype | str | + +----------------+------------+ + | Permissions | read-write | + +----------------+------------+ + | Channel Based | No | + +----------------+------------+ + | Resettable | No | + +----------------+------------+ + + .. tip:: + This property corresponds to the following LabVIEW Property or C Attribute: + + - LabVIEW Property: **Output Terminal** + - C Attribute: **NITCLK_ATTR_EXPORTED_TCLK_OUTPUT_TERMINAL** + +pause_trigger_master_session +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + .. py:currentmodule:: nitclk.Session + + .. py:attribute:: pause_trigger_master_session + + Specifies the pause trigger master session. + For external triggers, the session that originally receives the trigger. For None (no trigger configured) or software triggers, the session that originally generates the trigger. + + The following table lists the characteristics of this property. + + +----------------+----------------------------------------------------------------------------+ + | Characteristic | Value | + +================+============================================================================+ + | Datatype | nimi-python Session class, nitclk.SessionReference, NI-TClk Session Number | + +----------------+----------------------------------------------------------------------------+ + | Permissions | read-write | + +----------------+----------------------------------------------------------------------------+ + | Channel Based | No | + +----------------+----------------------------------------------------------------------------+ + | Resettable | No | + +----------------+----------------------------------------------------------------------------+ + + .. tip:: + This property corresponds to the following LabVIEW Property or C Attribute: + + - LabVIEW Property: **Pause Trigger Master Session** + - C Attribute: **NITCLK_ATTR_PAUSE_TRIGGER_MASTER_SESSION** + +ref_trigger_master_session +~~~~~~~~~~~~~~~~~~~~~~~~~~ + + .. py:currentmodule:: nitclk.Session + + .. py:attribute:: ref_trigger_master_session + + Specifies the reference trigger master session. + For external triggers, the session that originally receives the trigger. For None (no trigger configured) or software triggers, the session that originally generates the trigger. + + The following table lists the characteristics of this property. + + +----------------+----------------------------------------------------------------------------+ + | Characteristic | Value | + +================+============================================================================+ + | Datatype | nimi-python Session class, nitclk.SessionReference, NI-TClk Session Number | + +----------------+----------------------------------------------------------------------------+ + | Permissions | read-write | + +----------------+----------------------------------------------------------------------------+ + | Channel Based | No | + +----------------+----------------------------------------------------------------------------+ + | Resettable | No | + +----------------+----------------------------------------------------------------------------+ + + .. tip:: + This property corresponds to the following LabVIEW Property or C Attribute: + + - LabVIEW Property: **Reference Trigger Master Session** + - C Attribute: **NITCLK_ATTR_REF_TRIGGER_MASTER_SESSION** + +sample_clock_delay +~~~~~~~~~~~~~~~~~~ + + .. py:currentmodule:: nitclk.Session + + .. py:attribute:: sample_clock_delay + + Specifies the sample clock delay. + Specifies the delay, in seconds, to apply to the session sample clock relative to the other synchronized sessions. During synchronization, NI-TClk aligns the sample clocks on the synchronized devices. If you want to delay the sample clocks, set this property before calling :py:meth:`nitclk.Session.synchronize`. + not supported for acquisition sessions. + Values - Between minus one and plus one period of the sample clock. + One sample clock period is equal to (1/sample clock rate). For example, for a session with sample rate of 100 MS/s, you can specify sample clock delays between -10.0 ns and +10.0 ns. + Default Value is 0 + + + + .. note:: Sample clock delay is supported for generation sessions only; it is + + The following table lists the characteristics of this property. + + +----------------+------------+ + | Characteristic | Value | + +================+============+ + | Datatype | float | + +----------------+------------+ + | Permissions | read-write | + +----------------+------------+ + | Channel Based | No | + +----------------+------------+ + | Resettable | No | + +----------------+------------+ + + .. tip:: + This property corresponds to the following LabVIEW Property or C Attribute: + + - LabVIEW Property: **Sample Clock Delay** + - C Attribute: **NITCLK_ATTR_SAMPLE_CLOCK_DELAY** + +script_trigger_master_session +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + .. py:currentmodule:: nitclk.Session + + .. py:attribute:: script_trigger_master_session + + Specifies the script trigger master session. + For external triggers, the session that originally receives the trigger. For None (no trigger configured) or software triggers, the session that originally generates the trigger. + + The following table lists the characteristics of this property. + + +----------------+----------------------------------------------------------------------------+ + | Characteristic | Value | + +================+============================================================================+ + | Datatype | nimi-python Session class, nitclk.SessionReference, NI-TClk Session Number | + +----------------+----------------------------------------------------------------------------+ + | Permissions | read-write | + +----------------+----------------------------------------------------------------------------+ + | Channel Based | No | + +----------------+----------------------------------------------------------------------------+ + | Resettable | No | + +----------------+----------------------------------------------------------------------------+ + + .. tip:: + This property corresponds to the following LabVIEW Property or C Attribute: + + - LabVIEW Property: **Script Trigger Master Session** + - C Attribute: **NITCLK_ATTR_SCRIPT_TRIGGER_MASTER_SESSION** + +sequencer_flag_master_session +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + .. py:currentmodule:: nitclk.Session + + .. py:attribute:: sequencer_flag_master_session + + Specifies the sequencer flag master session. + For external triggers, the session that originally receives the trigger. + For None (no trigger configured) or software triggers, the session that + originally generates the trigger. + + The following table lists the characteristics of this property. + + +----------------+----------------------------------------------------------------------------+ + | Characteristic | Value | + +================+============================================================================+ + | Datatype | nimi-python Session class, nitclk.SessionReference, NI-TClk Session Number | + +----------------+----------------------------------------------------------------------------+ + | Permissions | read-write | + +----------------+----------------------------------------------------------------------------+ + | Channel Based | No | + +----------------+----------------------------------------------------------------------------+ + | Resettable | No | + +----------------+----------------------------------------------------------------------------+ + + .. tip:: + This property corresponds to the following LabVIEW Property or C Attribute: + + - LabVIEW Property: **Sequencer Flag Master Session** + - C Attribute: **NITCLK_ATTR_SEQUENCER_FLAG_MASTER_SESSION** + +start_trigger_master_session +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + .. py:currentmodule:: nitclk.Session + + .. py:attribute:: start_trigger_master_session + + Specifies the start trigger master session. + For external triggers, the session that originally receives the trigger. For None (no trigger configured) or software triggers, the session that originally generates the trigger. + + The following table lists the characteristics of this property. + + +----------------+----------------------------------------------------------------------------+ + | Characteristic | Value | + +================+============================================================================+ + | Datatype | nimi-python Session class, nitclk.SessionReference, NI-TClk Session Number | + +----------------+----------------------------------------------------------------------------+ + | Permissions | read-write | + +----------------+----------------------------------------------------------------------------+ + | Channel Based | No | + +----------------+----------------------------------------------------------------------------+ + | Resettable | No | + +----------------+----------------------------------------------------------------------------+ + + .. tip:: + This property corresponds to the following LabVIEW Property or C Attribute: + + - LabVIEW Property: **Start Trigger Master Session** + - C Attribute: **NITCLK_ATTR_START_TRIGGER_MASTER_SESSION** + +sync_pulse_clock_source +~~~~~~~~~~~~~~~~~~~~~~~ + + .. py:currentmodule:: nitclk.Session + + .. py:attribute:: sync_pulse_clock_source + + Specifies the Sync Pulse Clock source. This property is typically used to synchronize PCI devices when you want to control RTSI 7 yourself. Make sure that a 10 MHz clock is driven onto RTSI 7. + Values + PCI Devices - 'RTSI_7' and 'None' + PXI Devices - 'PXI_CLK10' and 'None' + Default Value - 'None' directs :py:meth:`nitclk.Session.synchronize` to create the necessary routes. For PCI, one of the synchronized devices drives a 10 MHz clock on RTSI 7 unless that line is already being driven. + + The following table lists the characteristics of this property. + + +----------------+------------+ + | Characteristic | Value | + +================+============+ + | Datatype | str | + +----------------+------------+ + | Permissions | read-write | + +----------------+------------+ + | Channel Based | No | + +----------------+------------+ + | Resettable | No | + +----------------+------------+ + + .. tip:: + This property corresponds to the following LabVIEW Property or C Attribute: + + - LabVIEW Property: **Sync Pulse Clock Source** + - C Attribute: **NITCLK_ATTR_SYNC_PULSE_CLOCK_SOURCE** + +sync_pulse_sender_sync_pulse_source +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + .. py:currentmodule:: nitclk.Session + + .. py:attribute:: sync_pulse_sender_sync_pulse_source + + Specifies the external sync pulse source for the Sync Pulse Sender. You can use this source to synchronize the Sync Pulse Sender with an external non-TClk source. + Values + Empty string. Empty string is a valid value, indicating that the signal is not exported. + PXI Devices - 'PXI_Trig0' through 'PXI_Trig7' and device-specific settings + PCI Devices - 'RTSI_0' through 'RTSI_7' and device-specific settings + Examples of Device-Specific Settings + - NI PXI-5122 supports 'PFI0' and 'PFI1' + - NI PXI-5421 supports 'PFI0', 'PFI1', 'PFI4', and 'PFI5' + - NI PXI-6551/6552 supports 'PFI0', 'PFI1', 'PFI2', and 'PFI3' + Default Value is empty string + + The following table lists the characteristics of this property. + + +----------------+------------+ + | Characteristic | Value | + +================+============+ + | Datatype | str | + +----------------+------------+ + | Permissions | read-write | + +----------------+------------+ + | Channel Based | No | + +----------------+------------+ + | Resettable | No | + +----------------+------------+ + + .. tip:: + This property corresponds to the following LabVIEW Property or C Attribute: + + - LabVIEW Property: **External Pulse Source** + - C Attribute: **NITCLK_ATTR_SYNC_PULSE_SENDER_SYNC_PULSE_SOURCE** + +sync_pulse_source +~~~~~~~~~~~~~~~~~ + + .. py:currentmodule:: nitclk.Session + + .. py:attribute:: sync_pulse_source + + Specifies the Sync Pulse source. This property is most often used when synchronizing a multichassis system. + Values + Empty string + PXI Devices - 'PXI_Trig0' through 'PXI_Trig7' and device-specific settings + PCI Devices - 'RTSI_0' through 'RTSI_7' and device-specific settings + Examples of Device-Specific Settings + - NI PXI-5122 supports 'PFI0' and 'PFI1' + - NI PXI-5421 supports 'PFI0', 'PFI1', 'PFI2', and 'PFI3' + - NI PXI-6551/6552 supports 'PFI0', 'PFI1', 'PFI2', and 'PFI3' + Default Value - Empty string. This default value directs :py:meth:`nitclk.Session.synchronize` to set this property when all the synchronized devices are in one PXI chassis. To synchronize a multichassis system, you must set this property before calling :py:meth:`nitclk.Session.synchronize`. + + The following table lists the characteristics of this property. + + +----------------+------------+ + | Characteristic | Value | + +================+============+ + | Datatype | str | + +----------------+------------+ + | Permissions | read-write | + +----------------+------------+ + | Channel Based | No | + +----------------+------------+ + | Resettable | No | + +----------------+------------+ + + .. tip:: + This property corresponds to the following LabVIEW Property or C Attribute: + + - LabVIEW Property: **Sync Pulse Source** + - C Attribute: **NITCLK_ATTR_SYNC_PULSE_SOURCE** + +tclk_actual_period +~~~~~~~~~~~~~~~~~~ + + .. py:currentmodule:: nitclk.Session + + .. py:attribute:: tclk_actual_period + + Indicates the computed TClk period that will be used during the acquisition. + + The following table lists the characteristics of this property. + + +----------------+-----------+ + | Characteristic | Value | + +================+===========+ + | Datatype | float | + +----------------+-----------+ + | Permissions | read only | + +----------------+-----------+ + | Channel Based | No | + +----------------+-----------+ + | Resettable | No | + +----------------+-----------+ + + .. tip:: + This property corresponds to the following LabVIEW Property or C Attribute: + + - LabVIEW Property: **Period** + - C Attribute: **NITCLK_ATTR_TCLK_ACTUAL_PERIOD** + + +Methods +------- + + +configure_for_homogeneous_triggers +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + .. py:currentmodule:: nitclk.Session + + .. py:method:: configure_for_homogeneous_triggers(sessions) + + Configures the properties commonly required for the TClk synchronization + of device sessions with homogeneous triggers in a single PXI chassis or + a single PC. Use :py:meth:`nitclk.Session.configure_for_homogeneous_triggers` to configure + the properties for the reference clocks, start triggers, reference + triggers, script triggers, and pause triggers. If + :py:meth:`nitclk.Session.configure_for_homogeneous_triggers` cannot perform all the steps + appropriate for the given sessions, it returns an error. If an error is + returned, use the instrument driver methods and properties for signal + routing, along with the following NI-TClk properties: + :py:data:`nitclk.Session.start_trigger_master_session` + :py:data:`nitclk.Session.ref_trigger_master_session` + :py:data:`nitclk.Session.script_trigger_master_session` + :py:data:`nitclk.Session.pause_trigger_master_session` + :py:meth:`nitclk.Session.configure_for_homogeneous_triggers` affects the following clocks and + triggers: - Reference clocks - Start triggers - Reference triggers - + Script triggers - Pause triggers Reference Clocks + :py:meth:`nitclk.Session.configure_for_homogeneous_triggers` configures the reference clocks + if they are needed. Specifically, if the internal sample clocks or + internal sample clock timebases are used, and the reference clock source + is not configured--or is set to None (no trigger + configured)--:py:meth:`nitclk.Session.configure_for_homogeneous_triggers` configures the + following: PXI--The reference clock source on all devices is set to be + the 10 MHz PXI backplane clock (PXI_CLK10). PCI--One of the devices + exports its 10 MHz onboard reference clock to RTSI 7. The reference + clock source on all devices is set to be RTSI 7. Note: If the reference + clock source is set to a value other than None, + :py:meth:`nitclk.Session.configure_for_homogeneous_triggers` cannot configure the reference + clock source. Start Triggers If the start trigger is set to None (no + trigger configured) for all sessions, the sessions are configured to + share the start trigger. The start trigger is shared by: - Implicitly + exporting the start trigger from one session - Configuring the other + sessions for digital edge start triggers with sources corresponding to + the exported start trigger - Setting + :py:data:`nitclk.Session.start_trigger_master_session` to the session that is + exporting the trigger for all sessions If the start triggers are None + for all except one session, :py:meth:`nitclk.Session.configure_for_homogeneous_triggers` + configures the sessions to share the start trigger from the one excepted + session. The start trigger is shared by: - Implicitly exporting start + trigger from the session with the start trigger that is not None - + Configuring the other sessions for digital-edge start triggers with + sources corresponding to the exported start trigger - Setting + :py:data:`nitclk.Session.start_trigger_master_session` to the session that is + exporting the trigger for all sessions If start triggers are configured + for all sessions, :py:meth:`nitclk.Session.configure_for_homogeneous_triggers` does not + affect the start triggers. Start triggers are considered to be + configured for all sessions if either of the following conditions is + true: - No session has a start trigger that is None - One session has a + start trigger that is None, and all other sessions have start triggers + other than None. The one session with the None trigger must have + :py:data:`nitclk.Session.start_trigger_master_session` set to itself, indicating + that the session itself is the start trigger master Reference Triggers + :py:meth:`nitclk.Session.configure_for_homogeneous_triggers` configures sessions that support + reference triggers to share the reference triggers if the reference + triggers are None (no trigger configured) for all except one session. + The reference triggers are shared by: - Implicitly exporting the + reference trigger from the session whose reference trigger is not None - + Configuring the other sessions that support the reference trigger for + digital-edge reference triggers with sources corresponding to the + exported reference trigger - Setting + :py:data:`nitclk.Session.ref_trigger_master_session` to the session that is + exporting the trigger for all sessions that support reference trigger If + the reference triggers are configured for all sessions that support + reference triggers, :py:meth:`nitclk.Session.configure_for_homogeneous_triggers` does not + affect the reference triggers. Reference triggers are considered to be + configured for all sessions if either one or the other of the following + conditions is true: - No session has a reference trigger that is None - + One session has a reference trigger that is None, and all other sessions + have reference triggers other than None. The one session with the None + trigger must have :py:data:`nitclk.Session.ref_trigger_master_session` set to + itself, indicating that the session itself is the reference trigger + master Reference Trigger Holdoffs Acquisition sessions may be configured + with the reference trigger. For acquisition sessions, when the reference + trigger is shared, :py:meth:`nitclk.Session.configure_for_homogeneous_triggers` configures + the holdoff properties (which are instrument driver specific) on the + reference trigger master session so that the session does not recognize + the reference trigger before the other sessions are ready. This + condition is only relevant when the sample clock rates, sample clock + timebase rates, sample counts, holdoffs, and/or any delays for the + acquisitions are different. When the sample clock rates, sample clock + timebase rates, and/or the sample counts are different in acquisition + sessions sharing the reference trigger, you should also set the holdoff + properties for the reference trigger master using the instrument driver. + Script Triggers :py:meth:`nitclk.Session.configure_for_homogeneous_triggers` configures + sessions that support script triggers to share them, if the script + triggers are None (no trigger configured) for all except one session. + The script triggers are shared in the following ways: - Implicitly + exporting the script trigger from the session whose script trigger is + not None - Configuring the other sessions that support the script + trigger for digital-edge script triggers with sources corresponding to + the exported script trigger - Setting + :py:data:`nitclk.Session.script_trigger_master_session` to the session that is + exporting the trigger for all sessions that support script triggers If + the script triggers are configured for all sessions that support script + triggers, :py:meth:`nitclk.Session.configure_for_homogeneous_triggers` does not affect script + triggers. Script triggers are considered to be configured for all + sessions if either one or the other of the following conditions are + true: - No session has a script trigger that is None - One session has a + script trigger that is None and all other sessions have script triggers + other than None. The one session with the None trigger must have + :py:data:`nitclk.Session.script_trigger_master_session` set to itself, indicating + that the session itself is the script trigger master Pause Triggers + :py:meth:`nitclk.Session.configure_for_homogeneous_triggers` configures generation sessions + that support pause triggers to share them, if the pause triggers are + None (no trigger configured) for all except one session. The pause + triggers are shared by: - Implicitly exporting the pause trigger from + the session whose script trigger is not None - Configuring the other + sessions that support the pause trigger for digital-edge pause triggers + with sources corresponding to the exported pause trigger - Setting + :py:data:`nitclk.Session.pause_trigger_master_session` to the session that is + exporting the trigger for all sessions that support script triggers If + the pause triggers are configured for all generation sessions that + support pause triggers, :py:meth:`nitclk.Session.configure_for_homogeneous_triggers` does not + affect pause triggers. Pause triggers are considered to be configured + for all sessions if either one or the other of the following conditions + is true: - No session has a pause trigger that is None - One session has + a pause trigger that is None and all other sessions have pause triggers + other than None. The one session with the None trigger must have + :py:data:`nitclk.Session.pause_trigger_master_session` set to itself, indicating + that the session itself is the pause trigger master Note: TClk + synchronization is not supported for pause triggers on acquisition + sessions. + + + + + + :param sessions: + + + sessions is an array of sessions that are being synchronized. + + + + + :type sessions: list of int + +finish_sync_pulse_sender_synchronize +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + .. py:currentmodule:: nitclk.Session + + .. py:method:: finish_sync_pulse_sender_synchronize(sessions, min_time) + + TBD + + + + + + :param sessions: + + + sessions is an array of sessions that are being synchronized. + + + + + :type sessions: list of int + :param min_time: + + + Minimal period of TClk, expressed in seconds. Supported values are + between 0.0 s and 0.050 s (50 ms). Minimal period for a single + chassis/PC is 200 ns. If the specified value is less than 200 ns, + NI-TClk automatically coerces minTime to 200 ns. For multichassis + synchronization, adjust this value to account for propagation delays + through the various devices and cables. + + + + + :type min_time: float + +init_for_documentation +~~~~~~~~~~~~~~~~~~~~~~ + + .. py:currentmodule:: nitclk.Session + + .. py:method:: init_for_documentation() + + TBD + + + + + +initiate +~~~~~~~~ + + .. py:currentmodule:: nitclk.Session + + .. py:method:: initiate(sessions) + + Initiates the acquisition or generation sessions specified, taking into + consideration any special requirements needed for synchronization. For + example, the session exporting the TClk-synchronized start trigger is + not initiated until after :py:meth:`nitclk.Session.initiate` initiates all the sessions + that import the TClk-synchronized start trigger. + + + + + + :param sessions: + + + sessions is an array of sessions that are being synchronized. + + + + + :type sessions: list of int + +is_done +~~~~~~~ + + .. py:currentmodule:: nitclk.Session + + .. py:method:: is_done(sessions) + + Monitors the progress of the acquisitions and/or generations + corresponding to sessions. + + + + + + :param sessions: + + + sessions is an array of sessions that are being synchronized. + + + + + :type sessions: list of int + + :rtype: bool + :return: + + + Indicates that the operation is done. The operation is done when each + session has completed without any errors or when any one of the sessions + reports an error. + + + + + +setup_for_sync_pulse_sender_synchronize +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + .. py:currentmodule:: nitclk.Session + + .. py:method:: setup_for_sync_pulse_sender_synchronize(sessions, min_time) + + TBD + + + + + + :param sessions: + + + sessions is an array of sessions that are being synchronized. + + + + + :type sessions: list of int + :param min_time: + + + Minimal period of TClk, expressed in seconds. Supported values are + between 0.0 s and 0.050 s (50 ms). Minimal period for a single + chassis/PC is 200 ns. If the specified value is less than 200 ns, + NI-TClk automatically coerces minTime to 200 ns. For multichassis + synchronization, adjust this value to account for propagation delays + through the various devices and cables. + + + + + :type min_time: float + +synchronize +~~~~~~~~~~~ + + .. py:currentmodule:: nitclk.Session + + .. py:method:: synchronize(sessions, min_tclk_period=datetime.timedelta(seconds=0.0)) + + Synchronizes the TClk signals on the given sessions. After + :py:meth:`nitclk.Session.synchronize` executes, TClk signals from all sessions are + synchronized. Note: Before using this NI-TClk method, verify that your + system is configured as specified in the PXI Trigger Lines and RTSI + Lines topic of the NI-TClk Synchronization Help. You can locate this + help file at Start>>Programs>>National Instruments>>NI-TClk. + + + + + + :param sessions: + + + sessions is an array of sessions that are being synchronized. + + + + + :type sessions: list of int + :param min_tclk_period: + + + Minimal period of TClk, expressed in seconds. Supported values are + between 0.0 s and 0.050 s (50 ms). Minimal period for a single + chassis/PC is 200 ns. If the specified value is less than 200 ns, + NI-TClk automatically coerces minTime to 200 ns. For multichassis + synchronization, adjust this value to account for propagation delays + through the various devices and cables. + + + + + :type min_tclk_period: float in seconds or datetime.timedelta + +synchronize_to_sync_pulse_sender +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + .. py:currentmodule:: nitclk.Session + + .. py:method:: synchronize_to_sync_pulse_sender(sessions, min_time) + + TBD + + + + + + :param sessions: + + + sessions is an array of sessions that are being synchronized. + + + + + :type sessions: list of int + :param min_time: + + + Minimal period of TClk, expressed in seconds. Supported values are + between 0.0 s and 0.050 s (50 ms). Minimal period for a single + chassis/PC is 200 ns. If the specified value is less than 200 ns, + NI-TClk automatically coerces minTime to 200 ns. For multichassis + synchronization, adjust this value to account for propagation delays + through the various devices and cables. + + + + + :type min_time: float + +wait_until_done +~~~~~~~~~~~~~~~ + + .. py:currentmodule:: nitclk.Session + + .. py:method:: wait_until_done(sessions, timeout) + + Call this method to pause execution of your program until the + acquisitions and/or generations corresponding to sessions are done or + until the method returns a timeout error. :py:meth:`nitclk.Session.wait_until_done` is a + blocking method that periodically checks the operation status. It + returns control to the calling program if the operation completes + successfully or an error occurs (including a timeout error). This + method is most useful for finite data operations that you expect to + complete within a certain time. + + + + + + :param sessions: + + + sessions is an array of sessions that are being synchronized. + + + + + :type sessions: list of int + :param timeout: + + + The amount of time in seconds that :py:meth:`nitclk.Session.wait_until_done` waits for the + sessions to complete. If timeout is exceeded, :py:meth:`nitclk.Session.wait_until_done` + returns an error. + + + + + :type timeout: float + + + +Properties +---------- + ++---------------------------------------------------------------+----------------------------------------------------------------------------+ +| Property | Datatype | ++===============================================================+============================================================================+ +| :py:attr:`nitclk.Session.exported_sync_pulse_output_terminal` | str | ++---------------------------------------------------------------+----------------------------------------------------------------------------+ +| :py:attr:`nitclk.Session.exported_tclk_output_terminal` | str | ++---------------------------------------------------------------+----------------------------------------------------------------------------+ +| :py:attr:`nitclk.Session.pause_trigger_master_session` | nimi-python Session class, nitclk.SessionReference, NI-TClk Session Number | ++---------------------------------------------------------------+----------------------------------------------------------------------------+ +| :py:attr:`nitclk.Session.ref_trigger_master_session` | nimi-python Session class, nitclk.SessionReference, NI-TClk Session Number | ++---------------------------------------------------------------+----------------------------------------------------------------------------+ +| :py:attr:`nitclk.Session.sample_clock_delay` | float | ++---------------------------------------------------------------+----------------------------------------------------------------------------+ +| :py:attr:`nitclk.Session.script_trigger_master_session` | nimi-python Session class, nitclk.SessionReference, NI-TClk Session Number | ++---------------------------------------------------------------+----------------------------------------------------------------------------+ +| :py:attr:`nitclk.Session.sequencer_flag_master_session` | nimi-python Session class, nitclk.SessionReference, NI-TClk Session Number | ++---------------------------------------------------------------+----------------------------------------------------------------------------+ +| :py:attr:`nitclk.Session.start_trigger_master_session` | nimi-python Session class, nitclk.SessionReference, NI-TClk Session Number | ++---------------------------------------------------------------+----------------------------------------------------------------------------+ +| :py:attr:`nitclk.Session.sync_pulse_clock_source` | str | ++---------------------------------------------------------------+----------------------------------------------------------------------------+ +| :py:attr:`nitclk.Session.sync_pulse_sender_sync_pulse_source` | str | ++---------------------------------------------------------------+----------------------------------------------------------------------------+ +| :py:attr:`nitclk.Session.sync_pulse_source` | str | ++---------------------------------------------------------------+----------------------------------------------------------------------------+ +| :py:attr:`nitclk.Session.tclk_actual_period` | float | ++---------------------------------------------------------------+----------------------------------------------------------------------------+ + +Methods +------- + ++-------------------------------------------------------------------+ +| Method name | ++===================================================================+ +| :py:func:`nitclk.Session.configure_for_homogeneous_triggers` | ++-------------------------------------------------------------------+ +| :py:func:`nitclk.Session.finish_sync_pulse_sender_synchronize` | ++-------------------------------------------------------------------+ +| :py:func:`nitclk.Session.init_for_documentation` | ++-------------------------------------------------------------------+ +| :py:func:`nitclk.Session.initiate` | ++-------------------------------------------------------------------+ +| :py:func:`nitclk.Session.is_done` | ++-------------------------------------------------------------------+ +| :py:func:`nitclk.Session.setup_for_sync_pulse_sender_synchronize` | ++-------------------------------------------------------------------+ +| :py:func:`nitclk.Session.synchronize` | ++-------------------------------------------------------------------+ +| :py:func:`nitclk.Session.synchronize_to_sync_pulse_sender` | ++-------------------------------------------------------------------+ +| :py:func:`nitclk.Session.wait_until_done` | ++-------------------------------------------------------------------+ + diff --git a/docs/nitclk/errors.rst b/docs/nitclk/errors.rst new file mode 100644 index 000000000..3ea9e8455 --- /dev/null +++ b/docs/nitclk/errors.rst @@ -0,0 +1,62 @@ +Exceptions and Warnings +======================= + +DriverError +----------- + + .. py:currentmodule:: nitclk + + .. exception:: DriverError + + An error originating from the NI-TClk driver + + +UnsupportedConfigurationError +----------------------------- + + .. py:currentmodule:: nitclk + + .. exception:: UnsupportedConfigurationError + + An error due to using this module in an usupported platform. + +DriverNotInstalledError +----------------------- + + .. py:currentmodule:: nitclk + + .. exception:: DriverNotInstalledError + + An error due to using this module without the driver runtime installed. + +InvalidRepeatedCapabilityError +------------------------------ + + .. py:currentmodule:: nitclk + + .. exception:: InvalidRepeatedCapabilityError + + An error due to an invalid character in a repeated capability + + +SelfTestError +------------- + + .. py:currentmodule:: nitclk + + .. exception:: SelfTestError + + An error due to a failed self-test + + +DriverWarning +------------- + + .. py:currentmodule:: nitclk + + .. exception:: DriverWarning + + A warning originating from the NI-TClk driver + + + diff --git a/docs/nitclk/examples.rst b/docs/nitclk/examples.rst new file mode 100644 index 000000000..ba2816a24 --- /dev/null +++ b/docs/nitclk/examples.rst @@ -0,0 +1,12 @@ +Examples +======== + +nitclk_configure.py +------------------- + +.. literalinclude:: ../../src/nitclk/examples/nitclk_configure.py + :language: python + :linenos: + :encoding: utf8 + :caption: `(nitclk_configure.py) `_ + diff --git a/docs/nitclk/installation.inc b/docs/nitclk/installation.inc new file mode 100644 index 000000000..1c705daad --- /dev/null +++ b/docs/nitclk/installation.inc @@ -0,0 +1,18 @@ + +.. _nitclk_installation-section: + +Installation +------------ + +As a prerequisite to using the nitclk module, you must install the NI-TClk runtime on your system. Visit `ni.com/downloads `_ to download the driver runtime for your devices. + +The nimi-python modules (i.e. for **NI-TClk**) can be installed with `pip `_:: + + $ python -m pip install nitclk~=0.1.0.dev0 + +Or **easy_install** from +`setuptools `_:: + + $ python -m easy_install nitclk + + diff --git a/docs/nitclk/status.inc b/docs/nitclk/status.inc new file mode 100644 index 000000000..e0c88c36f --- /dev/null +++ b/docs/nitclk/status.inc @@ -0,0 +1,41 @@ + +NI-TClk Python API Status +------------------------- + ++-------------------------------+-----------------------+ +| NI-TClk (nitclk) | | ++===============================+=======================+ +| Driver Version Tested Against | 18.0.0 | ++-------------------------------+-----------------------+ +| Driver API Version | 255.0.0d0 | ++-------------------------------+-----------------------+ +| PyPI Version | |nitclkLatestVersion| | ++-------------------------------+-----------------------+ +| Supported Python Version | |nitclkPythonVersion| | ++-------------------------------+-----------------------+ +| Open Issues | |nitclkOpenIssues| | ++-------------------------------+-----------------------+ +| Open Pull Requests | |nitclkOpenPRs| | ++-------------------------------+-----------------------+ + + +.. |nitclkLatestVersion| image:: http://img.shields.io/pypi/v/nitclk.svg + :alt: Latest NI-TClk Version + :target: http://pypi.python.org/pypi/nitclk + + +.. |nitclkPythonVersion| image:: http://img.shields.io/pypi/pyversions/nitclk.svg + :alt: NI-TClk supported Python versions + :target: http://pypi.python.org/pypi/nitclk + + +.. |nitclkOpenIssues| image:: https://img.shields.io/github/issues/ni/nimi-python/nitclk.svg + :alt: Open Issues + Pull Requests for NI-TClk + :target: https://github.com/ni/nimi-python/issues?q=is%3Aopen+is%3Aissue+label%3Anitclk + + +.. |nitclkOpenPRs| image:: https://img.shields.io/github/issues-pr/ni/nimi-python/nitclk.svg + :alt: Pull Requests for NI-TClk + :target: https://github.com/ni/nimi-python/pulls?q=is%3Aopen+is%3Aissue+label%3Anitclk + + diff --git a/docs/nitclk/toc.inc b/docs/nitclk/toc.inc new file mode 100644 index 000000000..f0f601180 --- /dev/null +++ b/docs/nitclk/toc.inc @@ -0,0 +1,10 @@ +API Reference +-------------- + +.. toctree:: + :maxdepth: 6 + + nitclk/class + nitclk/errors + nitclk/examples + diff --git a/generated/nidcpower/session.py b/generated/nidcpower/session.py index 21591026c..586c3a8cb 100644 --- a/generated/nidcpower/session.py +++ b/generated/nidcpower/session.py @@ -2515,7 +2515,7 @@ def _fetch_multiple(self, timeout, count): vi_ctype = _visatype.ViSession(self._vi) # case S110 channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 timeout_ctype = _converters.convert_timedelta_to_seconds(timeout, _visatype.ViReal64) # case S140 - count_ctype = _visatype.ViInt32(count) # case S190 + count_ctype = _visatype.ViInt32(count) # case S210 voltage_measurements_size = count # case B600 voltage_measurements_array = array.array("d", [0] * voltage_measurements_size) # case B600 voltage_measurements_ctype = get_ctypes_pointer_for_buffer(value=voltage_measurements_array, library_type=_visatype.ViReal64) # case B600 @@ -2524,7 +2524,7 @@ def _fetch_multiple(self, timeout, count): current_measurements_ctype = get_ctypes_pointer_for_buffer(value=current_measurements_array, library_type=_visatype.ViReal64) # case B600 in_compliance_size = count # case B600 in_compliance_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViBoolean, size=in_compliance_size) # case B600 - actual_count_ctype = _visatype.ViInt32() # case S200 + actual_count_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niDCPower_FetchMultiple(vi_ctype, channel_name_ctype, timeout_ctype, count_ctype, voltage_measurements_ctype, current_measurements_ctype, in_compliance_ctype, None if actual_count_ctype is None else (ctypes.pointer(actual_count_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return voltage_measurements_array, current_measurements_array, [bool(in_compliance_ctype[i]) for i in range(count_ctype.value)] @@ -2579,7 +2579,7 @@ def _get_attribute_vi_boolean(self, attribute_id): 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 + attribute_value_ctype = _visatype.ViBoolean() # case S220 error_code = self._library.niDCPower_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) @@ -2634,7 +2634,7 @@ def _get_attribute_vi_int32(self, attribute_id): 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 + attribute_value_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niDCPower_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) @@ -2689,7 +2689,7 @@ def _get_attribute_vi_int64(self, attribute_id): 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.ViInt64() # case S200 + attribute_value_ctype = _visatype.ViInt64() # case S220 error_code = self._library.niDCPower_GetAttributeViInt64(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) @@ -2744,7 +2744,7 @@ def _get_attribute_vi_real64(self, attribute_id): 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.ViReal64() # case S200 + attribute_value_ctype = _visatype.ViReal64() # case S220 error_code = self._library.niDCPower_GetAttributeViReal64(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 float(attribute_value_ctype.value) @@ -2859,7 +2859,7 @@ def _get_error(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - code_ctype = _visatype.ViStatus() # case S200 + code_ctype = _visatype.ViStatus() # case S220 buffer_size_ctype = _visatype.ViInt32() # case S170 description_ctype = None # case C050 error_code = self._library.niDCPower_GetError(vi_ctype, None if code_ctype is None else (ctypes.pointer(code_ctype)), buffer_size_ctype, description_ctype) @@ -2954,7 +2954,7 @@ def measure(self, measurement_type): vi_ctype = _visatype.ViSession(self._vi) # case S110 channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 measurement_type_ctype = _visatype.ViInt32(measurement_type.value) # case S130 - measurement_ctype = _visatype.ViReal64() # case S200 + measurement_ctype = _visatype.ViReal64() # case S220 error_code = self._library.niDCPower_Measure(vi_ctype, channel_name_ctype, measurement_type_ctype, None if measurement_ctype is None else (ctypes.pointer(measurement_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(measurement_ctype.value) @@ -3021,7 +3021,7 @@ def _parse_channel_count(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 channels_string_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - number_of_channels_ctype = _visatype.ViUInt32() # case S200 + number_of_channels_ctype = _visatype.ViUInt32() # case S220 error_code = self._library.niDCPower_ParseChannelCount(vi_ctype, channels_string_ctype, None if number_of_channels_ctype is None else (ctypes.pointer(number_of_channels_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(number_of_channels_ctype.value) @@ -3068,7 +3068,7 @@ def query_in_compliance(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - in_compliance_ctype = _visatype.ViBoolean() # case S200 + in_compliance_ctype = _visatype.ViBoolean() # case S220 error_code = self._library.niDCPower_QueryInCompliance(vi_ctype, channel_name_ctype, None if in_compliance_ctype is None else (ctypes.pointer(in_compliance_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return bool(in_compliance_ctype.value) @@ -3101,7 +3101,7 @@ def query_max_current_limit(self, voltage_level): vi_ctype = _visatype.ViSession(self._vi) # case S110 channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 voltage_level_ctype = _visatype.ViReal64(voltage_level) # case S150 - max_current_limit_ctype = _visatype.ViReal64() # case S200 + max_current_limit_ctype = _visatype.ViReal64() # case S220 error_code = self._library.niDCPower_QueryMaxCurrentLimit(vi_ctype, channel_name_ctype, voltage_level_ctype, None if max_current_limit_ctype is None else (ctypes.pointer(max_current_limit_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(max_current_limit_ctype.value) @@ -3134,7 +3134,7 @@ def query_max_voltage_level(self, current_limit): vi_ctype = _visatype.ViSession(self._vi) # case S110 channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 current_limit_ctype = _visatype.ViReal64(current_limit) # case S150 - max_voltage_level_ctype = _visatype.ViReal64() # case S200 + max_voltage_level_ctype = _visatype.ViReal64() # case S220 error_code = self._library.niDCPower_QueryMaxVoltageLevel(vi_ctype, channel_name_ctype, current_limit_ctype, None if max_voltage_level_ctype is None else (ctypes.pointer(max_voltage_level_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(max_voltage_level_ctype.value) @@ -3167,7 +3167,7 @@ def query_min_current_limit(self, voltage_level): vi_ctype = _visatype.ViSession(self._vi) # case S110 channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 voltage_level_ctype = _visatype.ViReal64(voltage_level) # case S150 - min_current_limit_ctype = _visatype.ViReal64() # case S200 + min_current_limit_ctype = _visatype.ViReal64() # case S220 error_code = self._library.niDCPower_QueryMinCurrentLimit(vi_ctype, channel_name_ctype, voltage_level_ctype, None if min_current_limit_ctype is None else (ctypes.pointer(min_current_limit_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(min_current_limit_ctype.value) @@ -3212,7 +3212,7 @@ def query_output_state(self, output_state): vi_ctype = _visatype.ViSession(self._vi) # case S110 channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 output_state_ctype = _visatype.ViInt32(output_state.value) # case S130 - in_state_ctype = _visatype.ViBoolean() # case S200 + in_state_ctype = _visatype.ViBoolean() # case S220 error_code = self._library.niDCPower_QueryOutputState(vi_ctype, channel_name_ctype, output_state_ctype, None if in_state_ctype is None else (ctypes.pointer(in_state_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return bool(in_state_ctype.value) @@ -4198,11 +4198,11 @@ def _get_ext_cal_last_date_and_time(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - year_ctype = _visatype.ViInt32() # case S200 - month_ctype = _visatype.ViInt32() # case S200 - day_ctype = _visatype.ViInt32() # case S200 - hour_ctype = _visatype.ViInt32() # case S200 - minute_ctype = _visatype.ViInt32() # case S200 + year_ctype = _visatype.ViInt32() # case S220 + month_ctype = _visatype.ViInt32() # case S220 + day_ctype = _visatype.ViInt32() # case S220 + hour_ctype = _visatype.ViInt32() # case S220 + minute_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niDCPower_GetExtCalLastDateAndTime(vi_ctype, None if year_ctype is None else (ctypes.pointer(year_ctype)), None if month_ctype is None else (ctypes.pointer(month_ctype)), None if day_ctype is None else (ctypes.pointer(day_ctype)), None if hour_ctype is None else (ctypes.pointer(hour_ctype)), None if minute_ctype is None else (ctypes.pointer(minute_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(year_ctype.value), int(month_ctype.value), int(day_ctype.value), int(hour_ctype.value), int(minute_ctype.value) @@ -4220,7 +4220,7 @@ def get_ext_cal_last_temp(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - temperature_ctype = _visatype.ViReal64() # case S200 + temperature_ctype = _visatype.ViReal64() # case S220 error_code = self._library.niDCPower_GetExtCalLastTemp(vi_ctype, None if temperature_ctype is None else (ctypes.pointer(temperature_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(temperature_ctype.value) @@ -4238,7 +4238,7 @@ def get_ext_cal_recommended_interval(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - months_ctype = _visatype.ViInt32() # case S200 + months_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niDCPower_GetExtCalRecommendedInterval(vi_ctype, None if months_ctype is None else (ctypes.pointer(months_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return _converters.convert_month_to_timedelta(int(months_ctype.value)) @@ -4304,11 +4304,11 @@ def _get_self_cal_last_date_and_time(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - year_ctype = _visatype.ViInt32() # case S200 - month_ctype = _visatype.ViInt32() # case S200 - day_ctype = _visatype.ViInt32() # case S200 - hour_ctype = _visatype.ViInt32() # case S200 - minute_ctype = _visatype.ViInt32() # case S200 + year_ctype = _visatype.ViInt32() # case S220 + month_ctype = _visatype.ViInt32() # case S220 + day_ctype = _visatype.ViInt32() # case S220 + hour_ctype = _visatype.ViInt32() # case S220 + minute_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niDCPower_GetSelfCalLastDateAndTime(vi_ctype, None if year_ctype is None else (ctypes.pointer(year_ctype)), None if month_ctype is None else (ctypes.pointer(month_ctype)), None if day_ctype is None else (ctypes.pointer(day_ctype)), None if hour_ctype is None else (ctypes.pointer(hour_ctype)), None if minute_ctype is None else (ctypes.pointer(minute_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(year_ctype.value), int(month_ctype.value), int(day_ctype.value), int(hour_ctype.value), int(minute_ctype.value) @@ -4339,7 +4339,7 @@ def get_self_cal_last_temp(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - temperature_ctype = _visatype.ViReal64() # case S200 + temperature_ctype = _visatype.ViReal64() # case S220 error_code = self._library.niDCPower_GetSelfCalLastTemp(vi_ctype, None if temperature_ctype is None else (ctypes.pointer(temperature_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(temperature_ctype.value) @@ -4535,7 +4535,7 @@ def _initialize_with_channels(self, resource_name, channels=None, reset=False, o channels_ctype = ctypes.create_string_buffer(channels.encode(self._encoding)) # case C020 reset_ctype = _visatype.ViBoolean(reset) # case S150 option_string_ctype = ctypes.create_string_buffer(option_string.encode(self._encoding)) # case C020 - vi_ctype = _visatype.ViSession() # case S200 + vi_ctype = _visatype.ViSession() # case S220 error_code = self._library.niDCPower_InitializeWithChannels(resource_name_ctype, channels_ctype, reset_ctype, option_string_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) @@ -4574,7 +4574,7 @@ def read_current_temperature(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - temperature_ctype = _visatype.ViReal64() # case S200 + temperature_ctype = _visatype.ViReal64() # case S220 error_code = self._library.niDCPower_ReadCurrentTemperature(vi_ctype, None if temperature_ctype is None else (ctypes.pointer(temperature_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(temperature_ctype.value) @@ -4818,7 +4818,7 @@ def _self_test(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - self_test_result_ctype = _visatype.ViInt16() # case S200 + self_test_result_ctype = _visatype.ViInt16() # case S220 self_test_message_ctype = (_visatype.ViChar * 256)() # case C070 error_code = self._library.niDCPower_self_test(vi_ctype, None if self_test_result_ctype is None else (ctypes.pointer(self_test_result_ctype)), self_test_message_ctype) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) diff --git a/generated/nidigital/session.py b/generated/nidigital/session.py index c53b6a766..fa41adcd0 100644 --- a/generated/nidigital/session.py +++ b/generated/nidigital/session.py @@ -888,7 +888,7 @@ def frequency_counter_measure_frequency(self): channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 frequencies_buffer_size_ctype = _visatype.ViInt32(0) # case S210 frequencies_ctype = None # case B610 - actual_num_frequencies_ctype = _visatype.ViInt32() # case S200 + actual_num_frequencies_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niDigital_FrequencyCounter_MeasureFrequency(vi_ctype, channel_list_ctype, frequencies_buffer_size_ctype, frequencies_ctype, None if actual_num_frequencies_ctype is None else (ctypes.pointer(actual_num_frequencies_ctype))) errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) frequencies_buffer_size_ctype = _visatype.ViInt32(actual_num_frequencies_ctype.value) # case S220 @@ -923,7 +923,7 @@ def get_attribute_vi_boolean(self, attribute): vi_ctype = _visatype.ViSession(self._vi) # case S110 channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_ctype = _visatype.ViAttr(attribute) # case S150 - value_ctype = _visatype.ViBoolean() # case S200 + value_ctype = _visatype.ViBoolean() # case S220 error_code = self._library.niDigital_GetAttributeViBoolean(vi_ctype, channel_name_ctype, attribute_ctype, None if value_ctype is None else (ctypes.pointer(value_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return bool(value_ctype.value) @@ -953,7 +953,7 @@ def get_attribute_vi_int32(self, attribute): vi_ctype = _visatype.ViSession(self._vi) # case S110 channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_ctype = _visatype.ViAttr(attribute) # case S150 - value_ctype = _visatype.ViInt32() # case S200 + value_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niDigital_GetAttributeViInt32(vi_ctype, channel_name_ctype, attribute_ctype, None if value_ctype is None else (ctypes.pointer(value_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(value_ctype.value) @@ -983,7 +983,7 @@ def get_attribute_vi_int64(self, attribute): vi_ctype = _visatype.ViSession(self._vi) # case S110 channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_ctype = _visatype.ViAttr(attribute) # case S150 - value_ctype = _visatype.ViInt64() # case S200 + value_ctype = _visatype.ViInt64() # case S220 error_code = self._library.niDigital_GetAttributeViInt64(vi_ctype, channel_name_ctype, attribute_ctype, None if value_ctype is None else (ctypes.pointer(value_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(value_ctype.value) @@ -1013,7 +1013,7 @@ def get_attribute_vi_real64(self, attribute): vi_ctype = _visatype.ViSession(self._vi) # case S110 channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_ctype = _visatype.ViAttr(attribute) # case S150 - value_ctype = _visatype.ViReal64() # case S200 + value_ctype = _visatype.ViReal64() # case S220 error_code = self._library.niDigital_GetAttributeViReal64(vi_ctype, channel_name_ctype, attribute_ctype, None if value_ctype is None else (ctypes.pointer(value_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(value_ctype.value) @@ -1043,7 +1043,7 @@ def get_attribute_vi_session(self, attribute): vi_ctype = _visatype.ViSession(self._vi) # case S110 channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_ctype = _visatype.ViAttr(attribute) # case S150 - value_ctype = _visatype.ViSession() # case S200 + value_ctype = _visatype.ViSession() # case S220 error_code = self._library.niDigital_GetAttributeViSession(vi_ctype, channel_name_ctype, attribute_ctype, None if value_ctype is None else (ctypes.pointer(value_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(value_ctype.value) @@ -1089,7 +1089,7 @@ def _get_error(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - error_code_ctype = _visatype.ViStatus() # case S200 + error_code_ctype = _visatype.ViStatus() # case S220 error_description_buffer_size_ctype = _visatype.ViInt32() # case S170 error_description_ctype = None # case C050 error_code = self._library.niDigital_GetError(vi_ctype, None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), error_description_buffer_size_ctype, error_description_ctype) @@ -1122,7 +1122,7 @@ def get_fail_count(self): channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 buffer_size_ctype = _visatype.ViInt32(0) # case S210 failure_count_ctype = None # case B610 - actual_num_read_ctype = _visatype.ViInt32() # case S200 + actual_num_read_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niDigital_GetFailCount(vi_ctype, channel_list_ctype, buffer_size_ctype, failure_count_ctype, None if actual_num_read_ctype is None else (ctypes.pointer(actual_num_read_ctype))) errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) buffer_size_ctype = _visatype.ViInt32(actual_num_read_ctype.value) # case S220 @@ -1156,7 +1156,7 @@ def get_pin_results_pin_information(self): pin_indexes_ctype = None # case B610 site_numbers_ctype = None # case B610 channel_indexes_ctype = None # case B610 - actual_num_values_ctype = _visatype.ViInt32() # case S200 + actual_num_values_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niDigital_GetPinResultsPinInformation(vi_ctype, channel_list_ctype, buffer_size_ctype, pin_indexes_ctype, site_numbers_ctype, channel_indexes_ctype, None if actual_num_values_ctype is None else (ctypes.pointer(actual_num_values_ctype))) errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) buffer_size_ctype = _visatype.ViInt32(actual_num_values_ctype.value) # case S220 @@ -1481,7 +1481,7 @@ def ppmu_measure(self, measurement_type): measurement_type_ctype = _visatype.ViInt32(measurement_type) # case S150 buffer_size_ctype = _visatype.ViInt32(0) # case S210 measurements_ctype = None # case B610 - actual_num_read_ctype = _visatype.ViInt32() # case S200 + actual_num_read_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niDigital_PPMU_Measure(vi_ctype, channel_list_ctype, measurement_type_ctype, buffer_size_ctype, measurements_ctype, None if actual_num_read_ctype is None else (ctypes.pointer(actual_num_read_ctype))) errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) buffer_size_ctype = _visatype.ViInt32(actual_num_read_ctype.value) # case S220 @@ -1492,6 +1492,7 @@ def ppmu_measure(self, measurement_type): return [float(measurements_ctype[i]) for i in range(buffer_size_ctype.value)], int(actual_num_read_ctype.value) @ivi_synchronized + def ppmu_source(self): r'''ppmu_source @@ -1533,7 +1534,7 @@ def read_static(self): channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 buffer_size_ctype = _visatype.ViInt32(0) # case S210 data_ctype = None # case B610 - actual_num_read_ctype = _visatype.ViInt32() # case S200 + actual_num_read_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niDigital_ReadStatic(vi_ctype, channel_list_ctype, buffer_size_ctype, data_ctype, None if actual_num_read_ctype is None else (ctypes.pointer(actual_num_read_ctype))) errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) buffer_size_ctype = _visatype.ViInt32(actual_num_read_ctype.value) # case S220 @@ -1786,7 +1787,7 @@ def tdr(self, apply_offsets): apply_offsets_ctype = _visatype.ViBoolean(apply_offsets) # case S150 offsets_buffer_size_ctype = _visatype.ViInt32(0) # case S210 offsets_ctype = None # case B610 - actual_num_offsets_ctype = _visatype.ViInt32() # case S200 + actual_num_offsets_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niDigital_TDR(vi_ctype, channel_list_ctype, apply_offsets_ctype, offsets_buffer_size_ctype, offsets_ctype, None if actual_num_offsets_ctype is None else (ctypes.pointer(actual_num_offsets_ctype))) errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) offsets_buffer_size_ctype = _visatype.ViInt32(actual_num_offsets_ctype.value) # case S220 @@ -2778,11 +2779,11 @@ def fetch_history_ram_cycle_information(self, site, sample_index): vi_ctype = _visatype.ViSession(self._vi) # case S110 site_ctype = ctypes.create_string_buffer(site.encode(self._encoding)) # case C020 sample_index_ctype = _visatype.ViInt64(sample_index) # case S150 - pattern_index_ctype = _visatype.ViInt32() # case S200 - time_set_index_ctype = _visatype.ViInt32() # case S200 - vector_number_ctype = _visatype.ViInt64() # case S200 - cycle_number_ctype = _visatype.ViInt64() # case S200 - num_dut_cycles_ctype = _visatype.ViInt32() # case S200 + pattern_index_ctype = _visatype.ViInt32() # case S220 + time_set_index_ctype = _visatype.ViInt32() # case S220 + vector_number_ctype = _visatype.ViInt64() # case S220 + cycle_number_ctype = _visatype.ViInt64() # case S220 + num_dut_cycles_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niDigital_FetchHistoryRAMCycleInformation(vi_ctype, site_ctype, sample_index_ctype, None if pattern_index_ctype is None else (ctypes.pointer(pattern_index_ctype)), None if time_set_index_ctype is None else (ctypes.pointer(time_set_index_ctype)), None if vector_number_ctype is None else (ctypes.pointer(vector_number_ctype)), None if cycle_number_ctype is None else (ctypes.pointer(cycle_number_ctype)), None if num_dut_cycles_ctype is None else (ctypes.pointer(num_dut_cycles_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(pattern_index_ctype.value), int(time_set_index_ctype.value), int(vector_number_ctype.value), int(cycle_number_ctype.value), int(num_dut_cycles_ctype.value) @@ -2816,7 +2817,7 @@ def fetch_history_ram_cycle_pin_data(self, site, pin_list, sample_index, dut_cyc expected_pin_states_ctype = None # case B610 actual_pin_states_ctype = None # case B610 per_pin_pass_fail_ctype = None # case B610 - actual_num_pin_data_ctype = _visatype.ViInt32() # case S200 + actual_num_pin_data_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niDigital_FetchHistoryRAMCyclePinData(vi_ctype, site_ctype, pin_list_ctype, sample_index_ctype, dut_cycle_index_ctype, pin_data_buffer_size_ctype, expected_pin_states_ctype, actual_pin_states_ctype, per_pin_pass_fail_ctype, None if actual_num_pin_data_ctype is None else (ctypes.pointer(actual_num_pin_data_ctype))) errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) pin_data_buffer_size_ctype = _visatype.ViInt32(actual_num_pin_data_ctype.value) # case S220 @@ -2849,7 +2850,7 @@ def fetch_history_ram_scan_cycle_number(self, site, sample_index): vi_ctype = _visatype.ViSession(self._vi) # case S110 site_ctype = ctypes.create_string_buffer(site.encode(self._encoding)) # case C020 sample_index_ctype = _visatype.ViInt64(sample_index) # case S150 - scan_cycle_number_ctype = _visatype.ViInt64() # case S200 + scan_cycle_number_ctype = _visatype.ViInt64() # case S220 error_code = self._library.niDigital_FetchHistoryRAMScanCycleNumber(vi_ctype, site_ctype, sample_index_ctype, None if scan_cycle_number_ctype is None else (ctypes.pointer(scan_cycle_number_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(scan_cycle_number_ctype.value) @@ -2959,7 +2960,7 @@ def get_pattern_pin_indexes(self, start_label): start_label_ctype = ctypes.create_string_buffer(start_label.encode(self._encoding)) # case C020 pin_indexes_buffer_size_ctype = _visatype.ViInt32(0) # case S210 pin_indexes_ctype = None # case B610 - actual_num_pins_ctype = _visatype.ViInt32() # case S200 + actual_num_pins_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niDigital_GetPatternPinIndexes(vi_ctype, start_label_ctype, pin_indexes_buffer_size_ctype, pin_indexes_ctype, None if actual_num_pins_ctype is None else (ctypes.pointer(actual_num_pins_ctype))) errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) pin_indexes_buffer_size_ctype = _visatype.ViInt32(actual_num_pins_ctype.value) # case S220 @@ -3031,7 +3032,7 @@ def get_site_pass_fail(self, site_list): site_list_ctype = ctypes.create_string_buffer(site_list.encode(self._encoding)) # case C020 pass_fail_buffer_size_ctype = _visatype.ViInt32(0) # case S210 pass_fail_ctype = None # case B610 - actual_num_sites_ctype = _visatype.ViInt32() # case S200 + actual_num_sites_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niDigital_GetSitePassFail(vi_ctype, site_list_ctype, pass_fail_buffer_size_ctype, pass_fail_ctype, None if actual_num_sites_ctype is None else (ctypes.pointer(actual_num_sites_ctype))) errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) pass_fail_buffer_size_ctype = _visatype.ViInt32(actual_num_sites_ctype.value) # case S220 @@ -3062,7 +3063,7 @@ def get_site_results_site_numbers(self, site_list, site_result_type): site_result_type_ctype = _visatype.ViInt32(site_result_type) # case S150 site_numbers_buffer_size_ctype = _visatype.ViInt32(0) # case S210 site_numbers_ctype = None # case B610 - actual_num_site_numbers_ctype = _visatype.ViInt32() # case S200 + actual_num_site_numbers_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niDigital_GetSiteResultsSiteNumbers(vi_ctype, site_list_ctype, site_result_type_ctype, site_numbers_buffer_size_ctype, site_numbers_ctype, None if actual_num_site_numbers_ctype is None else (ctypes.pointer(actual_num_site_numbers_ctype))) errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) site_numbers_buffer_size_ctype = _visatype.ViInt32(actual_num_site_numbers_ctype.value) # case S220 @@ -3091,7 +3092,7 @@ def get_time_set_drive_format(self, pin, time_set): vi_ctype = _visatype.ViSession(self._vi) # case S110 pin_ctype = ctypes.create_string_buffer(pin.encode(self._encoding)) # case C020 time_set_ctype = ctypes.create_string_buffer(time_set.encode(self._encoding)) # case C020 - format_ctype = _visatype.ViInt32() # case S200 + format_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niDigital_GetTimeSetDriveFormat(vi_ctype, pin_ctype, time_set_ctype, None if format_ctype is None else (ctypes.pointer(format_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(format_ctype.value) @@ -3118,7 +3119,7 @@ def get_time_set_edge(self, pin, time_set, edge): pin_ctype = ctypes.create_string_buffer(pin.encode(self._encoding)) # case C020 time_set_ctype = ctypes.create_string_buffer(time_set.encode(self._encoding)) # case C020 edge_ctype = _visatype.ViInt32(edge) # case S150 - time_ctype = _visatype.ViReal64() # case S200 + time_ctype = _visatype.ViReal64() # case S220 error_code = self._library.niDigital_GetTimeSetEdge(vi_ctype, pin_ctype, time_set_ctype, edge_ctype, None if time_ctype is None else (ctypes.pointer(time_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(time_ctype.value) @@ -3142,7 +3143,7 @@ def get_time_set_edge_multiplier(self, pin, time_set): vi_ctype = _visatype.ViSession(self._vi) # case S110 pin_ctype = ctypes.create_string_buffer(pin.encode(self._encoding)) # case C020 time_set_ctype = ctypes.create_string_buffer(time_set.encode(self._encoding)) # case C020 - edge_multiplier_ctype = _visatype.ViInt32() # case S200 + edge_multiplier_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niDigital_GetTimeSetEdgeMultiplier(vi_ctype, pin_ctype, time_set_ctype, None if edge_multiplier_ctype is None else (ctypes.pointer(edge_multiplier_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(edge_multiplier_ctype.value) @@ -3185,7 +3186,7 @@ def get_time_set_period(self, time_set): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 time_set_ctype = ctypes.create_string_buffer(time_set.encode(self._encoding)) # case C020 - period_ctype = _visatype.ViReal64() # case S200 + period_ctype = _visatype.ViReal64() # case S220 error_code = self._library.niDigital_GetTimeSetPeriod(vi_ctype, time_set_ctype, None if period_ctype is None else (ctypes.pointer(period_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(period_ctype.value) @@ -3213,7 +3214,7 @@ def _init_with_options(self, resource_name, id_query=False, reset_device=False, id_query_ctype = _visatype.ViBoolean(id_query) # case S150 reset_device_ctype = _visatype.ViBoolean(reset_device) # case S150 option_string_ctype = ctypes.create_string_buffer(option_string.encode(self._encoding)) # case C020 - new_vi_ctype = _visatype.ViSession() # case S200 + new_vi_ctype = _visatype.ViSession() # case S220 error_code = self._library.niDigital_InitWithOptions(resource_name_ctype, id_query_ctype, reset_device_ctype, option_string_ctype, None if new_vi_ctype is None else (ctypes.pointer(new_vi_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(new_vi_ctype.value) @@ -3240,7 +3241,7 @@ def is_done(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - done_ctype = _visatype.ViBoolean() # case S200 + done_ctype = _visatype.ViBoolean() # case S220 error_code = self._library.niDigital_IsDone(vi_ctype, None if done_ctype is None else (ctypes.pointer(done_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return bool(done_ctype.value) @@ -3261,7 +3262,7 @@ def is_site_enabled(self, site): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 site_ctype = ctypes.create_string_buffer(site.encode(self._encoding)) # case C020 - enable_ctype = _visatype.ViBoolean() # case S200 + enable_ctype = _visatype.ViBoolean() # case S220 error_code = self._library.niDigital_IsSiteEnabled(vi_ctype, site_ctype, None if enable_ctype is None else (ctypes.pointer(enable_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return bool(enable_ctype.value) @@ -3362,7 +3363,7 @@ def read_sequencer_flag(self, flag): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 flag_ctype = ctypes.create_string_buffer(flag.encode(self._encoding)) # case C020 - value_ctype = _visatype.ViBoolean() # case S200 + value_ctype = _visatype.ViBoolean() # case S220 error_code = self._library.niDigital_ReadSequencerFlag(vi_ctype, flag_ctype, None if value_ctype is None else (ctypes.pointer(value_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return bool(value_ctype.value) @@ -3383,7 +3384,7 @@ def read_sequencer_register(self, reg): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 reg_ctype = ctypes.create_string_buffer(reg.encode(self._encoding)) # case C020 - value_ctype = _visatype.ViInt32() # case S200 + value_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niDigital_ReadSequencerRegister(vi_ctype, reg_ctype, None if value_ctype is None else (ctypes.pointer(value_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(value_ctype.value) @@ -3590,7 +3591,7 @@ def _self_test(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - test_result_ctype = _visatype.ViInt16() # case S200 + test_result_ctype = _visatype.ViInt16() # case S220 test_message_ctype = (_visatype.ViChar * 2048)() # case C070 error_code = self._library.niDigital_self_test(vi_ctype, None if test_result_ctype is None else (ctypes.pointer(test_result_ctype)), test_message_ctype) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) diff --git a/generated/nidmm/session.py b/generated/nidmm/session.py index be1b31aad..c16789b28 100644 --- a/generated/nidmm/session.py +++ b/generated/nidmm/session.py @@ -596,7 +596,7 @@ def _get_attribute_vi_boolean(self, attribute_id): 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 + attribute_value_ctype = _visatype.ViBoolean() # case S220 error_code = self._library.niDMM_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) @@ -636,7 +636,7 @@ def _get_attribute_vi_int32(self, attribute_id): 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 + attribute_value_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niDMM_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) @@ -676,7 +676,7 @@ def _get_attribute_vi_real64(self, attribute_id): 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.ViReal64() # case S200 + attribute_value_ctype = _visatype.ViReal64() # case S220 error_code = self._library.niDMM_GetAttributeViReal64(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 float(attribute_value_ctype.value) @@ -740,7 +740,7 @@ def _get_error(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - error_code_ctype = _visatype.ViStatus() # case S200 + error_code_ctype = _visatype.ViStatus() # case S220 buffer_size_ctype = _visatype.ViInt32() # case S170 description_ctype = None # case C050 error_code = self._library.niDMM_GetError(vi_ctype, None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), buffer_size_ctype, description_ctype) @@ -1796,7 +1796,7 @@ def fetch(self, maximum_time=datetime.timedelta(milliseconds=-1)): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 maximum_time_ctype = _converters.convert_timedelta_to_milliseconds(maximum_time, _visatype.ViInt32) # case S140 - reading_ctype = _visatype.ViReal64() # case S200 + reading_ctype = _visatype.ViReal64() # case S220 error_code = self._library.niDMM_Fetch(vi_ctype, maximum_time_ctype, None if reading_ctype is None else (ctypes.pointer(reading_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(reading_ctype.value) @@ -1847,11 +1847,11 @@ def fetch_multi_point(self, array_size, maximum_time=datetime.timedelta(millisec ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 maximum_time_ctype = _converters.convert_timedelta_to_milliseconds(maximum_time, _visatype.ViInt32) # case S140 - array_size_ctype = _visatype.ViInt32(array_size) # case S190 + array_size_ctype = _visatype.ViInt32(array_size) # case S210 reading_array_size = array_size # case B600 reading_array_array = array.array("d", [0] * reading_array_size) # case B600 reading_array_ctype = get_ctypes_pointer_for_buffer(value=reading_array_array, library_type=_visatype.ViReal64) # case B600 - actual_number_of_points_ctype = _visatype.ViInt32() # case S200 + actual_number_of_points_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niDMM_FetchMultiPoint(vi_ctype, maximum_time_ctype, array_size_ctype, reading_array_ctype, None if actual_number_of_points_ctype is None else (ctypes.pointer(actual_number_of_points_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return reading_array_array @@ -1894,11 +1894,11 @@ def fetch_waveform(self, array_size, maximum_time=datetime.timedelta(millisecond ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 maximum_time_ctype = _converters.convert_timedelta_to_milliseconds(maximum_time, _visatype.ViInt32) # case S140 - array_size_ctype = _visatype.ViInt32(array_size) # case S190 + array_size_ctype = _visatype.ViInt32(array_size) # case S210 waveform_array_size = array_size # case B600 waveform_array_array = array.array("d", [0] * waveform_array_size) # case B600 waveform_array_ctype = get_ctypes_pointer_for_buffer(value=waveform_array_array, library_type=_visatype.ViReal64) # case B600 - actual_number_of_points_ctype = _visatype.ViInt32() # case S200 + actual_number_of_points_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niDMM_FetchWaveform(vi_ctype, maximum_time_ctype, array_size_ctype, waveform_array_ctype, None if actual_number_of_points_ctype is None else (ctypes.pointer(actual_number_of_points_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return waveform_array_array @@ -1949,9 +1949,9 @@ def fetch_waveform_into(self, waveform_array, maximum_time=datetime.timedelta(mi vi_ctype = _visatype.ViSession(self._vi) # case S110 maximum_time_ctype = _converters.convert_timedelta_to_milliseconds(maximum_time, _visatype.ViInt32) # case S140 - array_size_ctype = _visatype.ViInt32(array_size) # case S190 + array_size_ctype = _visatype.ViInt32(array_size) # case S210 waveform_array_ctype = get_ctypes_pointer_for_buffer(value=waveform_array) # case B510 - actual_number_of_points_ctype = _visatype.ViInt32() # case S200 + actual_number_of_points_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niDMM_FetchWaveform(vi_ctype, maximum_time_ctype, array_size_ctype, waveform_array_ctype, None if actual_number_of_points_ctype is None else (ctypes.pointer(actual_number_of_points_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @@ -1994,11 +1994,11 @@ def _get_cal_date_and_time(self, cal_type): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 cal_type_ctype = _visatype.ViInt32(cal_type) # case S150 - month_ctype = _visatype.ViInt32() # case S200 - day_ctype = _visatype.ViInt32() # case S200 - year_ctype = _visatype.ViInt32() # case S200 - hour_ctype = _visatype.ViInt32() # case S200 - minute_ctype = _visatype.ViInt32() # case S200 + month_ctype = _visatype.ViInt32() # case S220 + day_ctype = _visatype.ViInt32() # case S220 + year_ctype = _visatype.ViInt32() # case S220 + hour_ctype = _visatype.ViInt32() # case S220 + minute_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niDMM_GetCalDateAndTime(vi_ctype, cal_type_ctype, None if month_ctype is None else (ctypes.pointer(month_ctype)), None if day_ctype is None else (ctypes.pointer(day_ctype)), None if year_ctype is None else (ctypes.pointer(year_ctype)), None if hour_ctype is None else (ctypes.pointer(hour_ctype)), None if minute_ctype is None else (ctypes.pointer(minute_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(month_ctype.value), int(day_ctype.value), int(year_ctype.value), int(hour_ctype.value), int(minute_ctype.value) @@ -2021,7 +2021,7 @@ def get_dev_temp(self, options=""): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 options_ctype = ctypes.create_string_buffer(options.encode(self._encoding)) # case C020 - temperature_ctype = _visatype.ViReal64() # case S200 + temperature_ctype = _visatype.ViReal64() # case S220 error_code = self._library.niDMM_GetDevTemp(vi_ctype, options_ctype, None if temperature_ctype is None else (ctypes.pointer(temperature_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(temperature_ctype.value) @@ -2041,7 +2041,7 @@ def get_ext_cal_recommended_interval(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - months_ctype = _visatype.ViInt32() # case S200 + months_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niDMM_GetExtCalRecommendedInterval(vi_ctype, None if months_ctype is None else (ctypes.pointer(months_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return _converters.convert_month_to_timedelta(int(months_ctype.value)) @@ -2106,7 +2106,7 @@ def get_last_cal_temp(self, cal_type): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 cal_type_ctype = _visatype.ViInt32(cal_type) # case S150 - temperature_ctype = _visatype.ViReal64() # case S200 + temperature_ctype = _visatype.ViReal64() # case S220 error_code = self._library.niDMM_GetLastCalTemp(vi_ctype, cal_type_ctype, None if temperature_ctype is None else (ctypes.pointer(temperature_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(temperature_ctype.value) @@ -2130,7 +2130,7 @@ def get_self_cal_supported(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - self_cal_supported_ctype = _visatype.ViBoolean() # case S200 + self_cal_supported_ctype = _visatype.ViBoolean() # case S220 error_code = self._library.niDMM_GetSelfCalSupported(vi_ctype, None if self_cal_supported_ctype is None else (ctypes.pointer(self_cal_supported_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return bool(self_cal_supported_ctype.value) @@ -2343,7 +2343,7 @@ def _init_with_options(self, resource_name, id_query=False, reset_device=False, id_query_ctype = _visatype.ViBoolean(id_query) # case S150 reset_device_ctype = _visatype.ViBoolean(reset_device) # case S150 option_string_ctype = ctypes.create_string_buffer(option_string.encode(self._encoding)) # case C020 - vi_ctype = _visatype.ViSession() # case S200 + vi_ctype = _visatype.ViSession() # case S220 error_code = self._library.niDMM_InitWithOptions(resource_name_ctype, id_query_ctype, reset_device_ctype, option_string_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) @@ -2389,8 +2389,8 @@ def perform_open_cable_comp(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - conductance_ctype = _visatype.ViReal64() # case S200 - susceptance_ctype = _visatype.ViReal64() # case S200 + conductance_ctype = _visatype.ViReal64() # case S220 + susceptance_ctype = _visatype.ViReal64() # case S220 error_code = self._library.niDMM_PerformOpenCableComp(vi_ctype, None if conductance_ctype is None else (ctypes.pointer(conductance_ctype)), None if susceptance_ctype is None else (ctypes.pointer(susceptance_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(conductance_ctype.value), float(susceptance_ctype.value) @@ -2420,8 +2420,8 @@ def perform_short_cable_comp(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - resistance_ctype = _visatype.ViReal64() # case S200 - reactance_ctype = _visatype.ViReal64() # case S200 + resistance_ctype = _visatype.ViReal64() # case S220 + reactance_ctype = _visatype.ViReal64() # case S220 error_code = self._library.niDMM_PerformShortCableComp(vi_ctype, None if resistance_ctype is None else (ctypes.pointer(resistance_ctype)), None if reactance_ctype is None else (ctypes.pointer(reactance_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(resistance_ctype.value), float(reactance_ctype.value) @@ -2454,7 +2454,7 @@ def read(self, maximum_time=datetime.timedelta(milliseconds=-1)): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 maximum_time_ctype = _converters.convert_timedelta_to_milliseconds(maximum_time, _visatype.ViInt32) # case S140 - reading_ctype = _visatype.ViReal64() # case S200 + reading_ctype = _visatype.ViReal64() # case S220 error_code = self._library.niDMM_Read(vi_ctype, maximum_time_ctype, None if reading_ctype is None else (ctypes.pointer(reading_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(reading_ctype.value) @@ -2504,11 +2504,11 @@ def read_multi_point(self, array_size, maximum_time=datetime.timedelta(milliseco ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 maximum_time_ctype = _converters.convert_timedelta_to_milliseconds(maximum_time, _visatype.ViInt32) # case S140 - array_size_ctype = _visatype.ViInt32(array_size) # case S190 + array_size_ctype = _visatype.ViInt32(array_size) # case S210 reading_array_size = array_size # case B600 reading_array_array = array.array("d", [0] * reading_array_size) # case B600 reading_array_ctype = get_ctypes_pointer_for_buffer(value=reading_array_array, library_type=_visatype.ViReal64) # case B600 - actual_number_of_points_ctype = _visatype.ViInt32() # case S200 + actual_number_of_points_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niDMM_ReadMultiPoint(vi_ctype, maximum_time_ctype, array_size_ctype, reading_array_ctype, None if actual_number_of_points_ctype is None else (ctypes.pointer(actual_number_of_points_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return reading_array_array @@ -2552,8 +2552,8 @@ def read_status(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - acquisition_backlog_ctype = _visatype.ViInt32() # case S200 - acquisition_status_ctype = _visatype.ViInt16() # case S200 + acquisition_backlog_ctype = _visatype.ViInt32() # case S220 + acquisition_status_ctype = _visatype.ViInt16() # case S220 error_code = self._library.niDMM_ReadStatus(vi_ctype, None if acquisition_backlog_ctype is None else (ctypes.pointer(acquisition_backlog_ctype)), None if acquisition_status_ctype is None else (ctypes.pointer(acquisition_status_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(acquisition_backlog_ctype.value), enums.AcquisitionStatus(acquisition_status_ctype.value) @@ -2601,11 +2601,11 @@ def read_waveform(self, array_size, maximum_time=datetime.timedelta(milliseconds ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 maximum_time_ctype = _converters.convert_timedelta_to_milliseconds(maximum_time, _visatype.ViInt32) # case S140 - array_size_ctype = _visatype.ViInt32(array_size) # case S190 + array_size_ctype = _visatype.ViInt32(array_size) # case S210 waveform_array_size = array_size # case B600 waveform_array_array = array.array("d", [0] * waveform_array_size) # case B600 waveform_array_ctype = get_ctypes_pointer_for_buffer(value=waveform_array_array, library_type=_visatype.ViReal64) # case B600 - actual_number_of_points_ctype = _visatype.ViInt32() # case S200 + actual_number_of_points_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niDMM_ReadWaveform(vi_ctype, maximum_time_ctype, array_size_ctype, waveform_array_ctype, None if actual_number_of_points_ctype is None else (ctypes.pointer(actual_number_of_points_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return waveform_array_array @@ -2751,7 +2751,7 @@ def _self_test(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - self_test_result_ctype = _visatype.ViInt16() # case S200 + self_test_result_ctype = _visatype.ViInt16() # case S220 self_test_message_ctype = (_visatype.ViChar * 256)() # case C070 error_code = self._library.niDMM_self_test(vi_ctype, None if self_test_result_ctype is None else (ctypes.pointer(self_test_result_ctype)), self_test_message_ctype) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) diff --git a/generated/nifake/session.py b/generated/nifake/session.py index 5a0d5a1e1..1d10c4ebf 100644 --- a/generated/nifake/session.py +++ b/generated/nifake/session.py @@ -238,7 +238,7 @@ def _get_attribute_vi_boolean(self, attribute_id): 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 + attribute_value_ctype = _visatype.ViBoolean() # case S220 error_code = self._library.niFake_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) @@ -268,7 +268,7 @@ def _get_attribute_vi_int32(self, attribute_id): 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 + attribute_value_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niFake_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) @@ -298,7 +298,7 @@ def _get_attribute_vi_int64(self, attribute_id): 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.ViInt64() # case S200 + attribute_value_ctype = _visatype.ViInt64() # case S220 error_code = self._library.niFake_GetAttributeViInt64(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) @@ -328,7 +328,7 @@ def _get_attribute_vi_real64(self, attribute_id): 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.ViReal64() # case S200 + attribute_value_ctype = _visatype.ViReal64() # case S220 error_code = self._library.niFake_GetAttributeViReal64(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 float(attribute_value_ctype.value) @@ -374,7 +374,7 @@ def _get_error(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - error_code_ctype = _visatype.ViStatus() # case S200 + error_code_ctype = _visatype.ViStatus() # case S220 buffer_size_ctype = _visatype.ViInt32() # case S170 description_ctype = None # case C050 error_code = self._library.niFake_GetError(vi_ctype, None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), buffer_size_ctype, description_ctype) @@ -455,7 +455,7 @@ def read_from_channel(self, maximum_time): vi_ctype = _visatype.ViSession(self._vi) # case S110 channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 maximum_time_ctype = _converters.convert_timedelta_to_microseconds(maximum_time, _visatype.ViInt32) # case S140 - reading_ctype = _visatype.ViReal64() # case S200 + reading_ctype = _visatype.ViReal64() # case S220 error_code = self._library.niFake_ReadFromChannel(vi_ctype, channel_name_ctype, maximum_time_ctype, None if reading_ctype is None else (ctypes.pointer(reading_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(reading_ctype.value) @@ -761,7 +761,7 @@ def bool_array_output_function(self, number_of_elements): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - number_of_elements_ctype = _visatype.ViInt32(number_of_elements) # case S190 + number_of_elements_ctype = _visatype.ViInt32(number_of_elements) # case S210 an_array_size = number_of_elements # case B600 an_array_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViBoolean, size=an_array_size) # case B600 error_code = self._library.niFake_BoolArrayOutputFunction(vi_ctype, number_of_elements_ctype, an_array_ctype) @@ -783,7 +783,7 @@ def enum_array_output_function(self, number_of_elements): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - number_of_elements_ctype = _visatype.ViInt32(number_of_elements) # case S190 + number_of_elements_ctype = _visatype.ViInt32(number_of_elements) # case S210 an_array_size = number_of_elements # case B600 an_array_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViInt16, size=an_array_size) # case B600 error_code = self._library.niFake_EnumArrayOutputFunction(vi_ctype, number_of_elements_ctype, an_array_ctype) @@ -835,11 +835,11 @@ def fetch_waveform(self, number_of_samples): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - number_of_samples_ctype = _visatype.ViInt32(number_of_samples) # case S190 + number_of_samples_ctype = _visatype.ViInt32(number_of_samples) # case S210 waveform_data_size = number_of_samples # case B600 waveform_data_array = array.array("d", [0] * waveform_data_size) # case B600 waveform_data_ctype = get_ctypes_pointer_for_buffer(value=waveform_data_array, library_type=_visatype.ViReal64) # case B600 - actual_number_of_samples_ctype = _visatype.ViInt32() # case S200 + actual_number_of_samples_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niFake_FetchWaveform(vi_ctype, number_of_samples_ctype, waveform_data_ctype, None if actual_number_of_samples_ctype is None else (ctypes.pointer(actual_number_of_samples_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return waveform_data_array @@ -871,9 +871,9 @@ def fetch_waveform_into(self, waveform_data): number_of_samples = len(waveform_data) vi_ctype = _visatype.ViSession(self._vi) # case S110 - number_of_samples_ctype = _visatype.ViInt32(number_of_samples) # case S190 + number_of_samples_ctype = _visatype.ViInt32(number_of_samples) # case S210 waveform_data_ctype = get_ctypes_pointer_for_buffer(value=waveform_data) # case B510 - actual_number_of_samples_ctype = _visatype.ViInt32() # case S200 + actual_number_of_samples_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niFake_FetchWaveform(vi_ctype, number_of_samples_ctype, waveform_data_ctype, None if actual_number_of_samples_ctype is None else (ctypes.pointer(actual_number_of_samples_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @@ -891,7 +891,7 @@ def get_a_boolean(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - a_boolean_ctype = _visatype.ViBoolean() # case S200 + a_boolean_ctype = _visatype.ViBoolean() # case S220 error_code = self._library.niFake_GetABoolean(vi_ctype, None if a_boolean_ctype is None else (ctypes.pointer(a_boolean_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return bool(a_boolean_ctype.value) @@ -909,7 +909,7 @@ def get_a_number(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - a_number_ctype = _visatype.ViInt16() # case S200 + a_number_ctype = _visatype.ViInt16() # case S220 error_code = self._library.niFake_GetANumber(vi_ctype, None if a_number_ctype is None else (ctypes.pointer(a_number_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(a_number_ctype.value) @@ -983,7 +983,7 @@ def get_an_ivi_dance_with_a_twist_string(self): vi_ctype = _visatype.ViSession(self._vi) # case S110 buffer_size_ctype = _visatype.ViInt32(0) # case S210 a_string_ctype = None # case C090 - actual_size_ctype = _visatype.ViInt32() # case S200 + actual_size_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niFake_GetAnIviDanceWithATwistString(vi_ctype, buffer_size_ctype, a_string_ctype, None if actual_size_ctype is None else (ctypes.pointer(actual_size_ctype))) errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) buffer_size_ctype = _visatype.ViInt32(actual_size_ctype.value) # case S220 @@ -1039,7 +1039,7 @@ def get_array_size_for_python_code(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - size_out_ctype = _visatype.ViInt32() # case S200 + size_out_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niFake_GetArraySizeForPythonCode(vi_ctype, None if size_out_ctype is None else (ctypes.pointer(size_out_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(size_out_ctype.value) @@ -1086,11 +1086,11 @@ def _get_cal_date_and_time(self, cal_type): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 cal_type_ctype = _visatype.ViInt32(cal_type) # case S150 - month_ctype = _visatype.ViInt32() # case S200 - day_ctype = _visatype.ViInt32() # case S200 - year_ctype = _visatype.ViInt32() # case S200 - hour_ctype = _visatype.ViInt32() # case S200 - minute_ctype = _visatype.ViInt32() # case S200 + month_ctype = _visatype.ViInt32() # case S220 + day_ctype = _visatype.ViInt32() # case S220 + year_ctype = _visatype.ViInt32() # case S220 + hour_ctype = _visatype.ViInt32() # case S220 + minute_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niFake_GetCalDateAndTime(vi_ctype, cal_type_ctype, None if month_ctype is None else (ctypes.pointer(month_ctype)), None if day_ctype is None else (ctypes.pointer(day_ctype)), None if year_ctype is None else (ctypes.pointer(year_ctype)), None if hour_ctype is None else (ctypes.pointer(hour_ctype)), None if minute_ctype is None else (ctypes.pointer(minute_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(month_ctype.value), int(day_ctype.value), int(year_ctype.value), int(hour_ctype.value), int(minute_ctype.value) @@ -1106,7 +1106,7 @@ def get_cal_interval(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - months_ctype = _visatype.ViInt32() # case S200 + months_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niFake_GetCalInterval(vi_ctype, None if months_ctype is None else (ctypes.pointer(months_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return _converters.convert_month_to_timedelta(int(months_ctype.value)) @@ -1122,7 +1122,7 @@ def get_custom_type(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - cs_ctype = custom_struct.struct_CustomStruct() # case S200 + cs_ctype = custom_struct.struct_CustomStruct() # case S220 error_code = self._library.niFake_GetCustomType(vi_ctype, None if cs_ctype is None else (ctypes.pointer(cs_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return custom_struct.CustomStruct(cs_ctype) @@ -1142,7 +1142,7 @@ def get_custom_type_array(self, number_of_elements): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - number_of_elements_ctype = _visatype.ViInt32(number_of_elements) # case S190 + number_of_elements_ctype = _visatype.ViInt32(number_of_elements) # case S210 cs_size = number_of_elements # case B600 cs_ctype = get_ctypes_pointer_for_buffer(library_type=custom_struct.struct_CustomStruct, size=cs_size) # case B600 error_code = self._library.niFake_GetCustomTypeArray(vi_ctype, number_of_elements_ctype, cs_ctype) @@ -1176,8 +1176,8 @@ def get_enum_value(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - a_quantity_ctype = _visatype.ViInt32() # case S200 - a_turtle_ctype = _visatype.ViInt16() # case S200 + a_quantity_ctype = _visatype.ViInt32() # case S220 + a_turtle_ctype = _visatype.ViInt16() # case S220 error_code = self._library.niFake_GetEnumValue(vi_ctype, None if a_quantity_ctype is None else (ctypes.pointer(a_quantity_ctype)), None if a_turtle_ctype is None else (ctypes.pointer(a_turtle_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(a_quantity_ctype.value), enums.Turtle(a_turtle_ctype.value) @@ -1236,7 +1236,7 @@ def _init_with_options(self, resource_name, option_string, id_query=False, reset id_query_ctype = _visatype.ViBoolean(id_query) # case S150 reset_device_ctype = _visatype.ViBoolean(reset_device) # case S150 option_string_ctype = ctypes.create_string_buffer(option_string.encode(self._encoding)) # case C020 - vi_ctype = _visatype.ViSession() # case S200 + vi_ctype = _visatype.ViSession() # case S220 error_code = self._library.niFake_InitWithOptions(resource_name_ctype, id_query_ctype, reset_device_ctype, option_string_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) @@ -1275,7 +1275,7 @@ def multiple_array_types(self, output_array_size, input_array_of_floats, input_a ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - output_array_size_ctype = _visatype.ViInt32(output_array_size) # case S190 + output_array_size_ctype = _visatype.ViInt32(output_array_size) # case S210 output_array_size = output_array_size # case B600 output_array_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViReal64, size=output_array_size) # case B600 output_array_of_fixed_length_size = 3 # case B570 @@ -1413,7 +1413,7 @@ def read(self, maximum_time): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 maximum_time_ctype = _converters.convert_timedelta_to_seconds(maximum_time, _visatype.ViReal64) # case S140 - reading_ctype = _visatype.ViReal64() # case S200 + reading_ctype = _visatype.ViReal64() # case S220 error_code = self._library.niFake_Read(vi_ctype, maximum_time_ctype, None if reading_ctype is None else (ctypes.pointer(reading_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(reading_ctype.value) @@ -1433,7 +1433,7 @@ def return_a_number_and_a_string(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - a_number_ctype = _visatype.ViInt16() # case S200 + a_number_ctype = _visatype.ViInt16() # case S220 a_string_ctype = (_visatype.ViChar * 256)() # case C070 error_code = self._library.niFake_ReturnANumberAndAString(vi_ctype, None if a_number_ctype is None else (ctypes.pointer(a_number_ctype)), a_string_ctype) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) @@ -1478,13 +1478,13 @@ def return_multiple_types(self, array_size): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - a_boolean_ctype = _visatype.ViBoolean() # case S200 - an_int32_ctype = _visatype.ViInt32() # case S200 - an_int64_ctype = _visatype.ViInt64() # case S200 - an_int_enum_ctype = _visatype.ViInt16() # case S200 - a_float_ctype = _visatype.ViReal64() # case S200 - a_float_enum_ctype = _visatype.ViReal64() # case S200 - array_size_ctype = _visatype.ViInt32(array_size) # case S190 + a_boolean_ctype = _visatype.ViBoolean() # case S220 + an_int32_ctype = _visatype.ViInt32() # case S220 + an_int64_ctype = _visatype.ViInt64() # case S220 + an_int_enum_ctype = _visatype.ViInt16() # case S220 + a_float_ctype = _visatype.ViReal64() # case S220 + a_float_enum_ctype = _visatype.ViReal64() # case S220 + array_size_ctype = _visatype.ViInt32(array_size) # case S210 an_array_size = array_size # case B600 an_array_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViReal64, size=an_array_size) # case B600 string_size_ctype = _visatype.ViInt32() # case S170 @@ -1567,7 +1567,7 @@ def use64_bit_number(self, input): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 input_ctype = _visatype.ViInt64(input) # case S150 - output_ctype = _visatype.ViInt64() # case S200 + output_ctype = _visatype.ViInt64() # case S220 error_code = self._library.niFake_Use64BitNumber(vi_ctype, input_ctype, None if output_ctype is None else (ctypes.pointer(output_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(output_ctype.value) @@ -1649,7 +1649,7 @@ def _self_test(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - self_test_result_ctype = _visatype.ViInt16() # case S200 + self_test_result_ctype = _visatype.ViInt16() # case S220 self_test_message_ctype = (_visatype.ViChar * 256)() # case C070 error_code = self._library.niFake_self_test(vi_ctype, None if self_test_result_ctype is None else (ctypes.pointer(self_test_result_ctype)), self_test_message_ctype) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) diff --git a/generated/nifgen/session.py b/generated/nifgen/session.py index f697d0a94..480050d7c 100644 --- a/generated/nifgen/session.py +++ b/generated/nifgen/session.py @@ -1043,7 +1043,7 @@ def allocate_waveform(self, waveform_size): vi_ctype = _visatype.ViSession(self._vi) # case S110 channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 waveform_size_ctype = _visatype.ViInt32(waveform_size) # case S150 - waveform_handle_ctype = _visatype.ViInt32() # case S200 + waveform_handle_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niFgen_AllocateWaveform(vi_ctype, channel_name_ctype, waveform_size_ctype, None if waveform_handle_ctype is None else (ctypes.pointer(waveform_handle_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(waveform_handle_ctype.value) @@ -1552,7 +1552,7 @@ def _create_waveform_f64(self, waveform_data_array): waveform_size_ctype = _visatype.ViInt32(0 if waveform_data_array is None else len(waveform_data_array)) # case S160 waveform_data_array_array = get_ctypes_and_array(value=waveform_data_array, array_type="d") # case B550 waveform_data_array_ctype = get_ctypes_pointer_for_buffer(value=waveform_data_array_array, library_type=_visatype.ViReal64) # case B550 - waveform_handle_ctype = _visatype.ViInt32() # case S200 + waveform_handle_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niFgen_CreateWaveformF64(vi_ctype, channel_name_ctype, waveform_size_ctype, waveform_data_array_ctype, None if waveform_handle_ctype is None else (ctypes.pointer(waveform_handle_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(waveform_handle_ctype.value) @@ -1608,7 +1608,7 @@ def _create_waveform_f64_numpy(self, waveform_data_array): channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 waveform_size_ctype = _visatype.ViInt32(0 if waveform_data_array is None else len(waveform_data_array)) # case S160 waveform_data_array_ctype = get_ctypes_pointer_for_buffer(value=waveform_data_array) # case B510 - waveform_handle_ctype = _visatype.ViInt32() # case S200 + waveform_handle_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niFgen_CreateWaveformF64(vi_ctype, channel_name_ctype, waveform_size_ctype, waveform_data_array_ctype, None if waveform_handle_ctype is None else (ctypes.pointer(waveform_handle_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(waveform_handle_ctype.value) @@ -1672,7 +1672,7 @@ def create_waveform_from_file_f64(self, file_name, byte_order): channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 file_name_ctype = ctypes.create_string_buffer(file_name.encode(self._encoding)) # case C020 byte_order_ctype = _visatype.ViInt32(byte_order.value) # case S130 - waveform_handle_ctype = _visatype.ViInt32() # case S200 + waveform_handle_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niFgen_CreateWaveformFromFileF64(vi_ctype, channel_name_ctype, file_name_ctype, byte_order_ctype, None if waveform_handle_ctype is None else (ctypes.pointer(waveform_handle_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(waveform_handle_ctype.value) @@ -1736,7 +1736,7 @@ def create_waveform_from_file_i16(self, file_name, byte_order): channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 file_name_ctype = ctypes.create_string_buffer(file_name.encode(self._encoding)) # case C020 byte_order_ctype = _visatype.ViInt32(byte_order.value) # case S130 - waveform_handle_ctype = _visatype.ViInt32() # case S200 + waveform_handle_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niFgen_CreateWaveformFromFileI16(vi_ctype, channel_name_ctype, file_name_ctype, byte_order_ctype, None if waveform_handle_ctype is None else (ctypes.pointer(waveform_handle_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(waveform_handle_ctype.value) @@ -1790,7 +1790,7 @@ def _create_waveform_i16_numpy(self, waveform_data_array): channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 waveform_size_ctype = _visatype.ViInt32(0 if waveform_data_array is None else len(waveform_data_array)) # case S160 waveform_data_array_ctype = get_ctypes_pointer_for_buffer(value=waveform_data_array) # case B510 - waveform_handle_ctype = _visatype.ViInt32() # case S200 + waveform_handle_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niFgen_CreateWaveformI16(vi_ctype, channel_name_ctype, waveform_size_ctype, waveform_data_array_ctype, None if waveform_handle_ctype is None else (ctypes.pointer(waveform_handle_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(waveform_handle_ctype.value) @@ -1958,7 +1958,7 @@ def _get_attribute_vi_boolean(self, attribute_id): 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 + attribute_value_ctype = _visatype.ViBoolean() # case S220 error_code = self._library.niFgen_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) @@ -1996,7 +1996,7 @@ def _get_attribute_vi_int32(self, attribute_id): 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 + attribute_value_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niFgen_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) @@ -2036,7 +2036,7 @@ def _get_attribute_vi_real64(self, attribute_id): 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.ViReal64() # case S200 + attribute_value_ctype = _visatype.ViReal64() # case S220 error_code = self._library.niFgen_GetAttributeViReal64(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 float(attribute_value_ctype.value) @@ -2128,7 +2128,7 @@ def _get_error(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - error_code_ctype = _visatype.ViStatus() # case S200 + error_code_ctype = _visatype.ViStatus() # case S220 error_description_buffer_size_ctype = _visatype.ViInt32() # case S170 error_description_ctype = None # case C050 error_code = self._library.niFgen_GetError(vi_ctype, None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), error_description_buffer_size_ctype, error_description_ctype) @@ -3468,7 +3468,7 @@ def create_advanced_arb_sequence(self, waveform_handles_array, loop_counts_array marker_location_array_ctype = get_ctypes_pointer_for_buffer(value=marker_location_array, library_type=_visatype.ViInt32) # case B550 coerced_markers_array_size = (0 if marker_location_array is None else len(marker_location_array)) # case B560 coerced_markers_array_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViInt32, size=coerced_markers_array_size) # case B560 - sequence_handle_ctype = _visatype.ViInt32() # case S200 + sequence_handle_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niFgen_CreateAdvancedArbSequence(vi_ctype, sequence_length_ctype, waveform_handles_array_ctype, loop_counts_array_ctype, sample_counts_array_ctype, marker_location_array_ctype, coerced_markers_array_ctype, None if sequence_handle_ctype is None else (ctypes.pointer(sequence_handle_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return [int(coerced_markers_array_ctype[i]) for i in range((0 if marker_location_array is None else len(marker_location_array)))], int(sequence_handle_ctype.value) @@ -3536,7 +3536,7 @@ def create_arb_sequence(self, waveform_handles_array, loop_counts_array): raise ValueError("Length of loop_counts_array and waveform_handles_array parameters do not match.") # case S160 waveform_handles_array_ctype = get_ctypes_pointer_for_buffer(value=waveform_handles_array, library_type=_visatype.ViInt32) # case B550 loop_counts_array_ctype = get_ctypes_pointer_for_buffer(value=loop_counts_array, library_type=_visatype.ViInt32) # case B550 - sequence_handle_ctype = _visatype.ViInt32() # case S200 + sequence_handle_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niFgen_CreateArbSequence(vi_ctype, sequence_length_ctype, waveform_handles_array_ctype, loop_counts_array_ctype, None if sequence_handle_ctype is None else (ctypes.pointer(sequence_handle_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(sequence_handle_ctype.value) @@ -3625,7 +3625,7 @@ def create_freq_list(self, waveform, frequency_array, duration_array): raise ValueError("Length of duration_array and frequency_array parameters do not match.") # case S160 frequency_array_ctype = get_ctypes_pointer_for_buffer(value=frequency_array, library_type=_visatype.ViReal64) # case B550 duration_array_ctype = get_ctypes_pointer_for_buffer(value=duration_array, library_type=_visatype.ViReal64) # case B550 - frequency_list_handle_ctype = _visatype.ViInt32() # case S200 + frequency_list_handle_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niFgen_CreateFreqList(vi_ctype, waveform_ctype, frequency_list_length_ctype, frequency_array_ctype, duration_array_ctype, None if frequency_list_handle_ctype is None else (ctypes.pointer(frequency_list_handle_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(frequency_list_handle_ctype.value) @@ -3665,11 +3665,11 @@ def _get_ext_cal_last_date_and_time(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - year_ctype = _visatype.ViInt32() # case S200 - month_ctype = _visatype.ViInt32() # case S200 - day_ctype = _visatype.ViInt32() # case S200 - hour_ctype = _visatype.ViInt32() # case S200 - minute_ctype = _visatype.ViInt32() # case S200 + year_ctype = _visatype.ViInt32() # case S220 + month_ctype = _visatype.ViInt32() # case S220 + day_ctype = _visatype.ViInt32() # case S220 + hour_ctype = _visatype.ViInt32() # case S220 + minute_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niFgen_GetExtCalLastDateAndTime(vi_ctype, None if year_ctype is None else (ctypes.pointer(year_ctype)), None if month_ctype is None else (ctypes.pointer(month_ctype)), None if day_ctype is None else (ctypes.pointer(day_ctype)), None if hour_ctype is None else (ctypes.pointer(hour_ctype)), None if minute_ctype is None else (ctypes.pointer(minute_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(year_ctype.value), int(month_ctype.value), int(day_ctype.value), int(hour_ctype.value), int(minute_ctype.value) @@ -3687,7 +3687,7 @@ def get_ext_cal_last_temp(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - temperature_ctype = _visatype.ViReal64() # case S200 + temperature_ctype = _visatype.ViReal64() # case S220 error_code = self._library.niFgen_GetExtCalLastTemp(vi_ctype, None if temperature_ctype is None else (ctypes.pointer(temperature_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(temperature_ctype.value) @@ -3705,7 +3705,7 @@ def get_ext_cal_recommended_interval(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - months_ctype = _visatype.ViInt32() # case S200 + months_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niFgen_GetExtCalRecommendedInterval(vi_ctype, None if months_ctype is None else (ctypes.pointer(months_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return _converters.convert_month_to_timedelta(int(months_ctype.value)) @@ -3738,7 +3738,7 @@ def get_hardware_state(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - state_ctype = _visatype.ViInt32() # case S200 + state_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niFgen_GetHardwareState(vi_ctype, None if state_ctype is None else (ctypes.pointer(state_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return enums.HardwareState(state_ctype.value) @@ -3798,11 +3798,11 @@ def _get_self_cal_last_date_and_time(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - year_ctype = _visatype.ViInt32() # case S200 - month_ctype = _visatype.ViInt32() # case S200 - day_ctype = _visatype.ViInt32() # case S200 - hour_ctype = _visatype.ViInt32() # case S200 - minute_ctype = _visatype.ViInt32() # case S200 + year_ctype = _visatype.ViInt32() # case S220 + month_ctype = _visatype.ViInt32() # case S220 + day_ctype = _visatype.ViInt32() # case S220 + hour_ctype = _visatype.ViInt32() # case S220 + minute_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niFgen_GetSelfCalLastDateAndTime(vi_ctype, None if year_ctype is None else (ctypes.pointer(year_ctype)), None if month_ctype is None else (ctypes.pointer(month_ctype)), None if day_ctype is None else (ctypes.pointer(day_ctype)), None if hour_ctype is None else (ctypes.pointer(hour_ctype)), None if minute_ctype is None else (ctypes.pointer(minute_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(year_ctype.value), int(month_ctype.value), int(day_ctype.value), int(hour_ctype.value), int(minute_ctype.value) @@ -3820,7 +3820,7 @@ def get_self_cal_last_temp(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - temperature_ctype = _visatype.ViReal64() # case S200 + temperature_ctype = _visatype.ViReal64() # case S220 error_code = self._library.niFgen_GetSelfCalLastTemp(vi_ctype, None if temperature_ctype is None else (ctypes.pointer(temperature_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(temperature_ctype.value) @@ -3844,7 +3844,7 @@ def get_self_cal_supported(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - self_cal_supported_ctype = _visatype.ViBoolean() # case S200 + self_cal_supported_ctype = _visatype.ViBoolean() # case S220 error_code = self._library.niFgen_GetSelfCalSupported(vi_ctype, None if self_cal_supported_ctype is None else (ctypes.pointer(self_cal_supported_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return bool(self_cal_supported_ctype.value) @@ -3981,7 +3981,7 @@ def _initialize_with_channels(self, resource_name, channel_name=None, reset_devi channel_name_ctype = ctypes.create_string_buffer(channel_name.encode(self._encoding)) # case C020 reset_device_ctype = _visatype.ViBoolean(reset_device) # case S150 option_string_ctype = ctypes.create_string_buffer(option_string.encode(self._encoding)) # case C020 - vi_ctype = _visatype.ViSession() # case S200 + vi_ctype = _visatype.ViSession() # case S220 error_code = self._library.niFgen_InitializeWithChannels(resource_name_ctype, channel_name_ctype, reset_device_ctype, option_string_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) @@ -4025,7 +4025,7 @@ def is_done(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - done_ctype = _visatype.ViBoolean() # case S200 + done_ctype = _visatype.ViBoolean() # case S220 error_code = self._library.niFgen_IsDone(vi_ctype, None if done_ctype is None else (ctypes.pointer(done_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return bool(done_ctype.value) @@ -4059,10 +4059,10 @@ def query_arb_seq_capabilities(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - maximum_number_of_sequences_ctype = _visatype.ViInt32() # case S200 - minimum_sequence_length_ctype = _visatype.ViInt32() # case S200 - maximum_sequence_length_ctype = _visatype.ViInt32() # case S200 - maximum_loop_count_ctype = _visatype.ViInt32() # case S200 + maximum_number_of_sequences_ctype = _visatype.ViInt32() # case S220 + minimum_sequence_length_ctype = _visatype.ViInt32() # case S220 + maximum_sequence_length_ctype = _visatype.ViInt32() # case S220 + maximum_loop_count_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niFgen_QueryArbSeqCapabilities(vi_ctype, None if maximum_number_of_sequences_ctype is None else (ctypes.pointer(maximum_number_of_sequences_ctype)), None if minimum_sequence_length_ctype is None else (ctypes.pointer(minimum_sequence_length_ctype)), None if maximum_sequence_length_ctype is None else (ctypes.pointer(maximum_sequence_length_ctype)), None if maximum_loop_count_ctype is None else (ctypes.pointer(maximum_loop_count_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(maximum_number_of_sequences_ctype.value), int(minimum_sequence_length_ctype.value), int(maximum_sequence_length_ctype.value), int(maximum_loop_count_ctype.value) @@ -4103,10 +4103,10 @@ def query_arb_wfm_capabilities(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - maximum_number_of_waveforms_ctype = _visatype.ViInt32() # case S200 - waveform_quantum_ctype = _visatype.ViInt32() # case S200 - minimum_waveform_size_ctype = _visatype.ViInt32() # case S200 - maximum_waveform_size_ctype = _visatype.ViInt32() # case S200 + maximum_number_of_waveforms_ctype = _visatype.ViInt32() # case S220 + waveform_quantum_ctype = _visatype.ViInt32() # case S220 + minimum_waveform_size_ctype = _visatype.ViInt32() # case S220 + maximum_waveform_size_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niFgen_QueryArbWfmCapabilities(vi_ctype, None if maximum_number_of_waveforms_ctype is None else (ctypes.pointer(maximum_number_of_waveforms_ctype)), None if waveform_quantum_ctype is None else (ctypes.pointer(waveform_quantum_ctype)), None if minimum_waveform_size_ctype is None else (ctypes.pointer(minimum_waveform_size_ctype)), None if maximum_waveform_size_ctype is None else (ctypes.pointer(maximum_waveform_size_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(maximum_number_of_waveforms_ctype.value), int(waveform_quantum_ctype.value), int(minimum_waveform_size_ctype.value), int(maximum_waveform_size_ctype.value) @@ -4151,12 +4151,12 @@ def query_freq_list_capabilities(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - maximum_number_of_freq_lists_ctype = _visatype.ViInt32() # case S200 - minimum_frequency_list_length_ctype = _visatype.ViInt32() # case S200 - maximum_frequency_list_length_ctype = _visatype.ViInt32() # case S200 - minimum_frequency_list_duration_ctype = _visatype.ViReal64() # case S200 - maximum_frequency_list_duration_ctype = _visatype.ViReal64() # case S200 - frequency_list_duration_quantum_ctype = _visatype.ViReal64() # case S200 + maximum_number_of_freq_lists_ctype = _visatype.ViInt32() # case S220 + minimum_frequency_list_length_ctype = _visatype.ViInt32() # case S220 + maximum_frequency_list_length_ctype = _visatype.ViInt32() # case S220 + minimum_frequency_list_duration_ctype = _visatype.ViReal64() # case S220 + maximum_frequency_list_duration_ctype = _visatype.ViReal64() # case S220 + frequency_list_duration_quantum_ctype = _visatype.ViReal64() # case S220 error_code = self._library.niFgen_QueryFreqListCapabilities(vi_ctype, None if maximum_number_of_freq_lists_ctype is None else (ctypes.pointer(maximum_number_of_freq_lists_ctype)), None if minimum_frequency_list_length_ctype is None else (ctypes.pointer(minimum_frequency_list_length_ctype)), None if maximum_frequency_list_length_ctype is None else (ctypes.pointer(maximum_frequency_list_length_ctype)), None if minimum_frequency_list_duration_ctype is None else (ctypes.pointer(minimum_frequency_list_duration_ctype)), None if maximum_frequency_list_duration_ctype is None else (ctypes.pointer(maximum_frequency_list_duration_ctype)), None if frequency_list_duration_quantum_ctype is None else (ctypes.pointer(frequency_list_duration_quantum_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(maximum_number_of_freq_lists_ctype.value), int(minimum_frequency_list_length_ctype.value), int(maximum_frequency_list_length_ctype.value), float(minimum_frequency_list_duration_ctype.value), float(maximum_frequency_list_duration_ctype.value), float(frequency_list_duration_quantum_ctype.value) @@ -4174,7 +4174,7 @@ def read_current_temperature(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - temperature_ctype = _visatype.ViReal64() # case S200 + temperature_ctype = _visatype.ViReal64() # case S220 error_code = self._library.niFgen_ReadCurrentTemperature(vi_ctype, None if temperature_ctype is None else (ctypes.pointer(temperature_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(temperature_ctype.value) @@ -4346,7 +4346,7 @@ def _self_test(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - self_test_result_ctype = _visatype.ViInt16() # case S200 + self_test_result_ctype = _visatype.ViInt16() # case S220 self_test_message_ctype = (_visatype.ViChar * 256)() # case C070 error_code = self._library.niFgen_self_test(vi_ctype, None if self_test_result_ctype is None else (ctypes.pointer(self_test_result_ctype)), self_test_message_ctype) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) diff --git a/generated/nimodinst/session.py b/generated/nimodinst/session.py index 8a7044bfe..14e9a580a 100644 --- a/generated/nimodinst/session.py +++ b/generated/nimodinst/session.py @@ -294,7 +294,7 @@ def _get_installed_device_attribute_vi_int32(self, index, attribute_id): handle_ctype = _visatype.ViSession(self._handle) # case S110 index_ctype = _visatype.ViInt32(index) # case S150 attribute_id_ctype = _visatype.ViInt32(attribute_id) # case S150 - attribute_value_ctype = _visatype.ViInt32() # case S200 + attribute_value_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niModInst_GetInstalledDeviceAttributeViInt32(handle_ctype, index_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) @@ -379,8 +379,8 @@ def _open_installed_devices_session(self, driver): ''' driver_ctype = ctypes.create_string_buffer(driver.encode(self._encoding)) # case C020 - handle_ctype = _visatype.ViSession() # case S200 - device_count_ctype = _visatype.ViInt32() # case S200 + handle_ctype = _visatype.ViSession() # case S220 + device_count_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niModInst_OpenInstalledDevicesSession(driver_ctype, None if handle_ctype is None else (ctypes.pointer(handle_ctype)), None if device_count_ctype is None else (ctypes.pointer(device_count_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(handle_ctype.value), int(device_count_ctype.value) diff --git a/generated/niscope/session.py b/generated/niscope/session.py index 014023b55..63a4c79f6 100644 --- a/generated/niscope/session.py +++ b/generated/niscope/session.py @@ -1638,7 +1638,7 @@ def _actual_meas_wfm_size(self, array_meas_function): raise TypeError('Parameter mode must be of type ' + str(enums._ArrayMeasurement)) vi_ctype = _visatype.ViSession(self._vi) # case S110 array_meas_function_ctype = _visatype.ViInt32(array_meas_function.value) # case S130 - meas_waveform_size_ctype = _visatype.ViInt32() # case S200 + meas_waveform_size_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niScope_ActualMeasWfmSize(vi_ctype, array_meas_function_ctype, None if meas_waveform_size_ctype is None else (ctypes.pointer(meas_waveform_size_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(meas_waveform_size_ctype.value) @@ -1666,7 +1666,7 @@ def _actual_num_wfms(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - num_wfms_ctype = _visatype.ViInt32() # case S200 + num_wfms_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niScope_ActualNumWfms(vi_ctype, channel_list_ctype, None if num_wfms_ctype is None else (ctypes.pointer(num_wfms_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(num_wfms_ctype.value) @@ -3163,7 +3163,7 @@ def _get_attribute_vi_boolean(self, attribute_id): vi_ctype = _visatype.ViSession(self._vi) # case S110 channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 - value_ctype = _visatype.ViBoolean() # case S200 + value_ctype = _visatype.ViBoolean() # case S220 error_code = self._library.niScope_GetAttributeViBoolean(vi_ctype, channel_list_ctype, attribute_id_ctype, None if value_ctype is None else (ctypes.pointer(value_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return bool(value_ctype.value) @@ -3200,7 +3200,7 @@ def _get_attribute_vi_int32(self, attribute_id): vi_ctype = _visatype.ViSession(self._vi) # case S110 channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 - value_ctype = _visatype.ViInt32() # case S200 + value_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niScope_GetAttributeViInt32(vi_ctype, channel_list_ctype, attribute_id_ctype, None if value_ctype is None else (ctypes.pointer(value_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(value_ctype.value) @@ -3237,7 +3237,7 @@ def _get_attribute_vi_int64(self, attribute_id): vi_ctype = _visatype.ViSession(self._vi) # case S110 channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 - value_ctype = _visatype.ViInt64() # case S200 + value_ctype = _visatype.ViInt64() # case S220 error_code = self._library.niScope_GetAttributeViInt64(vi_ctype, channel_list_ctype, attribute_id_ctype, None if value_ctype is None else (ctypes.pointer(value_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(value_ctype.value) @@ -3275,7 +3275,7 @@ def _get_attribute_vi_real64(self, attribute_id): vi_ctype = _visatype.ViSession(self._vi) # case S110 channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 - value_ctype = _visatype.ViReal64() # case S200 + value_ctype = _visatype.ViReal64() # case S220 error_code = self._library.niScope_GetAttributeViReal64(vi_ctype, channel_list_ctype, attribute_id_ctype, None if value_ctype is None else (ctypes.pointer(value_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(value_ctype.value) @@ -3361,7 +3361,7 @@ def _get_equalization_filter_coefficients(self, number_of_coefficients): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 channel_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - number_of_coefficients_ctype = _visatype.ViInt32(number_of_coefficients) # case S190 + number_of_coefficients_ctype = _visatype.ViInt32(number_of_coefficients) # case S210 coefficients_size = number_of_coefficients # case B600 coefficients_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViReal64, size=coefficients_size) # case B600 error_code = self._library.niScope_GetEqualizationFilterCoefficients(vi_ctype, channel_ctype, number_of_coefficients_ctype, coefficients_ctype) @@ -3397,7 +3397,7 @@ def _get_error(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - error_code_ctype = _visatype.ViStatus() # case S200 + error_code_ctype = _visatype.ViStatus() # case S220 buffer_size_ctype = _visatype.ViInt32() # case S170 description_ctype = None # case C050 error_code = self._library.niScope_GetError(vi_ctype, None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), buffer_size_ctype, description_ctype) @@ -4100,7 +4100,7 @@ def acquisition_status(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - acquisition_status_ctype = _visatype.ViInt32() # case S200 + acquisition_status_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niScope_AcquisitionStatus(vi_ctype, None if acquisition_status_ctype is None else (ctypes.pointer(acquisition_status_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return enums.AcquisitionStatus(acquisition_status_ctype.value) @@ -4994,7 +4994,7 @@ def _init_with_options(self, resource_name, id_query=False, reset_device=False, id_query_ctype = _visatype.ViBoolean(id_query) # case S150 reset_device_ctype = _visatype.ViBoolean(reset_device) # case S150 option_string_ctype = ctypes.create_string_buffer(option_string.encode(self._encoding)) # case C020 - vi_ctype = _visatype.ViSession() # case S200 + vi_ctype = _visatype.ViSession() # case S220 error_code = self._library.niScope_InitWithOptions(resource_name_ctype, id_query_ctype, reset_device_ctype, option_string_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) @@ -5171,7 +5171,7 @@ def _self_test(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - self_test_result_ctype = _visatype.ViInt16() # case S200 + self_test_result_ctype = _visatype.ViInt16() # case S220 self_test_message_ctype = (_visatype.ViChar * 256)() # case C070 error_code = self._library.niScope_self_test(vi_ctype, None if self_test_result_ctype is None else (ctypes.pointer(self_test_result_ctype)), self_test_message_ctype) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) diff --git a/generated/nise/session.py b/generated/nise/session.py index 30daf6a4b..ed6a41066 100644 --- a/generated/nise/session.py +++ b/generated/nise/session.py @@ -160,7 +160,7 @@ def _get_error(self, error_description_size=[1024]): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - error_number_ctype = _visatype.ViInt32() # case S200 + error_number_ctype = _visatype.ViInt32() # case S220 error_description_ctype = (_visatype.ViChar * error_description_size[0])() # case C080 error_description_size_ctype = get_ctypes_pointer_for_buffer(value=error_description_size, library_type=_visatype.ViInt32) # case B550 error_code = self._library.niSE_GetError(vi_ctype, None if error_number_ctype is None else (ctypes.pointer(error_number_ctype)), error_description_ctype, error_description_size_ctype) @@ -616,7 +616,7 @@ def find_route(self, channel1, channel2, route_spec_size=[1024]): channel2_ctype = ctypes.create_string_buffer(channel2.encode(self._encoding)) # case C020 route_spec_ctype = (_visatype.ViChar * route_spec_size[0])() # case C080 route_spec_size_ctype = get_ctypes_pointer_for_buffer(value=route_spec_size, library_type=_visatype.ViInt32) # case B550 - path_capability_ctype = _visatype.ViInt32() # case S200 + path_capability_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niSE_FindRoute(vi_ctype, channel1_ctype, channel2_ctype, route_spec_ctype, route_spec_size_ctype, None if path_capability_ctype is None else (ctypes.pointer(path_capability_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return route_spec_ctype.value.decode(self._encoding), enums.PathCapability(path_capability_ctype.value) @@ -692,7 +692,7 @@ def is_connected(self, route_spec): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 route_spec_ctype = ctypes.create_string_buffer(route_spec.encode(self._encoding)) # case C020 - is_connected_ctype = _visatype.ViBoolean() # case S200 + is_connected_ctype = _visatype.ViBoolean() # case S220 error_code = self._library.niSE_IsConnected(vi_ctype, route_spec_ctype, None if is_connected_ctype is None else (ctypes.pointer(is_connected_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return bool(is_connected_ctype.value) @@ -711,7 +711,7 @@ def is_debounced(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - is_debounced_ctype = _visatype.ViBoolean() # case S200 + is_debounced_ctype = _visatype.ViBoolean() # case S220 error_code = self._library.niSE_IsDebounced(vi_ctype, None if is_debounced_ctype is None else (ctypes.pointer(is_debounced_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return bool(is_debounced_ctype.value) @@ -749,7 +749,7 @@ def _open_session(self, virtual_device_name, option_string=""): ''' virtual_device_name_ctype = ctypes.create_string_buffer(virtual_device_name.encode(self._encoding)) # case C020 option_string_ctype = ctypes.create_string_buffer(option_string.encode(self._encoding)) # case C020 - vi_ctype = _visatype.ViSession() # case S200 + vi_ctype = _visatype.ViSession() # case S220 error_code = self._library.niSE_OpenSession(virtual_device_name_ctype, option_string_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) diff --git a/generated/niswitch/session.py b/generated/niswitch/session.py index 3aff1ebd2..d997db420 100644 --- a/generated/niswitch/session.py +++ b/generated/niswitch/session.py @@ -646,7 +646,7 @@ def _get_attribute_vi_boolean(self, attribute_id): 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 + attribute_value_ctype = _visatype.ViBoolean() # case S220 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) @@ -702,7 +702,7 @@ def _get_attribute_vi_int32(self, attribute_id): 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 + attribute_value_ctype = _visatype.ViInt32() # case S220 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) @@ -758,7 +758,7 @@ def _get_attribute_vi_real64(self, attribute_id): 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.ViReal64() # case S200 + attribute_value_ctype = _visatype.ViReal64() # case S220 error_code = self._library.niSwitch_GetAttributeViReal64(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 float(attribute_value_ctype.value) @@ -854,7 +854,7 @@ def _get_error(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - code_ctype = _visatype.ViStatus() # case S200 + code_ctype = _visatype.ViStatus() # case S220 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) @@ -1561,7 +1561,7 @@ def can_connect(self, channel1, channel2): vi_ctype = _visatype.ViSession(self._vi) # case S110 channel1_ctype = ctypes.create_string_buffer(channel1.encode(self._encoding)) # case C020 channel2_ctype = ctypes.create_string_buffer(channel2.encode(self._encoding)) # case C020 - path_capability_ctype = _visatype.ViInt32() # case S200 + path_capability_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niSwitch_CanConnect(vi_ctype, channel1_ctype, channel2_ctype, None if path_capability_ctype is None else (ctypes.pointer(path_capability_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return enums.PathCapability(path_capability_ctype.value) @@ -1831,7 +1831,7 @@ def get_relay_count(self, relay_name): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 relay_name_ctype = ctypes.create_string_buffer(relay_name.encode(self._encoding)) # case C020 - relay_count_ctype = _visatype.ViInt32() # case S200 + relay_count_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niSwitch_GetRelayCount(vi_ctype, relay_name_ctype, None if relay_count_ctype is None else (ctypes.pointer(relay_count_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(relay_count_ctype.value) @@ -1882,7 +1882,7 @@ def get_relay_position(self, relay_name): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 relay_name_ctype = ctypes.create_string_buffer(relay_name.encode(self._encoding)) # case C020 - relay_position_ctype = _visatype.ViInt32() # case S200 + relay_position_ctype = _visatype.ViInt32() # case S220 error_code = self._library.niSwitch_GetRelayPosition(vi_ctype, relay_name_ctype, None if relay_position_ctype is None else (ctypes.pointer(relay_position_ctype))) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return enums.RelayPosition(relay_position_ctype.value) @@ -2131,7 +2131,7 @@ def _init_with_topology(self, resource_name, topology="Configured Topology", sim 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 + vi_ctype = _visatype.ViSession() # case S220 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) @@ -2437,7 +2437,7 @@ def _self_test(self): ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - self_test_result_ctype = _visatype.ViInt16() # case S200 + self_test_result_ctype = _visatype.ViInt16() # case S220 self_test_message_ctype = (_visatype.ViChar * 256)() # case C070 error_code = self._library.niSwitch_self_test(vi_ctype, None if self_test_result_ctype is None else (ctypes.pointer(self_test_result_ctype)), self_test_message_ctype) errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) diff --git a/generated/nitclk/__init__.py b/generated/nitclk/__init__.py new file mode 100644 index 000000000..f640a6295 --- /dev/null +++ b/generated/nitclk/__init__.py @@ -0,0 +1,106 @@ +# -*- coding: utf-8 -*- +# This file was generated + + +__version__ = '0.1.0.dev0' + +from nitclk.errors import DriverWarning # noqa: F401 +from nitclk.errors import Error # noqa: F401 +from nitclk.session import SessionReference # noqa: F401 + +# Function imports +from nitclk.session import configure_for_homogeneous_triggers # noqa: F401 +from nitclk.session import finish_sync_pulse_sender_synchronize # noqa: F401 +from nitclk.session import init_for_documentation # noqa: F401 +from nitclk.session import initiate # noqa: F401 +from nitclk.session import is_done # noqa: F401 +from nitclk.session import setup_for_sync_pulse_sender_synchronize # noqa: F401 +from nitclk.session import synchronize # noqa: F401 +from nitclk.session import synchronize_to_sync_pulse_sender # noqa: F401 +from nitclk.session import wait_until_done # noqa: F401 + + +def get_diagnostic_information(): + '''Get diagnostic information about the system state that is suitable for printing or logging + + returns: dict + + note: Python bitness may be incorrect when running in a virtual environment + ''' + import os + import pkg_resources + import platform + import struct + import sys + + def is_python_64bit(): + return (struct.calcsize("P") == 8) + + def is_os_64bit(): + return platform.machine().endswith('64') + + def is_venv(): + return 'VIRTUAL_ENV' in os.environ + + info = {} + info['os'] = {} + info['python'] = {} + info['driver'] = {} + info['module'] = {} + if platform.system() == 'Windows': + try: + import winreg as winreg + except ImportError: + import _winreg as winreg + + os_name = 'Windows' + try: + driver_version_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\National Instruments\NI-TClk\CurrentVersion") + driver_version = winreg.QueryValueEx(driver_version_key, "Version")[0] + except WindowsError: + driver_version = 'Unknown' + elif platform.system() == 'Linux': + os_name = 'Linux' + driver_version = 'Unknown' + else: + raise SystemError('Unsupported platform: {}'.format(platform.system())) + + installed_packages = pkg_resources.working_set + installed_packages_list = [{'name': i.key, 'version': i.version, } for i in installed_packages] + + info['os']['name'] = os_name + info['os']['version'] = platform.version() + info['os']['bits'] = '64' if is_os_64bit() else '32' + info['driver']['name'] = "NI-TClk" + info['driver']['version'] = driver_version + info['module']['name'] = 'nitclk' + info['module']['version'] = "0.1.0.dev0" + info['python']['version'] = sys.version + info['python']['bits'] = '64' if is_python_64bit() else '32' + info['python']['is_venv'] = is_venv() + info['python']['packages'] = installed_packages_list + + return info + + +def print_diagnostic_information(): + '''Print diagnostic information in a format suitable for issue report + + note: Python bitness may be incorrect when running in a virtual environment + ''' + info = get_diagnostic_information() + + row_format = ' {:<10} {}' + for type in ['OS', 'Driver', 'Module', 'Python']: + typename = type.lower() + print(type + ':') + for item in info[typename]: + if item != 'packages': + print(row_format.format(item.title() + ':', info[typename][item])) + print(' Installed Packages:') + for p in info['python']['packages']: + print((' ' * 8) + p['name'] + '==' + p['version']) + + return info + + diff --git a/generated/nitclk/_attributes.py b/generated/nitclk/_attributes.py new file mode 100644 index 000000000..24c967dd7 --- /dev/null +++ b/generated/nitclk/_attributes.py @@ -0,0 +1,124 @@ +# -*- coding: utf-8 -*- +# This file was generated +import nitclk._converters as _converters + +import datetime + + +class Attribute(object): + '''Base class for all typed attributes.''' + + def __init__(self, attribute_id): + self._attribute_id = attribute_id + + +class AttributeViInt32(Attribute): + + def __get__(self, session, session_type): + return session._get_attribute_vi_int32(self._attribute_id) + + def __set__(self, session, value): + session._set_attribute_vi_int32(self._attribute_id, value) + + +class AttributeViInt32TimeDeltaSeconds(Attribute): + + def __get__(self, session, session_type): + return datetime.timedelta(seconds=session._get_attribute_vi_int32(self._attribute_id)) + + def __set__(self, session, value): + session._set_attribute_vi_int32(self._attribute_id, _converters.convert_timedelta_to_seconds(value, int)) + + +class AttributeViInt32TimeDeltaMilliseconds(Attribute): + + def __get__(self, session, session_type): + return datetime.timedelta(milliseconds=session._get_attribute_vi_int32(self._attribute_id)) + + def __set__(self, session, value): + session._set_attribute_vi_int32(self._attribute_id, _converters.convert_timedelta_to_milliseconds(value, int)) + + +class AttributeViInt64(Attribute): + + def __get__(self, session, session_type): + return session._get_attribute_vi_int64(self._attribute_id) + + def __set__(self, session, value): + session._set_attribute_vi_int64(self._attribute_id, value) + + +class AttributeViReal64(Attribute): + + def __get__(self, session, session_type): + return session._get_attribute_vi_real64(self._attribute_id) + + def __set__(self, session, value): + session._set_attribute_vi_real64(self._attribute_id, value) + + +class AttributeViReal64TimeDeltaSeconds(Attribute): + + def __get__(self, session, session_type): + return datetime.timedelta(seconds=session._get_attribute_vi_real64(self._attribute_id)) + + def __set__(self, session, value): + session._set_attribute_vi_real64(self._attribute_id, _converters.convert_timedelta_to_seconds(value, float)) + + +class AttributeViReal64TimeDeltaMilliseconds(Attribute): + + def __get__(self, session, session_type): + return datetime.timedelta(milliseconds=session._get_attribute_vi_real64(self._attribute_id)) + + def __set__(self, session, value): + session._set_attribute_vi_real64(self._attribute_id, _converters.convert_timedelta_to_milliseconds(value, float)) + + +class AttributeViString(Attribute): + + def __get__(self, session, session_type): + return session._get_attribute_vi_string(self._attribute_id) + + def __set__(self, session, value): + session._set_attribute_vi_string(self._attribute_id, value) + + +class AttributeViBoolean(Attribute): + + def __get__(self, session, session_type): + return session._get_attribute_vi_boolean(self._attribute_id) + + def __set__(self, session, value): + session._set_attribute_vi_boolean(self._attribute_id, value) + + +class AttributeEnum(object): + + def __init__(self, underlying_attribute_meta_class, enum_meta_class, attribute_id): + self._underlying_attribute = underlying_attribute_meta_class(attribute_id) + self._attribute_type = enum_meta_class + self._attribute_id = attribute_id + + def __get__(self, session, session_type): + return self._attribute_type(self._underlying_attribute.__get__(session, session_type)) + + def __set__(self, session, value): + if type(value) is not self._attribute_type: + raise TypeError('must be ' + str(self._attribute_type.__name__) + ' not ' + str(type(value).__name__)) + return self._underlying_attribute.__set__(session, value.value) + + +# nitclk specific attribute type +class AttributeViInt32SessionReference(Attribute): + + def __get__(self, session, session_type): + # Import here to avoid a circular dependency when initial import happens + from nitclk.session import SessionReference + return SessionReference(session._get_attribute_vi_int32(self._attribute_id)) + + def __set__(self, session, value): + session._set_attribute_vi_int32(self._attribute_id, _converters.convert_to_nitclk_session_num(value)) + + + diff --git a/generated/nitclk/_converters.py b/generated/nitclk/_converters.py new file mode 100644 index 000000000..69c09314a --- /dev/null +++ b/generated/nitclk/_converters.py @@ -0,0 +1,531 @@ +# -*- coding: utf-8 -*- +# This file was generated +import nitclk._visatype as _visatype +import nitclk.errors as errors + +import datetime +import numbers +import six + +try: + from functools import singledispatch # Python 3.4+ +except ImportError: + from singledispatch import singledispatch # Python 2.7 + + +@singledispatch +def _convert_repeated_capabilities(arg, prefix): # noqa: F811 + '''Base version that should not be called + + Overall purpose is to convert the repeated capabilities to a list of strings with prefix from what ever form + + Supported types: + - str - List (comma delimited) + - str - Range (using '-' or ':') + - str - single item + - int + - tuple + - range + - slice + + Each instance should return a list of strings, without prefix + - '0' --> ['0'] + - 0 --> ['0'] + - '0, 1' --> ['0', '1'] + - 'ScriptTrigger0, ScriptTrigger1' --> ['0', '1'] + - '0-1' --> ['0', '1'] + - '0:1' --> ['0', '1'] + - '0-1,4' --> ['0', '1', '4'] + - range(0, 2) --> ['0', '1'] + - slice(0, 2) --> ['0', '1'] + - (0, 1, 4) --> ['0', '1', '4'] + - ('0-1', 4) --> ['0', '1', '4'] + - (slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17') --> + ['0', '2', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '16', '17'] + ''' + raise errors.InvalidRepeatedCapabilityError('Invalid type', type(arg)) + + +@_convert_repeated_capabilities.register(numbers.Integral) # noqa: F811 +def _(repeated_capability, prefix): + '''Integer version''' + return [str(repeated_capability)] + + +# This parsing function duplicate the parsing in the driver, so if changes to the allowed format are made there, they will need to be replicated here. +@_convert_repeated_capabilities.register(six.text_type) # noqa: F811 +@_convert_repeated_capabilities.register(str) # noqa: F811 +def _(repeated_capability, prefix): + '''String version (this is the most complex) + + We need to deal with a range ('0-3' or '0:3'), a list ('0,1,2,3') and a single item + ''' + # First we deal with a list + rep_cap_list = repeated_capability.split(',') + if len(rep_cap_list) > 1: + # We have a list so call ourselves again to let the iterable instance handle it + return _convert_repeated_capabilities(rep_cap_list, prefix) + + # Now we deal with ranges + # We remove any prefix and change ':' to '-' + r = repeated_capability.strip().replace(prefix, '').replace(':', '-') + rc = r.split('-') + if len(rc) > 1: + if len(rc) > 2: + raise errors.InvalidRepeatedCapabilityError("Multiple '-' or ':'", repeated_capability) + start = int(rc[0]) + end = int(rc[1]) + if end < start: + rng = range(start, end - 1, -1) + else: + rng = range(start, end + 1) + return _convert_repeated_capabilities(rng, prefix) + + # If we made it here, it must be a simple item so we remove any prefix and return + return [repeated_capability.replace(prefix, '').strip()] + + +# We cannot use collections.abc.Iterable here because strings are also iterable and then this +# instance is what gets called instead of the string one. +@_convert_repeated_capabilities.register(list) # noqa: F811 +@_convert_repeated_capabilities.register(range) # noqa: F811 +@_convert_repeated_capabilities.register(tuple) # noqa: F811 +def _(repeated_capability, prefix): + '''Iterable version - can handle lists, ranges, and tuples''' + rep_cap_list = [] + for r in repeated_capability: + rep_cap_list += _convert_repeated_capabilities(r, prefix) + return rep_cap_list + + +@_convert_repeated_capabilities.register(slice) # noqa: F811 +def _(repeated_capability, prefix): + '''slice version''' + def ifnone(a, b): + return b if a is None else a + # Turn the slice into a list and call ourselves again to let the iterable instance handle it + rng = range(ifnone(repeated_capability.start, 0), repeated_capability.stop, ifnone(repeated_capability.step, 1)) + return _convert_repeated_capabilities(rng, prefix) + + +def convert_repeated_capabilities(repeated_capability, prefix=''): + '''Convert a repeated capabilities object to a comma delimited list + + Args: + repeated_capability (str, list, tuple, slice, None) - + prefix (str) - common prefix for all strings + + Returns: + rep_cal_list (list of str) - list of each repeated capability item with ranges expanded and prefix added + ''' + # We need to explicitly handle None here. Everything else we can pass on to the singledispatch functions + if repeated_capability is None: + return [] + return [prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix)] + + +def convert_repeated_capabilities_from_init(repeated_capability, encoding): + '''Convert a repeated capabilities object to a comma delimited list + + Parameter list is so it can be called from the code generated __init__(). We know it is for channels when called + this was so we use a prefix of '' + + Args: + repeated_capability (str, list, tuple, slice, None) - + encoding (str) - ignored for this converter + + Returns: + rep_cal (str) - comma delimited string of each repeated capability item with ranges expanded + ''' + return ','.join(convert_repeated_capabilities(repeated_capability, '')) + + +def _convert_timedelta(value, library_type, scaling): + try: + # We first assume it is a datetime.timedelta object + scaled_value = value.total_seconds() * scaling + except AttributeError: + # If that doesn't work, assume it is a value in seconds + # cast to float so scaled_value is always a float. This allows `timeout=10` to work as expected + scaled_value = float(value) * scaling + + # ctype integer types don't convert to int from float so we need to + if library_type in [_visatype.ViInt64, _visatype.ViInt32, _visatype.ViUInt32, _visatype.ViInt16, _visatype.ViUInt16, _visatype.ViInt8]: + scaled_value = int(scaled_value) + + return library_type(scaled_value) + + +def convert_timedelta_to_seconds(value, library_type): + return _convert_timedelta(value, library_type, 1) + + +def convert_timedelta_to_milliseconds(value, library_type): + return _convert_timedelta(value, library_type, 1000) + + +def convert_timedelta_to_microseconds(value, library_type): + return _convert_timedelta(value, library_type, 1000000) + + +def convert_month_to_timedelta(months): + return datetime.timedelta(days=(30.4167 * months)) + + +# This converter is not called from the normal codegen path for function. Instead it is +# call from init and is a special case. Also, it just returns a string rather than a ctype object +def convert_init_with_options_dictionary(values, encoding): + if type(values) is str: + init_with_options_string = values + else: + good_keys = { + 'rangecheck': 'RangeCheck', + 'queryinstrstatus': 'QueryInstrStatus', + 'cache': 'Cache', + 'simulate': 'Simulate', + 'recordcoercions': 'RecordCoercions', + 'interchangecheck': 'InterchangeCheck', + 'driversetup': 'DriverSetup', + 'range_check': 'RangeCheck', + 'query_instr_status': 'QueryInstrStatus', + 'record_coercions': 'RecordCoercions', + 'interchange_check': 'InterchangeCheck', + 'driver_setup': 'DriverSetup', + } + init_with_options = [] + for k in sorted(values.keys()): + value = None + if k.lower() in good_keys and not good_keys[k.lower()] == 'DriverSetup': + value = good_keys[k.lower()] + ('=1' if values[k] is True else '=0') + elif k.lower() in good_keys and good_keys[k.lower()] == 'DriverSetup': + if not isinstance(values[k], dict): + raise TypeError('DriverSetup must be a dictionary') + value = 'DriverSetup=' + (';'.join([key + ':' + values[k][key] for key in sorted(values[k])])) + else: + value = k + ('=1' if values[k] is True else '=0') + + init_with_options.append(value) + + init_with_options_string = ','.join(init_with_options) + + return init_with_options_string + + +# nitclk specific converters +def convert_to_nitclk_session_num(item): + '''Convert from supported objects to NI-TClk Session Num + + Supported objects are: + - class with .tclk object of type nitclk.SessionReference + - nitclk.SessionReference + - NI-TClk Session Num + ''' + try: + return item.tclk.get_session_number() + except KeyError: + pass + + try: + return item.get_session_number() + except KeyError: + pass + + # If we haven't gotten a SessionReference, we assume the item is the actual nitclk session num and return it + return item + + +def convert_to_nitclk_session_num_list(item_list): + '''Converts a list of items to nitclk session nums''' + return [convert_to_nitclk_session_num(i) for i in item_list] + + +# Let's run some tests +def test_convert_init_with_options_dictionary(): + assert convert_init_with_options_dictionary('', 'ascii') == '' + assert convert_init_with_options_dictionary('Simulate=1', 'ascii') == 'Simulate=1' + assert convert_init_with_options_dictionary({'Simulate': True, }, 'ascii') == 'Simulate=1' + assert convert_init_with_options_dictionary({'Simulate': False, }, 'ascii') == 'Simulate=0' + assert convert_init_with_options_dictionary({'Simulate': True, 'Cache': False}, 'ascii') == 'Cache=0,Simulate=1' + assert convert_init_with_options_dictionary({'DriverSetup': {'Model': '5162 (4CH)', 'Bitfile': 'CustomProcessing'}}, 'ascii') == 'DriverSetup=Bitfile:CustomProcessing;Model:5162 (4CH)' + assert convert_init_with_options_dictionary({'Simulate': True, 'DriverSetup': {'Model': '5162 (4CH)', 'Bitfile': 'CustomProcessing'}}, 'ascii') == 'DriverSetup=Bitfile:CustomProcessing;Model:5162 (4CH),Simulate=1' + assert convert_init_with_options_dictionary({'simulate': True, 'cache': False}, 'ascii') == 'Cache=0,Simulate=1' + assert convert_init_with_options_dictionary({'driver_setup': {'Model': '5162 (4CH)', 'Bitfile': 'CustomProcessing'}}, 'ascii') == 'DriverSetup=Bitfile:CustomProcessing;Model:5162 (4CH)' + assert convert_init_with_options_dictionary({'simulate': True, 'driver_setup': {'Model': '5162 (4CH)', 'Bitfile': 'CustomProcessing'}}, 'ascii') == 'DriverSetup=Bitfile:CustomProcessing;Model:5162 (4CH),Simulate=1' + + +# Tests - time +def test_convert_timedelta_to_seconds_double(): + test_result = convert_timedelta_to_seconds(datetime.timedelta(seconds=10), _visatype.ViReal64) + assert test_result.value == 10.0 + assert isinstance(test_result, _visatype.ViReal64) + test_result = convert_timedelta_to_seconds(datetime.timedelta(seconds=-1), _visatype.ViReal64) + assert test_result.value == -1 + assert isinstance(test_result, _visatype.ViReal64) + test_result = convert_timedelta_to_seconds(10.5, _visatype.ViReal64) + assert test_result.value == 10.5 + assert isinstance(test_result, _visatype.ViReal64) + test_result = convert_timedelta_to_seconds(-1, _visatype.ViReal64) + assert test_result.value == -1 + assert isinstance(test_result, _visatype.ViReal64) + + +def test_convert_timedelta_to_seconds_int(): + test_result = convert_timedelta_to_seconds(datetime.timedelta(seconds=10), _visatype.ViInt32) + assert test_result.value == 10 + assert isinstance(test_result, _visatype.ViInt32) + test_result = convert_timedelta_to_seconds(datetime.timedelta(seconds=-1), _visatype.ViInt32) + assert test_result.value == -1 + assert isinstance(test_result, _visatype.ViInt32) + test_result = convert_timedelta_to_seconds(10.5, _visatype.ViInt32) + assert test_result.value == 10 + assert isinstance(test_result, _visatype.ViInt32) + test_result = convert_timedelta_to_seconds(-1, _visatype.ViInt32) + assert test_result.value == -1 + assert isinstance(test_result, _visatype.ViInt32) + + +def test_convert_timedelta_to_milliseconds_double(): + test_result = convert_timedelta_to_milliseconds(datetime.timedelta(seconds=10), _visatype.ViReal64) + assert test_result.value == 10000.0 + assert isinstance(test_result, _visatype.ViReal64) + test_result = convert_timedelta_to_milliseconds(datetime.timedelta(seconds=-1), _visatype.ViReal64) + assert test_result.value == -1000.0 + assert isinstance(test_result, _visatype.ViReal64) + test_result = convert_timedelta_to_milliseconds(10.5, _visatype.ViReal64) + assert test_result.value == 10500.0 + assert isinstance(test_result, _visatype.ViReal64) + test_result = convert_timedelta_to_milliseconds(-1, _visatype.ViReal64) + assert test_result.value == -1000.0 + assert isinstance(test_result, _visatype.ViReal64) + + +def test_convert_timedelta_to_milliseconds_int(): + test_result = convert_timedelta_to_milliseconds(datetime.timedelta(seconds=10), _visatype.ViInt32) + assert test_result.value == 10000 + assert isinstance(test_result, _visatype.ViInt32) + test_result = convert_timedelta_to_milliseconds(datetime.timedelta(seconds=-1), _visatype.ViInt32) + assert test_result.value == -1000 + assert isinstance(test_result, _visatype.ViInt32) + test_result = convert_timedelta_to_milliseconds(10.5, _visatype.ViInt32) + assert test_result.value == 10500 + assert isinstance(test_result, _visatype.ViInt32) + test_result = convert_timedelta_to_milliseconds(-1, _visatype.ViInt32) + assert test_result.value == -1000 + assert isinstance(test_result, _visatype.ViInt32) + + +def test_convert_timedelta_to_microseconds_double(): + test_result = convert_timedelta_to_microseconds(datetime.timedelta(seconds=10), _visatype.ViReal64) + assert test_result.value == 10000000.0 + assert isinstance(test_result, _visatype.ViReal64) + test_result = convert_timedelta_to_microseconds(datetime.timedelta(seconds=-1), _visatype.ViReal64) + assert test_result.value == -1000000.0 + assert isinstance(test_result, _visatype.ViReal64) + test_result = convert_timedelta_to_microseconds(10.5, _visatype.ViReal64) + assert test_result.value == 10500000.0 + assert isinstance(test_result, _visatype.ViReal64) + test_result = convert_timedelta_to_microseconds(-1, _visatype.ViReal64) + assert test_result.value == -1000000.0 + assert isinstance(test_result, _visatype.ViReal64) + + +def test_convert_timedelta_to_microseconds_int(): + test_result = convert_timedelta_to_microseconds(datetime.timedelta(seconds=10), _visatype.ViInt32) + assert test_result.value == 10000000 + assert isinstance(test_result, _visatype.ViInt32) + test_result = convert_timedelta_to_microseconds(datetime.timedelta(seconds=-1), _visatype.ViInt32) + assert test_result.value == -1000000 + assert isinstance(test_result, _visatype.ViInt32) + test_result = convert_timedelta_to_microseconds(10.5, _visatype.ViInt32) + assert test_result.value == 10500000 + assert isinstance(test_result, _visatype.ViInt32) + test_result = convert_timedelta_to_microseconds(-1, _visatype.ViInt32) + assert test_result.value == -1000000 + assert isinstance(test_result, _visatype.ViInt32) + + +# Tests - repeated capabilities +def test_repeated_capabilies_string_channel(): + test_result_list = convert_repeated_capabilities('0') + assert test_result_list == ['0'] + test_result_list = convert_repeated_capabilities('r0') + assert test_result_list == ['r0'] + test_result_list = convert_repeated_capabilities('0,1') + assert test_result_list == ['0', '1'] + + +def test_repeated_capabilies_string_prefix(): + test_result_list = convert_repeated_capabilities('0', prefix='ScriptTrigger') + assert test_result_list == ['ScriptTrigger0'] + + +def test_repeated_capabilies_list_channel(): + test_result_list = convert_repeated_capabilities(['0']) + assert test_result_list == ['0'] + test_result_list = convert_repeated_capabilities(['r0']) + assert test_result_list == ['r0'] + test_result_list = convert_repeated_capabilities(['0', '1']) + assert test_result_list == ['0', '1'] + test_result_list = convert_repeated_capabilities([0, 1]) + assert test_result_list == ['0', '1'] + test_result_list = convert_repeated_capabilities([0, 1, '3']) + assert test_result_list == ['0', '1', '3'] + + +def test_repeated_capabilies_list_prefix(): + test_result_list = convert_repeated_capabilities(['ScriptTrigger0', 'ScriptTrigger1'], prefix='ScriptTrigger') + assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] + test_result_list = convert_repeated_capabilities(['0'], prefix='ScriptTrigger') + assert test_result_list == ['ScriptTrigger0'] + test_result_list = convert_repeated_capabilities(['0', '1'], prefix='ScriptTrigger') + assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] + test_result_list = convert_repeated_capabilities([0, 1], prefix='ScriptTrigger') + assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] + + +def test_repeated_capabilies_tuple_channel(): + test_result_list = convert_repeated_capabilities(('0')) + assert test_result_list == ['0'] + test_result_list = convert_repeated_capabilities(('0,1')) + assert test_result_list == ['0', '1'] + test_result_list = convert_repeated_capabilities(('0', '1')) + assert test_result_list == ['0', '1'] + test_result_list = convert_repeated_capabilities((0, 1)) + assert test_result_list == ['0', '1'] + test_result_list = convert_repeated_capabilities((0, 1, '3')) + assert test_result_list == ['0', '1', '3'] + + +def test_repeated_capabilies_tuple_prefix(): + test_result_list = convert_repeated_capabilities(('ScriptTrigger0,ScriptTrigger1'), prefix='ScriptTrigger') + assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] + test_result_list = convert_repeated_capabilities(('0'), prefix='ScriptTrigger') + assert test_result_list == ['ScriptTrigger0'] + test_result_list = convert_repeated_capabilities(('0', '1'), prefix='ScriptTrigger') + assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] + test_result_list = convert_repeated_capabilities((0, 1), prefix='ScriptTrigger') + assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] + + +def test_repeated_capabilies_unicode(): + test_result_list = convert_repeated_capabilities(u'ScriptTrigger0,ScriptTrigger1', prefix='ScriptTrigger') + assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] + test_result_list = convert_repeated_capabilities(u'ScriptTrigger0,ScriptTrigger1', prefix=u'ScriptTrigger') + assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] + test_result_list = convert_repeated_capabilities('ScriptTrigger0,ScriptTrigger1', prefix=u'ScriptTrigger') + assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] + + +def test_repeated_capabilies_raw(): + test_result_list = convert_repeated_capabilities(r'ScriptTrigger0,ScriptTrigger1', prefix='ScriptTrigger') + assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] + test_result_list = convert_repeated_capabilities(r'ScriptTrigger0,ScriptTrigger1', prefix=r'ScriptTrigger') + assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] + test_result_list = convert_repeated_capabilities('ScriptTrigger0,ScriptTrigger1', prefix=r'ScriptTrigger') + assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] + test_result_list = convert_repeated_capabilities(r'ScriptTrigger0,ScriptTrigger1', prefix=u'ScriptTrigger') + assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] + test_result_list = convert_repeated_capabilities(r'ScriptTrigger0,ScriptTrigger1', prefix=r'ScriptTrigger') + assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] + test_result_list = convert_repeated_capabilities(u'ScriptTrigger0,ScriptTrigger1', prefix=r'ScriptTrigger') + assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] + + +def test_repeated_capabilies_slice_channel(): + test_result_list = convert_repeated_capabilities(slice(0, 1)) + assert test_result_list == ['0'] + test_result_list = convert_repeated_capabilities(slice(0, 2)) + assert test_result_list == ['0', '1'] + test_result_list = convert_repeated_capabilities(slice(None, 2)) + assert test_result_list == ['0', '1'] + + +def test_repeated_capabilies_mixed_channel(): + test_result_list = convert_repeated_capabilities((slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17')) + assert test_result_list == ['0', '2', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '16', '17'] + test_result_list = convert_repeated_capabilities([slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17']) + assert test_result_list == ['0', '2', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '16', '17'] + + +def test_repeated_capabilies_mixed_prefix(): + test_result_list = convert_repeated_capabilities((slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17'), prefix='ScriptTrigger') + assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger2', 'ScriptTrigger4', 'ScriptTrigger5', 'ScriptTrigger6', 'ScriptTrigger7', 'ScriptTrigger8', 'ScriptTrigger9', 'ScriptTrigger11', 'ScriptTrigger12', 'ScriptTrigger13', 'ScriptTrigger14', 'ScriptTrigger16', 'ScriptTrigger17'] + test_result_list = convert_repeated_capabilities([slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17'], prefix='ScriptTrigger') + assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger2', 'ScriptTrigger4', 'ScriptTrigger5', 'ScriptTrigger6', 'ScriptTrigger7', 'ScriptTrigger8', 'ScriptTrigger9', 'ScriptTrigger11', 'ScriptTrigger12', 'ScriptTrigger13', 'ScriptTrigger14', 'ScriptTrigger16', 'ScriptTrigger17'] + + +def test_invalid_repeated_capabilies(): + try: + convert_repeated_capabilities('6-8-10') + assert False + except errors.InvalidRepeatedCapabilityError: + pass + try: + convert_repeated_capabilities(['5', '6-8-10']) + assert False + except errors.InvalidRepeatedCapabilityError: + pass + try: + convert_repeated_capabilities(('5', '6-8-10')) + assert False + except errors.InvalidRepeatedCapabilityError: + pass + try: + convert_repeated_capabilities('5,6-8-10') + assert False + except errors.InvalidRepeatedCapabilityError: + pass + try: + convert_repeated_capabilities(5.0) + assert False + except errors.InvalidRepeatedCapabilityError: + pass + try: + convert_repeated_capabilities([5.0, '0']) + assert False + except errors.InvalidRepeatedCapabilityError: + pass + try: + convert_repeated_capabilities((5.0, '0')) + assert False + except errors.InvalidRepeatedCapabilityError: + pass + + +def test_repeated_capabilies_slice_prefix(): + test_result_list = convert_repeated_capabilities(slice(0, 1), prefix='ScriptTrigger') + assert test_result_list == ['ScriptTrigger0'] + test_result_list = convert_repeated_capabilities(slice(0, 2), prefix='ScriptTrigger') + assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] + test_result_list = convert_repeated_capabilities(slice(None, 2), prefix='ScriptTrigger') + assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] + + +def test_repeated_capabilies_from_init(): + test_result = convert_repeated_capabilities_from_init((slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17'), '') + assert test_result == '0,2,4,5,6,7,8,9,11,12,13,14,16,17' + + +def test_string_to_list_channel(): + test_result = _convert_repeated_capabilities('r0', '') + assert test_result == ['r0'] + test_result = _convert_repeated_capabilities(['0-2'], '') + assert test_result == ['0', '1', '2'] + test_result = _convert_repeated_capabilities(['3:7'], '') + assert test_result == ['3', '4', '5', '6', '7'] + test_result = _convert_repeated_capabilities(['2-0'], '') + assert test_result == ['2', '1', '0'] + test_result = _convert_repeated_capabilities(['2:0'], '') + assert test_result == ['2', '1', '0'] + + +def test_string_to_list_prefix(): + test_result = _convert_repeated_capabilities(['ScriptTrigger3-ScriptTrigger7'], 'ScriptTrigger') + assert test_result == ['3', '4', '5', '6', '7'] + test_result = _convert_repeated_capabilities(['ScriptTrigger3:ScriptTrigger7'], 'ScriptTrigger') + assert test_result == ['3', '4', '5', '6', '7'] + test_result = _convert_repeated_capabilities(['ScriptTrigger2-ScriptTrigger0'], 'ScriptTrigger') + assert test_result == ['2', '1', '0'] + test_result = _convert_repeated_capabilities(['ScriptTrigger2:ScriptTrigger0'], 'ScriptTrigger') + assert test_result == ['2', '1', '0'] + diff --git a/generated/nitclk/_library.py b/generated/nitclk/_library.py new file mode 100644 index 000000000..de9d04070 --- /dev/null +++ b/generated/nitclk/_library.py @@ -0,0 +1,173 @@ +# -*- coding: utf-8 -*- +# This file was generated + +import ctypes +import threading + +from nitclk._visatype import * # noqa: F403,H303 + + +class Library(object): + '''Library + + Wrapper around driver library. + Class will setup the correct ctypes information for every function on first call. + ''' + + def __init__(self, ctypes_library): + self._func_lock = threading.Lock() + self._library = ctypes_library + # We cache the cfunc object from the ctypes.CDLL object + self.niTClk_ConfigureForHomogeneousTriggers_cfunc = None + self.niTClk_FinishSyncPulseSenderSynchronize_cfunc = None + self.niTClk_GetAttributeViBoolean_cfunc = None + self.niTClk_GetAttributeViReal64_cfunc = None + self.niTClk_GetAttributeViSession_cfunc = None + self.niTClk_GetAttributeViString_cfunc = None + self.niTClk_GetExtendedErrorInfo_cfunc = None + self.niTClk_Initiate_cfunc = None + self.niTClk_IsDone_cfunc = None + self.niTClk_SetAttributeViBoolean_cfunc = None + self.niTClk_SetAttributeViReal64_cfunc = None + self.niTClk_SetAttributeViSession_cfunc = None + self.niTClk_SetAttributeViString_cfunc = None + self.niTClk_SetupForSyncPulseSenderSynchronize_cfunc = None + self.niTClk_Synchronize_cfunc = None + self.niTClk_SynchronizeToSyncPulseSender_cfunc = None + self.niTClk_WaitUntilDone_cfunc = None + + def niTClk_ConfigureForHomogeneousTriggers(self, session_count, sessions): # noqa: N802 + with self._func_lock: + if self.niTClk_ConfigureForHomogeneousTriggers_cfunc is None: + self.niTClk_ConfigureForHomogeneousTriggers_cfunc = self._library.niTClk_ConfigureForHomogeneousTriggers + self.niTClk_ConfigureForHomogeneousTriggers_cfunc.argtypes = [ViUInt32, ctypes.POINTER(ViSession)] # noqa: F405 + self.niTClk_ConfigureForHomogeneousTriggers_cfunc.restype = ViStatus # noqa: F405 + return self.niTClk_ConfigureForHomogeneousTriggers_cfunc(session_count, sessions) + + def niTClk_FinishSyncPulseSenderSynchronize(self, session_count, sessions, min_time): # noqa: N802 + with self._func_lock: + if self.niTClk_FinishSyncPulseSenderSynchronize_cfunc is None: + self.niTClk_FinishSyncPulseSenderSynchronize_cfunc = self._library.niTClk_FinishSyncPulseSenderSynchronize + self.niTClk_FinishSyncPulseSenderSynchronize_cfunc.argtypes = [ViUInt32, ctypes.POINTER(ViSession), ViReal64] # noqa: F405 + self.niTClk_FinishSyncPulseSenderSynchronize_cfunc.restype = ViStatus # noqa: F405 + return self.niTClk_FinishSyncPulseSenderSynchronize_cfunc(session_count, sessions, min_time) + + def niTClk_GetAttributeViBoolean(self, session, channel_name, attribute_id, value): # noqa: N802 + with self._func_lock: + if self.niTClk_GetAttributeViBoolean_cfunc is None: + self.niTClk_GetAttributeViBoolean_cfunc = self._library.niTClk_GetAttributeViBoolean + self.niTClk_GetAttributeViBoolean_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViBoolean)] # noqa: F405 + self.niTClk_GetAttributeViBoolean_cfunc.restype = ViStatus # noqa: F405 + return self.niTClk_GetAttributeViBoolean_cfunc(session, channel_name, attribute_id, value) + + def niTClk_GetAttributeViReal64(self, session, channel_name, attribute_id, value): # noqa: N802 + with self._func_lock: + if self.niTClk_GetAttributeViReal64_cfunc is None: + self.niTClk_GetAttributeViReal64_cfunc = self._library.niTClk_GetAttributeViReal64 + self.niTClk_GetAttributeViReal64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViReal64)] # noqa: F405 + self.niTClk_GetAttributeViReal64_cfunc.restype = ViStatus # noqa: F405 + return self.niTClk_GetAttributeViReal64_cfunc(session, channel_name, attribute_id, value) + + def niTClk_GetAttributeViSession(self, session, channel_name, attribute_id, value): # noqa: N802 + with self._func_lock: + if self.niTClk_GetAttributeViSession_cfunc is None: + self.niTClk_GetAttributeViSession_cfunc = self._library.niTClk_GetAttributeViSession + self.niTClk_GetAttributeViSession_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViSession)] # noqa: F405 + self.niTClk_GetAttributeViSession_cfunc.restype = ViStatus # noqa: F405 + return self.niTClk_GetAttributeViSession_cfunc(session, channel_name, attribute_id, value) + + def niTClk_GetAttributeViString(self, session, channel_name, attribute_id, buf_size, value): # noqa: N802 + with self._func_lock: + if self.niTClk_GetAttributeViString_cfunc is None: + self.niTClk_GetAttributeViString_cfunc = self._library.niTClk_GetAttributeViString + self.niTClk_GetAttributeViString_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 + self.niTClk_GetAttributeViString_cfunc.restype = ViStatus # noqa: F405 + return self.niTClk_GetAttributeViString_cfunc(session, channel_name, attribute_id, buf_size, value) + + def niTClk_GetExtendedErrorInfo(self, error_string, error_string_size): # noqa: N802 + with self._func_lock: + if self.niTClk_GetExtendedErrorInfo_cfunc is None: + self.niTClk_GetExtendedErrorInfo_cfunc = self._library.niTClk_GetExtendedErrorInfo + self.niTClk_GetExtendedErrorInfo_cfunc.argtypes = [ctypes.POINTER(ViChar), ViUInt32] # noqa: F405 + self.niTClk_GetExtendedErrorInfo_cfunc.restype = ViStatus # noqa: F405 + return self.niTClk_GetExtendedErrorInfo_cfunc(error_string, error_string_size) + + def niTClk_Initiate(self, session_count, sessions): # noqa: N802 + with self._func_lock: + if self.niTClk_Initiate_cfunc is None: + self.niTClk_Initiate_cfunc = self._library.niTClk_Initiate + self.niTClk_Initiate_cfunc.argtypes = [ViUInt32, ctypes.POINTER(ViSession)] # noqa: F405 + self.niTClk_Initiate_cfunc.restype = ViStatus # noqa: F405 + return self.niTClk_Initiate_cfunc(session_count, sessions) + + def niTClk_IsDone(self, session_count, sessions, done): # noqa: N802 + with self._func_lock: + if self.niTClk_IsDone_cfunc is None: + self.niTClk_IsDone_cfunc = self._library.niTClk_IsDone + self.niTClk_IsDone_cfunc.argtypes = [ViUInt32, ctypes.POINTER(ViSession), ctypes.POINTER(ViBoolean)] # noqa: F405 + self.niTClk_IsDone_cfunc.restype = ViStatus # noqa: F405 + return self.niTClk_IsDone_cfunc(session_count, sessions, done) + + def niTClk_SetAttributeViBoolean(self, session, channel_name, attribute_id, value): # noqa: N802 + with self._func_lock: + if self.niTClk_SetAttributeViBoolean_cfunc is None: + self.niTClk_SetAttributeViBoolean_cfunc = self._library.niTClk_SetAttributeViBoolean + self.niTClk_SetAttributeViBoolean_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViBoolean] # noqa: F405 + self.niTClk_SetAttributeViBoolean_cfunc.restype = ViStatus # noqa: F405 + return self.niTClk_SetAttributeViBoolean_cfunc(session, channel_name, attribute_id, value) + + def niTClk_SetAttributeViReal64(self, session, channel_name, attribute_id, value): # noqa: N802 + with self._func_lock: + if self.niTClk_SetAttributeViReal64_cfunc is None: + self.niTClk_SetAttributeViReal64_cfunc = self._library.niTClk_SetAttributeViReal64 + self.niTClk_SetAttributeViReal64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViReal64] # noqa: F405 + self.niTClk_SetAttributeViReal64_cfunc.restype = ViStatus # noqa: F405 + return self.niTClk_SetAttributeViReal64_cfunc(session, channel_name, attribute_id, value) + + def niTClk_SetAttributeViSession(self, session, channel_name, attribute_id, value): # noqa: N802 + with self._func_lock: + if self.niTClk_SetAttributeViSession_cfunc is None: + self.niTClk_SetAttributeViSession_cfunc = self._library.niTClk_SetAttributeViSession + self.niTClk_SetAttributeViSession_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViSession] # noqa: F405 + self.niTClk_SetAttributeViSession_cfunc.restype = ViStatus # noqa: F405 + return self.niTClk_SetAttributeViSession_cfunc(session, channel_name, attribute_id, value) + + def niTClk_SetAttributeViString(self, session, channel_name, attribute_id, value): # noqa: N802 + with self._func_lock: + if self.niTClk_SetAttributeViString_cfunc is None: + self.niTClk_SetAttributeViString_cfunc = self._library.niTClk_SetAttributeViString + self.niTClk_SetAttributeViString_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViChar)] # noqa: F405 + self.niTClk_SetAttributeViString_cfunc.restype = ViStatus # noqa: F405 + return self.niTClk_SetAttributeViString_cfunc(session, channel_name, attribute_id, value) + + def niTClk_SetupForSyncPulseSenderSynchronize(self, session_count, sessions, min_time): # noqa: N802 + with self._func_lock: + if self.niTClk_SetupForSyncPulseSenderSynchronize_cfunc is None: + self.niTClk_SetupForSyncPulseSenderSynchronize_cfunc = self._library.niTClk_SetupForSyncPulseSenderSynchronize + self.niTClk_SetupForSyncPulseSenderSynchronize_cfunc.argtypes = [ViUInt32, ctypes.POINTER(ViSession), ViReal64] # noqa: F405 + self.niTClk_SetupForSyncPulseSenderSynchronize_cfunc.restype = ViStatus # noqa: F405 + return self.niTClk_SetupForSyncPulseSenderSynchronize_cfunc(session_count, sessions, min_time) + + def niTClk_Synchronize(self, session_count, sessions, min_tclk_period): # noqa: N802 + with self._func_lock: + if self.niTClk_Synchronize_cfunc is None: + self.niTClk_Synchronize_cfunc = self._library.niTClk_Synchronize + self.niTClk_Synchronize_cfunc.argtypes = [ViUInt32, ctypes.POINTER(ViSession), ViReal64] # noqa: F405 + self.niTClk_Synchronize_cfunc.restype = ViStatus # noqa: F405 + return self.niTClk_Synchronize_cfunc(session_count, sessions, min_tclk_period) + + def niTClk_SynchronizeToSyncPulseSender(self, session_count, sessions, min_time): # noqa: N802 + with self._func_lock: + if self.niTClk_SynchronizeToSyncPulseSender_cfunc is None: + self.niTClk_SynchronizeToSyncPulseSender_cfunc = self._library.niTClk_SynchronizeToSyncPulseSender + self.niTClk_SynchronizeToSyncPulseSender_cfunc.argtypes = [ViUInt32, ctypes.POINTER(ViSession), ViReal64] # noqa: F405 + self.niTClk_SynchronizeToSyncPulseSender_cfunc.restype = ViStatus # noqa: F405 + return self.niTClk_SynchronizeToSyncPulseSender_cfunc(session_count, sessions, min_time) + + def niTClk_WaitUntilDone(self, session_count, sessions, timeout): # noqa: N802 + with self._func_lock: + if self.niTClk_WaitUntilDone_cfunc is None: + self.niTClk_WaitUntilDone_cfunc = self._library.niTClk_WaitUntilDone + self.niTClk_WaitUntilDone_cfunc.argtypes = [ViUInt32, ctypes.POINTER(ViSession), ViReal64] # noqa: F405 + self.niTClk_WaitUntilDone_cfunc.restype = ViStatus # noqa: F405 + return self.niTClk_WaitUntilDone_cfunc(session_count, sessions, timeout) diff --git a/generated/nitclk/_library_singleton.py b/generated/nitclk/_library_singleton.py new file mode 100644 index 000000000..f8c685dca --- /dev/null +++ b/generated/nitclk/_library_singleton.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# This file was generated + +import platform + +import ctypes +import nitclk._library as _library +import nitclk.errors as errors +import threading + + +_instance = None +_instance_lock = threading.Lock() +_library_info = {'Linux': {'64bit': {'name': 'libnitclk.so', 'type': 'cdll'}}, + 'Windows': {'32bit': {'name': 'nitclk.dll', 'type': 'windll'}, + '64bit': {'name': 'nitclk_64.dll', 'type': 'cdll'}}} + + +def _get_library_name(): + try: + return _library_info[platform.system()][platform.architecture()[0]]['name'] + except KeyError: + raise errors.UnsupportedConfigurationError + + +def _get_library_type(): + try: + return _library_info[platform.system()][platform.architecture()[0]]['type'] + except KeyError: + raise errors.UnsupportedConfigurationError + + +def get(): + '''get + + Returns the library.Library singleton for nitclk. + ''' + global _instance + global _instance_lock + + with _instance_lock: + if _instance is None: + try: + library_type = _get_library_type() + if library_type == 'windll': + ctypes_library = ctypes.WinDLL(_get_library_name()) + else: + assert library_type == 'cdll' + ctypes_library = ctypes.CDLL(_get_library_name()) + except OSError: + raise errors.DriverNotInstalledError() + _instance = _library.Library(ctypes_library) + return _instance + diff --git a/generated/nitclk/_visatype.py b/generated/nitclk/_visatype.py new file mode 100644 index 000000000..fc07e5728 --- /dev/null +++ b/generated/nitclk/_visatype.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +import ctypes + + +'''Definitions of the VISA types used by the C API of the driver runtime. +These are aliased directly to ctypes types so can be used directly to call into the library. +''' + + +ViChar = ctypes.c_char +ViInt8 = ctypes.c_int8 +ViInt16 = ctypes.c_int16 +ViUInt16 = ctypes.c_uint16 +ViInt32 = ctypes.c_int32 +ViUInt32 = ctypes.c_uint32 +ViInt64 = ctypes.c_int64 +ViString = ctypes.c_char_p +ViReal32 = ctypes.c_float +ViReal64 = ctypes.c_double + +# Types that are based on other visatypes +ViBoolean = ViUInt16 +ViStatus = ViInt32 +ViSession = ViUInt32 +ViAttr = ViUInt32 +ViConstString = ViString +ViRsrc = ViString + diff --git a/generated/nitclk/errors.py b/generated/nitclk/errors.py new file mode 100644 index 000000000..5fe1108f7 --- /dev/null +++ b/generated/nitclk/errors.py @@ -0,0 +1,100 @@ +# -*- coding: utf-8 -*- +# This file was generated + + +import platform +import warnings + + +def _is_success(code): + return (code == 0) + + +def _is_error(code): + return (code < 0) + + +def _is_warning(code): + return (code > 0) + + +class Error(Exception): + '''Base error class for NI-TClk''' + + def __init__(self, message): + super(Error, self).__init__(message) + + +class DriverError(Error): + '''An error originating from the NI-TClk driver''' + + def __init__(self, code, description): + assert (_is_error(code)), "Should not raise Error if code is not fatal." + self.code = code + self.description = description + super(DriverError, self).__init__(str(self.code) + ": " + self.description) + + +class DriverWarning(Warning): + '''A warning originating from the NI-TClk driver''' + + def __init__(self, code, description): + assert (_is_warning(code)), "Should not create Warning if code is not positive." + super(DriverWarning, self).__init__('Warning {0} occurred.\n\n{1}'.format(code, description)) + + +class UnsupportedConfigurationError(Error): + '''An error due to using this module in an usupported platform.''' + + def __init__(self): + super(UnsupportedConfigurationError, self).__init__('System configuration is unsupported: ' + platform.architecture()[0] + ' ' + platform.system()) + + +class DriverNotInstalledError(Error): + '''An error due to using this module without the driver runtime installed.''' + + def __init__(self): + super(DriverNotInstalledError, self).__init__('The NI-TClk runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it.') + + +class InvalidRepeatedCapabilityError(Error): + '''An error due to an invalid character in a repeated capability''' + + def __init__(self, invalid_character, invalid_string): + super(InvalidRepeatedCapabilityError, self).__init__('An invalid character ({0}) was found in repeated capability string ({1})'.format(invalid_character, invalid_string)) + + +class SelfTestError(Error): + '''An error due to a failed self-test''' + + def __init__(self, code, msg): + self.code = code + self.message = msg + super(SelfTestError, self).__init__('Self-test failed with code {0}: {1}'.format(code, msg)) + + +def handle_error(session, code, ignore_warnings, is_error_handling): + '''handle_error + + Helper function for handling errors returned by nitclk.Library. + It calls back into the session to get the corresponding error description + and raises if necessary. + ''' + + if _is_success(code) or (_is_warning(code) and ignore_warnings): + return + + if is_error_handling: + # The caller is in the midst of error handling and an error occurred. + # Don't try to get the description or we'll start recursing until the stack overflows. + description = '' + else: + description = session._get_error_description(code) + + if _is_error(code): + raise DriverError(code, description) + + assert _is_warning(code) + warnings.warn(DriverWarning(code, description)) + + diff --git a/generated/nitclk/session.py b/generated/nitclk/session.py new file mode 100644 index 000000000..709771d4c --- /dev/null +++ b/generated/nitclk/session.py @@ -0,0 +1,1142 @@ +# This file was generated + +import array +import ctypes +import datetime +import threading + +import nitclk._attributes as _attributes +import nitclk._converters as _converters +import nitclk._library_singleton as _library_singleton +import nitclk._visatype as _visatype +import nitclk.errors as errors + +# Used for __repr__ and __str__ +import pprint +pp = pprint.PrettyPrinter(indent=4) + +_session_instance = None +_session_instance_lock = threading.Lock() + + +# Helper functions for creating ctypes needed for calling into the driver DLL +def get_ctypes_pointer_for_buffer(value=None, library_type=None, size=None): + if isinstance(value, array.array): + assert library_type is not None, 'library_type is required for array.array' + addr, _ = value.buffer_info() + return ctypes.cast(addr, ctypes.POINTER(library_type)) + elif str(type(value)).find("'numpy.ndarray'") != -1: + import numpy + return numpy.ctypeslib.as_ctypes(value) + elif isinstance(value, list): + assert library_type is not None, 'library_type is required for list' + return (library_type * len(value))(*value) + else: + if library_type is not None and size is not None: + return (library_type * size)() + else: + return None + + +class SessionReference(object): + '''Properties container for NI-TClk attributes.''' + + # This is needed during __init__. Without it, __setattr__ raises an exception + _is_frozen = False + + exported_sync_pulse_output_terminal = _attributes.AttributeViString(2) + '''Type: str + + Specifies the destination of the Sync Pulse. This property is most often used when synchronizing a multichassis system. + Values + Empty string. Empty string is a valid value, indicating that the signal is not exported. + PXI Devices - 'PXI_Trig0' through 'PXI_Trig7' and device-specific settings + PCI Devices - 'RTSI_0' through 'RTSI_7' and device-specific settings + Examples of Device-Specific Settings + - NI PXI-5122 supports 'PFI0' and 'PFI1' + - NI PXI-5421 supports 'PFI0', 'PFI1', 'PFI4', and 'PFI5' + - NI PXI-6551/6552 supports 'PFI0', 'PFI1', 'PFI2', and 'PFI3' + Default Value is empty string + ''' + exported_tclk_output_terminal = _attributes.AttributeViString(9) + '''Type: str + + Specifies the destination of the device's TClk signal. + Values + Empty string. Empty string is a valid value, indicating that the signal is not exported. + PXI Devices - 'PXI_Trig0' through 'PXI_Trig7' and device-specific settings + PCI Devices - 'RTSI_0' through 'RTSI_7' and device-specific settings + Examples of Device-Specific Settings + - NI PXI-5122 supports 'PFI0' and 'PFI1' + - NI PXI-5421 supports 'PFI0', 'PFI1', 'PFI4', and 'PFI5' + - NI PXI-6551/6552 supports 'PFI0', 'PFI1', 'PFI2', and 'PFI3' + Default Value is empty string + ''' + pause_trigger_master_session = _attributes.AttributeViInt32SessionReference(6) + '''Type: nimi-python Session class, nitclk.SessionReference, NI-TClk Session Number + + Specifies the pause trigger master session. + For external triggers, the session that originally receives the trigger. For None (no trigger configured) or software triggers, the session that originally generates the trigger. + ''' + ref_trigger_master_session = _attributes.AttributeViInt32SessionReference(4) + '''Type: nimi-python Session class, nitclk.SessionReference, NI-TClk Session Number + + Specifies the reference trigger master session. + For external triggers, the session that originally receives the trigger. For None (no trigger configured) or software triggers, the session that originally generates the trigger. + ''' + sample_clock_delay = _attributes.AttributeViReal64(11) + '''Type: float + + Specifies the sample clock delay. + Specifies the delay, in seconds, to apply to the session sample clock relative to the other synchronized sessions. During synchronization, NI-TClk aligns the sample clocks on the synchronized devices. If you want to delay the sample clocks, set this property before calling synchronize. + not supported for acquisition sessions. + Values - Between minus one and plus one period of the sample clock. + One sample clock period is equal to (1/sample clock rate). For example, for a session with sample rate of 100 MS/s, you can specify sample clock delays between -10.0 ns and +10.0 ns. + Default Value is 0 + + Note: Sample clock delay is supported for generation sessions only; it is + ''' + script_trigger_master_session = _attributes.AttributeViInt32SessionReference(5) + '''Type: nimi-python Session class, nitclk.SessionReference, NI-TClk Session Number + + Specifies the script trigger master session. + For external triggers, the session that originally receives the trigger. For None (no trigger configured) or software triggers, the session that originally generates the trigger. + ''' + sequencer_flag_master_session = _attributes.AttributeViInt32SessionReference(16) + '''Type: nimi-python Session class, nitclk.SessionReference, NI-TClk Session Number + + Specifies the sequencer flag master session. + For external triggers, the session that originally receives the trigger. + For None (no trigger configured) or software triggers, the session that + originally generates the trigger. + ''' + start_trigger_master_session = _attributes.AttributeViInt32SessionReference(3) + '''Type: nimi-python Session class, nitclk.SessionReference, NI-TClk Session Number + + Specifies the start trigger master session. + For external triggers, the session that originally receives the trigger. For None (no trigger configured) or software triggers, the session that originally generates the trigger. + ''' + sync_pulse_clock_source = _attributes.AttributeViString(10) + '''Type: str + + Specifies the Sync Pulse Clock source. This property is typically used to synchronize PCI devices when you want to control RTSI 7 yourself. Make sure that a 10 MHz clock is driven onto RTSI 7. + Values + PCI Devices - 'RTSI_7' and 'None' + PXI Devices - 'PXI_CLK10' and 'None' + Default Value - 'None' directs synchronize to create the necessary routes. For PCI, one of the synchronized devices drives a 10 MHz clock on RTSI 7 unless that line is already being driven. + ''' + sync_pulse_sender_sync_pulse_source = _attributes.AttributeViString(13) + '''Type: str + + Specifies the external sync pulse source for the Sync Pulse Sender. You can use this source to synchronize the Sync Pulse Sender with an external non-TClk source. + Values + Empty string. Empty string is a valid value, indicating that the signal is not exported. + PXI Devices - 'PXI_Trig0' through 'PXI_Trig7' and device-specific settings + PCI Devices - 'RTSI_0' through 'RTSI_7' and device-specific settings + Examples of Device-Specific Settings + - NI PXI-5122 supports 'PFI0' and 'PFI1' + - NI PXI-5421 supports 'PFI0', 'PFI1', 'PFI4', and 'PFI5' + - NI PXI-6551/6552 supports 'PFI0', 'PFI1', 'PFI2', and 'PFI3' + Default Value is empty string + ''' + sync_pulse_source = _attributes.AttributeViString(1) + '''Type: str + + Specifies the Sync Pulse source. This property is most often used when synchronizing a multichassis system. + Values + Empty string + PXI Devices - 'PXI_Trig0' through 'PXI_Trig7' and device-specific settings + PCI Devices - 'RTSI_0' through 'RTSI_7' and device-specific settings + Examples of Device-Specific Settings + - NI PXI-5122 supports 'PFI0' and 'PFI1' + - NI PXI-5421 supports 'PFI0', 'PFI1', 'PFI2', and 'PFI3' + - NI PXI-6551/6552 supports 'PFI0', 'PFI1', 'PFI2', and 'PFI3' + Default Value - Empty string. This default value directs synchronize to set this property when all the synchronized devices are in one PXI chassis. To synchronize a multichassis system, you must set this property before calling synchronize. + ''' + tclk_actual_period = _attributes.AttributeViReal64(8) + '''Type: float + + Indicates the computed TClk period that will be used during the acquisition. + ''' + + def __init__(self, session, repeated_capability_list='', encoding='windows-1251'): + self._repeated_capability_list = repeated_capability_list + self._repeated_capability = ','.join(repeated_capability_list) + self._session = session + self._library = _library_singleton.get() + self._encoding = encoding + + # Store the parameter list for later printing in __repr__ + param_list = [] + param_list.append("session=" + pp.pformat(session)) + param_list.append("repeated_capability_list=" + pp.pformat(repeated_capability_list)) + param_list.append("encoding=" + pp.pformat(encoding)) + self._param_list = ', '.join(param_list) + + self._is_frozen = True + + def __repr__(self): + return '{0}.{1}({2})'.format('nitclk', self.__class__.__name__, self._param_list) + + def __setattr__(self, key, value): + if self._is_frozen and key not in dir(self): + raise AttributeError("'{0}' object has no attribute '{1}'".format(type(self).__name__, key)) + object.__setattr__(self, key, value) + + def _get_error_description(self, error_code): + '''_get_error_description + + Returns the error description. + ''' + try: + ''' + It is expected for _get_error to raise when the session is invalid + (IVI spec requires GetError to fail). + Use _error_message instead. It doesn't require a session. + ''' + error_string = self._get_extended_error_info() + return error_string + except errors.Error: + return "Failed to retrieve error description." + + def get_session_number(self): + return self._session + + def _get_attribute_vi_boolean(self, attribute_id): + r'''_get_attribute_vi_boolean + + TBD + + Tip: + This method requires repeated capabilities (channels). If called directly on the + nitclk.Session object, then the method will use all repeated capabilities in the session. + You can specify a subset of repeated capabilities using the Python index notation on an + nitclk.Session repeated capabilities container, and calling this method on the result.: + + session.channels[0,1]._get_attribute_vi_boolean(attribute_id) + + Args: + attribute_id (int): + + + Returns: + value (bool): + + ''' + session_ctype = _visatype.ViSession(self._session) # 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 + value_ctype = _visatype.ViBoolean() # case S220 + error_code = self._library.niTClk_GetAttributeViBoolean(session_ctype, channel_name_ctype, attribute_id_ctype, None if value_ctype is None else (ctypes.pointer(value_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return bool(value_ctype.value) + + def _get_attribute_vi_real64(self, attribute_id): + r'''_get_attribute_vi_real64 + + Gets the value of an NI-TClk ViReal64 property. + + Tip: + This method requires repeated capabilities (channels). If called directly on the + nitclk.Session object, then the method will use all repeated capabilities in the session. + You can specify a subset of repeated capabilities using the Python index notation on an + nitclk.Session repeated capabilities container, and calling this method on the result.: + + session.channels[0,1]._get_attribute_vi_real64(attribute_id) + + Args: + attribute_id (int): The ID of the property that you want to get Supported Property + sample_clock_delay + + + Returns: + value (float): The value that you are getting + + ''' + session_ctype = _visatype.ViSession(self._session) # 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 + value_ctype = _visatype.ViReal64() # case S220 + error_code = self._library.niTClk_GetAttributeViReal64(session_ctype, channel_name_ctype, attribute_id_ctype, None if value_ctype is None else (ctypes.pointer(value_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return float(value_ctype.value) + + def _get_attribute_vi_session(self, attribute_id): + r'''_get_attribute_vi_session + + Gets the value of an NI-TClk ViSession property. + + Tip: + This method requires repeated capabilities (channels). If called directly on the + nitclk.Session object, then the method will use all repeated capabilities in the session. + You can specify a subset of repeated capabilities using the Python index notation on an + nitclk.Session repeated capabilities container, and calling this method on the result.: + + session.channels[0,1]._get_attribute_vi_session(attribute_id) + + Args: + attribute_id (int): The ID of the property that you want to set Supported Properties + start_trigger_master_session + ref_trigger_master_session + script_trigger_master_session + pause_trigger_master_session + + + Returns: + value (int): The value that you are getting + + ''' + session_ctype = _visatype.ViSession(self._session) # 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 + value_ctype = _visatype.ViSession() # case S220 + error_code = self._library.niTClk_GetAttributeViSession(session_ctype, channel_name_ctype, attribute_id_ctype, None if value_ctype is None else (ctypes.pointer(value_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return int(value_ctype.value) + + def _get_attribute_vi_string(self, attribute_id, buf_size, value): + r'''_get_attribute_vi_string + + This method queries the value of an NI-TClk ViString property. You + must provide a ViChar array to serve as a buffer for the value. You pass + the number of bytes in the buffer as bufSize. If the current value of + the property, including the terminating NULL byte, is larger than the + size you indicate in bufSize, the method copies bufSize minus 1 bytes + into the buffer, places an ASCII NULL byte at the end of the buffer, and + returns the array size that you must pass to get the entire value. For + example, if the value is "123456" and bufSize is 4, the method places + "123" into the buffer and returns 7. If you want to call + _get_attribute_vi_string just to get the required array size, pass 0 + for bufSize and VI_NULL for the value. + + Tip: + This method requires repeated capabilities (channels). If called directly on the + nitclk.Session object, then the method will use all repeated capabilities in the session. + You can specify a subset of repeated capabilities using the Python index notation on an + nitclk.Session repeated capabilities container, and calling this method on the result.: + + session.channels[0,1]._get_attribute_vi_string(attribute_id, buf_size, value) + + Args: + attribute_id (int): The ID of the property that you want to get Supported Properties + sync_pulse_source + sync_pulse_clock_source + exported_sync_pulse_output_terminal + + buf_size (int): The number of bytes in the ViChar array that you specify for the value + parameter + + value (str): The value that you are getting + + ''' + session_ctype = _visatype.ViSession(self._session) # 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 + buf_size_ctype = _visatype.ViInt32(buf_size) # case S150 + value_ctype = ctypes.create_string_buffer(value.encode(self._encoding)) # case C020 + error_code = self._library.niTClk_GetAttributeViString(session_ctype, channel_name_ctype, attribute_id_ctype, buf_size_ctype, value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return + + def _get_extended_error_info(self): + r'''_get_extended_error_info + + Reports extended error information for the most recent NI-TClk method + that returned an error. To establish the method that returned an + error, use the return values of the individual methods because once + _get_extended_error_info reports an errorString, it does not report + an empty string again. + ''' + error_string_ctype = None # case C050 + error_string_size_ctype = _visatype.ViUInt32() # case S170 + error_code = self._library.niTClk_GetExtendedErrorInfo(error_string_ctype, error_string_size_ctype) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=True) + error_string_size_ctype = _visatype.ViUInt32(error_code) # case S180 + error_string_ctype = (_visatype.ViChar * error_string_size_ctype.value)() # case C060 + error_code = self._library.niTClk_GetExtendedErrorInfo(error_string_ctype, error_string_size_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) + return error_string_ctype.value.decode(self._encoding) + + def _set_attribute_vi_boolean(self, attribute_id, value): + r'''_set_attribute_vi_boolean + + TBD + + Tip: + This method requires repeated capabilities (channels). If called directly on the + nitclk.Session object, then the method will use all repeated capabilities in the session. + You can specify a subset of repeated capabilities using the Python index notation on an + nitclk.Session repeated capabilities container, and calling this method on the result.: + + session.channels[0,1]._set_attribute_vi_boolean(attribute_id, value) + + Args: + attribute_id (int): + + value (bool): + + ''' + session_ctype = _visatype.ViSession(self._session) # 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 + value_ctype = _visatype.ViBoolean(value) # case S150 + error_code = self._library.niTClk_SetAttributeViBoolean(session_ctype, channel_name_ctype, attribute_id_ctype, value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return + + def _set_attribute_vi_real64(self, attribute_id, value): + r'''_set_attribute_vi_real64 + + Sets the value of an NI-TClk VIReal64 property. + _set_attribute_vi_real64 is a low-level method that you can use to + set the values NI-TClk properties. NI-TClk contains high-level methods + that set most of the properties. It is best to use the high-level + methods as much as possible. + + Tip: + This method requires repeated capabilities (channels). If called directly on the + nitclk.Session object, then the method will use all repeated capabilities in the session. + You can specify a subset of repeated capabilities using the Python index notation on an + nitclk.Session repeated capabilities container, and calling this method on the result.: + + session.channels[0,1]._set_attribute_vi_real64(attribute_id, value) + + Args: + attribute_id (int): The ID of the property that you want to set Supported Property + sample_clock_delay + + value (float): The value for the property + + ''' + session_ctype = _visatype.ViSession(self._session) # 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 + value_ctype = _visatype.ViReal64(value) # case S150 + error_code = self._library.niTClk_SetAttributeViReal64(session_ctype, channel_name_ctype, attribute_id_ctype, value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return + + def _set_attribute_vi_session(self, attribute_id): + r'''_set_attribute_vi_session + + Sets the value of an NI-TClk ViSession property. + _set_attribute_vi_session is a low-level method that you can use + to set the values NI-TClk properties. NI-TClk contains high-level + methods that set most of the properties. It is best to use the + high-level methods as much as possible. + + Tip: + This method requires repeated capabilities (channels). If called directly on the + nitclk.Session object, then the method will use all repeated capabilities in the session. + You can specify a subset of repeated capabilities using the Python index notation on an + nitclk.Session repeated capabilities container, and calling this method on the result.: + + session.channels[0,1]._set_attribute_vi_session(attribute_id) + + Args: + attribute_id (int): The ID of the property that you want to set Supported Properties + start_trigger_master_session + ref_trigger_master_session + script_trigger_master_session + pause_trigger_master_session + + ''' + session_ctype = _visatype.ViSession(self._session) # 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 + value_ctype = _visatype.ViSession(self._value) # case S110 + error_code = self._library.niTClk_SetAttributeViSession(session_ctype, channel_name_ctype, attribute_id_ctype, value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return + + def _set_attribute_vi_string(self, attribute_id, value): + r'''_set_attribute_vi_string + + Sets the value of an NI-TClk VIString property. + _set_attribute_vi_string is a low-level method that you can use to + set the values of NI-TClk properties. NI-TClk contain high-level + methods that set most of the properties. It is best to use the + high-level methods as much as possible. + + Tip: + This method requires repeated capabilities (channels). If called directly on the + nitclk.Session object, then the method will use all repeated capabilities in the session. + You can specify a subset of repeated capabilities using the Python index notation on an + nitclk.Session repeated capabilities container, and calling this method on the result.: + + session.channels[0,1]._set_attribute_vi_string(attribute_id, value) + + Args: + attribute_id (int): Pass the ID of the property that you want to set Supported Properties + sync_pulse_source + sync_pulse_clock_source + exported_sync_pulse_output_terminal + + value (str): Pass the value for the property + + ''' + session_ctype = _visatype.ViSession(self._session) # 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 + value_ctype = ctypes.create_string_buffer(value.encode(self._encoding)) # case C020 + error_code = self._library.niTClk_SetAttributeViString(session_ctype, channel_name_ctype, attribute_id_ctype, value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return + + +class _Session(object): + '''An NI-TClk session.''' + + def __init__(self): + r'''An NI-TClk session.''' + self._library = _library_singleton.get() + self._encoding = 'windows-1251' + + # Instantiate any repeated capability objects + + # Store the parameter list for later printing in __repr__ + param_list = [] + self._param_list = ', '.join(param_list) + + self._is_frozen = True + + def _get_error_description(self, error_code): + '''_get_error_description + + Returns the error description. + ''' + try: + ''' + It is expected for _get_error to raise when the session is invalid + (IVI spec requires GetError to fail). + Use _error_message instead. It doesn't require a session. + ''' + error_string = self._get_extended_error_info() + return error_string + except errors.Error: + return "Failed to retrieve error description." + + ''' These are code-generated ''' + def configure_for_homogeneous_triggers(self, sessions): + r'''configure_for_homogeneous_triggers + + Configures the properties commonly required for the TClk synchronization + of device sessions with homogeneous triggers in a single PXI chassis or + a single PC. Use configure_for_homogeneous_triggers to configure + the properties for the reference clocks, start triggers, reference + triggers, script triggers, and pause triggers. If + configure_for_homogeneous_triggers cannot perform all the steps + appropriate for the given sessions, it returns an error. If an error is + returned, use the instrument driver methods and properties for signal + routing, along with the following NI-TClk properties: + start_trigger_master_session + ref_trigger_master_session + script_trigger_master_session + pause_trigger_master_session + configure_for_homogeneous_triggers affects the following clocks and + triggers: - Reference clocks - Start triggers - Reference triggers - + Script triggers - Pause triggers Reference Clocks + configure_for_homogeneous_triggers configures the reference clocks + if they are needed. Specifically, if the internal sample clocks or + internal sample clock timebases are used, and the reference clock source + is not configured--or is set to None (no trigger + configured)--configure_for_homogeneous_triggers configures the + following: PXI--The reference clock source on all devices is set to be + the 10 MHz PXI backplane clock (PXI_CLK10). PCI--One of the devices + exports its 10 MHz onboard reference clock to RTSI 7. The reference + clock source on all devices is set to be RTSI 7. Note: If the reference + clock source is set to a value other than None, + configure_for_homogeneous_triggers cannot configure the reference + clock source. Start Triggers If the start trigger is set to None (no + trigger configured) for all sessions, the sessions are configured to + share the start trigger. The start trigger is shared by: - Implicitly + exporting the start trigger from one session - Configuring the other + sessions for digital edge start triggers with sources corresponding to + the exported start trigger - Setting + start_trigger_master_session to the session that is + exporting the trigger for all sessions If the start triggers are None + for all except one session, configure_for_homogeneous_triggers + configures the sessions to share the start trigger from the one excepted + session. The start trigger is shared by: - Implicitly exporting start + trigger from the session with the start trigger that is not None - + Configuring the other sessions for digital-edge start triggers with + sources corresponding to the exported start trigger - Setting + start_trigger_master_session to the session that is + exporting the trigger for all sessions If start triggers are configured + for all sessions, configure_for_homogeneous_triggers does not + affect the start triggers. Start triggers are considered to be + configured for all sessions if either of the following conditions is + true: - No session has a start trigger that is None - One session has a + start trigger that is None, and all other sessions have start triggers + other than None. The one session with the None trigger must have + start_trigger_master_session set to itself, indicating + that the session itself is the start trigger master Reference Triggers + configure_for_homogeneous_triggers configures sessions that support + reference triggers to share the reference triggers if the reference + triggers are None (no trigger configured) for all except one session. + The reference triggers are shared by: - Implicitly exporting the + reference trigger from the session whose reference trigger is not None - + Configuring the other sessions that support the reference trigger for + digital-edge reference triggers with sources corresponding to the + exported reference trigger - Setting + ref_trigger_master_session to the session that is + exporting the trigger for all sessions that support reference trigger If + the reference triggers are configured for all sessions that support + reference triggers, configure_for_homogeneous_triggers does not + affect the reference triggers. Reference triggers are considered to be + configured for all sessions if either one or the other of the following + conditions is true: - No session has a reference trigger that is None - + One session has a reference trigger that is None, and all other sessions + have reference triggers other than None. The one session with the None + trigger must have ref_trigger_master_session set to + itself, indicating that the session itself is the reference trigger + master Reference Trigger Holdoffs Acquisition sessions may be configured + with the reference trigger. For acquisition sessions, when the reference + trigger is shared, configure_for_homogeneous_triggers configures + the holdoff properties (which are instrument driver specific) on the + reference trigger master session so that the session does not recognize + the reference trigger before the other sessions are ready. This + condition is only relevant when the sample clock rates, sample clock + timebase rates, sample counts, holdoffs, and/or any delays for the + acquisitions are different. When the sample clock rates, sample clock + timebase rates, and/or the sample counts are different in acquisition + sessions sharing the reference trigger, you should also set the holdoff + properties for the reference trigger master using the instrument driver. + Script Triggers configure_for_homogeneous_triggers configures + sessions that support script triggers to share them, if the script + triggers are None (no trigger configured) for all except one session. + The script triggers are shared in the following ways: - Implicitly + exporting the script trigger from the session whose script trigger is + not None - Configuring the other sessions that support the script + trigger for digital-edge script triggers with sources corresponding to + the exported script trigger - Setting + script_trigger_master_session to the session that is + exporting the trigger for all sessions that support script triggers If + the script triggers are configured for all sessions that support script + triggers, configure_for_homogeneous_triggers does not affect script + triggers. Script triggers are considered to be configured for all + sessions if either one or the other of the following conditions are + true: - No session has a script trigger that is None - One session has a + script trigger that is None and all other sessions have script triggers + other than None. The one session with the None trigger must have + script_trigger_master_session set to itself, indicating + that the session itself is the script trigger master Pause Triggers + configure_for_homogeneous_triggers configures generation sessions + that support pause triggers to share them, if the pause triggers are + None (no trigger configured) for all except one session. The pause + triggers are shared by: - Implicitly exporting the pause trigger from + the session whose script trigger is not None - Configuring the other + sessions that support the pause trigger for digital-edge pause triggers + with sources corresponding to the exported pause trigger - Setting + pause_trigger_master_session to the session that is + exporting the trigger for all sessions that support script triggers If + the pause triggers are configured for all generation sessions that + support pause triggers, configure_for_homogeneous_triggers does not + affect pause triggers. Pause triggers are considered to be configured + for all sessions if either one or the other of the following conditions + is true: - No session has a pause trigger that is None - One session has + a pause trigger that is None and all other sessions have pause triggers + other than None. The one session with the None trigger must have + pause_trigger_master_session set to itself, indicating + that the session itself is the pause trigger master Note: TClk + synchronization is not supported for pause triggers on acquisition + sessions. + + Args: + sessions (list of int): sessions is an array of sessions that are being synchronized. + + ''' + session_count_ctype = _visatype.ViUInt32(0 if sessions is None else len(sessions)) # case S160 + sessions_ctype = get_ctypes_pointer_for_buffer(value=_converters.convert_to_nitclk_session_num_list(sessions), library_type=_visatype.ViSession) # case B630 + error_code = self._library.niTClk_ConfigureForHomogeneousTriggers(session_count_ctype, sessions_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return + + def finish_sync_pulse_sender_synchronize(self, sessions, min_time): + r'''finish_sync_pulse_sender_synchronize + + TBD + + Args: + sessions (list of int): sessions is an array of sessions that are being synchronized. + + min_time (float): Minimal period of TClk, expressed in seconds. Supported values are + between 0.0 s and 0.050 s (50 ms). Minimal period for a single + chassis/PC is 200 ns. If the specified value is less than 200 ns, + NI-TClk automatically coerces minTime to 200 ns. For multichassis + synchronization, adjust this value to account for propagation delays + through the various devices and cables. + + ''' + session_count_ctype = _visatype.ViUInt32(0 if sessions is None else len(sessions)) # case S160 + sessions_ctype = get_ctypes_pointer_for_buffer(value=_converters.convert_to_nitclk_session_num_list(sessions), library_type=_visatype.ViSession) # case B630 + min_time_ctype = _visatype.ViReal64(min_time) # case S150 + error_code = self._library.niTClk_FinishSyncPulseSenderSynchronize(session_count_ctype, sessions_ctype, min_time_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return + + def _get_extended_error_info(self): + r'''_get_extended_error_info + + Reports extended error information for the most recent NI-TClk method + that returned an error. To establish the method that returned an + error, use the return values of the individual methods because once + _get_extended_error_info reports an errorString, it does not report + an empty string again. + ''' + error_string_ctype = None # case C050 + error_string_size_ctype = _visatype.ViUInt32() # case S170 + error_code = self._library.niTClk_GetExtendedErrorInfo(error_string_ctype, error_string_size_ctype) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=True) + error_string_size_ctype = _visatype.ViUInt32(error_code) # case S180 + error_string_ctype = (_visatype.ViChar * error_string_size_ctype.value)() # case C060 + error_code = self._library.niTClk_GetExtendedErrorInfo(error_string_ctype, error_string_size_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) + return error_string_ctype.value.decode(self._encoding) + + def init_for_documentation(self): + r'''init_for_documentation + + TBD + ''' + session_list_ctype = _visatype.ViSession(self._session_list) # case S110 + error_code = self._library.niTClk_InitForDocumentation(session_list_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return + + def initiate(self, sessions): + r'''initiate + + Initiates the acquisition or generation sessions specified, taking into + consideration any special requirements needed for synchronization. For + example, the session exporting the TClk-synchronized start trigger is + not initiated until after initiate initiates all the sessions + that import the TClk-synchronized start trigger. + + Args: + sessions (list of int): sessions is an array of sessions that are being synchronized. + + ''' + session_count_ctype = _visatype.ViUInt32(0 if sessions is None else len(sessions)) # case S160 + sessions_ctype = get_ctypes_pointer_for_buffer(value=_converters.convert_to_nitclk_session_num_list(sessions), library_type=_visatype.ViSession) # case B630 + error_code = self._library.niTClk_Initiate(session_count_ctype, sessions_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return + + def is_done(self, sessions): + r'''is_done + + Monitors the progress of the acquisitions and/or generations + corresponding to sessions. + + Args: + sessions (list of int): sessions is an array of sessions that are being synchronized. + + + Returns: + done (bool): Indicates that the operation is done. The operation is done when each + session has completed without any errors or when any one of the sessions + reports an error. + + ''' + session_count_ctype = _visatype.ViUInt32(0 if sessions is None else len(sessions)) # case S160 + sessions_ctype = get_ctypes_pointer_for_buffer(value=_converters.convert_to_nitclk_session_num_list(sessions), library_type=_visatype.ViSession) # case B630 + done_ctype = _visatype.ViBoolean() # case S220 + error_code = self._library.niTClk_IsDone(session_count_ctype, sessions_ctype, None if done_ctype is None else (ctypes.pointer(done_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return bool(done_ctype.value) + + def setup_for_sync_pulse_sender_synchronize(self, sessions, min_time): + r'''setup_for_sync_pulse_sender_synchronize + + TBD + + Args: + sessions (list of int): sessions is an array of sessions that are being synchronized. + + min_time (float): Minimal period of TClk, expressed in seconds. Supported values are + between 0.0 s and 0.050 s (50 ms). Minimal period for a single + chassis/PC is 200 ns. If the specified value is less than 200 ns, + NI-TClk automatically coerces minTime to 200 ns. For multichassis + synchronization, adjust this value to account for propagation delays + through the various devices and cables. + + ''' + session_count_ctype = _visatype.ViUInt32(0 if sessions is None else len(sessions)) # case S160 + sessions_ctype = get_ctypes_pointer_for_buffer(value=_converters.convert_to_nitclk_session_num_list(sessions), library_type=_visatype.ViSession) # case B630 + min_time_ctype = _visatype.ViReal64(min_time) # case S150 + error_code = self._library.niTClk_SetupForSyncPulseSenderSynchronize(session_count_ctype, sessions_ctype, min_time_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return + + def synchronize(self, sessions, min_tclk_period=datetime.timedelta(seconds=0.0)): + r'''synchronize + + Synchronizes the TClk signals on the given sessions. After + synchronize executes, TClk signals from all sessions are + synchronized. Note: Before using this NI-TClk method, verify that your + system is configured as specified in the PXI Trigger Lines and RTSI + Lines topic of the NI-TClk Synchronization Help. You can locate this + help file at Start>>Programs>>National Instruments>>NI-TClk. + + Args: + sessions (list of int): sessions is an array of sessions that are being synchronized. + + min_tclk_period (float in seconds or datetime.timedelta): Minimal period of TClk, expressed in seconds. Supported values are + between 0.0 s and 0.050 s (50 ms). Minimal period for a single + chassis/PC is 200 ns. If the specified value is less than 200 ns, + NI-TClk automatically coerces minTime to 200 ns. For multichassis + synchronization, adjust this value to account for propagation delays + through the various devices and cables. + + ''' + session_count_ctype = _visatype.ViUInt32(0 if sessions is None else len(sessions)) # case S160 + sessions_ctype = get_ctypes_pointer_for_buffer(value=_converters.convert_to_nitclk_session_num_list(sessions), library_type=_visatype.ViSession) # case B630 + min_tclk_period_ctype = _converters.convert_timedelta_to_seconds(min_tclk_period, _visatype.ViReal64) # case S140 + error_code = self._library.niTClk_Synchronize(session_count_ctype, sessions_ctype, min_tclk_period_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return + + def synchronize_to_sync_pulse_sender(self, sessions, min_time): + r'''synchronize_to_sync_pulse_sender + + TBD + + Args: + sessions (list of int): sessions is an array of sessions that are being synchronized. + + min_time (float): Minimal period of TClk, expressed in seconds. Supported values are + between 0.0 s and 0.050 s (50 ms). Minimal period for a single + chassis/PC is 200 ns. If the specified value is less than 200 ns, + NI-TClk automatically coerces minTime to 200 ns. For multichassis + synchronization, adjust this value to account for propagation delays + through the various devices and cables. + + ''' + session_count_ctype = _visatype.ViUInt32(0 if sessions is None else len(sessions)) # case S160 + sessions_ctype = get_ctypes_pointer_for_buffer(value=_converters.convert_to_nitclk_session_num_list(sessions), library_type=_visatype.ViSession) # case B630 + min_time_ctype = _visatype.ViReal64(min_time) # case S150 + error_code = self._library.niTClk_SynchronizeToSyncPulseSender(session_count_ctype, sessions_ctype, min_time_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return + + def wait_until_done(self, sessions, timeout): + r'''wait_until_done + + Call this method to pause execution of your program until the + acquisitions and/or generations corresponding to sessions are done or + until the method returns a timeout error. wait_until_done is a + blocking method that periodically checks the operation status. It + returns control to the calling program if the operation completes + successfully or an error occurs (including a timeout error). This + method is most useful for finite data operations that you expect to + complete within a certain time. + + Args: + sessions (list of int): sessions is an array of sessions that are being synchronized. + + timeout (float): The amount of time in seconds that wait_until_done waits for the + sessions to complete. If timeout is exceeded, wait_until_done + returns an error. + + ''' + session_count_ctype = _visatype.ViUInt32(0 if sessions is None else len(sessions)) # case S160 + sessions_ctype = get_ctypes_pointer_for_buffer(value=_converters.convert_to_nitclk_session_num_list(sessions), library_type=_visatype.ViSession) # case B630 + timeout_ctype = _visatype.ViReal64(timeout) # case S150 + error_code = self._library.niTClk_WaitUntilDone(session_count_ctype, sessions_ctype, timeout_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return + + +def _get_session_class(): + '''Internal function to return session singleton''' + global _session_instance + global _session_instance_lock + + with _session_instance_lock: + if _session_instance is None: + _session_instance = _Session() + + return _session_instance + + +def configure_for_homogeneous_triggers(sessions): + '''configure_for_homogeneous_triggers + + Configures the properties commonly required for the TClk synchronization + of device sessions with homogeneous triggers in a single PXI chassis or + a single PC. Use configure_for_homogeneous_triggers to configure + the properties for the reference clocks, start triggers, reference + triggers, script triggers, and pause triggers. If + configure_for_homogeneous_triggers cannot perform all the steps + appropriate for the given sessions, it returns an error. If an error is + returned, use the instrument driver methods and properties for signal + routing, along with the following NI-TClk properties: + start_trigger_master_session + ref_trigger_master_session + script_trigger_master_session + pause_trigger_master_session + configure_for_homogeneous_triggers affects the following clocks and + triggers: - Reference clocks - Start triggers - Reference triggers - + Script triggers - Pause triggers Reference Clocks + configure_for_homogeneous_triggers configures the reference clocks + if they are needed. Specifically, if the internal sample clocks or + internal sample clock timebases are used, and the reference clock source + is not configured--or is set to None (no trigger + configured)--configure_for_homogeneous_triggers configures the + following: PXI--The reference clock source on all devices is set to be + the 10 MHz PXI backplane clock (PXI_CLK10). PCI--One of the devices + exports its 10 MHz onboard reference clock to RTSI 7. The reference + clock source on all devices is set to be RTSI 7. Note: If the reference + clock source is set to a value other than None, + configure_for_homogeneous_triggers cannot configure the reference + clock source. Start Triggers If the start trigger is set to None (no + trigger configured) for all sessions, the sessions are configured to + share the start trigger. The start trigger is shared by: - Implicitly + exporting the start trigger from one session - Configuring the other + sessions for digital edge start triggers with sources corresponding to + the exported start trigger - Setting + start_trigger_master_session to the session that is + exporting the trigger for all sessions If the start triggers are None + for all except one session, configure_for_homogeneous_triggers + configures the sessions to share the start trigger from the one excepted + session. The start trigger is shared by: - Implicitly exporting start + trigger from the session with the start trigger that is not None - + Configuring the other sessions for digital-edge start triggers with + sources corresponding to the exported start trigger - Setting + start_trigger_master_session to the session that is + exporting the trigger for all sessions If start triggers are configured + for all sessions, configure_for_homogeneous_triggers does not + affect the start triggers. Start triggers are considered to be + configured for all sessions if either of the following conditions is + true: - No session has a start trigger that is None - One session has a + start trigger that is None, and all other sessions have start triggers + other than None. The one session with the None trigger must have + start_trigger_master_session set to itself, indicating + that the session itself is the start trigger master Reference Triggers + configure_for_homogeneous_triggers configures sessions that support + reference triggers to share the reference triggers if the reference + triggers are None (no trigger configured) for all except one session. + The reference triggers are shared by: - Implicitly exporting the + reference trigger from the session whose reference trigger is not None - + Configuring the other sessions that support the reference trigger for + digital-edge reference triggers with sources corresponding to the + exported reference trigger - Setting + ref_trigger_master_session to the session that is + exporting the trigger for all sessions that support reference trigger If + the reference triggers are configured for all sessions that support + reference triggers, configure_for_homogeneous_triggers does not + affect the reference triggers. Reference triggers are considered to be + configured for all sessions if either one or the other of the following + conditions is true: - No session has a reference trigger that is None - + One session has a reference trigger that is None, and all other sessions + have reference triggers other than None. The one session with the None + trigger must have ref_trigger_master_session set to + itself, indicating that the session itself is the reference trigger + master Reference Trigger Holdoffs Acquisition sessions may be configured + with the reference trigger. For acquisition sessions, when the reference + trigger is shared, configure_for_homogeneous_triggers configures + the holdoff properties (which are instrument driver specific) on the + reference trigger master session so that the session does not recognize + the reference trigger before the other sessions are ready. This + condition is only relevant when the sample clock rates, sample clock + timebase rates, sample counts, holdoffs, and/or any delays for the + acquisitions are different. When the sample clock rates, sample clock + timebase rates, and/or the sample counts are different in acquisition + sessions sharing the reference trigger, you should also set the holdoff + properties for the reference trigger master using the instrument driver. + Script Triggers configure_for_homogeneous_triggers configures + sessions that support script triggers to share them, if the script + triggers are None (no trigger configured) for all except one session. + The script triggers are shared in the following ways: - Implicitly + exporting the script trigger from the session whose script trigger is + not None - Configuring the other sessions that support the script + trigger for digital-edge script triggers with sources corresponding to + the exported script trigger - Setting + script_trigger_master_session to the session that is + exporting the trigger for all sessions that support script triggers If + the script triggers are configured for all sessions that support script + triggers, configure_for_homogeneous_triggers does not affect script + triggers. Script triggers are considered to be configured for all + sessions if either one or the other of the following conditions are + true: - No session has a script trigger that is None - One session has a + script trigger that is None and all other sessions have script triggers + other than None. The one session with the None trigger must have + script_trigger_master_session set to itself, indicating + that the session itself is the script trigger master Pause Triggers + configure_for_homogeneous_triggers configures generation sessions + that support pause triggers to share them, if the pause triggers are + None (no trigger configured) for all except one session. The pause + triggers are shared by: - Implicitly exporting the pause trigger from + the session whose script trigger is not None - Configuring the other + sessions that support the pause trigger for digital-edge pause triggers + with sources corresponding to the exported pause trigger - Setting + pause_trigger_master_session to the session that is + exporting the trigger for all sessions that support script triggers If + the pause triggers are configured for all generation sessions that + support pause triggers, configure_for_homogeneous_triggers does not + affect pause triggers. Pause triggers are considered to be configured + for all sessions if either one or the other of the following conditions + is true: - No session has a pause trigger that is None - One session has + a pause trigger that is None and all other sessions have pause triggers + other than None. The one session with the None trigger must have + pause_trigger_master_session set to itself, indicating + that the session itself is the pause trigger master Note: TClk + synchronization is not supported for pause triggers on acquisition + sessions. + + Args: + sessions (list of int): sessions is an array of sessions that are being synchronized. + + ''' + return _get_session_class().configure_for_homogeneous_triggers(sessions) + + +def finish_sync_pulse_sender_synchronize(sessions, min_time): + '''finish_sync_pulse_sender_synchronize + + TBD + + Args: + sessions (list of int): sessions is an array of sessions that are being synchronized. + + min_time (float): Minimal period of TClk, expressed in seconds. Supported values are + between 0.0 s and 0.050 s (50 ms). Minimal period for a single + chassis/PC is 200 ns. If the specified value is less than 200 ns, + NI-TClk automatically coerces minTime to 200 ns. For multichassis + synchronization, adjust this value to account for propagation delays + through the various devices and cables. + + ''' + return _get_session_class().finish_sync_pulse_sender_synchronize(sessions, min_time) + + +def init_for_documentation(self): + '''init_for_documentation + + TBD + ''' + return _get_session_class().init_for_documentation(self) + + +def initiate(sessions): + '''initiate + + Initiates the acquisition or generation sessions specified, taking into + consideration any special requirements needed for synchronization. For + example, the session exporting the TClk-synchronized start trigger is + not initiated until after initiate initiates all the sessions + that import the TClk-synchronized start trigger. + + Args: + sessions (list of int): sessions is an array of sessions that are being synchronized. + + ''' + return _get_session_class().initiate(sessions) + + +def is_done(sessions): + '''is_done + + Monitors the progress of the acquisitions and/or generations + corresponding to sessions. + + Args: + sessions (list of int): sessions is an array of sessions that are being synchronized. + + + Returns: + done (bool): Indicates that the operation is done. The operation is done when each + session has completed without any errors or when any one of the sessions + reports an error. + + ''' + return _get_session_class().is_done(sessions) + + +def setup_for_sync_pulse_sender_synchronize(sessions, min_time): + '''setup_for_sync_pulse_sender_synchronize + + TBD + + Args: + sessions (list of int): sessions is an array of sessions that are being synchronized. + + min_time (float): Minimal period of TClk, expressed in seconds. Supported values are + between 0.0 s and 0.050 s (50 ms). Minimal period for a single + chassis/PC is 200 ns. If the specified value is less than 200 ns, + NI-TClk automatically coerces minTime to 200 ns. For multichassis + synchronization, adjust this value to account for propagation delays + through the various devices and cables. + + ''' + return _get_session_class().setup_for_sync_pulse_sender_synchronize(sessions, min_time) + + +def synchronize(sessions, min_tclk_period=datetime.timedelta(seconds=0.0)): + '''synchronize + + Synchronizes the TClk signals on the given sessions. After + synchronize executes, TClk signals from all sessions are + synchronized. Note: Before using this NI-TClk method, verify that your + system is configured as specified in the PXI Trigger Lines and RTSI + Lines topic of the NI-TClk Synchronization Help. You can locate this + help file at Start>>Programs>>National Instruments>>NI-TClk. + + Args: + sessions (list of int): sessions is an array of sessions that are being synchronized. + + min_tclk_period (float in seconds or datetime.timedelta): Minimal period of TClk, expressed in seconds. Supported values are + between 0.0 s and 0.050 s (50 ms). Minimal period for a single + chassis/PC is 200 ns. If the specified value is less than 200 ns, + NI-TClk automatically coerces minTime to 200 ns. For multichassis + synchronization, adjust this value to account for propagation delays + through the various devices and cables. + + ''' + return _get_session_class().synchronize(sessions, min_tclk_period=datetime.timedelta(seconds=0.0)) + + +def synchronize_to_sync_pulse_sender(sessions, min_time): + '''synchronize_to_sync_pulse_sender + + TBD + + Args: + sessions (list of int): sessions is an array of sessions that are being synchronized. + + min_time (float): Minimal period of TClk, expressed in seconds. Supported values are + between 0.0 s and 0.050 s (50 ms). Minimal period for a single + chassis/PC is 200 ns. If the specified value is less than 200 ns, + NI-TClk automatically coerces minTime to 200 ns. For multichassis + synchronization, adjust this value to account for propagation delays + through the various devices and cables. + + ''' + return _get_session_class().synchronize_to_sync_pulse_sender(sessions, min_time) + + +def wait_until_done(sessions, timeout): + '''wait_until_done + + Call this method to pause execution of your program until the + acquisitions and/or generations corresponding to sessions are done or + until the method returns a timeout error. wait_until_done is a + blocking method that periodically checks the operation status. It + returns control to the calling program if the operation completes + successfully or an error occurs (including a timeout error). This + method is most useful for finite data operations that you expect to + complete within a certain time. + + Args: + sessions (list of int): sessions is an array of sessions that are being synchronized. + + timeout (float): The amount of time in seconds that wait_until_done waits for the + sessions to complete. If timeout is exceeded, wait_until_done + returns an error. + + ''' + return _get_session_class().wait_until_done(sessions, timeout) + + + diff --git a/generated/nitclk/setup.py b/generated/nitclk/setup.py new file mode 100644 index 000000000..f8d5dd683 --- /dev/null +++ b/generated/nitclk/setup.py @@ -0,0 +1,74 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# This file was generated + + +from setuptools.command.test import test as test_command +from setuptools import setup + + +class PyTest(test_command): + def finalize_options(self): + test_command.finalize_options(self) + self.test_args = [] + self.test_suite = True + + def run_tests(self): + import pytest + pytest.main(self.test_args) + + +pypi_name = 'nitclk' + + +def read_contents(file_to_read): + with open(file_to_read, 'r') as f: + return f.read() + + +setup( + name=pypi_name, + zip_safe=True, + version='0.1.0.dev0', + description='NI-TClk Python API', + long_description=read_contents('README.rst'), + long_description_content_type='text/x-rst', + author='National Instruments', + author_email="opensource@ni.com", + url="https://github.com/ni/nimi-python", + maintainer="National Instruments", + maintainer_email="opensource@ni.com", + keywords=['nitclk'], + license='MIT', + include_package_data=True, + packages=['nitclk'], + install_requires=[ + 'enum34;python_version<"3.4"', + 'singledispatch;python_version<"3.4"', + 'six', + ], + setup_requires=['pytest-runner', ], + tests_require=['pytest'], + test_suite='tests', + classifiers=[ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Intended Audience :: Manufacturing", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: MIT License", + "Operating System :: Microsoft :: Windows", + "Operating System :: POSIX", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + "Topic :: System :: Hardware :: Hardware Drivers" + ], + cmdclass={'test': PyTest}, + package_data={pypi_name: ['VERSION']}, +) diff --git a/generated/nitclk/unit_tests/_matchers.py b/generated/nitclk/unit_tests/_matchers.py new file mode 100644 index 000000000..088232cea --- /dev/null +++ b/generated/nitclk/unit_tests/_matchers.py @@ -0,0 +1,302 @@ +# -*- coding: utf-8 -*- +# This file was generated +'''Matcher classes used by unit tests in order to set mock expectations. +These work well with our visatype definitions. +''' + +import ctypes +import nitclk._visatype as _visatype +import pprint + +pp = pprint.PrettyPrinter(indent=4) + + +# Base classes + + +class _ScalarMatcher(object): + def __init__(self, expected_type, expected_value): + self.expected_type = expected_type + self.expected_value = expected_value + + def __eq__(self, other): + if not isinstance(other, self.expected_type): + print("{0}: Unexpected type. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_type, type(other))) + return False + if other.value != self.expected_value: + print("{0}: Unexpected value. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_value, other.value)) + return False + return True + + def __repr__(self): + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) + + +class _PointerMatcher(object): + def __init__(self, expected_type): + self.expected_type = expected_type + + def __eq__(self, other): + if not isinstance(other, ctypes.POINTER(self.expected_type)): + print("Unexpected type. Expected: {0}. Received: {1}".format(ctypes.POINTER(self.expected_type), type(other))) + return False + return True + + def __repr__(self): + return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_type)) + + +class _BufferMatcher(object): + def __init__(self, expected_element_type, expected_size_or_value): + if isinstance(expected_size_or_value, int): + # Were given the size of the buffer + self.expected_value = None + self.expected_size = expected_size_or_value + else: + # Were given a list or something that behaves like a list + self.expected_value = expected_size_or_value + self.expected_size = len(expected_size_or_value) + self.expected_type = expected_element_type * self.expected_size + # Store params for __repr__ + self._expected_element_type = expected_element_type + self._expected_size_or_value = expected_size_or_value + + def __eq__(self, other): + if not isinstance(other, self.expected_type): + # We try to "dereference" this in case it is a pointer and then do the check again. Only then saying they don't match + try: + other = other.contents + except AttributeError: + pass + + # Because of object lifetimes, we may need to mock the other instance and provide lists instead of the actual array + if not isinstance(other, self.expected_type) and not isinstance(other, list): + print("Unexpected type. Expected: {0} or {1}. Received: {2}".format(self.expected_type, list, type(other))) + return False + if self.expected_size != len(other): + print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(other))) + return False + if self.expected_value is not None: + # Can't compare the objects directly because they're different types (one is list, another is ctypes array). + # Go element by element, which allows for reporting the first index where different values were found. + for i in range(0, len(self.expected_value)): + if self.expected_value[i] != other[i]: + print("Unexpected value at index {0}. Expected: {1}. Received: {2}".format(i, self.expected_value[i], other[i])) + return False + return True + + def __repr__(self): + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self._expected_element_type), pp.pformat(self._expected_size_or_value)) + + def __str__(self): + ret_str = self.__repr__() + '\n' + ret_str += ' expected_type = ' + str(self.expected_type) + '\n' + ret_str += ' expected_value = ' + str(self.expected_value) + '\n' + ret_str += ' expected_size = ' + str(self.expected_size) + '\n' + return ret_str + + +# Strings + + +class ViStringMatcher(object): + def __init__(self, expected_string_value): + self.expected_string_value = expected_string_value + + def __eq__(self, other): + if not isinstance(other, ctypes.Array): + # We try to "dereference" this in case it is a pointer and then do the check again. Only then saying they don't match + try: + other = other.contents + except AttributeError: + pass + + if not isinstance(other, ctypes.Array): + print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(other))) + return False + if len(other) < len(self.expected_string_value) + 1: # +1 for NULL terminating character + print("Unexpected length in C string. Expected at least: {0}. Received {1}".format(len(other), len(self.expected_string_value) + 1)) + return False + if not isinstance(other[0], bytes): + print("Unexpected type. Not a string. Received: {0}".format(type(other[0]))) + return False + if other.value.decode("ascii") != self.expected_string_value: + print("Unexpected value. Expected {0}. Received: {1}".format(self.expected_string_value, other.value.decode)) + return False + return True + + def __repr__(self): + return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_string_value)) + + +# Custom Type + + +def _compare_ctype_structs(expected, actual): + # From https://stackoverflow.com/questions/20986330/print-all-fields-of-ctypes-structure-with-introspection + for field in expected._fields_: + field_name = field[0] + expected_val = getattr(expected, field_name) + actual_val = getattr(actual, field_name) + if expected_val != actual_val: + print("Unexpected value field {0}. Expected: {1}. Received: {2}".format(field_name, expected_val, actual_val)) + return False + return True + + +class CustomTypeMatcher(object): + def __init__(self, expected_type, expected_value): + self.expected_type = expected_type + self.expected_value = expected_value + + def __eq__(self, actual): + if not isinstance(actual, self.expected_type): + print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) + return False + return _compare_ctype_structs(self.expected_value, actual) + + def __repr__(self): + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) + + +class CustomTypeBufferMatcher(object): + def __init__(self, expected_element_type, expected_value): + self.expected_value = expected_value + self.expected_size = len(expected_value) + self.expected_type = expected_element_type * self.expected_size + self.expected_element_type = expected_element_type + + def __eq__(self, actual): + if not isinstance(actual, self.expected_type): + print("Unexpected array type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) + return False + if self.expected_size != len(actual): + print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(actual))) + return False + if self.expected_value is not None: + # Can't compare the objects directly because they're different types (one is list, another is ctypes array). + # Go element by element, which allows for reporting the first index where different values were found. + for a, e in zip(actual, self.expected_value): + if not isinstance(a, self.expected_element_type): + print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_element_type, type(a))) + return False + if not _compare_ctype_structs(e, a): + return False + return True + + def __repr__(self): + expected_val_repr = '[' + ', '.join([x.__repr__() for x in self.expected_value]) + ']' + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_element_type), expected_val_repr) + + def __str__(self): + ret_str = self.__repr__() + '\n' + ret_str += ' expected_type = ' + str(self.expected_type) + '\n' + ret_str += ' expected_size = ' + str(self.expected_size) + '\n' + return ret_str + + +# Scalars + + +class ViBooleanMatcher(_ScalarMatcher): + def __init__(self, expected_value): + _ScalarMatcher.__init__(self, _visatype.ViBoolean, 1 if expected_value is True else 0) + + +class ViSessionMatcher(_ScalarMatcher): + def __init__(self, expected_value): + _ScalarMatcher.__init__(self, _visatype.ViSession, expected_value) + + +class ViInt16Matcher(_ScalarMatcher): + def __init__(self, expected_value): + _ScalarMatcher.__init__(self, _visatype.ViInt16, expected_value) + + +class ViInt32Matcher(_ScalarMatcher): + def __init__(self, expected_value): + _ScalarMatcher.__init__(self, _visatype.ViInt32, expected_value) + + +class ViAttrMatcher(_ScalarMatcher): + def __init__(self, expected_value): + _ScalarMatcher.__init__(self, _visatype.ViAttr, expected_value) + + +class ViInt64Matcher(_ScalarMatcher): + def __init__(self, expected_value): + _ScalarMatcher.__init__(self, _visatype.ViInt64, expected_value) + + +class ViReal64Matcher(_ScalarMatcher): + def __init__(self, expected_value): + _ScalarMatcher.__init__(self, _visatype.ViReal64, expected_value) + + +# Pointers + + +class ViBooleanPointerMatcher(_PointerMatcher): + def __init__(self): + _PointerMatcher.__init__(self, _visatype.ViBoolean) + + +class ViSessionPointerMatcher(_PointerMatcher): + def __init__(self): + _PointerMatcher.__init__(self, _visatype.ViSession) + + +class ViInt16PointerMatcher(_PointerMatcher): + def __init__(self): + _PointerMatcher.__init__(self, _visatype.ViInt16) + + +class ViInt32PointerMatcher(_PointerMatcher): + def __init__(self): + _PointerMatcher.__init__(self, _visatype.ViInt32) + + +class ViInt64PointerMatcher(_PointerMatcher): + def __init__(self): + _PointerMatcher.__init__(self, _visatype.ViInt64) + + +class ViReal64PointerMatcher(_PointerMatcher): + def __init__(self): + _PointerMatcher.__init__(self, _visatype.ViReal64) + + +# Buffers + + +class ViBooleanBufferMatcher(_BufferMatcher): + def __init__(self, expected_size_or_value): + _BufferMatcher.__init__(self, _visatype.ViBoolean, expected_size_or_value) + + +class ViCharBufferMatcher(_BufferMatcher): + def __init__(self, expected_size_or_value): + _BufferMatcher.__init__(self, _visatype.ViChar, expected_size_or_value) + + +class ViInt16BufferMatcher(_BufferMatcher): + def __init__(self, expected_size_or_value): + _BufferMatcher.__init__(self, _visatype.ViInt16, expected_size_or_value) + + +class ViInt32BufferMatcher(_BufferMatcher): + def __init__(self, expected_size_or_value): + _BufferMatcher.__init__(self, _visatype.ViInt32, expected_size_or_value) + + +class ViInt64BufferMatcher(_BufferMatcher): + def __init__(self, expected_size_or_value): + _BufferMatcher.__init__(self, _visatype.ViInt64, expected_size_or_value) + + +class ViReal64BufferMatcher(_BufferMatcher): + def __init__(self, expected_size_or_value): + _BufferMatcher.__init__(self, _visatype.ViReal64, expected_size_or_value) + + + diff --git a/generated/nitclk/unit_tests/_mock_helper.py b/generated/nitclk/unit_tests/_mock_helper.py new file mode 100644 index 000000000..b3149e8d8 --- /dev/null +++ b/generated/nitclk/unit_tests/_mock_helper.py @@ -0,0 +1,210 @@ +# -*- coding: utf-8 -*- +# This file was generated +import sys # noqa: F401 - Not all mock_helpers will need this + + +class MockFunctionCallError(Exception): + def __init__(self, function, param=None): + self.function = function + self.param = param + msg = "{0} called without setting side_effect".format(self.function) + if param is not None: + msg += " or setting the {0} parameter return value".format(self.param) + super(Exception, self).__init__(msg) + + +class SideEffectsHelper(object): + def __init__(self): + self._defaults = {} + self._defaults['ConfigureForHomogeneousTriggers'] = {} + self._defaults['ConfigureForHomogeneousTriggers']['return'] = 0 + self._defaults['FinishSyncPulseSenderSynchronize'] = {} + self._defaults['FinishSyncPulseSenderSynchronize']['return'] = 0 + self._defaults['GetAttributeViBoolean'] = {} + self._defaults['GetAttributeViBoolean']['return'] = 0 + self._defaults['GetAttributeViBoolean']['value'] = None + self._defaults['GetAttributeViReal64'] = {} + self._defaults['GetAttributeViReal64']['return'] = 0 + self._defaults['GetAttributeViReal64']['value'] = None + self._defaults['GetAttributeViSession'] = {} + self._defaults['GetAttributeViSession']['return'] = 0 + self._defaults['GetAttributeViSession']['value'] = None + self._defaults['GetAttributeViString'] = {} + self._defaults['GetAttributeViString']['return'] = 0 + self._defaults['GetExtendedErrorInfo'] = {} + self._defaults['GetExtendedErrorInfo']['return'] = 0 + self._defaults['GetExtendedErrorInfo']['errorString'] = None + self._defaults['Initiate'] = {} + self._defaults['Initiate']['return'] = 0 + self._defaults['IsDone'] = {} + self._defaults['IsDone']['return'] = 0 + self._defaults['IsDone']['done'] = None + self._defaults['SetAttributeViBoolean'] = {} + self._defaults['SetAttributeViBoolean']['return'] = 0 + self._defaults['SetAttributeViReal64'] = {} + self._defaults['SetAttributeViReal64']['return'] = 0 + self._defaults['SetAttributeViSession'] = {} + self._defaults['SetAttributeViSession']['return'] = 0 + self._defaults['SetAttributeViString'] = {} + self._defaults['SetAttributeViString']['return'] = 0 + self._defaults['SetupForSyncPulseSenderSynchronize'] = {} + self._defaults['SetupForSyncPulseSenderSynchronize']['return'] = 0 + self._defaults['Synchronize'] = {} + self._defaults['Synchronize']['return'] = 0 + self._defaults['SynchronizeToSyncPulseSender'] = {} + self._defaults['SynchronizeToSyncPulseSender']['return'] = 0 + self._defaults['WaitUntilDone'] = {} + self._defaults['WaitUntilDone']['return'] = 0 + + def __getitem__(self, func): + return self._defaults[func] + + def __setitem__(self, func, val): + self._defaults[func] = val + + def niTClk_ConfigureForHomogeneousTriggers(self, session_count, sessions): # noqa: N802 + if self._defaults['ConfigureForHomogeneousTriggers']['return'] != 0: + return self._defaults['ConfigureForHomogeneousTriggers']['return'] + return self._defaults['ConfigureForHomogeneousTriggers']['return'] + + def niTClk_FinishSyncPulseSenderSynchronize(self, session_count, sessions, min_time): # noqa: N802 + if self._defaults['FinishSyncPulseSenderSynchronize']['return'] != 0: + return self._defaults['FinishSyncPulseSenderSynchronize']['return'] + return self._defaults['FinishSyncPulseSenderSynchronize']['return'] + + def niTClk_GetAttributeViBoolean(self, session, channel_name, attribute_id, value): # noqa: N802 + if self._defaults['GetAttributeViBoolean']['return'] != 0: + return self._defaults['GetAttributeViBoolean']['return'] + # value + if self._defaults['GetAttributeViBoolean']['value'] is None: + raise MockFunctionCallError("niTClk_GetAttributeViBoolean", param='value') + if value is not None: + value.contents.value = self._defaults['GetAttributeViBoolean']['value'] + return self._defaults['GetAttributeViBoolean']['return'] + + def niTClk_GetAttributeViReal64(self, session, channel_name, attribute_id, value): # noqa: N802 + if self._defaults['GetAttributeViReal64']['return'] != 0: + return self._defaults['GetAttributeViReal64']['return'] + # value + if self._defaults['GetAttributeViReal64']['value'] is None: + raise MockFunctionCallError("niTClk_GetAttributeViReal64", param='value') + if value is not None: + value.contents.value = self._defaults['GetAttributeViReal64']['value'] + return self._defaults['GetAttributeViReal64']['return'] + + def niTClk_GetAttributeViSession(self, session, channel_name, attribute_id, value): # noqa: N802 + if self._defaults['GetAttributeViSession']['return'] != 0: + return self._defaults['GetAttributeViSession']['return'] + # value + if self._defaults['GetAttributeViSession']['value'] is None: + raise MockFunctionCallError("niTClk_GetAttributeViSession", param='value') + if value is not None: + value.contents.value = self._defaults['GetAttributeViSession']['value'] + return self._defaults['GetAttributeViSession']['return'] + + def niTClk_GetAttributeViString(self, session, channel_name, attribute_id, buf_size, value): # noqa: N802 + if self._defaults['GetAttributeViString']['return'] != 0: + return self._defaults['GetAttributeViString']['return'] + return self._defaults['GetAttributeViString']['return'] + + def niTClk_GetExtendedErrorInfo(self, error_string, error_string_size): # noqa: N802 + if self._defaults['GetExtendedErrorInfo']['return'] != 0: + return self._defaults['GetExtendedErrorInfo']['return'] + if self._defaults['GetExtendedErrorInfo']['errorString'] is None: + raise MockFunctionCallError("niTClk_GetExtendedErrorInfo", param='errorString') + if error_string_size.value == 0: + return len(self._defaults['GetExtendedErrorInfo']['errorString']) + error_string.value = self._defaults['GetExtendedErrorInfo']['errorString'].encode('ascii') + return self._defaults['GetExtendedErrorInfo']['return'] + + def niTClk_Initiate(self, session_count, sessions): # noqa: N802 + if self._defaults['Initiate']['return'] != 0: + return self._defaults['Initiate']['return'] + return self._defaults['Initiate']['return'] + + def niTClk_IsDone(self, session_count, sessions, done): # noqa: N802 + if self._defaults['IsDone']['return'] != 0: + return self._defaults['IsDone']['return'] + # done + if self._defaults['IsDone']['done'] is None: + raise MockFunctionCallError("niTClk_IsDone", param='done') + if done is not None: + done.contents.value = self._defaults['IsDone']['done'] + return self._defaults['IsDone']['return'] + + def niTClk_SetAttributeViBoolean(self, session, channel_name, attribute_id, value): # noqa: N802 + if self._defaults['SetAttributeViBoolean']['return'] != 0: + return self._defaults['SetAttributeViBoolean']['return'] + return self._defaults['SetAttributeViBoolean']['return'] + + def niTClk_SetAttributeViReal64(self, session, channel_name, attribute_id, value): # noqa: N802 + if self._defaults['SetAttributeViReal64']['return'] != 0: + return self._defaults['SetAttributeViReal64']['return'] + return self._defaults['SetAttributeViReal64']['return'] + + def niTClk_SetAttributeViSession(self, session, channel_name, attribute_id, value): # noqa: N802 + if self._defaults['SetAttributeViSession']['return'] != 0: + return self._defaults['SetAttributeViSession']['return'] + return self._defaults['SetAttributeViSession']['return'] + + def niTClk_SetAttributeViString(self, session, channel_name, attribute_id, value): # noqa: N802 + if self._defaults['SetAttributeViString']['return'] != 0: + return self._defaults['SetAttributeViString']['return'] + return self._defaults['SetAttributeViString']['return'] + + def niTClk_SetupForSyncPulseSenderSynchronize(self, session_count, sessions, min_time): # noqa: N802 + if self._defaults['SetupForSyncPulseSenderSynchronize']['return'] != 0: + return self._defaults['SetupForSyncPulseSenderSynchronize']['return'] + return self._defaults['SetupForSyncPulseSenderSynchronize']['return'] + + def niTClk_Synchronize(self, session_count, sessions, min_tclk_period): # noqa: N802 + if self._defaults['Synchronize']['return'] != 0: + return self._defaults['Synchronize']['return'] + return self._defaults['Synchronize']['return'] + + def niTClk_SynchronizeToSyncPulseSender(self, session_count, sessions, min_time): # noqa: N802 + if self._defaults['SynchronizeToSyncPulseSender']['return'] != 0: + return self._defaults['SynchronizeToSyncPulseSender']['return'] + return self._defaults['SynchronizeToSyncPulseSender']['return'] + + def niTClk_WaitUntilDone(self, session_count, sessions, timeout): # noqa: N802 + if self._defaults['WaitUntilDone']['return'] != 0: + return self._defaults['WaitUntilDone']['return'] + return self._defaults['WaitUntilDone']['return'] + + # Helper function to setup Mock object with default side effects and return values + def set_side_effects_and_return_values(self, mock_library): + mock_library.niTClk_ConfigureForHomogeneousTriggers.side_effect = MockFunctionCallError("niTClk_ConfigureForHomogeneousTriggers") + mock_library.niTClk_ConfigureForHomogeneousTriggers.return_value = 0 + mock_library.niTClk_FinishSyncPulseSenderSynchronize.side_effect = MockFunctionCallError("niTClk_FinishSyncPulseSenderSynchronize") + mock_library.niTClk_FinishSyncPulseSenderSynchronize.return_value = 0 + mock_library.niTClk_GetAttributeViBoolean.side_effect = MockFunctionCallError("niTClk_GetAttributeViBoolean") + mock_library.niTClk_GetAttributeViBoolean.return_value = 0 + mock_library.niTClk_GetAttributeViReal64.side_effect = MockFunctionCallError("niTClk_GetAttributeViReal64") + mock_library.niTClk_GetAttributeViReal64.return_value = 0 + mock_library.niTClk_GetAttributeViSession.side_effect = MockFunctionCallError("niTClk_GetAttributeViSession") + mock_library.niTClk_GetAttributeViSession.return_value = 0 + mock_library.niTClk_GetAttributeViString.side_effect = MockFunctionCallError("niTClk_GetAttributeViString") + mock_library.niTClk_GetAttributeViString.return_value = 0 + mock_library.niTClk_GetExtendedErrorInfo.side_effect = MockFunctionCallError("niTClk_GetExtendedErrorInfo") + mock_library.niTClk_GetExtendedErrorInfo.return_value = 0 + mock_library.niTClk_Initiate.side_effect = MockFunctionCallError("niTClk_Initiate") + mock_library.niTClk_Initiate.return_value = 0 + mock_library.niTClk_IsDone.side_effect = MockFunctionCallError("niTClk_IsDone") + mock_library.niTClk_IsDone.return_value = 0 + mock_library.niTClk_SetAttributeViBoolean.side_effect = MockFunctionCallError("niTClk_SetAttributeViBoolean") + mock_library.niTClk_SetAttributeViBoolean.return_value = 0 + mock_library.niTClk_SetAttributeViReal64.side_effect = MockFunctionCallError("niTClk_SetAttributeViReal64") + mock_library.niTClk_SetAttributeViReal64.return_value = 0 + mock_library.niTClk_SetAttributeViSession.side_effect = MockFunctionCallError("niTClk_SetAttributeViSession") + mock_library.niTClk_SetAttributeViSession.return_value = 0 + mock_library.niTClk_SetAttributeViString.side_effect = MockFunctionCallError("niTClk_SetAttributeViString") + mock_library.niTClk_SetAttributeViString.return_value = 0 + mock_library.niTClk_SetupForSyncPulseSenderSynchronize.side_effect = MockFunctionCallError("niTClk_SetupForSyncPulseSenderSynchronize") + mock_library.niTClk_SetupForSyncPulseSenderSynchronize.return_value = 0 + mock_library.niTClk_Synchronize.side_effect = MockFunctionCallError("niTClk_Synchronize") + mock_library.niTClk_Synchronize.return_value = 0 + mock_library.niTClk_SynchronizeToSyncPulseSender.side_effect = MockFunctionCallError("niTClk_SynchronizeToSyncPulseSender") + mock_library.niTClk_SynchronizeToSyncPulseSender.return_value = 0 + mock_library.niTClk_WaitUntilDone.side_effect = MockFunctionCallError("niTClk_WaitUntilDone") + mock_library.niTClk_WaitUntilDone.return_value = 0 diff --git a/src/nidcpower/metadata/functions_addon.py b/src/nidcpower/metadata/functions_addon.py index 926a0303b..67cdbc943 100644 --- a/src/nidcpower/metadata/functions_addon.py +++ b/src/nidcpower/metadata/functions_addon.py @@ -5,3 +5,4 @@ } + diff --git a/src/nimodinst/nimodinst.mak b/src/nimodinst/nimodinst.mak index 64a44deea..dafe9b398 100644 --- a/src/nimodinst/nimodinst.mak +++ b/src/nimodinst/nimodinst.mak @@ -15,6 +15,4 @@ include $(BUILD_HELPER_DIR)/rules.mak $(MODULE_DIR)/session.py: $(DRIVER_DIR)/templates/session.py.mako $(BUILD_HELPER_SCRIPTS) $(METADATA_FILES) $(call trace_to_console, "Generating",$@) $(_hide_cmds)$(call GENERATE_SCRIPT, $<, $(MODULE_DIR), $(METADATA_DIR)) -# Need to signal the top level makefile to run tests again - $(_hide_cmds)$(call trigger_unit_tests) diff --git a/src/nitclk/examples/nitclk_configure.py b/src/nitclk/examples/nitclk_configure.py new file mode 100644 index 000000000..f79d6d63b --- /dev/null +++ b/src/nitclk/examples/nitclk_configure.py @@ -0,0 +1,42 @@ +#!/usr/bin/python + +import argparse +import nitclk +import pprint +import sys + +pp = pprint.PrettyPrinter(indent=4, width=80) + + +def example(resource_name, channels, options, length, voltage): + pass + + +def _main(argsv): + parser = argparse.ArgumentParser(description='Acquires one record from the given channels.', formatter_class=argparse.ArgumentDefaultsHelpFormatter) + parser.add_argument('-n', '--resource-name', default='PXI1Slot2', help='Resource name of a National Instruments Digitizer') + parser.add_argument('-c', '--channels', default='0', help='Channel(s) to use') + parser.add_argument('-l', '--length', default=1000, type=int, help='Measure record length') + parser.add_argument('-v', '--voltage', default=1.0, type=float, help='Voltage range (V)') + parser.add_argument('-op', '--option-string', default='', type=str, help='Option string') + args = parser.parse_args(argsv) + example(args.resource_name, args.channels, args.option_string, args.length, args.voltage) + + +def main(): + _main(sys.argv[1:]) + + +def test_example(): + options = {'simulate': True, 'driver_setup': {'Model': '5164', 'BoardType': 'PXIe', }, } + example('PXI1Slot2', '0', options, 1000, 1.0) + + +def test_main(): + cmd_line = ['--option-string', 'Simulate=1, DriverSetup=Model:5164; BoardType:PXIe', ] + _main(cmd_line) + + +if __name__ == '__main__': + main() + diff --git a/src/nitclk/metadata/__init__.py b/src/nitclk/metadata/__init__.py new file mode 100644 index 000000000..736945551 --- /dev/null +++ b/src/nitclk/metadata/__init__.py @@ -0,0 +1,19 @@ +from metadata.config import config +from metadata.functions import functions +from metadata.attributes import attributes +from metadata.enums import enums +import metadata.functions_addon +import metadata.attributes_addon +import metadata.enums_addon +import metadata.config_addon + +import build.helper as helper +import sys + +# Update generated functions data with hand maintained data +config['modules'] = sys.modules +helper.add_all_metadata(functions, attributes, enums, config) + +__version__ = config['module_version'] + + diff --git a/src/nitclk/metadata/attributes.py b/src/nitclk/metadata/attributes.py new file mode 100644 index 000000000..a7042a702 --- /dev/null +++ b/src/nitclk/metadata/attributes.py @@ -0,0 +1,147 @@ +# -*- coding: utf-8 -*- +# This file is generated from NI-TClk API metadata version 255.0.0d0 +attributes = { + 1: { + 'access': 'read-write', + 'channel_based': False, + 'documentation': { + 'description': "\nSpecifies the Sync Pulse source. This attribute is most often used when synchronizing a multichassis system.\nValues\nEmpty string\nPXI Devices - 'PXI_Trig0' through 'PXI_Trig7' and device-specific settings\nPCI Devices - 'RTSI_0' through 'RTSI_7' and device-specific settings\nExamples of Device-Specific Settings\n- NI PXI-5122 supports 'PFI0' and 'PFI1'\n- NI PXI-5421 supports 'PFI0', 'PFI1', 'PFI2', and 'PFI3'\n- NI PXI-6551/6552 supports 'PFI0', 'PFI1', 'PFI2', and 'PFI3'\nDefault Value - Empty string. This default value directs niTClk_Synchronize to set this attribute when all the synchronized devices are in one PXI chassis. To synchronize a multichassis system, you must set this attribute before calling niTClk_Synchronize.\n" + }, + 'lv_property': 'Sync Pulse Source', + 'name': 'SYNC_PULSE_SOURCE', + 'resettable': False, + 'type': 'ViString' + }, + 2: { + 'access': 'read-write', + 'channel_based': False, + 'documentation': { + 'description': "\nSpecifies the destination of the Sync Pulse. This attribute is most often used when synchronizing a multichassis system.\nValues\nEmpty string. Empty string is a valid value, indicating that the signal is not exported.\nPXI Devices - 'PXI_Trig0' through 'PXI_Trig7' and device-specific settings\nPCI Devices - 'RTSI_0' through 'RTSI_7' and device-specific settings\nExamples of Device-Specific Settings\n- NI PXI-5122 supports 'PFI0' and 'PFI1'\n- NI PXI-5421 supports 'PFI0', 'PFI1', 'PFI4', and 'PFI5'\n- NI PXI-6551/6552 supports 'PFI0', 'PFI1', 'PFI2', and 'PFI3'\nDefault Value is empty string\n" + }, + 'lv_property': 'Export Sync Pulse Output Terminal', + 'name': 'EXPORTED_SYNC_PULSE_OUTPUT_TERMINAL', + 'resettable': False, + 'type': 'ViString' + }, + 3: { + 'access': 'read-write', + 'attribute_class': 'AttributeViInt32SessionReference', + 'channel_based': False, + 'documentation': { + 'description': '\nSpecifies the start trigger master session.\nFor external triggers, the session that originally receives the trigger. For None (no trigger configured) or software triggers, the session that originally generates the trigger.\n' + }, + 'lv_property': 'Start Trigger Master Session', + 'name': 'START_TRIGGER_MASTER_SESSION', + 'resettable': False, + 'type': 'ViInt32', + 'type_in_documentation': 'nimi-python Session class, nitclk.SessionReference, NI-TClk Session Number' + }, + 4: { + 'access': 'read-write', + 'attribute_class': 'AttributeViInt32SessionReference', + 'channel_based': False, + 'documentation': { + 'description': '\nSpecifies the reference trigger master session.\nFor external triggers, the session that originally receives the trigger. For None (no trigger configured) or software triggers, the session that originally generates the trigger.\n' + }, + 'lv_property': 'Reference Trigger Master Session', + 'name': 'REF_TRIGGER_MASTER_SESSION', + 'resettable': False, + 'type': 'ViInt32', + 'type_in_documentation': 'nimi-python Session class, nitclk.SessionReference, NI-TClk Session Number' + }, + 5: { + 'access': 'read-write', + 'attribute_class': 'AttributeViInt32SessionReference', + 'channel_based': False, + 'documentation': { + 'description': '\nSpecifies the script trigger master session.\nFor external triggers, the session that originally receives the trigger. For None (no trigger configured) or software triggers, the session that originally generates the trigger.\n' + }, + 'lv_property': 'Script Trigger Master Session', + 'name': 'SCRIPT_TRIGGER_MASTER_SESSION', + 'resettable': False, + 'type': 'ViInt32', + 'type_in_documentation': 'nimi-python Session class, nitclk.SessionReference, NI-TClk Session Number' + }, + 6: { + 'access': 'read-write', + 'attribute_class': 'AttributeViInt32SessionReference', + 'channel_based': False, + 'documentation': { + 'description': '\nSpecifies the pause trigger master session.\nFor external triggers, the session that originally receives the trigger. For None (no trigger configured) or software triggers, the session that originally generates the trigger.\n' + }, + 'lv_property': 'Pause Trigger Master Session', + 'name': 'PAUSE_TRIGGER_MASTER_SESSION', + 'resettable': False, + 'type': 'ViInt32', + 'type_in_documentation': 'nimi-python Session class, nitclk.SessionReference, NI-TClk Session Number' + }, + 8: { + 'access': 'read only', + 'channel_based': False, + 'documentation': { + 'description': '\nIndicates the computed TClk period that will be used during the acquisition.\n' + }, + 'lv_property': 'Period', + 'name': 'TCLK_ACTUAL_PERIOD', + 'resettable': False, + 'type': 'ViReal64', + }, + 9: { + 'access': 'read-write', + 'channel_based': False, + 'documentation': { + 'description': "\nSpecifies the destination of the device's TClk signal.\nValues\nEmpty string. Empty string is a valid value, indicating that the signal is not exported.\nPXI Devices - 'PXI_Trig0' through 'PXI_Trig7' and device-specific settings\nPCI Devices - 'RTSI_0' through 'RTSI_7' and device-specific settings\nExamples of Device-Specific Settings\n- NI PXI-5122 supports 'PFI0' and 'PFI1'\n- NI PXI-5421 supports 'PFI0', 'PFI1', 'PFI4', and 'PFI5'\n- NI PXI-6551/6552 supports 'PFI0', 'PFI1', 'PFI2', and 'PFI3'\nDefault Value is empty string\n" + }, + 'lv_property': 'Output Terminal', + 'name': 'EXPORTED_TCLK_OUTPUT_TERMINAL', + 'resettable': False, + 'type': 'ViString', + }, + 10: { + 'access': 'read-write', + 'channel_based': False, + 'documentation': { + 'description': "\nSpecifies the Sync Pulse Clock source. This attribute is typically used to synchronize PCI devices when you want to control RTSI 7 yourself. Make sure that a 10 MHz clock is driven onto RTSI 7.\nValues\nPCI Devices - 'RTSI_7' and 'None'\nPXI Devices - 'PXI_CLK10' and 'None'\nDefault Value - 'None' directs niTClk_Synchronize to create the necessary routes. For PCI, one of the synchronized devices drives a 10 MHz clock on RTSI 7 unless that line is already being driven.\n" + }, + 'lv_property': 'Sync Pulse Clock Source', + 'name': 'SYNC_PULSE_CLOCK_SOURCE', + 'resettable': False, + 'type': 'ViString' + }, + 11: { + 'access': 'read-write', + 'channel_based': False, + 'documentation': { + 'description': '\nSpecifies the sample clock delay.\nSpecifies the delay, in seconds, to apply to the session sample clock relative to the other synchronized sessions. During synchronization, NI-TClk aligns the sample clocks on the synchronized devices. If you want to delay the sample clocks, set this attribute before calling niTClk_Synchronize.\nnot supported for acquisition sessions.\nValues - Between minus one and plus one period of the sample clock.\nOne sample clock period is equal to (1/sample clock rate). For example, for a session with sample rate of 100 MS/s, you can specify sample clock delays between -10.0 ns and +10.0 ns.\nDefault Value is 0\n', + 'note': 'Sample clock delay is supported for generation sessions only; it is' + }, + 'lv_property': 'Sample Clock Delay', + 'name': 'SAMPLE_CLOCK_DELAY', + 'resettable': False, + 'type': 'ViReal64' + }, + 13: { + 'access': 'read-write', + 'channel_based': False, + 'documentation': { + 'description': "\nSpecifies the external sync pulse source for the Sync Pulse Sender. You can use this source to synchronize the Sync Pulse Sender with an external non-TClk source.\nValues\nEmpty string. Empty string is a valid value, indicating that the signal is not exported.\nPXI Devices - 'PXI_Trig0' through 'PXI_Trig7' and device-specific settings\nPCI Devices - 'RTSI_0' through 'RTSI_7' and device-specific settings\nExamples of Device-Specific Settings\n- NI PXI-5122 supports 'PFI0' and 'PFI1'\n- NI PXI-5421 supports 'PFI0', 'PFI1', 'PFI4', and 'PFI5'\n- NI PXI-6551/6552 supports 'PFI0', 'PFI1', 'PFI2', and 'PFI3'\nDefault Value is empty string\n" + }, + 'lv_property': 'External Pulse Source', + 'name': 'SYNC_PULSE_SENDER_SYNC_PULSE_SOURCE', + 'resettable': False, + 'type': 'ViString' + }, + 16: { + 'access': 'read-write', + 'attribute_class': 'AttributeViInt32SessionReference', + 'channel_based': False, + 'documentation': { + 'description': '\nSpecifies the sequencer flag master session.\nFor external triggers, the session that originally receives the trigger.\nFor None (no trigger configured) or software triggers, the session that\noriginally generates the trigger.\n' + }, + 'lv_property': 'Sequencer Flag Master Session', + 'name': 'SEQUENCER_FLAG_MASTER_SESSION', + 'resettable': False, + 'type': 'ViInt32', + 'type_in_documentation': 'nimi-python Session class, nitclk.SessionReference, NI-TClk Session Number' + } +} diff --git a/src/nitclk/metadata/attributes_addon.py b/src/nitclk/metadata/attributes_addon.py new file mode 100644 index 000000000..395f33212 --- /dev/null +++ b/src/nitclk/metadata/attributes_addon.py @@ -0,0 +1,18 @@ +# These dictionaries are applied to the generated attributes dictionary at build time +# Any changes to the API should be made here. attributes.py is code generated + +# We are not code genning attributes that have been marked as obsolete prior to the initial +# Python API bindings release + +attributes_codegen_method = { +} + +attributes_converters = { +} + +attributes_enums = { +} + +# If the associated enum represents boolean values only, disconnect +attributes_remove_enum = { +} diff --git a/src/nitclk/metadata/config.py b/src/nitclk/metadata/config.py new file mode 100644 index 000000000..5d2b32e0e --- /dev/null +++ b/src/nitclk/metadata/config.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +# This file is generated from NI-TClk API metadata version 255.0.0d0 +config = { + 'api_version': '255.0.0d0', + 'c_function_prefix': 'niTClk_', + 'close_function': None, + 'context_manager_name': { + 'abort_function': None, + 'initiate_function': 'Initiate', + 'task': 'acquisition' + }, + 'custom_types': [ + ], + 'driver_name': 'NI-TClk', + 'init_function': 'InitForDocumentation', + 'library_info': { + 'Linux': { + '64bit': { + 'name': 'libnitclk.so', + 'type': 'cdll' + } + }, + 'Windows': { + '32bit': { + 'name': 'nitclk.dll', + 'type': 'windll' + }, + '64bit': { + 'name': 'nitclk_64.dll', + 'type': 'cdll' + } + } + }, + 'metadata_version': '2.0', + 'module_name': 'nitclk', + 'repeated_capabilities': [ + ], + 'session_class_description': 'An NI-TClk session.', + 'session_handle_parameter_name': 'session' +} diff --git a/src/nitclk/metadata/config_addon.py b/src/nitclk/metadata/config_addon.py new file mode 100644 index 000000000..6245f3081 --- /dev/null +++ b/src/nitclk/metadata/config_addon.py @@ -0,0 +1,5 @@ +# We need to maintain the version here since it needs to be updated by the build process on GitHub +config_additional_config = { + 'module_version': '0.1.0.dev0', + 'latest_runtime_version_tested_against': '18.0.0', +} diff --git a/src/nitclk/metadata/enums.py b/src/nitclk/metadata/enums.py new file mode 100644 index 000000000..cecf8a9f4 --- /dev/null +++ b/src/nitclk/metadata/enums.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# This file is generated from NI-TClk API metadata version 255.0.0d0 +enums = { +} diff --git a/src/nitclk/metadata/enums_addon.py b/src/nitclk/metadata/enums_addon.py new file mode 100644 index 000000000..74cd6913c --- /dev/null +++ b/src/nitclk/metadata/enums_addon.py @@ -0,0 +1,14 @@ +# These dictionaries are applied to the generated enums dictionary at build time +# Any changes to the API should be made here. attributes.py is code generated + +# We are not code genning enums that have been marked as obsolete prior to the initial +# Python API bindings release +# We also do not codegen enums associated with P2P or External Calibration since neither +# are supported in Python +enums_codegen_method = { +} + +enums_additional_enums = { +} + + diff --git a/src/nitclk/metadata/functions.py b/src/nitclk/metadata/functions.py new file mode 100644 index 000000000..abca1a5ae --- /dev/null +++ b/src/nitclk/metadata/functions.py @@ -0,0 +1,1177 @@ +# -*- coding: utf-8 -*- +# This file is generated from NI-TClk API metadata version 255.0.0d0 +functions = { + 'AdjustSyncPulseSenderTClkDivisors': { + 'codegen_method': 'no', + 'documentation': { + 'description': 'TBD' + }, + 'parameters': [ + { + 'direction': 'in', + 'name': 'sessionCount', + 'type': 'ViUInt32' + }, + { + 'direction': 'in', + 'name': 'sessions', + 'size': { + 'mechanism': 'TBD', + 'value': 'TBD' + }, + 'type': 'ViSession[]' + }, + { + 'direction': 'in', + 'name': 'tclkAdjustment', + 'type': 'ViReal64' + } + ], + 'returns': 'ViStatus' + }, + 'AdjustSyncPulseSenderTClkTimebase': { + 'codegen_method': 'no', + 'documentation': { + 'description': 'TBD' + }, + 'parameters': [ + { + 'direction': 'in', + 'name': 'sessionCount', + 'type': 'ViUInt32' + }, + { + 'direction': 'in', + 'name': 'sessions', + 'size': { + 'mechanism': 'TBD', + 'value': 'TBD' + }, + 'type': 'ViSession[]' + }, + { + 'direction': 'in', + 'name': 'tclkAdjustment', + 'type': 'ViReal64' + } + ], + 'returns': 'ViStatus' + }, + 'ConfigureForHomogeneousTriggers': { + 'documentation': { + 'description': '\nConfigures the attributes commonly required for the TClk synchronization\nof device sessions with homogeneous triggers in a single PXI chassis or\na single PC. Use niTClk_ConfigureForHomogeneousTriggers to configure\nthe attributes for the reference clocks, start triggers, reference\ntriggers, script triggers, and pause triggers. If\nniTClk_ConfigureForHomogeneousTriggers cannot perform all the steps\nappropriate for the given sessions, it returns an error. If an error is\nreturned, use the instrument driver functions and attributes for signal\nrouting, along with the following NI-TClk attributes:\nNITCLK_ATTR_START_TRIGGER_MASTER_SESSION\nNITCLK_ATTR_REF_TRIGGER_MASTER_SESSION\nNITCLK_ATTR_SCRIPT_TRIGGER_MASTER_SESSION\nNITCLK_ATTR_PAUSE_TRIGGER_MASTER_SESSION\nniTClk_ConfigureForHomogeneousTriggers affects the following clocks and\ntriggers: - Reference clocks - Start triggers - Reference triggers -\nScript triggers - Pause triggers Reference Clocks\nniTClk_ConfigureForHomogeneousTriggers configures the reference clocks\nif they are needed. Specifically, if the internal sample clocks or\ninternal sample clock timebases are used, and the reference clock source\nis not configured--or is set to None (no trigger\nconfigured)--niTClk_ConfigureForHomogeneousTriggers configures the\nfollowing: PXI--The reference clock source on all devices is set to be\nthe 10 MHz PXI backplane clock (PXI_CLK10). PCI--One of the devices\nexports its 10 MHz onboard reference clock to RTSI 7. The reference\nclock source on all devices is set to be RTSI 7. Note: If the reference\nclock source is set to a value other than None,\nniTClk_ConfigureForHomogeneousTriggers cannot configure the reference\nclock source. Start Triggers If the start trigger is set to None (no\ntrigger configured) for all sessions, the sessions are configured to\nshare the start trigger. The start trigger is shared by: - Implicitly\nexporting the start trigger from one session - Configuring the other\nsessions for digital edge start triggers with sources corresponding to\nthe exported start trigger - Setting\nNITCLK_ATTR_START_TRIGGER_MASTER_SESSION to the session that is\nexporting the trigger for all sessions If the start triggers are None\nfor all except one session, niTClk_ConfigureForHomogeneousTriggers\nconfigures the sessions to share the start trigger from the one excepted\nsession. The start trigger is shared by: - Implicitly exporting start\ntrigger from the session with the start trigger that is not None -\nConfiguring the other sessions for digital-edge start triggers with\nsources corresponding to the exported start trigger - Setting\nNITCLK_ATTR_START_TRIGGER_MASTER_SESSION to the session that is\nexporting the trigger for all sessions If start triggers are configured\nfor all sessions, niTClk_ConfigureForHomogeneousTriggers does not\naffect the start triggers. Start triggers are considered to be\nconfigured for all sessions if either of the following conditions is\ntrue: - No session has a start trigger that is None - One session has a\nstart trigger that is None, and all other sessions have start triggers\nother than None. The one session with the None trigger must have\nNITCLK_ATTR_START_TRIGGER_MASTER_SESSION set to itself, indicating\nthat the session itself is the start trigger master Reference Triggers\nniTClk_ConfigureForHomogeneousTriggers configures sessions that support\nreference triggers to share the reference triggers if the reference\ntriggers are None (no trigger configured) for all except one session.\nThe reference triggers are shared by: - Implicitly exporting the\nreference trigger from the session whose reference trigger is not None -\nConfiguring the other sessions that support the reference trigger for\ndigital-edge reference triggers with sources corresponding to the\nexported reference trigger - Setting\nNITCLK_ATTR_REF_TRIGGER_MASTER_SESSION to the session that is\nexporting the trigger for all sessions that support reference trigger If\nthe reference triggers are configured for all sessions that support\nreference triggers, niTClk_ConfigureForHomogeneousTriggers does not\naffect the reference triggers. Reference triggers are considered to be\nconfigured for all sessions if either one or the other of the following\nconditions is true: - No session has a reference trigger that is None -\nOne session has a reference trigger that is None, and all other sessions\nhave reference triggers other than None. The one session with the None\ntrigger must have NITCLK_ATTR_REF_TRIGGER_MASTER_SESSION set to\nitself, indicating that the session itself is the reference trigger\nmaster Reference Trigger Holdoffs Acquisition sessions may be configured\nwith the reference trigger. For acquisition sessions, when the reference\ntrigger is shared, niTClk_ConfigureForHomogeneousTriggers configures\nthe holdoff attributes (which are instrument driver specific) on the\nreference trigger master session so that the session does not recognize\nthe reference trigger before the other sessions are ready. This\ncondition is only relevant when the sample clock rates, sample clock\ntimebase rates, sample counts, holdoffs, and/or any delays for the\nacquisitions are different. When the sample clock rates, sample clock\ntimebase rates, and/or the sample counts are different in acquisition\nsessions sharing the reference trigger, you should also set the holdoff\nattributes for the reference trigger master using the instrument driver.\nScript Triggers niTClk_ConfigureForHomogeneousTriggers configures\nsessions that support script triggers to share them, if the script\ntriggers are None (no trigger configured) for all except one session.\nThe script triggers are shared in the following ways: - Implicitly\nexporting the script trigger from the session whose script trigger is\nnot None - Configuring the other sessions that support the script\ntrigger for digital-edge script triggers with sources corresponding to\nthe exported script trigger - Setting\nNITCLK_ATTR_SCRIPT_TRIGGER_MASTER_SESSION to the session that is\nexporting the trigger for all sessions that support script triggers If\nthe script triggers are configured for all sessions that support script\ntriggers, niTClk_ConfigureForHomogeneousTriggers does not affect script\ntriggers. Script triggers are considered to be configured for all\nsessions if either one or the other of the following conditions are\ntrue: - No session has a script trigger that is None - One session has a\nscript trigger that is None and all other sessions have script triggers\nother than None. The one session with the None trigger must have\nNITCLK_ATTR_SCRIPT_TRIGGER_MASTER_SESSION set to itself, indicating\nthat the session itself is the script trigger master Pause Triggers\nniTClk_ConfigureForHomogeneousTriggers configures generation sessions\nthat support pause triggers to share them, if the pause triggers are\nNone (no trigger configured) for all except one session. The pause\ntriggers are shared by: - Implicitly exporting the pause trigger from\nthe session whose script trigger is not None - Configuring the other\nsessions that support the pause trigger for digital-edge pause triggers\nwith sources corresponding to the exported pause trigger - Setting\nNITCLK_ATTR_PAUSE_TRIGGER_MASTER_SESSION to the session that is\nexporting the trigger for all sessions that support script triggers If\nthe pause triggers are configured for all generation sessions that\nsupport pause triggers, niTClk_ConfigureForHomogeneousTriggers does not\naffect pause triggers. Pause triggers are considered to be configured\nfor all sessions if either one or the other of the following conditions\nis true: - No session has a pause trigger that is None - One session has\na pause trigger that is None and all other sessions have pause triggers\nother than None. The one session with the None trigger must have\nNITCLK_ATTR_PAUSE_TRIGGER_MASTER_SESSION set to itself, indicating\nthat the session itself is the pause trigger master Note: TClk\nsynchronization is not supported for pause triggers on acquisition\nsessions.\n' + }, + 'parameters': [ + { + 'direction': 'in', + 'documentation': { + 'description': 'Number of elements in the sessions array' + }, + 'name': 'sessionCount', + 'type': 'ViUInt32' + }, + { + 'direction': 'in', + 'documentation': { + 'description': 'sessions is an array of sessions that are being synchronized.' + }, + 'python_api_converter_name': 'convert_to_nitclk_session_num_list', + 'name': 'sessions', + 'is_session_handle': False, + 'size': { + 'mechanism': 'len', + 'value': 'sessionCount' + }, + 'type': 'ViSession[]' + } + ], + 'returns': 'ViStatus' + }, + 'CorrespondingCAttrId': { + 'codegen_method': 'no', + 'documentation': { + 'description': 'TBD' + }, + 'parameters': [ + { + 'direction': 'in', + 'name': 'labviewAttrId', + 'type': 'ViUInt32' + } + ], + 'returns': 'ViUInt32' + }, + 'FinishSyncPulseSenderSynchronize': { + 'documentation': { + 'description': 'TBD' + }, + 'parameters': [ + { + 'direction': 'in', + 'documentation': { + 'description': 'Number of elements in the sessions array' + }, + 'name': 'sessionCount', + 'type': 'ViUInt32' + }, + { + 'direction': 'in', + 'documentation': { + 'description': 'sessions is an array of sessions that are being synchronized.' + }, + 'is_session_handle': False, + 'name': 'sessions', + 'python_api_converter_name': 'convert_to_nitclk_session_num_list', + 'size': { + 'mechanism': 'len', + 'value': 'sessionCount' + }, + 'type': 'ViSession[]' + }, + { + 'direction': 'in', + 'documentation': { + 'description': '\nMinimal period of TClk, expressed in seconds. Supported values are\nbetween 0.0 s and 0.050 s (50 ms). Minimal period for a single\nchassis/PC is 200 ns. If the specified value is less than 200 ns,\nNI-TClk automatically coerces minTime to 200 ns. For multichassis\nsynchronization, adjust this value to account for propagation delays\nthrough the various devices and cables.\n' + }, + 'name': 'minTime', + 'type': 'ViReal64' + } + ], + 'returns': 'ViStatus' + }, + 'FinishSyncPulseSenderSynchronizeWithAdjustmentType': { + 'codegen_method': 'no', + 'documentation': { + 'description': 'TBD' + }, + 'parameters': [ + { + 'direction': 'in', + 'name': 'sessionCount', + 'type': 'ViUInt32' + }, + { + 'direction': 'in', + 'name': 'sessions', + 'size': { + 'mechanism': 'TBD', + 'value': 'TBD' + }, + 'type': 'ViSession[]' + }, + { + 'direction': 'in', + 'name': 'minTime', + 'type': 'ViReal64' + }, + { + 'direction': 'in', + 'name': 'adjustmentType', + 'type': 'ViUInt32' + } + ], + 'returns': 'ViStatus' + }, + 'GetAttributeViBoolean': { + 'codegen_method': 'private', + 'documentation': { + 'description': 'TBD' + }, + 'parameters': [ + { + 'direction': 'in', + 'name': 'session', + 'type': 'ViSession' + }, + { + 'direction': 'in', + 'name': 'channelName', + 'type': 'ViConstString' + }, + { + 'direction': 'in', + 'name': 'attributeId', + 'type': 'ViAttr' + }, + { + 'direction': 'out', + 'name': 'value', + 'type': 'ViBoolean' + } + ], + 'returns': 'ViStatus' + }, + 'GetAttributeViReal64': { + 'codegen_method': 'private', + 'documentation': { + 'description': 'Gets the value of an NI-TClk ViReal64 attribute.' + }, + 'parameters': [ + { + 'direction': 'in', + 'documentation': { + 'description': 'session references the sessions being synchronized.' + }, + 'name': 'session', + 'type': 'ViSession' + }, + { + 'direction': 'in', + 'documentation': { + 'description': 'Pass VI_NULL or an empty string' + }, + 'name': 'channelName', + 'type': 'ViConstString' + }, + { + 'direction': 'in', + 'documentation': { + 'description': '\nThe ID of the attribute that you want to get Supported Attribute\nNITCLK_ATTR_SAMPLE_CLOCK_DELAY\n' + }, + 'name': 'attributeId', + 'type': 'ViAttr' + }, + { + 'direction': 'out', + 'documentation': { + 'description': 'The value that you are getting' + }, + 'name': 'value', + 'type': 'ViReal64' + } + ], + 'returns': 'ViStatus' + }, + 'GetAttributeViSession': { + 'codegen_method': 'private', + 'documentation': { + 'description': 'Gets the value of an NI-TClk ViSession attribute.' + }, + 'parameters': [ + { + 'direction': 'in', + 'documentation': { + 'description': 'session references the sessions being synchronized.' + }, + 'name': 'session', + 'type': 'ViSession' + }, + { + 'direction': 'in', + 'documentation': { + 'description': '\nPass VI_NULL or an empty string, except for\nNITCLK_ATTR_SCRIPT_TRIGGER_MASTER_SESSION, for which you should\nspecify scriptTrigger0, scriptTrigger1, scriptTrigger2, or\nscriptTrigger3. VI_NULL and the empty string are treated as\nscriptTrigger0 for NITCLK_ATTR_SCRIPT_TRIGGER_MASTER_SESSION.\n' + }, + 'name': 'channelName', + 'type': 'ViConstString' + }, + { + 'direction': 'in', + 'documentation': { + 'description': '\nThe ID of the attribute that you want to set Supported Attributes\nNITCLK_ATTR_START_TRIGGER_MASTER_SESSION\nNITCLK_ATTR_REF_TRIGGER_MASTER_SESSION\nNITCLK_ATTR_SCRIPT_TRIGGER_MASTER_SESSION\nNITCLK_ATTR_PAUSE_TRIGGER_MASTER_SESSION\n' + }, + 'name': 'attributeId', + 'type': 'ViAttr' + }, + { + 'direction': 'out', + 'documentation': { + 'description': 'The value that you are getting' + }, + 'name': 'value', + 'type': 'ViSession' + } + ], + 'returns': 'ViStatus' + }, + 'GetAttributeViString': { + 'codegen_method': 'private', + 'documentation': { + 'description': '\nThis function queries the value of an NI-TClk ViString attribute. You\nmust provide a ViChar array to serve as a buffer for the value. You pass\nthe number of bytes in the buffer as bufSize. If the current value of\nthe attribute, including the terminating NULL byte, is larger than the\nsize you indicate in bufSize, the function copies bufSize minus 1 bytes\ninto the buffer, places an ASCII NULL byte at the end of the buffer, and\nreturns the array size that you must pass to get the entire value. For\nexample, if the value is "123456" and bufSize is 4, the function places\n"123" into the buffer and returns 7. If you want to call\nniTClk_GetAttributeViString just to get the required array size, pass 0\nfor bufSize and VI_NULL for the value.\n' + }, + 'parameters': [ + { + 'direction': 'in', + 'documentation': { + 'description': 'session references the sessions being synchronized.' + }, + 'name': 'session', + 'type': 'ViSession' + }, + { + 'direction': 'in', + 'documentation': { + 'description': 'Pass VI_NULL or an empty string' + }, + 'name': 'channelName', + 'type': 'ViConstString' + }, + { + 'direction': 'in', + 'documentation': { + 'description': '\nThe ID of the attribute that you want to get Supported Attributes\nNITCLK_ATTR_SYNC_PULSE_SOURCE\nNITCLK_ATTR_SYNC_PULSE_CLOCK_SOURCE\nNITCLK_ATTR_EXPORTED_SYNC_PULSE_OUTPUT_TERMINAL\n' + }, + 'name': 'attributeId', + 'type': 'ViAttr' + }, + { + 'direction': 'in', + 'documentation': { + 'description': '\nThe number of bytes in the ViChar array that you specify for the value\nparameter\n' + }, + 'name': 'bufSize', + 'type': 'ViInt32' + }, + { + 'direction': 'in', + 'documentation': { + 'description': 'The value that you are getting' + }, + 'name': 'value', + 'type': 'ViChar[]' + } + ], + 'returns': 'ViStatus' + }, + 'GetExtendedErrorInfo': { + 'codegen_method': 'private', + 'documentation': { + 'description': '\nReports extended error information for the most recent NI-TClk function\nthat returned an error. To establish the function that returned an\nerror, use the return values of the individual functions because once\nniTClk_GetExtendedErrorInfo reports an errorString, it does not report\nan empty string again.\n' + }, + 'is_error_handling': True, + 'parameters': [ + { + 'direction': 'out', + 'documentation': { + 'description': '\nExtended error description. If errorString is NULL, then it is not large\nenough to hold the entire error description. In this case, the return\nvalue of niTClk_GetExtendedErrorInfo is the size that you should use\nfor niTClk_GetExtendedErrorInfo to return the full error string.\n' + }, + 'name': 'errorString', + 'size': { + 'mechanism': 'ivi-dance', + 'value': 'errorStringSize' + }, + 'type': 'ViChar[]' + }, + { + 'direction': 'in', + 'documentation': { + 'description': '\nSize of the errorString. If errorStringSize is 0, then it is not large\nenough to hold the entire error description. In this case, the return\nvalue of niTClk_GetExtendedErrorInfo is the size that you should use\nfor niTClk_GetExtendedErrorInfo to return the full error string.\n' + }, + 'name': 'errorStringSize', + 'type': 'ViUInt32' + } + ], + 'returns': 'ViStatus' + }, + 'GetTClkAdjustmentForDistributedTClk': { + 'codegen_method': 'no', + 'documentation': { + 'description': 'TBD' + }, + 'parameters': [ + { + 'direction': 'in', + 'name': 'tclkPeriod', + 'type': 'ViReal64' + }, + { + 'direction': 'in', + 'name': 'measurementsForSenderSize', + 'type': 'ViUInt32' + }, + { + 'direction': 'in', + 'name': 'measurementsForSender', + 'size': { + 'mechanism': 'TBD', + 'value': 'TBD' + }, + 'type': 'ViReal64[]' + }, + { + 'direction': 'in', + 'name': 'measurementsForReceiverSize', + 'type': 'ViUInt32' + }, + { + 'direction': 'in', + 'name': 'measurementsForReceiver', + 'size': { + 'mechanism': 'TBD', + 'value': 'TBD' + }, + 'type': 'ViReal64[]' + }, + { + 'direction': 'out', + 'name': 'tclkAdjustment', + 'type': 'ViReal64' + } + ], + 'returns': 'ViStatus' + }, + 'GetTClkDriftInPpm': { + 'codegen_method': 'no', + 'documentation': { + 'description': 'TBD' + }, + 'parameters': [ + { + 'direction': 'in', + 'name': 'sessionCount', + 'type': 'ViUInt32' + }, + { + 'direction': 'in', + 'name': 'sessions', + 'size': { + 'mechanism': 'TBD', + 'value': 'TBD' + }, + 'type': 'ViSession[]' + }, + { + 'direction': 'in', + 'name': 'minTime', + 'type': 'ViReal64' + }, + { + 'direction': 'out', + 'name': 'maxTClkDriftInPpm', + 'type': 'ViReal64' + } + ], + 'returns': 'ViStatus' + }, + 'GetTClkMeasurementForExternalSyncPulse': { + 'codegen_method': 'no', + 'documentation': { + 'description': 'TBD' + }, + 'parameters': [ + { + 'direction': 'in', + 'name': 'session', + 'type': 'ViSession' + }, + { + 'direction': 'out', + 'name': 'measurement', + 'type': 'ViReal64' + } + ], + 'returns': 'ViStatus' + }, + 'InitForDocumentation': { + 'codegen_method': 'python-only', + 'documentation': { + 'description': 'TBD' + }, + 'parameters': [ + { + 'default_value': None, + 'direction': 'in', + 'documentation': { + 'description': 'Array of driver session object or sessions' + }, + 'name': 'sessionList', + 'type': 'ViSession' + } + ], + 'returns': 'ViStatus' + }, + 'Initiate': { + 'documentation': { + 'description': '\nInitiates the acquisition or generation sessions specified, taking into\nconsideration any special requirements needed for synchronization. For\nexample, the session exporting the TClk-synchronized start trigger is\nnot initiated until after niTClk_Initiate initiates all the sessions\nthat import the TClk-synchronized start trigger.\n' + }, + 'parameters': [ + { + 'direction': 'in', + 'documentation': { + 'description': 'Number of elements in the sessions array' + }, + 'name': 'sessionCount', + 'type': 'ViUInt32' + }, + { + 'direction': 'in', + 'documentation': { + 'description': 'sessions is an array of sessions that are being synchronized.' + }, + 'is_session_handle': False, + 'name': 'sessions', + 'python_api_converter_name': 'convert_to_nitclk_session_num_list', + 'size': { + 'mechanism': 'len', + 'value': 'sessionCount' + }, + 'type': 'ViSession[]' + } + ], + 'returns': 'ViStatus' + }, + 'InternalCalibrateTClkTdcIfNeeded': { + 'codegen_method': 'no', + 'documentation': { + 'description': 'TBD' + }, + 'parameters': [ + { + 'direction': 'in', + 'name': 'session', + 'type': 'ViUInt32' + } + ], + 'returns': 'ViInt32' + }, + 'InternalConnectTClkSyncPulseToTdc': { + 'codegen_method': 'no', + 'documentation': { + 'description': 'TBD' + }, + 'parameters': [ + { + 'direction': 'in', + 'name': 'session', + 'type': 'ViUInt32' + } + ], + 'returns': 'ViInt32' + }, + 'InternalDisconnectTClkSyncPulseFromTdc': { + 'codegen_method': 'no', + 'documentation': { + 'description': 'TBD' + }, + 'parameters': [ + { + 'direction': 'in', + 'name': 'session', + 'type': 'ViUInt32' + } + ], + 'returns': 'ViInt32' + }, + 'InternalFinishSyncPulseSenderSynchronize': { + 'codegen_method': 'no', + 'documentation': { + 'description': 'TBD' + }, + 'parameters': [ + { + 'direction': 'in', + 'name': 'sessionCount', + 'type': 'ViUInt32' + }, + { + 'direction': 'in', + 'name': 'sessions', + 'size': { + 'mechanism': 'TBD', + 'value': 'TBD' + }, + 'type': 'ViSession[]' + }, + { + 'direction': 'in', + 'name': 'minTime', + 'type': 'ViReal64' + }, + { + 'direction': 'in', + 'name': 'adjustment', + 'type': 'ViUInt32' + }, + { + 'direction': 'out', + 'name': 'measuredSyncPulseClkRefEdgeToTClkDelay', + 'type': 'ViReal64' + } + ], + 'returns': 'ViInt32' + }, + 'InternalGetRawCalTdcReadings': { + 'codegen_method': 'no', + 'documentation': { + 'description': 'TBD' + }, + 'parameters': [ + { + 'direction': 'in', + 'name': 'session', + 'type': 'ViUInt32' + }, + { + 'direction': 'in', + 'name': 'calPulseWidthInPicoSec', + 'type': 'ViUInt32' + }, + { + 'direction': 'in', + 'name': 'numReadings', + 'type': 'ViUInt32' + }, + { + 'direction': 'in', + 'name': 'rawReadings', + 'size': { + 'mechanism': 'TBD', + 'value': 'TBD' + }, + 'type': 'ViUInt32[]' + } + ], + 'returns': 'ViInt32' + }, + 'InternalGetRawTClkMeasurements': { + 'codegen_method': 'no', + 'documentation': { + 'description': 'TBD' + }, + 'parameters': [ + { + 'direction': 'in', + 'name': 'sessionCount', + 'type': 'ViUInt32' + }, + { + 'direction': 'in', + 'name': 'sessions', + 'size': { + 'mechanism': 'TBD', + 'value': 'TBD' + }, + 'type': 'ViUInt32[]' + }, + { + 'direction': 'in', + 'name': 'numberOfMeasurements', + 'type': 'ViUInt32' + }, + { + 'direction': 'out', + 'name': 'measurements', + 'type': 'ViReal64' + } + ], + 'returns': 'ViInt32' + }, + 'InternalGetTClkMeasurement': { + 'codegen_method': 'no', + 'documentation': { + 'description': 'TBD' + }, + 'parameters': [ + { + 'direction': 'in', + 'name': 'session', + 'type': 'ViUInt32' + }, + { + 'direction': 'out', + 'name': 'clk10Count', + 'type': 'ViUInt32' + }, + { + 'direction': 'out', + 'name': 'tClkTdcReading', + 'type': 'ViUInt32' + } + ], + 'returns': 'ViInt32' + }, + 'InternalGetTClkMeasurementForExternalSyncPulse': { + 'codegen_method': 'no', + 'documentation': { + 'description': 'TBD' + }, + 'parameters': [ + { + 'direction': 'in', + 'name': 'session', + 'type': 'ViUInt32' + }, + { + 'direction': 'out', + 'name': 'measurement', + 'type': 'ViReal64' + } + ], + 'returns': 'ViInt32' + }, + 'InternalMeasTClkDeltas': { + 'codegen_method': 'no', + 'documentation': { + 'description': 'TBD' + }, + 'parameters': [ + { + 'direction': 'in', + 'name': 'sessionCount', + 'type': 'ViUInt32' + }, + { + 'direction': 'in', + 'name': 'sessions', + 'size': { + 'mechanism': 'TBD', + 'value': 'TBD' + }, + 'type': 'ViUInt32[]' + }, + { + 'direction': 'in', + 'name': 'averagingFactor', + 'type': 'ViUInt32' + }, + { + 'direction': 'in', + 'name': 'tClkDeltas', + 'size': { + 'mechanism': 'TBD', + 'value': 'TBD' + }, + 'type': 'ViReal64[]' + } + ], + 'returns': 'ViInt32' + }, + 'InternalProgramTClkAndEnableTdc': { + 'codegen_method': 'no', + 'documentation': { + 'description': 'TBD' + }, + 'parameters': [ + { + 'direction': 'in', + 'name': 'session', + 'type': 'ViUInt32' + }, + { + 'direction': 'in', + 'name': 'tClkDivisor', + 'type': 'ViUInt32' + } + ], + 'returns': 'ViInt32' + }, + 'InternalTestAttributes': { + 'codegen_method': 'no', + 'documentation': { + 'description': 'TBD' + }, + 'parameters': [ + { + 'direction': 'in', + 'name': 'session', + 'type': 'ViUInt32' + } + ], + 'returns': 'ViInt32' + }, + 'IsDone': { + 'documentation': { + 'description': '\nMonitors the progress of the acquisitions and/or generations\ncorresponding to sessions.\n' + }, + 'parameters': [ + { + 'direction': 'in', + 'documentation': { + 'description': 'Number of elements in the sessions array' + }, + 'name': 'sessionCount', + 'type': 'ViUInt32' + }, + { + 'direction': 'in', + 'documentation': { + 'description': 'sessions is an array of sessions that are being synchronized.' + }, + 'is_session_handle': False, + 'name': 'sessions', + 'python_api_converter_name': 'convert_to_nitclk_session_num_list', + 'size': { + 'mechanism': 'len', + 'value': 'sessionCount' + }, + 'type': 'ViSession[]' + }, + { + 'direction': 'out', + 'documentation': { + 'description': '\nIndicates that the operation is done. The operation is done when each\nsession has completed without any errors or when any one of the sessions\nreports an error.\n' + }, + 'name': 'done', + 'type': 'ViBoolean' + } + ], + 'returns': 'ViStatus' + }, + 'SetAttributeViBoolean': { + 'codegen_method': 'private', + 'documentation': { + 'description': 'TBD' + }, + 'parameters': [ + { + 'direction': 'in', + 'name': 'session', + 'type': 'ViSession' + }, + { + 'direction': 'in', + 'name': 'channelName', + 'type': 'ViConstString' + }, + { + 'direction': 'in', + 'name': 'attributeId', + 'type': 'ViAttr' + }, + { + 'direction': 'in', + 'name': 'value', + 'type': 'ViBoolean' + } + ], + 'returns': 'ViStatus' + }, + 'SetAttributeViReal64': { + 'codegen_method': 'private', + 'documentation': { + 'description': '\nSets the value of an NI-TClk VIReal64 attribute.\nniTClk_SetAttributeViReal64 is a low-level function that you can use to\nset the values NI-TClk attributes. NI-TClk contains high-level functions\nthat set most of the attributes. It is best to use the high-level\nfunctions as much as possible.\n' + }, + 'parameters': [ + { + 'direction': 'in', + 'documentation': { + 'description': 'session references the sessions being synchronized.' + }, + 'name': 'session', + 'type': 'ViSession' + }, + { + 'direction': 'in', + 'documentation': { + 'description': 'Pass VI_NULL or an empty string' + }, + 'name': 'channelName', + 'type': 'ViConstString' + }, + { + 'direction': 'in', + 'documentation': { + 'description': '\nThe ID of the attribute that you want to set Supported Attribute\nNITCLK_ATTR_SAMPLE_CLOCK_DELAY\n' + }, + 'name': 'attributeId', + 'type': 'ViAttr' + }, + { + 'direction': 'in', + 'documentation': { + 'description': 'The value for the attribute' + }, + 'name': 'value', + 'type': 'ViReal64' + } + ], + 'returns': 'ViStatus' + }, + 'SetAttributeViSession': { + 'codegen_method': 'private', + 'documentation': { + 'description': '\nSets the value of an NI-TClk ViSession attribute.\nniTClk_SetAttributeViSession is a low-level function that you can use\nto set the values NI-TClk attributes. NI-TClk contains high-level\nfunctions that set most of the attributes. It is best to use the\nhigh-level functions as much as possible.\n' + }, + 'parameters': [ + { + 'direction': 'in', + 'documentation': { + 'description': 'session references the sessions being synchronized.' + }, + 'name': 'session', + 'type': 'ViSession' + }, + { + 'direction': 'in', + 'documentation': { + 'description': '\nPass VI_NULL or an empty string, except for\nNITCLK_ATTR_SCRIPT_TRIGGER_MASTER_SESSION, for which you should\nspecify scriptTrigger0, scriptTrigger1, scriptTrigger2, or\nscriptTrigger3. VI_NULL and the empty string are treated as\nscriptTrigger0 for NITCLK_ATTR_SCRIPT_TRIGGER_MASTER_SESSION.\n' + }, + 'name': 'channelName', + 'type': 'ViConstString' + }, + { + 'direction': 'in', + 'documentation': { + 'description': '\nThe ID of the attribute that you want to set Supported Attributes\nNITCLK_ATTR_START_TRIGGER_MASTER_SESSION\nNITCLK_ATTR_REF_TRIGGER_MASTER_SESSION\nNITCLK_ATTR_SCRIPT_TRIGGER_MASTER_SESSION\nNITCLK_ATTR_PAUSE_TRIGGER_MASTER_SESSION\n' + }, + 'name': 'attributeId', + 'type': 'ViAttr' + }, + { + 'direction': 'in', + 'documentation': { + 'description': 'The value for the attribute' + }, + 'name': 'value', + 'type': 'ViSession' + } + ], + 'returns': 'ViStatus' + }, + 'SetAttributeViString': { + 'codegen_method': 'private', + 'documentation': { + 'description': '\nSets the value of an NI-TClk VIString attribute.\nniTClk_SetAttributeViString is a low-level function that you can use to\nset the values of NI-TClk attributes. NI-TClk contain high-level\nfunctions that set most of the attributes. It is best to use the\nhigh-level functions as much as possible.\n' + }, + 'parameters': [ + { + 'direction': 'in', + 'documentation': { + 'description': 'session references the sessions being synchronized.' + }, + 'name': 'session', + 'type': 'ViSession' + }, + { + 'direction': 'in', + 'documentation': { + 'description': 'Pass VI_NULL or an empty string' + }, + 'name': 'channelName', + 'type': 'ViConstString' + }, + { + 'direction': 'in', + 'documentation': { + 'description': '\nPass the ID of the attribute that you want to set Supported Attributes\nNITCLK_ATTR_SYNC_PULSE_SOURCE\nNITCLK_ATTR_SYNC_PULSE_CLOCK_SOURCE\nNITCLK_ATTR_EXPORTED_SYNC_PULSE_OUTPUT_TERMINAL\n' + }, + 'name': 'attributeId', + 'type': 'ViAttr' + }, + { + 'direction': 'in', + 'documentation': { + 'description': 'Pass the value for the attribute' + }, + 'name': 'value', + 'type': 'ViConstString' + } + ], + 'returns': 'ViStatus' + }, + 'SetupForSyncPulseSenderSynchronize': { + 'documentation': { + 'description': 'TBD' + }, + 'parameters': [ + { + 'direction': 'in', + 'documentation': { + 'description': 'Number of elements in the sessions array' + }, + 'name': 'sessionCount', + 'type': 'ViUInt32' + }, + { + 'direction': 'in', + 'documentation': { + 'description': 'sessions is an array of sessions that are being synchronized.' + }, + 'is_session_handle': False, + 'name': 'sessions', + 'python_api_converter_name': 'convert_to_nitclk_session_num_list', + 'size': { + 'mechanism': 'len', + 'value': 'sessionCount' + }, + 'type': 'ViSession[]' + }, + { + 'direction': 'in', + 'documentation': { + 'description': '\nMinimal period of TClk, expressed in seconds. Supported values are\nbetween 0.0 s and 0.050 s (50 ms). Minimal period for a single\nchassis/PC is 200 ns. If the specified value is less than 200 ns,\nNI-TClk automatically coerces minTime to 200 ns. For multichassis\nsynchronization, adjust this value to account for propagation delays\nthrough the various devices and cables.\n' + }, + 'name': 'minTime', + 'type': 'ViReal64' + } + ], + 'returns': 'ViStatus' + }, + 'Synchronize': { + 'documentation': { + 'description': '\nSynchronizes the TClk signals on the given sessions. After\nniTClk_Synchronize executes, TClk signals from all sessions are\nsynchronized. Note: Before using this NI-TClk function, verify that your\nsystem is configured as specified in the PXI Trigger Lines and RTSI\nLines topic of the NI-TClk Synchronization Help. You can locate this\nhelp file at Start>>Programs>>National Instruments>>NI-TClk.\n' + }, + 'parameters': [ + { + 'direction': 'in', + 'documentation': { + 'description': 'Number of elements in the sessions array' + }, + 'name': 'sessionCount', + 'type': 'ViUInt32' + }, + { + 'direction': 'in', + 'documentation': { + 'description': 'sessions is an array of sessions that are being synchronized.' + }, + 'is_session_handle': False, + 'name': 'sessions', + 'python_api_converter_name': 'convert_to_nitclk_session_num_list', + 'size': { + 'mechanism': 'len', + 'value': 'sessionCount' + }, + 'type': 'ViSession[]' + }, + { + 'direction': 'in', + 'documentation': { + 'description': '\nMinimal period of TClk, expressed in seconds. Supported values are\nbetween 0.0 s and 0.050 s (50 ms). Minimal period for a single\nchassis/PC is 200 ns. If the specified value is less than 200 ns,\nNI-TClk automatically coerces minTime to 200 ns. For multichassis\nsynchronization, adjust this value to account for propagation delays\nthrough the various devices and cables.\n' + }, + 'default_value': 'datetime.timedelta(seconds=0.0)', + 'python_api_converter_name': 'convert_timedelta_to_seconds', + 'type_in_documentation': 'float in seconds or datetime.timedelta', + 'name': 'minTclkPeriod', + 'type': 'ViReal64' + } + ], + 'returns': 'ViStatus' + }, + 'SynchronizeToSyncPulseSender': { + 'codegen_method': 'no', + 'documentation': { + 'description': 'TBD' + }, + 'parameters': [ + { + 'direction': 'in', + 'name': 'sessionCount', + 'type': 'ViUInt32' + }, + { + 'direction': 'in', + 'name': 'sessions', + 'size': { + 'mechanism': 'TBD', + 'value': 'TBD' + }, + 'type': 'ViSession[]' + }, + { + 'direction': 'in', + 'name': 'minTime', + 'type': 'ViReal64' + } + ], + 'returns': 'ViStatus' + }, + 'SynchronizeWithOptions': { + 'codegen_method': 'no', + 'documentation': { + 'description': 'TBD' + }, + 'parameters': [ + { + 'direction': 'in', + 'name': 'sessionCount', + 'type': 'ViUInt32' + }, + { + 'direction': 'in', + 'name': 'sessions', + 'size': { + 'mechanism': 'TBD', + 'value': 'TBD' + }, + 'type': 'ViSession[]' + }, + { + 'direction': 'in', + 'name': 'minTime', + 'type': 'ViReal64' + }, + { + 'direction': 'in', + 'name': 'options', + 'type': 'ViUInt32' + } + ], + 'returns': 'ViStatus' + }, + 'SynchronizeToSyncPulseSender': { + 'documentation': { + 'description': 'TBD' + }, + 'parameters': [ + { + 'direction': 'in', + 'documentation': { + 'description': 'Number of elements in the sessions array' + }, + 'name': 'sessionCount', + 'type': 'ViUInt32' + }, + { + 'direction': 'in', + 'documentation': { + 'description': 'sessions is an array of sessions that are being synchronized.' + }, + 'is_session_handle': False, + 'name': 'sessions', + 'python_api_converter_name': 'convert_to_nitclk_session_num_list', + 'size': { + 'mechanism': 'len', + 'value': 'sessionCount' + }, + 'type': 'ViSession[]' + }, + { + 'direction': 'in', + 'documentation': { + 'description': '\nMinimal period of TClk, expressed in seconds. Supported values are\nbetween 0.0 s and 0.050 s (50 ms). Minimal period for a single\nchassis/PC is 200 ns. If the specified value is less than 200 ns,\nNI-TClk automatically coerces minTime to 200 ns. For multichassis\nsynchronization, adjust this value to account for propagation delays\nthrough the various devices and cables.\n' + }, + 'name': 'minTime', + 'type': 'ViReal64' + } + ], + 'returns': 'ViStatus' + }, + 'WaitUntilDone': { + 'documentation': { + 'description': '\nCall this function to pause execution of your program until the\nacquisitions and/or generations corresponding to sessions are done or\nuntil the function returns a timeout error. niTClk_WaitUntilDone is a\nblocking function that periodically checks the operation status. It\nreturns control to the calling program if the operation completes\nsuccessfully or an error occurs (including a timeout error). This\nfunction is most useful for finite data operations that you expect to\ncomplete within a certain time.\n' + }, + 'parameters': [ + { + 'direction': 'in', + 'documentation': { + 'description': 'Number of elements in the sessions array' + }, + 'name': 'sessionCount', + 'type': 'ViUInt32' + }, + { + 'direction': 'in', + 'documentation': { + 'description': 'sessions is an array of sessions that are being synchronized.' + }, + 'is_session_handle': False, + 'name': 'sessions', + 'python_api_converter_name': 'convert_to_nitclk_session_num_list', + 'size': { + 'mechanism': 'len', + 'value': 'sessionCount' + }, + 'type': 'ViSession[]' + }, + { + 'direction': 'in', + 'documentation': { + 'description': '\nThe amount of time in seconds that niTClk_WaitUntilDone waits for the\nsessions to complete. If timeout is exceeded, niTClk_WaitUntilDone\nreturns an error.\n' + }, + 'name': 'timeout', + 'type': 'ViReal64' + } + ], + 'returns': 'ViStatus' + } +} diff --git a/src/nitclk/metadata/functions_addon.py b/src/nitclk/metadata/functions_addon.py new file mode 100644 index 000000000..2725caab2 --- /dev/null +++ b/src/nitclk/metadata/functions_addon.py @@ -0,0 +1,53 @@ +# These dictionaries are merged with the extracted function metadata at build time. +# Changes to the metadata should be made here, because functions.py is generated thus any changes get overwritten. + +# By default all functions in functions.py are "public". +# This will override that with private (prefixes name with '_'), or don't generate at all +functions_codegen_method = { +} + +functions_locking = { +} + +# Attach the given parameter to the given enum from enums.py +functions_enums = { +} + +# This is the additional metadata needed by the code generator in order create code that can properly handle buffer allocation. +functions_buffer_info = { +} + +# These are functions we mark as "error_handling":True. The generator uses this information to +# change how error handling is done within those functions themselves - basically, if an error occurs, +# dont try to handle it, since the functions are only used within the context of error handling. +functions_is_error_handling = { +} + +# There are some parameters that are needed in the C function call we use under the hood, but that we do not want in the Python API +functions_remove_from_python_api = { +} + +# Default values for method parameters +functions_default_value = { +} + +# Parameter that need to be array.array +functions_array = { +} + +# We want to use a common name for self_cal across all drivers +functions_name = { +} + +# Functions not in original metadata. +functions_additional_functions = { +} + +# Converted parameters +functions_converters = { +} + +# The extracted metadata is incorrect. Patch it here. +functions_bad_source_metadata = { +} + diff --git a/src/nitclk/nitclk.mak b/src/nitclk/nitclk.mak new file mode 100644 index 000000000..a3cec519c --- /dev/null +++ b/src/nitclk/nitclk.mak @@ -0,0 +1,19 @@ + + +include $(BUILD_HELPER_DIR)/defines.mak + +MODULE_FILES_TO_GENERATE := $(filter-out enums.py,$(DEFAULT_PY_FILES_TO_GENERATE)) + +MODULE_FILES_TO_COPY := $(DEFAULT_PY_FILES_TO_COPY) + +RST_FILES_TO_GENERATE := $(filter-out enums.rst,$(DEFAULT_RST_FILES_TO_GENERATE)) + + +include $(BUILD_HELPER_DIR)/rules.mak + +# We need to override the default rule for generating session since we have +# a specialized copy for TClk +$(MODULE_DIR)/session.py: $(DRIVER_DIR)/templates/session.py.mako $(BUILD_HELPER_SCRIPTS) $(METADATA_FILES) + $(call trace_to_console, "Generating",$@) + $(_hide_cmds)$(call GENERATE_SCRIPT, $<, $(MODULE_DIR), $(METADATA_DIR)) + diff --git a/src/nitclk/templates/session.py.mako b/src/nitclk/templates/session.py.mako new file mode 100644 index 000000000..e2fa52747 --- /dev/null +++ b/src/nitclk/templates/session.py.mako @@ -0,0 +1,217 @@ +# This file was generated +<% + import build.helper as helper + + config = template_parameters['metadata'].config + attributes = helper.filter_codegen_attributes(config['attributes']) + functions = config['functions'] + + module_name = config['module_name'] + c_function_prefix = config['c_function_prefix'] + + functions = helper.filter_codegen_functions(functions) +%>\ + +import array +import ctypes +import datetime +import threading + +% if attributes: +import ${module_name}._attributes as _attributes +% endif +import ${module_name}._converters as _converters +import ${module_name}._library_singleton as _library_singleton +import ${module_name}._visatype as _visatype +import ${module_name}.errors as errors + +# Used for __repr__ and __str__ +import pprint +pp = pprint.PrettyPrinter(indent=4) + +_session_instance = None +_session_instance_lock = threading.Lock() + + +# Helper functions for creating ctypes needed for calling into the driver DLL +def get_ctypes_pointer_for_buffer(value=None, library_type=None, size=None): + if isinstance(value, array.array): + assert library_type is not None, 'library_type is required for array.array' + addr, _ = value.buffer_info() + return ctypes.cast(addr, ctypes.POINTER(library_type)) + elif str(type(value)).find("'numpy.ndarray'") != -1: + import numpy + return numpy.ctypeslib.as_ctypes(value) + elif isinstance(value, list): + assert library_type is not None, 'library_type is required for list' + return (library_type * len(value))(*value) + else: + if library_type is not None and size is not None: + return (library_type * size)() + else: + return None + + +class SessionReference(object): + '''Properties container for NI-TClk attributes.''' + + # This is needed during __init__. Without it, __setattr__ raises an exception + _is_frozen = False + +% for attribute in helper.sorted_attrs(attributes): +<% +helper.add_attribute_rep_cap_tip_docstring(attributes[attribute], config) +%>\ + %if attributes[attribute]['enum']: + ${attributes[attribute]['python_name']} = _attributes.AttributeEnum(_attributes.Attribute${attributes[attribute]['type']}, enums.${enums[attributes[attribute]['enum']]['python_name']}, ${attribute}) + %else: + ${attributes[attribute]['python_name']} = _attributes.${attributes[attribute]['attribute_class']}(${attribute}) + %endif +% if 'documentation' in attributes[attribute] and len(helper.get_documentation_for_node_docstring(attributes[attribute], config, indent=4).strip()) > 0: + '''Type: ${attributes[attribute]['type_in_documentation']} + + ${helper.get_documentation_for_node_docstring(attributes[attribute], config, indent=4)} + ''' +% endif +% endfor + + def __init__(self, ${config['session_handle_parameter_name']}, repeated_capability_list='', encoding='windows-1251'): + self._repeated_capability_list = repeated_capability_list + self._repeated_capability = ','.join(repeated_capability_list) + self._${config['session_handle_parameter_name']} = ${config['session_handle_parameter_name']} + self._library = _library_singleton.get() + self._encoding = encoding + + # Store the parameter list for later printing in __repr__ + param_list = [] + param_list.append("${config['session_handle_parameter_name']}=" + pp.pformat(${config['session_handle_parameter_name']})) + param_list.append("repeated_capability_list=" + pp.pformat(repeated_capability_list)) + param_list.append("encoding=" + pp.pformat(encoding)) + self._param_list = ', '.join(param_list) + + self._is_frozen = True + + def __repr__(self): + return '{0}.{1}({2})'.format('${module_name}', self.__class__.__name__, self._param_list) + + def __setattr__(self, key, value): + if self._is_frozen and key not in dir(self): + raise AttributeError("'{0}' object has no attribute '{1}'".format(type(self).__name__, key)) + object.__setattr__(self, key, value) + + def _get_error_description(self, error_code): + '''_get_error_description + + Returns the error description. + ''' + try: + ''' + It is expected for _get_error to raise when the session is invalid + (IVI spec requires GetError to fail). + Use _error_message instead. It doesn't require a session. + ''' + error_string = self._get_extended_error_info() + return error_string + except errors.Error: + return "Failed to retrieve error description." + + def get_session_number(self): + return self._${config['session_handle_parameter_name']} + +<% +# We need _get_extended_error_info() to exist in both this class as well as the _Session class, so we will +# Set then unset the 'render_in_session_base' flag to get it added to both +functions['GetExtendedErrorInfo']['render_in_session_base'] = True +%>\ +% for func_name in sorted({k: v for k, v in functions.items() if v['render_in_session_base']}): +% for method_template in functions[func_name]['method_templates']: +<%include file="${'/session.py' + method_template['session_filename'] + '.py.mako'}" args="f=functions[func_name], config=config, method_template=method_template" />\ +% endfor +% endfor + +<% +# The main reason for having this class is to allow reusing the default method template. +%>\ +class _Session(object): + '''${config['session_class_description']}''' + + def __init__(self): + r'''${config['session_class_description']}''' + self._library = _library_singleton.get() + self._encoding = 'windows-1251' + + # Instantiate any repeated capability objects +% for rep_cap in config['repeated_capabilities']: + self.${rep_cap['python_name']} = _RepeatedCapabilities(self, '${rep_cap["prefix"]}') +% endfor + + # Store the parameter list for later printing in __repr__ + param_list = [] + self._param_list = ', '.join(param_list) + + self._is_frozen = True + + def _get_error_description(self, error_code): + '''_get_error_description + + Returns the error description. + ''' + try: + ''' + It is expected for _get_error to raise when the session is invalid + (IVI spec requires GetError to fail). + Use _error_message instead. It doesn't require a session. + ''' + error_string = self._get_extended_error_info() + return error_string + except errors.Error: + return "Failed to retrieve error description." + + ''' These are code-generated ''' +<% +# We need _get_extended_error_info() to exist in both this class as well as the SessionReference class, so we will +# Set then unset the 'render_in_session_base' flag to get it added to both +functions['GetExtendedErrorInfo']['render_in_session_base'] = False +%>\ +% for func_name in sorted({k: v for k, v in functions.items() if not v['render_in_session_base']}): +% for method_template in functions[func_name]['method_templates']: +<%include file="${'/session.py' + method_template['session_filename'] + '.py.mako'}" args="f=functions[func_name], config=config, method_template=method_template" />\ +% endfor +% endfor + +def _get_session_class(): + '''Internal function to return session singleton''' + global _session_instance + global _session_instance_lock + + with _session_instance_lock: + if _session_instance is None: + _session_instance = _Session() + + return _session_instance + + +<% +# We need _get_extended_error_info() to exist in both this class as well as the _Session class, so we will +# Set then unset the 'render_in_session_base' flag to get it added to both. We do not want it in the standalone +# functions so we set it back to True here to remove it from this list +functions['GetExtendedErrorInfo']['render_in_session_base'] = True +%>\ +% for func_name in sorted({k: v for k, v in functions.items() if not v['render_in_session_base']}): +<% +f = functions[func_name] +name = f['python_name'] +parameter_list = helper.get_params_snippet(f, helper.ParameterUsageOptions.SESSION_METHOD_DECLARATION) +# We remove 'self, ' since we are not part of a class here +parameter_list = parameter_list.replace('self, ', '') +%>\ +def ${name}(${parameter_list}): + '''${name} + + ${helper.get_function_docstring(f, False, config, indent=4)} + ''' + return _get_session_class().${name}(${parameter_list}) + + +% endfor +