From 0aebe0a2d50c52052873fe537dc72a54bbb351b7 Mon Sep 17 00:00:00 2001 From: Brian Lee Date: Tue, 21 Mar 2017 15:46:25 -0500 Subject: [PATCH] Upload First Version of nidaqmx Upload the First Version of the nidaqmx Package to Repository --- CONTRIBUTING.rst | 101 + LICENSE | 20 + MANIFEST.in | 7 + README.rst | 200 + docs/Makefile | 20 + docs/README.rst | 200 + docs/ai_channel.rst | 7 + docs/ai_channel_collection.rst | 7 + docs/ao_channel.rst | 7 + docs/ao_channel_collection.rst | 7 + docs/arm_start_trigger.rst | 6 + docs/channel.rst | 15 + docs/channel_collection.rst | 15 + docs/ci_channel.rst | 7 + docs/ci_channel_collection.rst | 7 + docs/co_channel.rst | 7 + docs/co_channel_collection.rst | 7 + docs/collections.rst | 10 + docs/conf.py | 156 + docs/constants.rst | 6 + docs/device.rst | 7 + docs/device_collection.rst | 6 + docs/di_channel.rst | 7 + docs/di_channel_collection.rst | 7 + docs/do_channel.rst | 7 + docs/do_channel_collection.rst | 7 + docs/errors.rst | 6 + docs/expiration_state.rst | 6 + docs/expiration_states_collection.rst | 6 + docs/export_signals.rst | 6 + docs/handshake_trigger.rst | 6 + docs/in_stream.rst | 6 + docs/index.rst | 30 + docs/make.bat | 36 + docs/out_stream.rst | 6 + docs/pause_trigger.rst | 6 + docs/persisted_channel.rst | 7 + docs/persisted_channel_collection.rst | 6 + docs/persisted_scale.rst | 7 + docs/persisted_scale_collection.rst | 6 + docs/persisted_task.rst | 7 + docs/persisted_task_collection.rst | 6 + docs/physical_channel.rst | 7 + docs/physical_channel_collection.rst | 6 + docs/reference_trigger.rst | 6 + docs/scale.rst | 7 + docs/start_trigger.rst | 6 + docs/storage.rst | 8 + docs/stream_readers.rst | 7 + docs/stream_writers.rst | 7 + docs/system.rst | 14 + docs/task.rst | 16 + docs/timing.rst | 6 + docs/triggers.rst | 14 + docs/types.rst | 6 + docs/utils.rst | 6 + docs/watchdog.rst | 12 + nidaqmx/__init__.py | 11 + nidaqmx/_lib.py | 234 + nidaqmx/_task_modules/__init__.py | 0 .../_task_modules/ai_channel_collection.py | 3630 ++++++ .../_task_modules/ao_channel_collection.py | 182 + nidaqmx/_task_modules/channel_collection.py | 140 + nidaqmx/_task_modules/channels/__init__.py | 17 + nidaqmx/_task_modules/channels/ai_channel.py | 6760 ++++++++++++ nidaqmx/_task_modules/channels/ao_channel.py | 1768 +++ nidaqmx/_task_modules/channels/channel.py | 361 + nidaqmx/_task_modules/channels/ci_channel.py | 9707 +++++++++++++++++ nidaqmx/_task_modules/channels/co_channel.py | 1459 +++ nidaqmx/_task_modules/channels/di_channel.py | 674 ++ nidaqmx/_task_modules/channels/do_channel.py | 739 ++ .../_task_modules/ci_channel_collection.py | 954 ++ .../_task_modules/co_channel_collection.py | 202 + .../_task_modules/di_channel_collection.py | 103 + .../_task_modules/do_channel_collection.py | 103 + nidaqmx/_task_modules/export_signals.py | 2253 ++++ nidaqmx/_task_modules/in_stream.py | 1748 +++ nidaqmx/_task_modules/out_stream.py | 939 ++ nidaqmx/_task_modules/read_functions.py | 510 + nidaqmx/_task_modules/timing.py | 2494 +++++ nidaqmx/_task_modules/triggering/__init__.py | 0 .../triggering/arm_start_trigger.py | 398 + .../triggering/handshake_trigger.py | 150 + .../_task_modules/triggering/pause_trigger.py | 1400 +++ .../triggering/reference_trigger.py | 1701 +++ .../_task_modules/triggering/start_trigger.py | 1647 +++ nidaqmx/_task_modules/triggers.py | 117 + nidaqmx/_task_modules/write_functions.py | 343 + nidaqmx/constants.py | 1048 ++ nidaqmx/error_codes.py | 1944 ++++ nidaqmx/errors.py | 143 + nidaqmx/scale.py | 840 ++ nidaqmx/stream_readers.py | 2029 ++++ nidaqmx/stream_writers.py | 1410 +++ nidaqmx/system/__init__.py | 14 + nidaqmx/system/_collections/__init__.py | 0 .../system/_collections/device_collection.py | 118 + .../persisted_channel_collection.py | 120 + .../persisted_scale_collection.py | 119 + .../_collections/persisted_task_collection.py | 118 + .../physical_channel_collection.py | 384 + nidaqmx/system/_watchdog_modules/__init__.py | 0 .../_watchdog_modules/expiration_state.py | 197 + .../expiration_states_collection.py | 49 + nidaqmx/system/device.py | 2097 ++++ nidaqmx/system/physical_channel.py | 906 ++ nidaqmx/system/storage/__init__.py | 10 + .../storage/_alternate_task_constructor.py | 35 + nidaqmx/system/storage/persisted_channel.py | 123 + nidaqmx/system/storage/persisted_scale.py | 133 + nidaqmx/system/storage/persisted_task.py | 146 + nidaqmx/system/system.py | 845 ++ nidaqmx/system/watchdog.py | 585 + nidaqmx/task.py | 1252 +++ nidaqmx/tests/__init__.py | 0 nidaqmx/tests/fixtures.py | 41 + nidaqmx/tests/helpers.py | 34 + nidaqmx/tests/max_config/nidaqmxMaxConfig.nce | Bin 0 -> 6896 bytes nidaqmx/tests/teds/Voltage.ted | Bin 0 -> 262 bytes nidaqmx/tests/test_channel_creation.py | 266 + nidaqmx/tests/test_channels.py | 64 + nidaqmx/tests/test_container_operations.py | 103 + nidaqmx/tests/test_export_signals.py | 34 + nidaqmx/tests/test_invalid_reads.py | 80 + nidaqmx/tests/test_invalid_writes.py | 153 + nidaqmx/tests/test_power_up_states.py | 55 + nidaqmx/tests/test_properties.py | 198 + nidaqmx/tests/test_read_write.py | 600 + nidaqmx/tests/test_resource_warnings.py | 23 + .../test_stream_analog_readers_writers.py | 248 + .../test_stream_counter_readers_writers.py | 466 + .../test_stream_digital_readers_writers.py | 622 ++ nidaqmx/tests/test_system_collections.py | 84 + nidaqmx/tests/test_teds.py | 46 + nidaqmx/tests/test_triggers.py | 104 + nidaqmx/tests/test_utils.py | 35 + nidaqmx/tests/test_watchdog.py | 73 + nidaqmx/types.py | 54 + nidaqmx/utils.py | 175 + nidaqmx_examples/__init__.py | 0 .../ai_multi_task_pxie_ref_clk.py | 40 + nidaqmx_examples/ai_raw.py | 25 + nidaqmx_examples/ai_voltage_sw_timed.py | 29 + nidaqmx_examples/ao_voltage_hw_timed.py | 27 + nidaqmx_examples/ao_voltage_sw_timed.py | 24 + nidaqmx_examples/channel_properties.py | 28 + nidaqmx_examples/ci_count_edges.py | 17 + nidaqmx_examples/ci_pulse_freq.py | 17 + nidaqmx_examples/co_pulse_time.py | 19 + nidaqmx_examples/di_sw_timed.py | 31 + nidaqmx_examples/do_sw_timed.py | 21 + nidaqmx_examples/every_n_samples_event.py | 32 + nidaqmx_examples/nidaqmx_warnings.py | 54 + nidaqmx_examples/system_properties.py | 10 + python_packages.txt | 1 + setup.py | 76 + tox.ini | 13 + 157 files changed, 60565 insertions(+) create mode 100644 CONTRIBUTING.rst create mode 100644 LICENSE create mode 100644 MANIFEST.in create mode 100644 README.rst create mode 100644 docs/Makefile create mode 100644 docs/README.rst create mode 100644 docs/ai_channel.rst create mode 100644 docs/ai_channel_collection.rst create mode 100644 docs/ao_channel.rst create mode 100644 docs/ao_channel_collection.rst create mode 100644 docs/arm_start_trigger.rst create mode 100644 docs/channel.rst create mode 100644 docs/channel_collection.rst create mode 100644 docs/ci_channel.rst create mode 100644 docs/ci_channel_collection.rst create mode 100644 docs/co_channel.rst create mode 100644 docs/co_channel_collection.rst create mode 100644 docs/collections.rst create mode 100644 docs/conf.py create mode 100644 docs/constants.rst create mode 100644 docs/device.rst create mode 100644 docs/device_collection.rst create mode 100644 docs/di_channel.rst create mode 100644 docs/di_channel_collection.rst create mode 100644 docs/do_channel.rst create mode 100644 docs/do_channel_collection.rst create mode 100644 docs/errors.rst create mode 100644 docs/expiration_state.rst create mode 100644 docs/expiration_states_collection.rst create mode 100644 docs/export_signals.rst create mode 100644 docs/handshake_trigger.rst create mode 100644 docs/in_stream.rst create mode 100644 docs/index.rst create mode 100644 docs/make.bat create mode 100644 docs/out_stream.rst create mode 100644 docs/pause_trigger.rst create mode 100644 docs/persisted_channel.rst create mode 100644 docs/persisted_channel_collection.rst create mode 100644 docs/persisted_scale.rst create mode 100644 docs/persisted_scale_collection.rst create mode 100644 docs/persisted_task.rst create mode 100644 docs/persisted_task_collection.rst create mode 100644 docs/physical_channel.rst create mode 100644 docs/physical_channel_collection.rst create mode 100644 docs/reference_trigger.rst create mode 100644 docs/scale.rst create mode 100644 docs/start_trigger.rst create mode 100644 docs/storage.rst create mode 100644 docs/stream_readers.rst create mode 100644 docs/stream_writers.rst create mode 100644 docs/system.rst create mode 100644 docs/task.rst create mode 100644 docs/timing.rst create mode 100644 docs/triggers.rst create mode 100644 docs/types.rst create mode 100644 docs/utils.rst create mode 100644 docs/watchdog.rst create mode 100644 nidaqmx/__init__.py create mode 100644 nidaqmx/_lib.py create mode 100644 nidaqmx/_task_modules/__init__.py create mode 100644 nidaqmx/_task_modules/ai_channel_collection.py create mode 100644 nidaqmx/_task_modules/ao_channel_collection.py create mode 100644 nidaqmx/_task_modules/channel_collection.py create mode 100644 nidaqmx/_task_modules/channels/__init__.py create mode 100644 nidaqmx/_task_modules/channels/ai_channel.py create mode 100644 nidaqmx/_task_modules/channels/ao_channel.py create mode 100644 nidaqmx/_task_modules/channels/channel.py create mode 100644 nidaqmx/_task_modules/channels/ci_channel.py create mode 100644 nidaqmx/_task_modules/channels/co_channel.py create mode 100644 nidaqmx/_task_modules/channels/di_channel.py create mode 100644 nidaqmx/_task_modules/channels/do_channel.py create mode 100644 nidaqmx/_task_modules/ci_channel_collection.py create mode 100644 nidaqmx/_task_modules/co_channel_collection.py create mode 100644 nidaqmx/_task_modules/di_channel_collection.py create mode 100644 nidaqmx/_task_modules/do_channel_collection.py create mode 100644 nidaqmx/_task_modules/export_signals.py create mode 100644 nidaqmx/_task_modules/in_stream.py create mode 100644 nidaqmx/_task_modules/out_stream.py create mode 100644 nidaqmx/_task_modules/read_functions.py create mode 100644 nidaqmx/_task_modules/timing.py create mode 100644 nidaqmx/_task_modules/triggering/__init__.py create mode 100644 nidaqmx/_task_modules/triggering/arm_start_trigger.py create mode 100644 nidaqmx/_task_modules/triggering/handshake_trigger.py create mode 100644 nidaqmx/_task_modules/triggering/pause_trigger.py create mode 100644 nidaqmx/_task_modules/triggering/reference_trigger.py create mode 100644 nidaqmx/_task_modules/triggering/start_trigger.py create mode 100644 nidaqmx/_task_modules/triggers.py create mode 100644 nidaqmx/_task_modules/write_functions.py create mode 100644 nidaqmx/constants.py create mode 100644 nidaqmx/error_codes.py create mode 100644 nidaqmx/errors.py create mode 100644 nidaqmx/scale.py create mode 100644 nidaqmx/stream_readers.py create mode 100644 nidaqmx/stream_writers.py create mode 100644 nidaqmx/system/__init__.py create mode 100644 nidaqmx/system/_collections/__init__.py create mode 100644 nidaqmx/system/_collections/device_collection.py create mode 100644 nidaqmx/system/_collections/persisted_channel_collection.py create mode 100644 nidaqmx/system/_collections/persisted_scale_collection.py create mode 100644 nidaqmx/system/_collections/persisted_task_collection.py create mode 100644 nidaqmx/system/_collections/physical_channel_collection.py create mode 100644 nidaqmx/system/_watchdog_modules/__init__.py create mode 100644 nidaqmx/system/_watchdog_modules/expiration_state.py create mode 100644 nidaqmx/system/_watchdog_modules/expiration_states_collection.py create mode 100644 nidaqmx/system/device.py create mode 100644 nidaqmx/system/physical_channel.py create mode 100644 nidaqmx/system/storage/__init__.py create mode 100644 nidaqmx/system/storage/_alternate_task_constructor.py create mode 100644 nidaqmx/system/storage/persisted_channel.py create mode 100644 nidaqmx/system/storage/persisted_scale.py create mode 100644 nidaqmx/system/storage/persisted_task.py create mode 100644 nidaqmx/system/system.py create mode 100644 nidaqmx/system/watchdog.py create mode 100644 nidaqmx/task.py create mode 100644 nidaqmx/tests/__init__.py create mode 100644 nidaqmx/tests/fixtures.py create mode 100644 nidaqmx/tests/helpers.py create mode 100644 nidaqmx/tests/max_config/nidaqmxMaxConfig.nce create mode 100644 nidaqmx/tests/teds/Voltage.ted create mode 100644 nidaqmx/tests/test_channel_creation.py create mode 100644 nidaqmx/tests/test_channels.py create mode 100644 nidaqmx/tests/test_container_operations.py create mode 100644 nidaqmx/tests/test_export_signals.py create mode 100644 nidaqmx/tests/test_invalid_reads.py create mode 100644 nidaqmx/tests/test_invalid_writes.py create mode 100644 nidaqmx/tests/test_power_up_states.py create mode 100644 nidaqmx/tests/test_properties.py create mode 100644 nidaqmx/tests/test_read_write.py create mode 100644 nidaqmx/tests/test_resource_warnings.py create mode 100644 nidaqmx/tests/test_stream_analog_readers_writers.py create mode 100644 nidaqmx/tests/test_stream_counter_readers_writers.py create mode 100644 nidaqmx/tests/test_stream_digital_readers_writers.py create mode 100644 nidaqmx/tests/test_system_collections.py create mode 100644 nidaqmx/tests/test_teds.py create mode 100644 nidaqmx/tests/test_triggers.py create mode 100644 nidaqmx/tests/test_utils.py create mode 100644 nidaqmx/tests/test_watchdog.py create mode 100644 nidaqmx/types.py create mode 100644 nidaqmx/utils.py create mode 100644 nidaqmx_examples/__init__.py create mode 100644 nidaqmx_examples/ai_multi_task_pxie_ref_clk.py create mode 100644 nidaqmx_examples/ai_raw.py create mode 100644 nidaqmx_examples/ai_voltage_sw_timed.py create mode 100644 nidaqmx_examples/ao_voltage_hw_timed.py create mode 100644 nidaqmx_examples/ao_voltage_sw_timed.py create mode 100644 nidaqmx_examples/channel_properties.py create mode 100644 nidaqmx_examples/ci_count_edges.py create mode 100644 nidaqmx_examples/ci_pulse_freq.py create mode 100644 nidaqmx_examples/co_pulse_time.py create mode 100644 nidaqmx_examples/di_sw_timed.py create mode 100644 nidaqmx_examples/do_sw_timed.py create mode 100644 nidaqmx_examples/every_n_samples_event.py create mode 100644 nidaqmx_examples/nidaqmx_warnings.py create mode 100644 nidaqmx_examples/system_properties.py create mode 100644 python_packages.txt create mode 100644 setup.py create mode 100644 tox.ini diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst new file mode 100644 index 00000000..664e5837 --- /dev/null +++ b/CONTRIBUTING.rst @@ -0,0 +1,101 @@ +Contributing to nidaqmx +======================= + +Contributions to **nidaqmx** are welcome from all! + +**nidaqmx** is managed via [git](https://git-scm.com), with the canonical +upstream repository hosted on [GitHub](http://developercertificate.org/). + +**nidaqmx** follows a pull-request model for development. If you wish to +contribute, you will need to create a GitHub account, fork this project, +push a branch with your changes to your project, and then submit a pull +request. + +See [GitHub's official documentation](https://help.github.com/articles/using-pull-requests/) +for more details. + +Getting Started +--------------- + +To contribute to this project, it is recommended that you follow these steps: + +1. Fork the repository on GitHub. +2. Run the unit tests on your system (see :ref:`testing-section`). At + this point, if any tests fail, do not begin development. Try to + investigate these failures. If you're unable to do so, report an issue + through our `GitHub issues page `_. +3. Write new tests that demonstrate your bug or feature. Ensure that these + new tests fail. +4. Make your change. +5. Run all the unit tests again (which include the tests you just added), + and confirm that they all pass. +6. Send a GitHub Pull Request to the main repository's master branch. GitHub + Pull Requests are the expected method of code collaboration on this project. + +.. _testing-section: + +Testing +------- + +In order to be able to run the **nidaqmx** unit tests, your setup should meet +the following minimum requirements: + + - Setup has a machine with NI-DAQmx or the NI-DAQmx Runtime installed. + - Machine has a supported version of CPython or PyPy installed. + - Machine has an X-Series DAQ device connected to it (we ran the tests + using a PCIe-6363 or a USB-6351). + +Before running any unit tests, an NI MAX configuration needs be imported. The +MAX configuration simply contains some custom scales used during testing. The +MAX configuration file is located at +``nidaqmx\tests\max_config\nidaqmxMaxConfig.nce``. Refer to this +`KB article `_ +for details on how to import a MAX Configuration. + +To run the **nidaqmx** unit tests in a specific version of Python, run +the following command in the root of the distribution:: + + $ setup.py test + +To run the unit tests in all Python interpreters supported by **nidaqmx**, +run the following commands in the root of the distribution:: + + $ pip install tox + $ tox + +This requires you to have all the Python interpreters supported by +**nidaqmx** installed on your machine. + +Developer Certificate of Origin (DCO) +------------------------------------- + +Developer's Certificate of Origin 1.1 + +By making a contribution to this project, I certify that: + +(a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or + +(b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the same open source license (unless I am + permitted to submit under a different license), as indicated + in the file; or + +(c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. + +(d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it, including my sign-off) is + maintained indefinitely and may be redistributed consistent with + this project or the open source license(s) involved. + +(taken from [developercertificate.org](http://developercertificate.org/)) + +See [LICENSE](https://github.com/ni/nidaqmx/blob/master/LICENSE) +for details about how **nidaqmx** is licensed. diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..b6b7bdf6 --- /dev/null +++ b/LICENSE @@ -0,0 +1,20 @@ +This is the MIT license: http://www.opensource.org/licenses/mit-license.php + +Copyright (c) 2017, National Instruments Corp. NI-DAQ is a trademark of National +Instruments. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons +to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 00000000..2e93b3a5 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,7 @@ +include *.txt +recursive-include nidaqmx_examples *.py +recursive-include nidaqmx/system *.py +recursive-include nidaqmx/_task_modules *.py +recursive-include nidaqmx/tests *.py +recursive-include nidaqmx/tests/teds *.ted +recursive-include nidaqmx/tests/max_config *.nce \ No newline at end of file diff --git a/README.rst b/README.rst new file mode 100644 index 00000000..11f7ed3a --- /dev/null +++ b/README.rst @@ -0,0 +1,200 @@ +=========== ================================================================================================================================= +Info Contains a Python API for interacting with NI-DAQmx. See `GitHub `_ for the latest source. +Author National Instruments +=========== ================================================================================================================================= + +About +===== + +The **nidaqmx** package contains an API (Application Programming Interface) +for interacting with the NI-DAQmx driver. The package is implemented in Python. +This package was created and is supported by NI. The package is implemented as a +complex, highly object-oriented wrapper around the NI-DAQmx C API using the +`ctypes `_ Python library. + +**nidaqmx** 0.5 supports all versions of the NI-DAQmx driver that ships with the +C API. The C API is included in any version of the driver that supports it. The +**nidaqmx** package does not require installation of the C header files. + +Some functions in the **nidaqmx** package may be unavailable with earlier +versions of the NI-DAQmx driver. Visit the +`ni.com/downloads `_ to upgrade your version of +NI-DAQmx. + +**nidaqmx** supports only the Windows operating system. + +**nidaqmx** supports CPython 2.7, 3.4+, PyPy2, and PyPy3. + +Features +======== +The following represents a non-exhaustive list of supported features for **nidaqmx**: + +- Fully-object oriented +- Fully-featured Task class +- Fully-featured Scale class +- Fully-featured System sub-package with System, Device, PhysicalChannel, WatchdogTask, etc. classes +- NI-DAQmx Events +- NI-DAQmx Streams +- `Enums `_ support in both Python 2 and 3 +- Exceptions support +- `Warnings `_ support +- Collections that emulate Python container types +- Single, dynamic read and write methods (see :ref:`usage-section`) +- Performant, NumPy-based reader and writer classes +- Optional parameters +- Implicitly verified properties +- Context managers + +The following features are not yet supported by the **nidaqmx** package: + +- Calibration methods +- Real-time methods + +Installation +============ + +Running **nidaqmx** requires NI-DAQmx or NI-DAQmx Runtime. Visit the +`ni.com/downloads `_ to download the latest version +of NI-DAQmx. + +**nidaqmx** can be installed with `pip `_:: + + $ python -m pip install nidaqmx + +Or **easy_install** from +`setuptools `_:: + + $ python -m easy_install nidaqmx + +You also can download the project source and run:: + + $ python setup.py install + +.. _usage-section: + +Usage +===== +The following is a basic example of using an :py:class:`nidaqmx.task.Task` object. +This example illustrates how the single, dynamic :py:meth:`nidaqmx.task.Task.read` +method returns the appropriate data type. + +.. code-block:: python + + >>> import nidaqmx + >>> with nidaqmx.Task() as task: + ... task.ai_channels.add_ai_voltage_chan("Dev1/ai0") + ... task.read() + ... + -0.07476920729381246 + >>> with nidaqmx.Task() as task: + ... task.ai_channels.add_ai_voltage_chan("Dev1/ai0") + ... task.read(number_of_samples_per_channel=2) + ... + [0.26001373311970705, 0.37796597238117036] + >>> from nidaqmx.constants import LineGrouping + >>> with nidaqmx.Task() as task: + ... task.di_channels.add_di_chan( + ... "cDAQ2Mod4/port0/line1:3", line_grouping=LineGrouping.CHAN_PER_LINE) + ... task.read(number_of_samples_per_channel=2) + ... + [[False, True], [True, True]] + +A single, dynamic :py:meth:`nidaqmx.task.Task.write` method also exists. + +.. code-block:: python + + >>> import nidaqmx + >>> from nidaqmx.types import CtrTime + >>> with nidaqmx.Task() as task: + ... task.co_channels.add_co_pulse_chan_time("Dev1/ctr0") + ... sample = CtrTime(high_time=0.001, low_time=0.001) + ... task.write(sample) + ... + 1 + >>> with nidaqmx.Task() as task: + ... task.ao_channels.add_ao_voltage_chan("Dev1/ao0") + ... task.write([1.1, 2.2, 3.3, 4.4, 5.5], auto_start=True) + ... + 5 + +Consider using the :py:mod:`nidaqmx.stream_readers` and :py:mod:`nidaqmx.stream_writers` +classes to increase the performance of your application, which accept pre-allocated +NumPy arrays. + +Following is an example of using an :py:class:`nidaqmx.system.System` object. + +.. code-block:: python + + >>> import nidaqmx.system + >>> system = nidaqmx.system.System.local() + >>> system.driver_version + DriverVersion(major_version=16L, minor_version=0L, update_version=0L) + >>> for device in system.devices: + ... print(device) + ... + Device(name=Dev1) + Device(name=Dev2) + Device(name=cDAQ1) + >>> import collections + >>> isinstance(system.devices, collections.Sequence) + True + >>> device = system.devices['Dev1'] + >>> device == nidaqmx.system.Device('Dev1') + True + >>> isinstance(device.ai_physical_chans, collections.Sequence) + True + >>> phys_chan = device.ai_physical_chans['ai0'] + >>> phys_chan + PhysicalChannel(name=Dev1/ai0) + >>> phys_chan == nidaqmx.system.PhysicalChannel('Dev1/ai0') + True + >>> phys_chan.ai_term_cfgs + [, , ] + >>> from enum import Enum + >>> isinstance(phys_chan.ai_term_cfgs[0], Enum) + True + +Support / Feedback +================== + +The **nidaqmx** package is supported by NI. For support for **nidaqmx**, open +a request through the NI support portal at `ni.com `_. + +Bugs / Feature Requests +======================= + +To report a bug or submit a feature request, please use the +`GitHub issues page `_. + +Information to Include When Asking for Help +------------------------------------------- + +Please include **all** of the following information when opening an issue: + +- Detailed steps on how to reproduce the problem and full traceback, if + applicable. +- The python version used:: + + $ python -c "import sys; print(sys.version)" + +- The versions of the **nidaqmx**, numpy, six and enum34 packages used:: + + $ python -m pip list + +- The version of the NI-DAQmx driver used. Follow + `this KB article `_ + to determine the version of NI-DAQmx you have installed. +- The operating system and version, for example Windows 7, CentOS 7.2, ... + +Additional Documentation +======================== +Refer to the `NI-DAQmx Help `_ +for API-agnostic information about NI-DAQmx or measurement concepts. + +NI-DAQmx Help installs only with the full version of NI-DAQmx. + +License +======= +**nidaqmx** is licensed under an MIT-style license (see LICENSE). Other +incorporated projects may be licensed under different licenses. All licenses +allow for non-commercial and commercial use. \ No newline at end of file diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 00000000..5e89c377 --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +SPHINXPROJ = NI-DAQmxPythonAPI +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) \ No newline at end of file diff --git a/docs/README.rst b/docs/README.rst new file mode 100644 index 00000000..11f7ed3a --- /dev/null +++ b/docs/README.rst @@ -0,0 +1,200 @@ +=========== ================================================================================================================================= +Info Contains a Python API for interacting with NI-DAQmx. See `GitHub `_ for the latest source. +Author National Instruments +=========== ================================================================================================================================= + +About +===== + +The **nidaqmx** package contains an API (Application Programming Interface) +for interacting with the NI-DAQmx driver. The package is implemented in Python. +This package was created and is supported by NI. The package is implemented as a +complex, highly object-oriented wrapper around the NI-DAQmx C API using the +`ctypes `_ Python library. + +**nidaqmx** 0.5 supports all versions of the NI-DAQmx driver that ships with the +C API. The C API is included in any version of the driver that supports it. The +**nidaqmx** package does not require installation of the C header files. + +Some functions in the **nidaqmx** package may be unavailable with earlier +versions of the NI-DAQmx driver. Visit the +`ni.com/downloads `_ to upgrade your version of +NI-DAQmx. + +**nidaqmx** supports only the Windows operating system. + +**nidaqmx** supports CPython 2.7, 3.4+, PyPy2, and PyPy3. + +Features +======== +The following represents a non-exhaustive list of supported features for **nidaqmx**: + +- Fully-object oriented +- Fully-featured Task class +- Fully-featured Scale class +- Fully-featured System sub-package with System, Device, PhysicalChannel, WatchdogTask, etc. classes +- NI-DAQmx Events +- NI-DAQmx Streams +- `Enums `_ support in both Python 2 and 3 +- Exceptions support +- `Warnings `_ support +- Collections that emulate Python container types +- Single, dynamic read and write methods (see :ref:`usage-section`) +- Performant, NumPy-based reader and writer classes +- Optional parameters +- Implicitly verified properties +- Context managers + +The following features are not yet supported by the **nidaqmx** package: + +- Calibration methods +- Real-time methods + +Installation +============ + +Running **nidaqmx** requires NI-DAQmx or NI-DAQmx Runtime. Visit the +`ni.com/downloads `_ to download the latest version +of NI-DAQmx. + +**nidaqmx** can be installed with `pip `_:: + + $ python -m pip install nidaqmx + +Or **easy_install** from +`setuptools `_:: + + $ python -m easy_install nidaqmx + +You also can download the project source and run:: + + $ python setup.py install + +.. _usage-section: + +Usage +===== +The following is a basic example of using an :py:class:`nidaqmx.task.Task` object. +This example illustrates how the single, dynamic :py:meth:`nidaqmx.task.Task.read` +method returns the appropriate data type. + +.. code-block:: python + + >>> import nidaqmx + >>> with nidaqmx.Task() as task: + ... task.ai_channels.add_ai_voltage_chan("Dev1/ai0") + ... task.read() + ... + -0.07476920729381246 + >>> with nidaqmx.Task() as task: + ... task.ai_channels.add_ai_voltage_chan("Dev1/ai0") + ... task.read(number_of_samples_per_channel=2) + ... + [0.26001373311970705, 0.37796597238117036] + >>> from nidaqmx.constants import LineGrouping + >>> with nidaqmx.Task() as task: + ... task.di_channels.add_di_chan( + ... "cDAQ2Mod4/port0/line1:3", line_grouping=LineGrouping.CHAN_PER_LINE) + ... task.read(number_of_samples_per_channel=2) + ... + [[False, True], [True, True]] + +A single, dynamic :py:meth:`nidaqmx.task.Task.write` method also exists. + +.. code-block:: python + + >>> import nidaqmx + >>> from nidaqmx.types import CtrTime + >>> with nidaqmx.Task() as task: + ... task.co_channels.add_co_pulse_chan_time("Dev1/ctr0") + ... sample = CtrTime(high_time=0.001, low_time=0.001) + ... task.write(sample) + ... + 1 + >>> with nidaqmx.Task() as task: + ... task.ao_channels.add_ao_voltage_chan("Dev1/ao0") + ... task.write([1.1, 2.2, 3.3, 4.4, 5.5], auto_start=True) + ... + 5 + +Consider using the :py:mod:`nidaqmx.stream_readers` and :py:mod:`nidaqmx.stream_writers` +classes to increase the performance of your application, which accept pre-allocated +NumPy arrays. + +Following is an example of using an :py:class:`nidaqmx.system.System` object. + +.. code-block:: python + + >>> import nidaqmx.system + >>> system = nidaqmx.system.System.local() + >>> system.driver_version + DriverVersion(major_version=16L, minor_version=0L, update_version=0L) + >>> for device in system.devices: + ... print(device) + ... + Device(name=Dev1) + Device(name=Dev2) + Device(name=cDAQ1) + >>> import collections + >>> isinstance(system.devices, collections.Sequence) + True + >>> device = system.devices['Dev1'] + >>> device == nidaqmx.system.Device('Dev1') + True + >>> isinstance(device.ai_physical_chans, collections.Sequence) + True + >>> phys_chan = device.ai_physical_chans['ai0'] + >>> phys_chan + PhysicalChannel(name=Dev1/ai0) + >>> phys_chan == nidaqmx.system.PhysicalChannel('Dev1/ai0') + True + >>> phys_chan.ai_term_cfgs + [, , ] + >>> from enum import Enum + >>> isinstance(phys_chan.ai_term_cfgs[0], Enum) + True + +Support / Feedback +================== + +The **nidaqmx** package is supported by NI. For support for **nidaqmx**, open +a request through the NI support portal at `ni.com `_. + +Bugs / Feature Requests +======================= + +To report a bug or submit a feature request, please use the +`GitHub issues page `_. + +Information to Include When Asking for Help +------------------------------------------- + +Please include **all** of the following information when opening an issue: + +- Detailed steps on how to reproduce the problem and full traceback, if + applicable. +- The python version used:: + + $ python -c "import sys; print(sys.version)" + +- The versions of the **nidaqmx**, numpy, six and enum34 packages used:: + + $ python -m pip list + +- The version of the NI-DAQmx driver used. Follow + `this KB article `_ + to determine the version of NI-DAQmx you have installed. +- The operating system and version, for example Windows 7, CentOS 7.2, ... + +Additional Documentation +======================== +Refer to the `NI-DAQmx Help `_ +for API-agnostic information about NI-DAQmx or measurement concepts. + +NI-DAQmx Help installs only with the full version of NI-DAQmx. + +License +======= +**nidaqmx** is licensed under an MIT-style license (see LICENSE). Other +incorporated projects may be licensed under different licenses. All licenses +allow for non-commercial and commercial use. \ No newline at end of file diff --git a/docs/ai_channel.rst b/docs/ai_channel.rst new file mode 100644 index 00000000..37115f0e --- /dev/null +++ b/docs/ai_channel.rst @@ -0,0 +1,7 @@ +nidaqmx.task.ai_channel +======================= + +.. automodule:: nidaqmx._task_modules.channels.ai_channel + :members: + :inherited-members: + :show-inheritance: diff --git a/docs/ai_channel_collection.rst b/docs/ai_channel_collection.rst new file mode 100644 index 00000000..cd21a8c3 --- /dev/null +++ b/docs/ai_channel_collection.rst @@ -0,0 +1,7 @@ +nidaqmx.task.ai_channel_collection +================================== + +.. automodule:: nidaqmx._task_modules.ai_channel_collection + :members: + :inherited-members: + :show-inheritance: diff --git a/docs/ao_channel.rst b/docs/ao_channel.rst new file mode 100644 index 00000000..3a1950c7 --- /dev/null +++ b/docs/ao_channel.rst @@ -0,0 +1,7 @@ +nidaqmx.task.ao_channel +======================= + +.. automodule:: nidaqmx._task_modules.channels.ao_channel + :members: + :inherited-members: + :show-inheritance: diff --git a/docs/ao_channel_collection.rst b/docs/ao_channel_collection.rst new file mode 100644 index 00000000..6660f87a --- /dev/null +++ b/docs/ao_channel_collection.rst @@ -0,0 +1,7 @@ +nidaqmx.task.ao_channel_collection +================================== + +.. automodule:: nidaqmx._task_modules.ao_channel_collection + :members: + :inherited-members: + :show-inheritance: diff --git a/docs/arm_start_trigger.rst b/docs/arm_start_trigger.rst new file mode 100644 index 00000000..033ecb3f --- /dev/null +++ b/docs/arm_start_trigger.rst @@ -0,0 +1,6 @@ +nidaqmx.task.arm_start_trigger +============================== + +.. automodule:: nidaqmx._task_modules.triggering.arm_start_trigger + :members: + :show-inheritance: diff --git a/docs/channel.rst b/docs/channel.rst new file mode 100644 index 00000000..6043b2b6 --- /dev/null +++ b/docs/channel.rst @@ -0,0 +1,15 @@ +nidaqmx.task.channel +==================== + +.. automodule:: nidaqmx._task_modules.channels.channel + :members: + :show-inheritance: + +.. toctree:: + + ai_channel + ao_channel + ci_channel + co_channel + di_channel + do_channel \ No newline at end of file diff --git a/docs/channel_collection.rst b/docs/channel_collection.rst new file mode 100644 index 00000000..ecb23312 --- /dev/null +++ b/docs/channel_collection.rst @@ -0,0 +1,15 @@ +nidaqmx.task.channel_collection +=============================== + +.. automodule:: nidaqmx._task_modules.channel_collection + :members: + :show-inheritance: + +.. toctree:: + + ai_channel_collection + ao_channel_collection + ci_channel_collection + co_channel_collection + di_channel_collection + do_channel_collection diff --git a/docs/ci_channel.rst b/docs/ci_channel.rst new file mode 100644 index 00000000..bd23b654 --- /dev/null +++ b/docs/ci_channel.rst @@ -0,0 +1,7 @@ +nidaqmx.task.ci_channel +======================= + +.. automodule:: nidaqmx._task_modules.channels.ci_channel + :members: + :inherited-members: + :show-inheritance: diff --git a/docs/ci_channel_collection.rst b/docs/ci_channel_collection.rst new file mode 100644 index 00000000..f8170e03 --- /dev/null +++ b/docs/ci_channel_collection.rst @@ -0,0 +1,7 @@ +nidaqmx.task.ci_channel_collection +================================== + +.. automodule:: nidaqmx._task_modules.ci_channel_collection + :members: + :inherited-members: + :show-inheritance: diff --git a/docs/co_channel.rst b/docs/co_channel.rst new file mode 100644 index 00000000..99d231e6 --- /dev/null +++ b/docs/co_channel.rst @@ -0,0 +1,7 @@ +nidaqmx.task.co_channel +======================= + +.. automodule:: nidaqmx._task_modules.channels.co_channel + :members: + :inherited-members: + :show-inheritance: diff --git a/docs/co_channel_collection.rst b/docs/co_channel_collection.rst new file mode 100644 index 00000000..2b850aea --- /dev/null +++ b/docs/co_channel_collection.rst @@ -0,0 +1,7 @@ +nidaqmx.task.co_channel_collection +================================== + +.. automodule:: nidaqmx._task_modules.co_channel_collection + :members: + :inherited-members: + :show-inheritance: diff --git a/docs/collections.rst b/docs/collections.rst new file mode 100644 index 00000000..1a53b121 --- /dev/null +++ b/docs/collections.rst @@ -0,0 +1,10 @@ +nidaqmx.system.collections +========================== + +.. toctree:: + + device_collection + persisted_channel_collection + persisted_scale_collection + persisted_task_collection + physical_channel_collection diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 00000000..3cbfaf85 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,156 @@ +# -*- coding: utf-8 -*- +# +# NI-DAQmx Python API documentation build configuration file, created by +# sphinx-quickstart on Thu Dec 15 09:40:36 2016. +# +# This file is execfile()d with the current directory set to its +# containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +# import os +# import sys +# sys.path.insert(0, os.path.abspath('.')) + + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +# +# needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = ['sphinx.ext.autodoc', + 'sphinx.ext.coverage', + 'sphinx.ext.viewcode', + 'sphinx.ext.napoleon'] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +# +# source_suffix = ['.rst', '.md'] +source_suffix = '.rst' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'NI-DAQmx Python API' +copyright = u'2017, National Instruments' +author = u'National Instruments' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = u'0.5' +# The full version, including alpha/beta/rc tags. +release = u'0.5.0' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = None + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This patterns also effect to html_static_path and html_extra_path +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = False + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'sphinx_rtd_theme' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +# +# html_theme_options = {} + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + + +# -- Options for HTMLHelp output ------------------------------------------ + +# Output file base name for HTML help builder. +htmlhelp_basename = 'NI-DAQmxPythonAPIdoc' + + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # + # 'papersize': 'letterpaper', + + # The font size ('10pt', '11pt' or '12pt'). + # + # 'pointsize': '10pt', + + # Additional stuff for the LaTeX preamble. + # + # 'preamble': '', + + # Latex figure (float) alignment + # + # 'figure_align': 'htbp', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + (master_doc, 'NI-DAQmxPythonAPI.tex', u'NI-DAQmx Python API Documentation', + u'National Instruments', 'manual'), +] + + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + (master_doc, 'ni-daqmxpythonapi', u'NI-DAQmx Python API Documentation', + [author], 1) +] + + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + (master_doc, 'NI-DAQmxPythonAPI', u'NI-DAQmx Python API Documentation', + author, 'NI-DAQmxPythonAPI', 'One line description of project.', + 'Miscellaneous'), +] diff --git a/docs/constants.rst b/docs/constants.rst new file mode 100644 index 00000000..3454b0e2 --- /dev/null +++ b/docs/constants.rst @@ -0,0 +1,6 @@ +nidaqmx.constants +================= +.. automodule:: nidaqmx.constants + :members: + :undoc-members: + :show-inheritance: \ No newline at end of file diff --git a/docs/device.rst b/docs/device.rst new file mode 100644 index 00000000..52a80f7b --- /dev/null +++ b/docs/device.rst @@ -0,0 +1,7 @@ +nidaqmx.system.device +===================== + +.. automodule:: nidaqmx.system.device + :members: + :show-inheritance: + :special-members: diff --git a/docs/device_collection.rst b/docs/device_collection.rst new file mode 100644 index 00000000..889aec74 --- /dev/null +++ b/docs/device_collection.rst @@ -0,0 +1,6 @@ +nidaqmx.system.device_collection +================================ + +.. automodule:: nidaqmx.system._collections.device_collection + :members: + :show-inheritance: diff --git a/docs/di_channel.rst b/docs/di_channel.rst new file mode 100644 index 00000000..8ba882ec --- /dev/null +++ b/docs/di_channel.rst @@ -0,0 +1,7 @@ +nidaqmx.task.di_channel +======================= + +.. automodule:: nidaqmx._task_modules.channels.di_channel + :members: + :inherited-members: + :show-inheritance: diff --git a/docs/di_channel_collection.rst b/docs/di_channel_collection.rst new file mode 100644 index 00000000..b8158e63 --- /dev/null +++ b/docs/di_channel_collection.rst @@ -0,0 +1,7 @@ +nidaqmx.task.di_channel_collection +================================== + +.. automodule:: nidaqmx._task_modules.di_channel_collection + :members: + :inherited-members: + :show-inheritance: diff --git a/docs/do_channel.rst b/docs/do_channel.rst new file mode 100644 index 00000000..35de1f0f --- /dev/null +++ b/docs/do_channel.rst @@ -0,0 +1,7 @@ +nidaqmx.task.do_channel +======================= + +.. automodule:: nidaqmx._task_modules.channels.do_channel + :members: + :inherited-members: + :show-inheritance: diff --git a/docs/do_channel_collection.rst b/docs/do_channel_collection.rst new file mode 100644 index 00000000..565477ed --- /dev/null +++ b/docs/do_channel_collection.rst @@ -0,0 +1,7 @@ +nidaqmx.task.do_channel_collection +================================== + +.. automodule:: nidaqmx._task_modules.do_channel_collection + :members: + :inherited-members: + :show-inheritance: diff --git a/docs/errors.rst b/docs/errors.rst new file mode 100644 index 00000000..d38f0974 --- /dev/null +++ b/docs/errors.rst @@ -0,0 +1,6 @@ +nidaqmx.errors +============== +.. automodule:: nidaqmx.errors + :members: + :undoc-members: + :show-inheritance: \ No newline at end of file diff --git a/docs/expiration_state.rst b/docs/expiration_state.rst new file mode 100644 index 00000000..4d5ca5c9 --- /dev/null +++ b/docs/expiration_state.rst @@ -0,0 +1,6 @@ +nidaqmx.system.expiration_state +=============================== + +.. automodule:: nidaqmx.system._watchdog_modules.expiration_state + :members: + :show-inheritance: diff --git a/docs/expiration_states_collection.rst b/docs/expiration_states_collection.rst new file mode 100644 index 00000000..9e912ff5 --- /dev/null +++ b/docs/expiration_states_collection.rst @@ -0,0 +1,6 @@ +nidaqmx.system.expiration_states_collection +=========================================== + +.. automodule:: nidaqmx.system._watchdog_modules.expiration_states_collection + :members: + :show-inheritance: diff --git a/docs/export_signals.rst b/docs/export_signals.rst new file mode 100644 index 00000000..38521961 --- /dev/null +++ b/docs/export_signals.rst @@ -0,0 +1,6 @@ +nidaqmx.task.export_signals +=========================== + +.. automodule:: nidaqmx._task_modules.export_signals + :members: + :show-inheritance: diff --git a/docs/handshake_trigger.rst b/docs/handshake_trigger.rst new file mode 100644 index 00000000..32071996 --- /dev/null +++ b/docs/handshake_trigger.rst @@ -0,0 +1,6 @@ +nidaqmx.task.handshake_trigger +============================== + +.. automodule:: nidaqmx._task_modules.triggering.handshake_trigger + :members: + :show-inheritance: diff --git a/docs/in_stream.rst b/docs/in_stream.rst new file mode 100644 index 00000000..f5545db6 --- /dev/null +++ b/docs/in_stream.rst @@ -0,0 +1,6 @@ +nidaqmx.task.in_stream +====================== + +.. automodule:: nidaqmx._task_modules.in_stream + :members: + :show-inheritance: diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 00000000..a4c3f89e --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,30 @@ +.. NI-DAQmx Python API documentation master file, created by + sphinx-quickstart on Thu Dec 15 09:40:36 2016. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +NI-DAQmx Python Documentation +============================= + +.. include:: README.rst + +.. toctree:: + :maxdepth: 3 + :caption: API Reference: + + constants + errors + scale + stream_readers + stream_writers + system + task + types + utils + + +Indices and Tables +================== + +* :ref:`genindex` +* :ref:`modindex` diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 00000000..6cdacf7b --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,36 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build +set SPHINXPROJ=NI-DAQmxPythonAPI + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% + +:end +popd diff --git a/docs/out_stream.rst b/docs/out_stream.rst new file mode 100644 index 00000000..b6a1ea64 --- /dev/null +++ b/docs/out_stream.rst @@ -0,0 +1,6 @@ +nidaqmx.task.out_stream +======================= + +.. automodule:: nidaqmx._task_modules.out_stream + :members: + :show-inheritance: diff --git a/docs/pause_trigger.rst b/docs/pause_trigger.rst new file mode 100644 index 00000000..1c166831 --- /dev/null +++ b/docs/pause_trigger.rst @@ -0,0 +1,6 @@ +nidaqmx.task.pause_trigger +========================== + +.. automodule:: nidaqmx._task_modules.triggering.pause_trigger + :members: + :show-inheritance: diff --git a/docs/persisted_channel.rst b/docs/persisted_channel.rst new file mode 100644 index 00000000..f1d59246 --- /dev/null +++ b/docs/persisted_channel.rst @@ -0,0 +1,7 @@ +nidaqmx.system.persisted_channel +================================ + +.. automodule:: nidaqmx.system.storage.persisted_channel + :members: + :show-inheritance: + :special-members: diff --git a/docs/persisted_channel_collection.rst b/docs/persisted_channel_collection.rst new file mode 100644 index 00000000..ab7aef52 --- /dev/null +++ b/docs/persisted_channel_collection.rst @@ -0,0 +1,6 @@ +nidaqmx.system.persisted_channel_collection +=========================================== + +.. automodule:: nidaqmx.system._collections.persisted_channel_collection + :members: + :show-inheritance: diff --git a/docs/persisted_scale.rst b/docs/persisted_scale.rst new file mode 100644 index 00000000..c164bbc8 --- /dev/null +++ b/docs/persisted_scale.rst @@ -0,0 +1,7 @@ +nidaqmx.system.persisted_scale +============================== + +.. automodule:: nidaqmx.system.storage.persisted_scale + :members: + :show-inheritance: + :special-members: diff --git a/docs/persisted_scale_collection.rst b/docs/persisted_scale_collection.rst new file mode 100644 index 00000000..e6ad2497 --- /dev/null +++ b/docs/persisted_scale_collection.rst @@ -0,0 +1,6 @@ +nidaqmx.system.persisted_scale_collection +========================================= + +.. automodule:: nidaqmx.system._collections.persisted_scale_collection + :members: + :show-inheritance: diff --git a/docs/persisted_task.rst b/docs/persisted_task.rst new file mode 100644 index 00000000..2584d67a --- /dev/null +++ b/docs/persisted_task.rst @@ -0,0 +1,7 @@ +nidaqmx.system.persisted_task +============================= + +.. automodule:: nidaqmx.system.storage.persisted_task + :members: + :show-inheritance: + :special-members: diff --git a/docs/persisted_task_collection.rst b/docs/persisted_task_collection.rst new file mode 100644 index 00000000..ce1a0c6c --- /dev/null +++ b/docs/persisted_task_collection.rst @@ -0,0 +1,6 @@ +nidaqmx.system.persisted_task_collection +======================================== + +.. automodule:: nidaqmx.system._collections.persisted_task_collection + :members: + :show-inheritance: diff --git a/docs/physical_channel.rst b/docs/physical_channel.rst new file mode 100644 index 00000000..8fbcc7a1 --- /dev/null +++ b/docs/physical_channel.rst @@ -0,0 +1,7 @@ +nidaqmx.system.physical_channel +=============================== + +.. automodule:: nidaqmx.system.physical_channel + :members: + :show-inheritance: + :special-members: \ No newline at end of file diff --git a/docs/physical_channel_collection.rst b/docs/physical_channel_collection.rst new file mode 100644 index 00000000..eade825f --- /dev/null +++ b/docs/physical_channel_collection.rst @@ -0,0 +1,6 @@ +nidaqmx.system.physical_channel_collection +========================================== + +.. automodule:: nidaqmx.system._collections.physical_channel_collection + :members: + :show-inheritance: diff --git a/docs/reference_trigger.rst b/docs/reference_trigger.rst new file mode 100644 index 00000000..7d65bbd8 --- /dev/null +++ b/docs/reference_trigger.rst @@ -0,0 +1,6 @@ +nidaqmx.task.reference_trigger +============================== + +.. automodule:: nidaqmx._task_modules.triggering.reference_trigger + :members: + :show-inheritance: diff --git a/docs/scale.rst b/docs/scale.rst new file mode 100644 index 00000000..71034109 --- /dev/null +++ b/docs/scale.rst @@ -0,0 +1,7 @@ +nidaqmx.scale +===================== + +.. automodule:: nidaqmx.scale + :members: + :show-inheritance: + :special-members: \ No newline at end of file diff --git a/docs/start_trigger.rst b/docs/start_trigger.rst new file mode 100644 index 00000000..823729c8 --- /dev/null +++ b/docs/start_trigger.rst @@ -0,0 +1,6 @@ +nidaqmx.task.start_trigger +========================== + +.. automodule:: nidaqmx._task_modules.triggering.start_trigger + :members: + :show-inheritance: diff --git a/docs/storage.rst b/docs/storage.rst new file mode 100644 index 00000000..54963240 --- /dev/null +++ b/docs/storage.rst @@ -0,0 +1,8 @@ +nidaqmx.system.storage +====================== + +.. toctree:: + + persisted_channel + persisted_scale + persisted_task diff --git a/docs/stream_readers.rst b/docs/stream_readers.rst new file mode 100644 index 00000000..8609111e --- /dev/null +++ b/docs/stream_readers.rst @@ -0,0 +1,7 @@ +nidaqmx.stream_readers +====================== + +.. automodule:: nidaqmx.stream_readers + :members: + :show-inheritance: + :inherited-members: \ No newline at end of file diff --git a/docs/stream_writers.rst b/docs/stream_writers.rst new file mode 100644 index 00000000..84f8b004 --- /dev/null +++ b/docs/stream_writers.rst @@ -0,0 +1,7 @@ +nidaqmx.stream_writers +====================== + +.. automodule:: nidaqmx.stream_writers + :members: + :show-inheritance: + :inherited-members: \ No newline at end of file diff --git a/docs/system.rst b/docs/system.rst new file mode 100644 index 00000000..9b41db85 --- /dev/null +++ b/docs/system.rst @@ -0,0 +1,14 @@ +nidaqmx.system +============== + +.. automodule:: nidaqmx.system.system + :members: + :show-inheritance: + +.. toctree:: + + collections + device + physical_channel + storage + watchdog diff --git a/docs/task.rst b/docs/task.rst new file mode 100644 index 00000000..8135e3aa --- /dev/null +++ b/docs/task.rst @@ -0,0 +1,16 @@ +nidaqmx.task +============ +.. automodule:: nidaqmx.task + :members: + :show-inheritance: + :special-members: + +.. toctree:: + + channel + channel_collection + export_signals + in_stream + out_stream + timing + triggers \ No newline at end of file diff --git a/docs/timing.rst b/docs/timing.rst new file mode 100644 index 00000000..a89a623d --- /dev/null +++ b/docs/timing.rst @@ -0,0 +1,6 @@ +nidaqmx.task.timing +=================== + +.. automodule:: nidaqmx._task_modules.timing + :members: + :show-inheritance: diff --git a/docs/triggers.rst b/docs/triggers.rst new file mode 100644 index 00000000..80352bbc --- /dev/null +++ b/docs/triggers.rst @@ -0,0 +1,14 @@ +nidaqmx.task.triggers +===================== + +.. automodule:: nidaqmx._task_modules.triggers + :members: + :show-inheritance: + +.. toctree:: + + arm_start_trigger + handshake_trigger + pause_trigger + reference_trigger + start_trigger \ No newline at end of file diff --git a/docs/types.rst b/docs/types.rst new file mode 100644 index 00000000..586a5631 --- /dev/null +++ b/docs/types.rst @@ -0,0 +1,6 @@ +nidaqmx.types +============= +.. automodule:: nidaqmx.types + :members: + :undoc-members: + :show-inheritance: \ No newline at end of file diff --git a/docs/utils.rst b/docs/utils.rst new file mode 100644 index 00000000..6bf4f556 --- /dev/null +++ b/docs/utils.rst @@ -0,0 +1,6 @@ +nidaqmx.utils +============= + +.. automodule:: nidaqmx.utils + :members: + :show-inheritance: \ No newline at end of file diff --git a/docs/watchdog.rst b/docs/watchdog.rst new file mode 100644 index 00000000..24544863 --- /dev/null +++ b/docs/watchdog.rst @@ -0,0 +1,12 @@ +nidaqmx.system.watchdog +======================= + +.. automodule:: nidaqmx.system.watchdog + :members: + :show-inheritance: + :special-members: + +.. toctree:: + + expiration_state + expiration_states_collection diff --git a/nidaqmx/__init__.py b/nidaqmx/__init__.py new file mode 100644 index 00000000..1804a0e3 --- /dev/null +++ b/nidaqmx/__init__.py @@ -0,0 +1,11 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +from nidaqmx.errors import DaqError, DaqWarning, DaqResourceWarning +from nidaqmx.scale import Scale +from nidaqmx.task import Task +from nidaqmx._task_modules.read_functions import CtrFreq, CtrTick, CtrTime + +__all__ = ['errors', 'scale', 'stream_readers', 'stream_writers', 'task'] diff --git a/nidaqmx/_lib.py b/nidaqmx/_lib.py new file mode 100644 index 00000000..78655aaa --- /dev/null +++ b/nidaqmx/_lib.py @@ -0,0 +1,234 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import ctypes +import six +import sys +import platform +from ctypes.util import find_library +from numpy.ctypeslib import ndpointer + + +class Error(Exception): + pass + + +class DaqNotFoundError(Error): + pass + + +class DaqFunctionNotSupportedError(Error): + pass + + +class InvalidHandleError(Error): + pass + + +class c_bool32(ctypes.c_uint): + """ + Specifies a custom ctypes data type to represent 32-bit booleans. + """ + + def _getter(self): + return bool(ctypes.c_uint.value.fget(self)) + + def _setter(self, val): + ctypes.c_uint.value.fset(self, int(val)) + + value = property(_getter, _setter) + + del _getter, _setter + + +class CtypesByteString(object): + """ + Custom argtype that automatically converts unicode strings to ASCII + strings in Python 3. + """ + def from_param(self, param): + if isinstance(param, six.text_type): + param = param.encode('ascii') + return ctypes.c_char_p(param) + + +ctypes_byte_str = CtypesByteString() + + +def wrapped_ndpointer(*args, **kwargs): + """ + Specifies an ndpointer type that wraps numpy.ctypeslib.ndpointer and + allows a value of None to be passed to an argument of that type. + + Taken from http://stackoverflow.com/questions/32120178 + """ + if sys.version_info < (3,): + if 'flags' in kwargs: + kwargs['flags'] = tuple( + f.encode('ascii') for f in kwargs['flags']) + + base = ndpointer(*args, **kwargs) + + def from_param(cls, obj): + if obj is None: + return obj + return base.from_param(obj) + + return type(base.__name__, (base,), + {'from_param': classmethod(from_param)}) + + +def enum_bitfield_to_list(bitfield_value, bitfield_enum_type, + actual_enum_type): + """ + Converts a bitfield value to a list of enums. + + Args: + bitfield_value (int): Specifies the value of the bitfield. + bitfield_enum_type (enum.Enum): Specifies the bitfield enum type + from which to mask and extract the enum values. + actual_enum_type (enum.Enum): Specifies the actual enum type. + Returns: + List[enum.Enum]: Indicates the converted list of enums. + """ + supported_values = [] + for bitfield_mask in bitfield_enum_type: + if bitfield_value & bitfield_mask.value: + enum_value = next( + e for e in actual_enum_type if e.name == bitfield_mask.name) + supported_values.append(enum_value) + + return supported_values + + +def enum_list_to_bitfield(enum_list, bitfield_enum_type): + """ + Converts a list of enums to a bitfield value. + + Args: + enum_list (List[enum.Enum]): Specifies the list of enums. + bitfield_enum_type (enum.Enum): Specifies the bitfield enum type + from which to mask and extract the enum values. + Returns: + int: Indicates the value of the bitfield. + """ + bitfield_value = 0 + for enum_value in enum_list: + bitfield_mask = next( + b for b in bitfield_enum_type if b.name == enum_value.name) + bitfield_value |= bitfield_mask.value + + return bitfield_value + + +class DaqFunctionImporter(object): + """ + Wraps the function getter function of a ctypes library. + + Allows the NI-DAQmx Python API to fail elegantly if a function is not + supported in the current version of the API. + """ + + def __init__(self, library): + self._library = library + + def __getattr__(self, function): + try: + return getattr(self._library, function) + except AttributeError: + raise DaqFunctionNotSupportedError( + 'The NI-DAQmx function "{0}" is not supported in this ' + 'version of NI-DAQmx. Visit ni.com/downloads to upgrade your ' + 'version of NI-DAQmx.'.format(function)) + + +class DaqLibImporter(object): + """ + Encapsulates NI-DAQmx library importing and handle type parsing logic. + """ + + def __init__(self): + self._windll = None + self._cdll = None + self._cal_handle = None + self._task_handle = None + + @property + def windll(self): + if self._windll is None: + self._import_lib() + return self._windll + + @property + def cdll(self): + if self._cdll is None: + self._import_lib() + return self._cdll + + @property + def task_handle(self): + if self._task_handle is None: + self._parse_typedefs() + return self._task_handle + + @property + def cal_handle(self): + if self._cal_handle is None: + self._parse_typedefs() + return self._cal_handle + + def _import_lib(self): + """ + Determines the location of and loads the NI-DAQmx CAI DLL. + """ + self._windll = None + self._cdll = None + + windll = None + cdll = None + + if sys.platform.startswith('win') or sys.platform.startswith('cli'): + lib_name = "nicaiu" + if 'iron' in platform.python_implementation().lower(): + windll = ctypes.windll.nicaiu + cdll = ctypes.cdll.nicaiu + else: + windll = ctypes.windll.LoadLibrary(lib_name) + cdll = ctypes.cdll.LoadLibrary(lib_name) + + elif sys.platform.startswith('linux'): + # On linux you can use the command find_library('nidaqmx') + if find_library('nidaqmx') is not None: + cdll = ctypes.cdll.LoadLibrary(find_library('nidaqmx')) + windll = cdll + else: + raise DaqNotFoundError( + 'Could not find an installation of NI-DAQmx. Please ' + 'ensure that NI-DAQmx is installed on this machine or ' + 'contact National Instruments for support.') + + self._windll = DaqFunctionImporter(windll) + self._cdll = DaqFunctionImporter(cdll) + + def _parse_typedefs(self): + """ + Determines the ctypes data types of the Task and Cal handles + based on the version of the NI-DAQmx driver installed. + """ + from nidaqmx.system.system import System + system = System.local() + + # If DAQmx 8.8 and lower, TaskHandle is a typedef for uInt32 since + # DAQmx didn't support 64-bit applications then. + version = system.driver_version + if version.major_version <= 8 and version.minor_version <= 8: + self._task_handle = ctypes.c_uint + else: + self._task_handle = ctypes.c_void_p + + self._cal_handle = ctypes.c_uint + + +lib_importer = DaqLibImporter() diff --git a/nidaqmx/_task_modules/__init__.py b/nidaqmx/_task_modules/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/nidaqmx/_task_modules/ai_channel_collection.py b/nidaqmx/_task_modules/ai_channel_collection.py new file mode 100644 index 00000000..716aecd8 --- /dev/null +++ b/nidaqmx/_task_modules/ai_channel_collection.py @@ -0,0 +1,3630 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import ctypes +import numpy + +from nidaqmx._lib import ( + lib_importer, wrapped_ndpointer, ctypes_byte_str, c_bool32) +from nidaqmx.errors import check_for_error +from nidaqmx._task_modules.channels.ai_channel import AIChannel +from nidaqmx._task_modules.channel_collection import ChannelCollection +from nidaqmx.utils import unflatten_channel_string +from nidaqmx.constants import ( + ACExcitWireMode, AccelChargeSensitivityUnits, AccelSensitivityUnits, + AccelUnits, AngleUnits, BridgeConfiguration, BridgeElectricalUnits, + BridgePhysicalUnits, BridgeUnits, CJCSource, ChargeUnits, + CurrentShuntResistorLocation, CurrentUnits, + EddyCurrentProxProbeSensitivityUnits, ExcitationSource, + ForceIEPESensorSensitivityUnits, ForceUnits, FrequencyUnits, + LVDTSensitivityUnits, LengthUnits, PressureUnits, RTDType, + RVDTSensitivityUnits, ResistanceConfiguration, ResistanceUnits, + SoundPressureUnits, StrainGageBridgeType, StrainGageRosetteType, + StrainUnits, TEDSUnits, TemperatureUnits, TerminalConfiguration, + ThermocoupleType, TorqueUnits, VelocityIEPESensorSensitivityUnits, + VelocityUnits, VoltageUnits) + + +class AIChannelCollection(ChannelCollection): + """ + Contains the collection of analog input channels for a DAQmx Task. + """ + def __init__(self, task_handle): + super(AIChannelCollection, self).__init__(task_handle) + + def _create_chan(self, physical_channel, name_to_assign_to_channel=''): + """ + Creates and returns an AIChannel object. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. + name_to_assign_to_channel (Optional[str]): Specifies a name to + assign to the virtual channel this method creates. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Specifies the newly created AIChannel object. + """ + if name_to_assign_to_channel: + num_channels = len(unflatten_channel_string(physical_channel)) + + if num_channels > 1: + name = '{0}0:{1}'.format( + name_to_assign_to_channel, num_channels-1) + else: + name = name_to_assign_to_channel + else: + name = physical_channel + + return AIChannel(self._handle, name) + + def add_ai_accel_4_wire_dc_voltage_chan( + self, physical_channel, name_to_assign_to_channel="", + terminal_config=TerminalConfiguration.DEFAULT, min_val=-5.0, + max_val=5.0, units=AccelUnits.G, sensitivity=1000.0, + sensitivity_units=AccelSensitivityUnits.M_VOLTS_PER_G, + voltage_excit_source=ExcitationSource.INTERNAL, + voltage_excit_val=0.0, use_excit_for_scaling=False, + custom_scale_name=""): + """ + Creates channel(s) to measure acceleration. Use this instance + for custom sensors that require excitation. You can use the + excitation to scale the measurement. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + terminal_config (Optional[nidaqmx.constants.TerminalConfiguration]): + Specifies the input terminal configuration for the + channel. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.AccelUnits]): Specifies + the units to use to return acceleration measurements + from the channel. + sensitivity (Optional[float]): Is the sensitivity of the + sensor. This value is in the units you specify with the + **sensitivity_units** input. Refer to the sensor + documentation to determine this value. + sensitivity_units (Optional[nidaqmx.constants.AccelSensitivityUnits]): + Specifies the units of the **sensitivity** input. + voltage_excit_source (Optional[nidaqmx.constants.ExcitationSource]): + Specifies the source of excitation. + voltage_excit_val (Optional[float]): Specifies in volts the + amount of excitation supplied to the sensor. Refer to + the sensor documentation to determine appropriate + excitation values. + use_excit_for_scaling (Optional[bool]): Specifies if NI- + DAQmx divides the measurement by the excitation. You + should typically set **use_excit_for_scaling** to True + for ratiometric transducers. If you set + **use_excit_for_scaling** to True, set **max_val** and + **min_val** to reflect the scaling. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateAIAccel4WireDCVoltageChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_int, + ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_double, + c_bool32, ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + terminal_config.value, min_val, max_val, units.value, sensitivity, + sensitivity_units.value, voltage_excit_source.value, + voltage_excit_val, use_excit_for_scaling, custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_ai_accel_chan( + self, physical_channel, name_to_assign_to_channel="", + terminal_config=TerminalConfiguration.DEFAULT, min_val=-5.0, + max_val=5.0, units=AccelUnits.G, sensitivity=1000.0, + sensitivity_units=AccelSensitivityUnits.M_VOLTS_PER_G, + current_excit_source=ExcitationSource.INTERNAL, + current_excit_val=0.004, custom_scale_name=""): + """ + Creates channel(s) that use an accelerometer to measure + acceleration. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + terminal_config (Optional[nidaqmx.constants.TerminalConfiguration]): + Specifies the input terminal configuration for the + channel. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.AccelUnits]): Specifies + the units to use to return acceleration measurements + from the channel. + sensitivity (Optional[float]): Is the sensitivity of the + sensor. This value is in the units you specify with the + **sensitivity_units** input. Refer to the sensor + documentation to determine this value. + sensitivity_units (Optional[nidaqmx.constants.AccelSensitivityUnits]): + Specifies the units of the **sensitivity** input. + current_excit_source (Optional[nidaqmx.constants.ExcitationSource]): + Specifies the source of excitation. + current_excit_val (Optional[float]): Specifies in amperes + the amount of excitation to supply to the sensor. Refer + to the sensor documentation to determine this value. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateAIAccelChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_int, + ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_double, + ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + terminal_config.value, min_val, max_val, units.value, sensitivity, + sensitivity_units.value, current_excit_source.value, + current_excit_val, custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_ai_accel_charge_chan( + self, physical_channel, name_to_assign_to_channel="", + terminal_config=TerminalConfiguration.DEFAULT, min_val=-5.0, + max_val=5.0, units=AccelUnits.G, sensitivity=100.0, + sensitivity_units=AccelChargeSensitivityUnits.PICO_COULOMBS_PER_G, + custom_scale_name=""): + """ + Creates channel(s) that use a charge-based sensor to measure + acceleration. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + terminal_config (Optional[nidaqmx.constants.TerminalConfiguration]): + Specifies the input terminal configuration for the + channel. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.AccelUnits]): Specifies + the units to use to return acceleration measurements + from the channel. + sensitivity (Optional[float]): Is the sensitivity of the + sensor. This value is in the units you specify with the + **sensitivity_units** input. Refer to the sensor + documentation to determine this value. + sensitivity_units (Optional[nidaqmx.constants.AccelChargeSensitivityUnits]): + Specifies the units of the **sensitivity** input. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateAIAccelChargeChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_int, + ctypes.c_double, ctypes.c_int, ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + terminal_config.value, min_val, max_val, units.value, sensitivity, + sensitivity_units.value, custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_ai_bridge_chan( + self, physical_channel, name_to_assign_to_channel="", + min_val=-0.002, max_val=0.002, units=BridgeUnits.VOLTS_PER_VOLTS, + bridge_config=BridgeConfiguration.FULL_BRIDGE, + voltage_excit_source=ExcitationSource.INTERNAL, + voltage_excit_val=2.5, nominal_bridge_resistance=350.0, + custom_scale_name=""): + """ + Creates channel(s) that measure voltage ratios from a Wheatstone + bridge. Use this instance with bridge-based sensors that measure + phenomena other than strain, force, pressure, or torque, or that + scale data to physical units NI-DAQmx does not support. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.BridgeUnits]): Specifies + in which unit to return voltage ratios from the channel. + bridge_config (Optional[nidaqmx.constants.BridgeConfiguration]): + Specifies information about the bridge configuration and + measurement. + voltage_excit_source (Optional[nidaqmx.constants.ExcitationSource]): + Specifies information about the bridge configuration and + measurement. + voltage_excit_val (Optional[float]): Specifies information + about the bridge configuration and measurement. + nominal_bridge_resistance (Optional[float]): Specifies + information about the bridge configuration and + measurement. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateAIBridgeChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, + ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + min_val, max_val, units.value, bridge_config.value, + voltage_excit_source.value, voltage_excit_val, + nominal_bridge_resistance, custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_ai_charge_chan( + self, physical_channel, name_to_assign_to_channel="", + terminal_config=TerminalConfiguration.DEFAULT, + min_val=-0.000000001, max_val=0.000000001, + units=ChargeUnits.COULOMBS, custom_scale_name=""): + """ + Creates channel(s) that use a sensor with charge output. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + terminal_config (Optional[nidaqmx.constants.TerminalConfiguration]): + Specifies the input terminal configuration for the + channel. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.ChargeUnits]): Specifies + the units to use to return charge measurements from the + channel. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateAIChargeChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_int, + ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + terminal_config.value, min_val, max_val, units.value, + custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_ai_current_chan( + self, physical_channel, name_to_assign_to_channel="", + terminal_config=TerminalConfiguration.DEFAULT, min_val=-0.01, + max_val=0.01, units=CurrentUnits.AMPS, + shunt_resistor_loc=CurrentShuntResistorLocation.LET_DRIVER_CHOOSE, + ext_shunt_resistor_val=249.0, custom_scale_name=""): + """ + Creates channel(s) to measure current. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + terminal_config (Optional[nidaqmx.constants.TerminalConfiguration]): + Specifies the input terminal configuration for the + channel. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.CurrentUnits]): Specifies + the units to use to return current measurements. + shunt_resistor_loc (Optional[nidaqmx.constants.CurrentShuntResistorLocation]): + Specifies the location of the shunt resistor. For + devices with built-in shunt resistors, specify the + location as **INTERNAL**. For devices that do not have + built-in shunt resistors, you must attach an external + one, set this input to **EXTERNAL** and use the + **ext_shunt_resistor_val** input to specify the value of + the resistor. + ext_shunt_resistor_val (Optional[float]): Specifies in ohms + the resistance of an external shunt resistor. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateAICurrentChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_int, + ctypes.c_int, ctypes.c_double, ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + terminal_config.value, min_val, max_val, units.value, + shunt_resistor_loc.value, ext_shunt_resistor_val, + custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_ai_current_rms_chan( + self, physical_channel, name_to_assign_to_channel="", + terminal_config=TerminalConfiguration.DEFAULT, min_val=-0.01, + max_val=0.01, units=CurrentUnits.AMPS, + shunt_resistor_loc=CurrentShuntResistorLocation.LET_DRIVER_CHOOSE, + ext_shunt_resistor_val=249.0, custom_scale_name=""): + """ + Creates a channel to measure current RMS, the average (mean) + power of the acquired current. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + terminal_config (Optional[nidaqmx.constants.TerminalConfiguration]): + Specifies the input terminal configuration for the + channel. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.CurrentUnits]): Specifies + the units to use to return current measurements. + shunt_resistor_loc (Optional[nidaqmx.constants.CurrentShuntResistorLocation]): + Specifies the location of the shunt resistor. For + devices with built-in shunt resistors, specify the + location as **INTERNAL**. For devices that do not have + built-in shunt resistors, you must attach an external + one, set this input to **EXTERNAL** and use the + **ext_shunt_resistor_val** input to specify the value of + the resistor. + ext_shunt_resistor_val (Optional[float]): Specifies in ohms + the resistance of an external shunt resistor. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateAICurrentRMSChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_int, + ctypes.c_int, ctypes.c_double, ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + terminal_config.value, min_val, max_val, units.value, + shunt_resistor_loc.value, ext_shunt_resistor_val, + custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_ai_force_bridge_polynomial_chan( + self, physical_channel, name_to_assign_to_channel="", + min_val=-100.0, max_val=100.0, units=ForceUnits.POUNDS, + bridge_config=BridgeConfiguration.FULL_BRIDGE, + voltage_excit_source=ExcitationSource.INTERNAL, + voltage_excit_val=2.5, nominal_bridge_resistance=350.0, + forward_coeffs=None, reverse_coeffs=None, + electrical_units=BridgeElectricalUnits.M_VOLTS_PER_VOLT, + physical_units=BridgePhysicalUnits.POUNDS, custom_scale_name=""): + """ + Creates channel(s) that use a Wheatstone bridge to measure force + or load. Use this instance with sensors whose specifications + provide a polynomial to convert electrical values to physical + values. When you use this scaling type, NI-DAQmx requires + coefficients for a polynomial that converts electrical values to + physical values (forward), as well as coefficients for a + polynomial that converts physical values to electrical values + (reverse). If you only know one set of coefficients, use the + DAQmx Compute Reverse Polynomial Coefficients function to + generate the other set. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.ForceUnits]): Specifies in + which unit to return force measurements from the + channel. + bridge_config (Optional[nidaqmx.constants.BridgeConfiguration]): + Specifies information about the bridge configuration and + measurement. + voltage_excit_source (Optional[nidaqmx.constants.ExcitationSource]): + Specifies information about the bridge configuration and + measurement. + voltage_excit_val (Optional[float]): Specifies information + about the bridge configuration and measurement. + nominal_bridge_resistance (Optional[float]): Specifies + information about the bridge configuration and + measurement. + forward_coeffs (Optional[List[float]]): Specifies how to + scale electrical values from the sensor to physical + units. + reverse_coeffs (Optional[List[float]]): Specifies how to + scale electrical values from the sensor to physical + units. + electrical_units (Optional[nidaqmx.constants.BridgeElectricalUnits]): + Specifies how to scale electrical values from the sensor + to physical units. + physical_units (Optional[nidaqmx.constants.BridgePhysicalUnits]): + Specifies how to scale electrical values from the sensor + to physical units. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + if forward_coeffs is None: + forward_coeffs = [] + + if reverse_coeffs is None: + reverse_coeffs = [] + + forward_coeffs = numpy.float64(forward_coeffs) + reverse_coeffs = numpy.float64(reverse_coeffs) + + cfunc = lib_importer.windll.DAQmxCreateAIForceBridgePolynomialChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, + ctypes.c_int, ctypes.c_double, ctypes.c_double, + wrapped_ndpointer(dtype=numpy.float64, flags=('C','W')), + ctypes.c_uint, wrapped_ndpointer(dtype=numpy.float64, + flags=('C','W')), ctypes.c_uint, ctypes.c_int, ctypes.c_int, + ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + min_val, max_val, units.value, bridge_config.value, + voltage_excit_source.value, voltage_excit_val, + nominal_bridge_resistance, forward_coeffs, len(forward_coeffs), + reverse_coeffs, len(reverse_coeffs), electrical_units.value, + physical_units.value, custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_ai_force_bridge_table_chan( + self, physical_channel, name_to_assign_to_channel="", + min_val=-100.0, max_val=100.0, units=ForceUnits.POUNDS, + bridge_config=BridgeConfiguration.FULL_BRIDGE, + voltage_excit_source=ExcitationSource.INTERNAL, + voltage_excit_val=2.5, nominal_bridge_resistance=350.0, + electrical_vals=None, + electrical_units=BridgeElectricalUnits.M_VOLTS_PER_VOLT, + physical_vals=None, physical_units=BridgePhysicalUnits.POUNDS, + custom_scale_name=""): + """ + Creates channel(s) that use a Wheatstone bridge to measure force + or load. Use this instance with sensors whose specifications + provide a table of electrical values and the corresponding + physical values. When you use this scaling type, NI-DAQmx + performs linear scaling between each pair of electrical and + physical values. The input limits specified with **min_val** and + **max_val** must fall within the smallest and largest physical + values. For any data outside those endpoints, NI-DAQmx coerces + that data to the endpoints. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.ForceUnits]): Specifies in + which unit to return force measurements from the + channel. + bridge_config (Optional[nidaqmx.constants.BridgeConfiguration]): + Specifies information about the bridge configuration and + measurement. + voltage_excit_source (Optional[nidaqmx.constants.ExcitationSource]): + Specifies information about the bridge configuration and + measurement. + voltage_excit_val (Optional[float]): Specifies information + about the bridge configuration and measurement. + nominal_bridge_resistance (Optional[float]): Specifies + information about the bridge configuration and + measurement. + electrical_vals (Optional[List[float]]): Specifies how to + scale electrical values from the sensor to physical + units. + electrical_units (Optional[nidaqmx.constants.BridgeElectricalUnits]): + Specifies how to scale electrical values from the sensor + to physical units. + physical_vals (Optional[List[float]]): Specifies how to + scale electrical values from the sensor to physical + units. + physical_units (Optional[nidaqmx.constants.BridgePhysicalUnits]): + Specifies how to scale electrical values from the sensor + to physical units. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + if electrical_vals is None: + electrical_vals = [] + + if physical_vals is None: + physical_vals = [] + + electrical_vals = numpy.float64(electrical_vals) + physical_vals = numpy.float64(physical_vals) + + cfunc = lib_importer.windll.DAQmxCreateAIForceBridgeTableChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, + ctypes.c_int, ctypes.c_double, ctypes.c_double, + wrapped_ndpointer(dtype=numpy.float64, flags=('C','W')), + ctypes.c_uint, ctypes.c_int, + wrapped_ndpointer(dtype=numpy.float64, flags=('C','W')), + ctypes.c_uint, ctypes.c_int, ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + min_val, max_val, units.value, bridge_config.value, + voltage_excit_source.value, voltage_excit_val, + nominal_bridge_resistance, electrical_vals, len(electrical_vals), + electrical_units.value, physical_vals, len(physical_vals), + physical_units.value, custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_ai_force_bridge_two_point_lin_chan( + self, physical_channel, name_to_assign_to_channel="", + min_val=-100.0, max_val=100.0, units=ForceUnits.POUNDS, + bridge_config=BridgeConfiguration.FULL_BRIDGE, + voltage_excit_source=ExcitationSource.INTERNAL, + voltage_excit_val=2.5, nominal_bridge_resistance=350.0, + first_electrical_val=0.0, second_electrical_val=2.0, + electrical_units=BridgeElectricalUnits.M_VOLTS_PER_VOLT, + first_physical_val=0.0, second_physical_val=100.0, + physical_units=BridgePhysicalUnits.POUNDS, custom_scale_name=""): + """ + Creates channel(s) that use a Wheatstone bridge to measure force + or load. Use this instance with sensors whose specifications do + not provide a polynomial for scaling or a table of electrical + and physical values. When you use this scaling type, NI-DAQmx + uses two points of electrical and physical values to calculate + the slope and y-intercept of a linear equation and uses that + equation to scale electrical values to physical values. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.ForceUnits]): Specifies in + which unit to return force measurements from the + channel. + bridge_config (Optional[nidaqmx.constants.BridgeConfiguration]): + Specifies information about the bridge configuration and + measurement. + voltage_excit_source (Optional[nidaqmx.constants.ExcitationSource]): + Specifies information about the bridge configuration and + measurement. + voltage_excit_val (Optional[float]): Specifies information + about the bridge configuration and measurement. + nominal_bridge_resistance (Optional[float]): Specifies + information about the bridge configuration and + measurement. + first_electrical_val (Optional[float]): Specifies how to + scale electrical values from the sensor to physical + units. + second_electrical_val (Optional[float]): Specifies how to + scale electrical values from the sensor to physical + units. + electrical_units (Optional[nidaqmx.constants.BridgeElectricalUnits]): + Specifies how to scale electrical values from the sensor + to physical units. + first_physical_val (Optional[float]): Specifies how to scale + electrical values from the sensor to physical units. + second_physical_val (Optional[float]): Specifies how to + scale electrical values from the sensor to physical + units. + physical_units (Optional[nidaqmx.constants.BridgePhysicalUnits]): + Specifies how to scale electrical values from the sensor + to physical units. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateAIForceBridgeTwoPointLinChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, + ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_double, + ctypes.c_double, ctypes.c_int, ctypes.c_double, ctypes.c_double, + ctypes.c_int, ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + min_val, max_val, units.value, bridge_config.value, + voltage_excit_source.value, voltage_excit_val, + nominal_bridge_resistance, first_electrical_val, + second_electrical_val, electrical_units.value, first_physical_val, + second_physical_val, physical_units.value, custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_ai_force_iepe_chan( + self, physical_channel, name_to_assign_to_channel="", + terminal_config=TerminalConfiguration.DEFAULT, min_val=-2000.0, + max_val=2000.0, units=ForceUnits.NEWTONS, sensitivity=2.25, + sensitivity_units=ForceIEPESensorSensitivityUnits.M_VOLTS_PER_NEWTON, + current_excit_source=ExcitationSource.INTERNAL, + current_excit_val=0.004, custom_scale_name=""): + """ + Creates channel(s) that use an IEPE force sensor to measure + force or load. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + terminal_config (Optional[nidaqmx.constants.TerminalConfiguration]): + Specifies the input terminal configuration for the + channel. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.ForceUnits]): Specifies in + which unit to return force measurements from the + channel. + sensitivity (Optional[float]): Is the sensitivity of the + sensor. This value is in the units you specify with the + **sensitivity_units** input. Refer to the sensor + documentation to determine this value. + sensitivity_units (Optional[nidaqmx.constants.ForceIEPESensorSensitivityUnits]): + Specifies the units of the **sensitivity** input. + current_excit_source (Optional[nidaqmx.constants.ExcitationSource]): + Specifies the source of excitation. + current_excit_val (Optional[float]): Specifies in amperes + the amount of excitation to supply to the sensor. Refer + to the sensor documentation to determine this value. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateAIForceIEPEChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_int, + ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_double, + ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + terminal_config.value, min_val, max_val, units.value, sensitivity, + sensitivity_units.value, current_excit_source.value, + current_excit_val, custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_ai_freq_voltage_chan( + self, physical_channel, name_to_assign_to_channel="", min_val=1, + max_val=100, units=FrequencyUnits.HZ, threshold_level=0.0, + hysteresis=0.0, custom_scale_name=""): + """ + Creates channel(s) that use a frequency-to-voltage converter to + measure frequency. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.FrequencyUnits]): + Specifies the units to use to return frequency + measurements. + threshold_level (Optional[float]): Specifies in volts the + level at which to recognize waveform repetitions. You + should select a voltage level that occurs only once + within the entire period of a waveform. You also can + select a voltage that occurs only once while the voltage + rises or falls. + hysteresis (Optional[float]): Specifies in volts a window + below **level**. The input voltage must pass below + **threshold_level** minus **hysteresis** before NI-DAQmx + recognizes a waveform repetition. Hysteresis can improve + measurement accuracy when the signal contains noise or + jitter. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateAIFreqVoltageChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_double, + ctypes.c_double, ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + min_val, max_val, units.value, threshold_level, hysteresis, + custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_ai_microphone_chan( + self, physical_channel, name_to_assign_to_channel="", + terminal_config=TerminalConfiguration.DEFAULT, + units=SoundPressureUnits.PA, mic_sensitivity=10.0, + max_snd_press_level=100.0, + current_excit_source=ExcitationSource.INTERNAL, + current_excit_val=0.004, custom_scale_name=""): + """ + Creates channel(s) that use a microphone to measure sound + pressure. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + terminal_config (Optional[nidaqmx.constants.TerminalConfiguration]): + Specifies the input terminal configuration for the + channel. + units (Optional[nidaqmx.constants.SoundPressureUnits]): + Specifies the units to use to return sound pressure + measurements. + mic_sensitivity (Optional[float]): Is the sensitivity of the + microphone. Specify this value in mV/Pa. + max_snd_press_level (Optional[float]): Is the maximum + instantaneous sound pressure level you expect to + measure. This value is in decibels, referenced to 20 + micropascals. + current_excit_source (Optional[nidaqmx.constants.ExcitationSource]): + Specifies the source of excitation. + current_excit_val (Optional[float]): Specifies in amperes + the amount of excitation to supply to the sensor. Refer + to the sensor documentation to determine this value. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateAIMicrophoneChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_int, ctypes.c_int, ctypes.c_double, ctypes.c_double, + ctypes.c_int, ctypes.c_double, ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + terminal_config.value, units.value, mic_sensitivity, + max_snd_press_level, current_excit_source.value, + current_excit_val, custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_ai_pos_eddy_curr_prox_probe_chan( + self, physical_channel, name_to_assign_to_channel="", min_val=0.0, + max_val=0.00254, units=LengthUnits.METERS, sensitivity=200.0, + sensitivity_units=EddyCurrentProxProbeSensitivityUnits.MIL, + custom_scale_name=""): + """ + Creates channel(s) that use an eddy current proximity probe to + measure position. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.LengthUnits]): Specifies + the units to use to return position measurements from + the channel. + sensitivity (Optional[float]): Is the sensitivity of the + sensor. This value is in the units you specify with the + **sensitivity_units** input. Refer to the sensor + documentation to determine this value. + sensitivity_units (Optional[nidaqmx.constants.EddyCurrentProxProbeSensitivityUnits]): + Specifies the units of the **sensitivity** input. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateAIPosEddyCurrProxProbeChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_double, + ctypes.c_int, ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + min_val, max_val, units.value, sensitivity, + sensitivity_units.value, custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_ai_pos_lvdt_chan( + self, physical_channel, name_to_assign_to_channel="", + min_val=-0.1, max_val=0.1, units=LengthUnits.METERS, + sensitivity=50.0, + sensitivity_units=LVDTSensitivityUnits.M_VOLTS_PER_VOLT_PER_MILLIMETER, + voltage_excit_source=ExcitationSource.INTERNAL, + voltage_excit_val=1.0, voltage_excit_freq=2500.0, + ac_excit_wire_mode=ACExcitWireMode.FOUR_WIRE, + custom_scale_name=""): + """ + Creates channel(s) that use an LVDT to measure linear position. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.LengthUnits]): Specifies + the units to use to return linear position measurements + from the channel. + sensitivity (Optional[float]): Is the sensitivity of the + sensor. This value is in the units you specify with the + **sensitivity_units** input. Refer to the sensor + documentation to determine this value. + sensitivity_units (Optional[nidaqmx.constants.LVDTSensitivityUnits]): + Specifies the units of the **sensitivity** input. + voltage_excit_source (Optional[nidaqmx.constants.ExcitationSource]): + Specifies the source of excitation. + voltage_excit_val (Optional[float]): Specifies in volts the + amount of excitation supplied to the sensor. Refer to + the sensor documentation to determine appropriate + excitation values. + voltage_excit_freq (Optional[float]): Specifies in hertz the + excitation frequency that the sensor requires. Refer to + the sensor documentation to determine this value. + ac_excit_wire_mode (Optional[nidaqmx.constants.ACExcitWireMode]): + Is the number of leads on the sensor. Some sensors + require you to tie leads together to create a four- or + five- wire sensor. Refer to the sensor documentation for + more information. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateAIPosLVDTChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_double, + ctypes.c_int, ctypes.c_int, ctypes.c_double, ctypes.c_double, + ctypes.c_int, ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + min_val, max_val, units.value, sensitivity, + sensitivity_units.value, voltage_excit_source.value, + voltage_excit_val, voltage_excit_freq, ac_excit_wire_mode.value, + custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_ai_pos_rvdt_chan( + self, physical_channel, name_to_assign_to_channel="", + min_val=-70.0, max_val=70.0, units=AngleUnits.DEGREES, + sensitivity=50.0, + sensitivity_units=RVDTSensitivityUnits.M_VPER_VPER_DEGREE, + voltage_excit_source=ExcitationSource.INTERNAL, + voltage_excit_val=1.0, voltage_excit_freq=2500.0, + ac_excit_wire_mode=ACExcitWireMode.FOUR_WIRE, + custom_scale_name=""): + """ + Creates channel(s) that use an RVDT to measure angular position. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.AngleUnits]): Specifies + the units to use to return angular position measurements + from the channel. + sensitivity (Optional[float]): Is the sensitivity of the + sensor. This value is in the units you specify with the + **sensitivity_units** input. Refer to the sensor + documentation to determine this value. + sensitivity_units (Optional[nidaqmx.constants.RVDTSensitivityUnits]): + Specifies the units of the **sensitivity** input. + voltage_excit_source (Optional[nidaqmx.constants.ExcitationSource]): + Specifies the source of excitation. + voltage_excit_val (Optional[float]): Specifies in volts the + amount of excitation supplied to the sensor. Refer to + the sensor documentation to determine appropriate + excitation values. + voltage_excit_freq (Optional[float]): Specifies in hertz the + excitation frequency that the sensor requires. Refer to + the sensor documentation to determine this value. + ac_excit_wire_mode (Optional[nidaqmx.constants.ACExcitWireMode]): + Is the number of leads on the sensor. Some sensors + require you to tie leads together to create a four- or + five- wire sensor. Refer to the sensor documentation for + more information. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateAIPosRVDTChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_double, + ctypes.c_int, ctypes.c_int, ctypes.c_double, ctypes.c_double, + ctypes.c_int, ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + min_val, max_val, units.value, sensitivity, + sensitivity_units.value, voltage_excit_source.value, + voltage_excit_val, voltage_excit_freq, ac_excit_wire_mode.value, + custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_ai_pressure_bridge_polynomial_chan( + self, physical_channel, name_to_assign_to_channel="", + min_val=-100.0, max_val=100.0, + units=PressureUnits.POUNDS_PER_SQ_INCH, + bridge_config=BridgeConfiguration.FULL_BRIDGE, + voltage_excit_source=ExcitationSource.INTERNAL, + voltage_excit_val=2.5, nominal_bridge_resistance=350.0, + forward_coeffs=None, reverse_coeffs=None, + electrical_units=BridgeElectricalUnits.M_VOLTS_PER_VOLT, + physical_units=BridgePhysicalUnits.POUNDS_PER_SQ_INCH, + custom_scale_name=""): + """ + Creates channel(s) that use a Wheatstone bridge to measure + pressure. Use this instance with sensors whose specifications + provide a polynomial to convert electrical values to physical + values. When you use this scaling type, NI-DAQmx requires + coefficients for a polynomial that converts electrical values to + physical values (forward), as well as coefficients for a + polynomial that converts physical values to electrical values + (reverse). If you only know one set of coefficients, use the + DAQmx Compute Reverse Polynomial Coefficients function to + generate the other set. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.PressureUnits]): Specifies + in which unit to return pressure measurements from the + channel. + bridge_config (Optional[nidaqmx.constants.BridgeConfiguration]): + Specifies information about the bridge configuration and + measurement. + voltage_excit_source (Optional[nidaqmx.constants.ExcitationSource]): + Specifies information about the bridge configuration and + measurement. + voltage_excit_val (Optional[float]): Specifies information + about the bridge configuration and measurement. + nominal_bridge_resistance (Optional[float]): Specifies + information about the bridge configuration and + measurement. + forward_coeffs (Optional[List[float]]): Specifies how to + scale electrical values from the sensor to physical + units. + reverse_coeffs (Optional[List[float]]): Specifies how to + scale electrical values from the sensor to physical + units. + electrical_units (Optional[nidaqmx.constants.BridgeElectricalUnits]): + Specifies how to scale electrical values from the sensor + to physical units. + physical_units (Optional[nidaqmx.constants.BridgePhysicalUnits]): + Specifies how to scale electrical values from the sensor + to physical units. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + if forward_coeffs is None: + forward_coeffs = [] + + if reverse_coeffs is None: + reverse_coeffs = [] + + forward_coeffs = numpy.float64(forward_coeffs) + reverse_coeffs = numpy.float64(reverse_coeffs) + + cfunc = lib_importer.windll.DAQmxCreateAIPressureBridgePolynomialChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, + ctypes.c_int, ctypes.c_double, ctypes.c_double, + wrapped_ndpointer(dtype=numpy.float64, flags=('C','W')), + ctypes.c_uint, wrapped_ndpointer(dtype=numpy.float64, + flags=('C','W')), ctypes.c_uint, ctypes.c_int, ctypes.c_int, + ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + min_val, max_val, units.value, bridge_config.value, + voltage_excit_source.value, voltage_excit_val, + nominal_bridge_resistance, forward_coeffs, len(forward_coeffs), + reverse_coeffs, len(reverse_coeffs), electrical_units.value, + physical_units.value, custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_ai_pressure_bridge_table_chan( + self, physical_channel, name_to_assign_to_channel="", + min_val=-100.0, max_val=100.0, + units=PressureUnits.POUNDS_PER_SQ_INCH, + bridge_config=BridgeConfiguration.FULL_BRIDGE, + voltage_excit_source=ExcitationSource.INTERNAL, + voltage_excit_val=2.5, nominal_bridge_resistance=350.0, + electrical_vals=None, + electrical_units=BridgeElectricalUnits.M_VOLTS_PER_VOLT, + physical_vals=None, + physical_units=BridgePhysicalUnits.POUNDS_PER_SQ_INCH, + custom_scale_name=""): + """ + Creates channel(s) that use a Wheatstone bridge to measure + pressure. Use this instance with sensors whose specifications + provide a table of electrical values and the corresponding + physical values. When you use this scaling type, NI-DAQmx + performs linear scaling between each pair of electrical and + physical values. The input limits specified with **min_val** and + **max_val** must fall within the smallest and largest physical + values. For any data outside those endpoints, NI-DAQmx coerces + that data to the endpoints. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.PressureUnits]): Specifies + in which unit to return pressure measurements from the + channel. + bridge_config (Optional[nidaqmx.constants.BridgeConfiguration]): + Specifies information about the bridge configuration and + measurement. + voltage_excit_source (Optional[nidaqmx.constants.ExcitationSource]): + Specifies information about the bridge configuration and + measurement. + voltage_excit_val (Optional[float]): Specifies information + about the bridge configuration and measurement. + nominal_bridge_resistance (Optional[float]): Specifies + information about the bridge configuration and + measurement. + electrical_vals (Optional[List[float]]): Specifies how to + scale electrical values from the sensor to physical + units. + electrical_units (Optional[nidaqmx.constants.BridgeElectricalUnits]): + Specifies how to scale electrical values from the sensor + to physical units. + physical_vals (Optional[List[float]]): Specifies how to + scale electrical values from the sensor to physical + units. + physical_units (Optional[nidaqmx.constants.BridgePhysicalUnits]): + Specifies how to scale electrical values from the sensor + to physical units. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + if electrical_vals is None: + electrical_vals = [] + + if physical_vals is None: + physical_vals = [] + + electrical_vals = numpy.float64(electrical_vals) + physical_vals = numpy.float64(physical_vals) + + cfunc = lib_importer.windll.DAQmxCreateAIPressureBridgeTableChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, + ctypes.c_int, ctypes.c_double, ctypes.c_double, + wrapped_ndpointer(dtype=numpy.float64, flags=('C','W')), + ctypes.c_uint, ctypes.c_int, + wrapped_ndpointer(dtype=numpy.float64, flags=('C','W')), + ctypes.c_uint, ctypes.c_int, ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + min_val, max_val, units.value, bridge_config.value, + voltage_excit_source.value, voltage_excit_val, + nominal_bridge_resistance, electrical_vals, len(electrical_vals), + electrical_units.value, physical_vals, len(physical_vals), + physical_units.value, custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_ai_pressure_bridge_two_point_lin_chan( + self, physical_channel, name_to_assign_to_channel="", + min_val=-100.0, max_val=100.0, + units=PressureUnits.POUNDS_PER_SQ_INCH, + bridge_config=BridgeConfiguration.FULL_BRIDGE, + voltage_excit_source=ExcitationSource.INTERNAL, + voltage_excit_val=2.5, nominal_bridge_resistance=350.0, + first_electrical_val=0.0, second_electrical_val=2.0, + electrical_units=BridgeElectricalUnits.M_VOLTS_PER_VOLT, + first_physical_val=0.0, second_physical_val=100.0, + physical_units=BridgePhysicalUnits.POUNDS_PER_SQ_INCH, + custom_scale_name=""): + """ + Creates channel(s) that use a Wheatstone bridge to measure + pressure. Use this instance with sensors whose specifications do + not provide a polynomial for scaling or a table of electrical + and physical values. When you use this scaling type, NI-DAQmx + uses two points of electrical and physical values to calculate + the slope and y-intercept of a linear equation and uses that + equation to scale electrical values to physical values. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.PressureUnits]): Specifies + in which unit to return pressure measurements from the + channel. + bridge_config (Optional[nidaqmx.constants.BridgeConfiguration]): + Specifies information about the bridge configuration and + measurement. + voltage_excit_source (Optional[nidaqmx.constants.ExcitationSource]): + Specifies information about the bridge configuration and + measurement. + voltage_excit_val (Optional[float]): Specifies information + about the bridge configuration and measurement. + nominal_bridge_resistance (Optional[float]): Specifies + information about the bridge configuration and + measurement. + first_electrical_val (Optional[float]): Specifies how to + scale electrical values from the sensor to physical + units. + second_electrical_val (Optional[float]): Specifies how to + scale electrical values from the sensor to physical + units. + electrical_units (Optional[nidaqmx.constants.BridgeElectricalUnits]): + Specifies how to scale electrical values from the sensor + to physical units. + first_physical_val (Optional[float]): Specifies how to scale + electrical values from the sensor to physical units. + second_physical_val (Optional[float]): Specifies how to + scale electrical values from the sensor to physical + units. + physical_units (Optional[nidaqmx.constants.BridgePhysicalUnits]): + Specifies how to scale electrical values from the sensor + to physical units. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateAIPressureBridgeTwoPointLinChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, + ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_double, + ctypes.c_double, ctypes.c_int, ctypes.c_double, ctypes.c_double, + ctypes.c_int, ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + min_val, max_val, units.value, bridge_config.value, + voltage_excit_source.value, voltage_excit_val, + nominal_bridge_resistance, first_electrical_val, + second_electrical_val, electrical_units.value, first_physical_val, + second_physical_val, physical_units.value, custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_ai_resistance_chan( + self, physical_channel, name_to_assign_to_channel="", + min_val=100.0, max_val=1000.0, units=ResistanceUnits.OHMS, + resistance_config=ResistanceConfiguration.TWO_WIRE, + current_excit_source=ExcitationSource.EXTERNAL, + current_excit_val=0.001, custom_scale_name=""): + """ + Creates channel(s) to measure resistance. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.ResistanceUnits]): + Specifies the units to use to return resistance + measurements. + resistance_config (Optional[nidaqmx.constants.ResistanceConfiguration]): + Specifies the number of wires to use for resistive + measurements. + current_excit_source (Optional[nidaqmx.constants.ExcitationSource]): + Specifies the source of excitation. + current_excit_val (Optional[float]): Specifies in amperes + the amount of excitation to supply to the sensor. Refer + to the sensor documentation to determine this value. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateAIResistanceChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, + ctypes.c_int, ctypes.c_double, ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + min_val, max_val, units.value, resistance_config.value, + current_excit_source.value, current_excit_val, custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_ai_rosette_strain_gage_chan( + self, physical_channel, rosette_type, gage_orientation, + rosette_meas_types, name_to_assign_to_channel="", min_val=-0.001, + max_val=0.001, + strain_config=StrainGageBridgeType.QUARTER_BRIDGE_I, + voltage_excit_source=ExcitationSource.INTERNAL, + voltage_excit_val=2.5, gage_factor=2.0, + nominal_gage_resistance=350.0, poisson_ratio=0.3, + lead_wire_resistance=0.0): + """ + Creates channels to measure two-dimensional strain using a + rosette strain gage. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create the strain gage virtual + channels necessary to calculate the **rosette + measurements** channels. + rosette_type (nidaqmx.constants.StrainGageRosetteType): + Specifies information about the rosette configuration + and measurements. + gage_orientation (float): Specifies information about the + rosette configuration and measurements. + rosette_meas_types (List[int]): Specifies information about + the rosette configuration and measurements. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + creates a default channel name. + min_val (Optional[float]): Specifies the minimum strain you + expect to measure. This value applies to each strain + gage in the rosette. + max_val (Optional[float]): Specifies the maximum strain you + expect to measure. This value applies to each strain + gage in the rosette. + strain_config (Optional[nidaqmx.constants.StrainGageBridgeType]): + Specifies information about the bridge configuration and + measurement. + voltage_excit_source (Optional[nidaqmx.constants.ExcitationSource]): + Specifies information about the bridge configuration and + measurement. + voltage_excit_val (Optional[float]): Specifies information + about the bridge configuration and measurement. + gage_factor (Optional[float]): Contains information about + the strain gage and measurement. + nominal_gage_resistance (Optional[float]): Contains + information about the strain gage and measurement. + poisson_ratio (Optional[float]): Contains information about + the strain gage and measurement. + lead_wire_resistance (Optional[float]): Specifies + information about the bridge configuration and + measurement. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + if rosette_meas_types is None: + rosette_meas_types = [] + + rosette_meas_types = numpy.int32(rosette_meas_types) + + cfunc = lib_importer.windll.DAQmxCreateAIRosetteStrainGageChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_double, + wrapped_ndpointer(dtype=numpy.int32, flags=('C','W')), + ctypes.c_uint, ctypes.c_int, ctypes.c_int, ctypes.c_double, + ctypes.c_double, ctypes.c_double, ctypes.c_double, ctypes.c_double] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + min_val, max_val, rosette_type.value, gage_orientation, + rosette_meas_types, len(rosette_meas_types), strain_config.value, + voltage_excit_source.value, voltage_excit_val, gage_factor, + nominal_gage_resistance, poisson_ratio, lead_wire_resistance) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_ai_rtd_chan( + self, physical_channel, name_to_assign_to_channel="", min_val=0.0, + max_val=100.0, units=TemperatureUnits.DEG_C, + rtd_type=RTDType.PT_3750, + resistance_config=ResistanceConfiguration.TWO_WIRE, + current_excit_source=ExcitationSource.EXTERNAL, + current_excit_val=0.0025, r_0=100.0): + """ + Creates channel(s) that use an RTD to measure temperature. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.TemperatureUnits]): + Specifies the units to use to return temperature + measurements. + rtd_type (Optional[nidaqmx.constants.RTDType]): Specifies + the type of RTD connected to the channel. + resistance_config (Optional[nidaqmx.constants.ResistanceConfiguration]): + Specifies the number of wires to use for resistive + measurements. + current_excit_source (Optional[nidaqmx.constants.ExcitationSource]): + Specifies the source of excitation. + current_excit_val (Optional[float]): Specifies in amperes + the amount of excitation to supply to the sensor. Refer + to the sensor documentation to determine this value. + r_0 (Optional[float]): Is the sensor resistance in ohms at 0 + degrees Celsius. The Callendar-Van Dusen equation + requires this value. Refer to the sensor documentation + to determine this value. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateAIRTDChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, + ctypes.c_int, ctypes.c_int, ctypes.c_double, ctypes.c_double] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + min_val, max_val, units.value, rtd_type.value, + resistance_config.value, current_excit_source.value, + current_excit_val, r_0) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_ai_strain_gage_chan( + self, physical_channel, name_to_assign_to_channel="", + min_val=-0.001, max_val=0.001, units=StrainUnits.STRAIN, + strain_config=StrainGageBridgeType.FULL_BRIDGE_I, + voltage_excit_source=ExcitationSource.INTERNAL, + voltage_excit_val=2.5, gage_factor=2.0, + initial_bridge_voltage=0.0, nominal_gage_resistance=350.0, + poisson_ratio=0.30, lead_wire_resistance=0.0, + custom_scale_name=""): + """ + Creates channel(s) to measure strain. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.StrainUnits]): Specifies + the units to use to return strain measurements. + strain_config (Optional[nidaqmx.constants.StrainGageBridgeType]): + Specifies information about the bridge configuration and + measurement. + voltage_excit_source (Optional[nidaqmx.constants.ExcitationSource]): + Specifies information about the bridge configuration and + measurement. + voltage_excit_val (Optional[float]): Specifies information + about the bridge configuration and measurement. + gage_factor (Optional[float]): Contains information about + the strain gage and measurement. + initial_bridge_voltage (Optional[float]): Specifies + information about the bridge configuration and + measurement. + nominal_gage_resistance (Optional[float]): Contains + information about the strain gage and measurement. + poisson_ratio (Optional[float]): Contains information about + the strain gage and measurement. + lead_wire_resistance (Optional[float]): Specifies + information about the bridge configuration and + measurement. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateAIStrainGageChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, + ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_double, + ctypes.c_double, ctypes.c_double, ctypes.c_double, ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + min_val, max_val, units.value, strain_config.value, + voltage_excit_source.value, voltage_excit_val, gage_factor, + initial_bridge_voltage, nominal_gage_resistance, poisson_ratio, + lead_wire_resistance, custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_ai_temp_built_in_sensor_chan( + self, physical_channel, name_to_assign_to_channel="", + units=TemperatureUnits.DEG_C): + """ + Creates channel(s) that use the built-in sensor of a terminal + block or device to measure temperature. On SCXI modules, for + example, the built-in sensor could be the CJC sensor. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + units (Optional[nidaqmx.constants.TemperatureUnits]): + Specifies the units to use to return temperature + measurements. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateAITempBuiltInSensorChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_int] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + units.value) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_ai_thrmcpl_chan( + self, physical_channel, name_to_assign_to_channel="", min_val=0.0, + max_val=100.0, units=TemperatureUnits.DEG_C, + thermocouple_type=ThermocoupleType.J, + cjc_source=CJCSource.CONSTANT_USER_VALUE, cjc_val=25.0, + cjc_channel=""): + """ + Creates channel(s) that use a thermocouple to measure + temperature. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.TemperatureUnits]): + Specifies the units to use to return temperature + measurements. + thermocouple_type (Optional[nidaqmx.constants.ThermocoupleType]): + Specifies the type of thermocouple connected to the + channel. Thermocouple types differ in composition and + measurement range. + cjc_source (Optional[nidaqmx.constants.CJCSource]): + Specifies the source of cold-junction compensation. + cjc_val (Optional[float]): Specifies in **units** the + temperature of the cold junction if you set + **cjc_source** to **CONSTANT_VALUE**. + cjc_channel (Optional[str]): Specifies the channel that + acquires the temperature of the thermocouple cold- + junction if you set **cjc_source** to **CHANNEL**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateAIThrmcplChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, + ctypes.c_int, ctypes.c_double, ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + min_val, max_val, units.value, thermocouple_type.value, + cjc_source.value, cjc_val, cjc_channel) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_ai_thrmstr_chan_iex( + self, physical_channel, name_to_assign_to_channel="", min_val=0.0, + max_val=100.0, units=TemperatureUnits.DEG_C, + resistance_config=ResistanceConfiguration.FOUR_WIRE, + current_excit_source=ExcitationSource.EXTERNAL, + current_excit_val=0.00015, a=0.001295361, b=0.0002343159, + c=0.0000001018703): + """ + Creates channel(s) that use a thermistor to measure temperature. + Use this instance when the thermistor requires current + excitation. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.TemperatureUnits]): + Specifies the units to use to return temperature + measurements. + resistance_config (Optional[nidaqmx.constants.ResistanceConfiguration]): + Specifies the number of wires to use for resistive + measurements. + current_excit_source (Optional[nidaqmx.constants.ExcitationSource]): + Specifies the source of excitation. + current_excit_val (Optional[float]): Specifies in amperes + the amount of excitation to supply to the sensor. Refer + to the sensor documentation to determine this value. + a (Optional[float]): Contains the constants for the + Steinhart-Hart thermistor equation. Refer to the sensor + documentation to determine values for these constants. + b (Optional[float]): Contains the constants for the + Steinhart-Hart thermistor equation. Refer to the sensor + documentation to determine values for these constants. + c (Optional[float]): Contains the constants for the + Steinhart-Hart thermistor equation. Refer to the sensor + documentation to determine values for these constants. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateAIThrmstrChanIex + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, + ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_double, + ctypes.c_double] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + min_val, max_val, units.value, resistance_config.value, + current_excit_source.value, current_excit_val, a, b, c) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_ai_thrmstr_chan_vex( + self, physical_channel, name_to_assign_to_channel="", min_val=0.0, + max_val=100.0, units=TemperatureUnits.DEG_C, + resistance_config=ResistanceConfiguration.FOUR_WIRE, + voltage_excit_source=ExcitationSource.EXTERNAL, + voltage_excit_val=2.5, a=0.001295361, b=0.0002343159, + c=0.0000001018703, r_1=5000.0): + """ + Creates channel(s) that use a thermistor to measure temperature. + Use this instance when the thermistor requires voltage + excitation. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.TemperatureUnits]): + Specifies the units to use to return temperature + measurements. + resistance_config (Optional[nidaqmx.constants.ResistanceConfiguration]): + Specifies the number of wires to use for resistive + measurements. + voltage_excit_source (Optional[nidaqmx.constants.ExcitationSource]): + Specifies the source of excitation. + voltage_excit_val (Optional[float]): Specifies in volts the + amount of excitation supplied to the sensor. Refer to + the sensor documentation to determine appropriate + excitation values. + a (Optional[float]): Contains the constants for the + Steinhart-Hart thermistor equation. Refer to the sensor + documentation to determine values for these constants. + b (Optional[float]): Contains the constants for the + Steinhart-Hart thermistor equation. Refer to the sensor + documentation to determine values for these constants. + c (Optional[float]): Contains the constants for the + Steinhart-Hart thermistor equation. Refer to the sensor + documentation to determine values for these constants. + r_1 (Optional[float]): Specifies in ohms the value of the + reference resistor. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateAIThrmstrChanVex + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, + ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_double, + ctypes.c_double, ctypes.c_double] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + min_val, max_val, units.value, resistance_config.value, + voltage_excit_source.value, voltage_excit_val, a, b, c, r_1) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_ai_torque_bridge_polynomial_chan( + self, physical_channel, name_to_assign_to_channel="", + min_val=-100.0, max_val=100.0, units=TorqueUnits.INCH_POUNDS, + bridge_config=BridgeConfiguration.FULL_BRIDGE, + voltage_excit_source=ExcitationSource.INTERNAL, + voltage_excit_val=2.5, nominal_bridge_resistance=350.0, + forward_coeffs=None, reverse_coeffs=None, + electrical_units=BridgeElectricalUnits.M_VOLTS_PER_VOLT, + physical_units=BridgePhysicalUnits.INCH_POUNDS, + custom_scale_name=""): + """ + Creates channel(s) that use a Wheatstone bridge to measure + torque. Use this instance with sensors whose specifications + provide a polynomial to convert electrical values to physical + values. When you use this scaling type, NI-DAQmx requires + coefficients for a polynomial that converts electrical values to + physical values (forward), as well as coefficients for a + polynomial that converts physical values to electrical values + (reverse). If you only know one set of coefficients, use the + DAQmx Compute Reverse Polynomial Coefficients function to + generate the other set. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.TorqueUnits]): Specifies + in which unit to return torque measurements from the + channel. + bridge_config (Optional[nidaqmx.constants.BridgeConfiguration]): + Specifies information about the bridge configuration and + measurement. + voltage_excit_source (Optional[nidaqmx.constants.ExcitationSource]): + Specifies information about the bridge configuration and + measurement. + voltage_excit_val (Optional[float]): Specifies information + about the bridge configuration and measurement. + nominal_bridge_resistance (Optional[float]): Specifies + information about the bridge configuration and + measurement. + forward_coeffs (Optional[List[float]]): Specifies how to + scale electrical values from the sensor to physical + units. + reverse_coeffs (Optional[List[float]]): Specifies how to + scale electrical values from the sensor to physical + units. + electrical_units (Optional[nidaqmx.constants.BridgeElectricalUnits]): + Specifies how to scale electrical values from the sensor + to physical units. + physical_units (Optional[nidaqmx.constants.BridgePhysicalUnits]): + Specifies how to scale electrical values from the sensor + to physical units. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + if forward_coeffs is None: + forward_coeffs = [] + + if reverse_coeffs is None: + reverse_coeffs = [] + + forward_coeffs = numpy.float64(forward_coeffs) + reverse_coeffs = numpy.float64(reverse_coeffs) + + cfunc = lib_importer.windll.DAQmxCreateAITorqueBridgePolynomialChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, + ctypes.c_int, ctypes.c_double, ctypes.c_double, + wrapped_ndpointer(dtype=numpy.float64, flags=('C','W')), + ctypes.c_uint, wrapped_ndpointer(dtype=numpy.float64, + flags=('C','W')), ctypes.c_uint, ctypes.c_int, ctypes.c_int, + ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + min_val, max_val, units.value, bridge_config.value, + voltage_excit_source.value, voltage_excit_val, + nominal_bridge_resistance, forward_coeffs, len(forward_coeffs), + reverse_coeffs, len(reverse_coeffs), electrical_units.value, + physical_units.value, custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_ai_torque_bridge_table_chan( + self, physical_channel, name_to_assign_to_channel="", + min_val=-100.0, max_val=100.0, units=TorqueUnits.INCH_POUNDS, + bridge_config=BridgeConfiguration.FULL_BRIDGE, + voltage_excit_source=ExcitationSource.INTERNAL, + voltage_excit_val=2.5, nominal_bridge_resistance=350.0, + electrical_vals=None, + electrical_units=BridgeElectricalUnits.M_VOLTS_PER_VOLT, + physical_vals=None, + physical_units=BridgePhysicalUnits.INCH_POUNDS, + custom_scale_name=""): + """ + Creates channel(s) that use a Wheatstone bridge to measure + torque. Use this instance with sensors whose specifications + provide a table of electrical values and the corresponding + physical values. When you use this scaling type, NI-DAQmx + performs linear scaling between each pair of electrical and + physical values. The input limits specified with **min_val** and + **max_val** must fall within the smallest and largest physical + values. For any data outside those endpoints, NI-DAQmx coerces + that data to the endpoints. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.TorqueUnits]): Specifies + in which unit to return torque measurements from the + channel. + bridge_config (Optional[nidaqmx.constants.BridgeConfiguration]): + Specifies information about the bridge configuration and + measurement. + voltage_excit_source (Optional[nidaqmx.constants.ExcitationSource]): + Specifies information about the bridge configuration and + measurement. + voltage_excit_val (Optional[float]): Specifies information + about the bridge configuration and measurement. + nominal_bridge_resistance (Optional[float]): Specifies + information about the bridge configuration and + measurement. + electrical_vals (Optional[List[float]]): Specifies how to + scale electrical values from the sensor to physical + units. + electrical_units (Optional[nidaqmx.constants.BridgeElectricalUnits]): + Specifies how to scale electrical values from the sensor + to physical units. + physical_vals (Optional[List[float]]): Specifies how to + scale electrical values from the sensor to physical + units. + physical_units (Optional[nidaqmx.constants.BridgePhysicalUnits]): + Specifies how to scale electrical values from the sensor + to physical units. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + if electrical_vals is None: + electrical_vals = [] + + if physical_vals is None: + physical_vals = [] + + electrical_vals = numpy.float64(electrical_vals) + physical_vals = numpy.float64(physical_vals) + + cfunc = lib_importer.windll.DAQmxCreateAITorqueBridgeTableChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, + ctypes.c_int, ctypes.c_double, ctypes.c_double, + wrapped_ndpointer(dtype=numpy.float64, flags=('C','W')), + ctypes.c_uint, ctypes.c_int, + wrapped_ndpointer(dtype=numpy.float64, flags=('C','W')), + ctypes.c_uint, ctypes.c_int, ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + min_val, max_val, units.value, bridge_config.value, + voltage_excit_source.value, voltage_excit_val, + nominal_bridge_resistance, electrical_vals, len(electrical_vals), + electrical_units.value, physical_vals, len(physical_vals), + physical_units.value, custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_ai_torque_bridge_two_point_lin_chan( + self, physical_channel, name_to_assign_to_channel="", + min_val=-100.0, max_val=100.0, units=TorqueUnits.INCH_POUNDS, + bridge_config=BridgeConfiguration.FULL_BRIDGE, + voltage_excit_source=ExcitationSource.INTERNAL, + voltage_excit_val=2.5, nominal_bridge_resistance=350.0, + first_electrical_val=0.0, second_electrical_val=2.0, + electrical_units=BridgeElectricalUnits.M_VOLTS_PER_VOLT, + first_physical_val=0.0, second_physical_val=100.0, + physical_units=BridgePhysicalUnits.INCH_POUNDS, + custom_scale_name=""): + """ + Creates channel(s) that use a Wheatstone bridge to measure + torque. Use this instance with sensors whose specifications do + not provide a polynomial for scaling or a table of electrical + and physical values. When you use this scaling type, NI-DAQmx + uses two points of electrical and physical values to calculate + the slope and y-intercept of a linear equation and uses that + equation to scale electrical values to physical values. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.TorqueUnits]): Specifies + in which unit to return torque measurements from the + channel. + bridge_config (Optional[nidaqmx.constants.BridgeConfiguration]): + Specifies information about the bridge configuration and + measurement. + voltage_excit_source (Optional[nidaqmx.constants.ExcitationSource]): + Specifies information about the bridge configuration and + measurement. + voltage_excit_val (Optional[float]): Specifies information + about the bridge configuration and measurement. + nominal_bridge_resistance (Optional[float]): Specifies + information about the bridge configuration and + measurement. + first_electrical_val (Optional[float]): Specifies how to + scale electrical values from the sensor to physical + units. + second_electrical_val (Optional[float]): Specifies how to + scale electrical values from the sensor to physical + units. + electrical_units (Optional[nidaqmx.constants.BridgeElectricalUnits]): + Specifies how to scale electrical values from the sensor + to physical units. + first_physical_val (Optional[float]): Specifies how to scale + electrical values from the sensor to physical units. + second_physical_val (Optional[float]): Specifies how to + scale electrical values from the sensor to physical + units. + physical_units (Optional[nidaqmx.constants.BridgePhysicalUnits]): + Specifies how to scale electrical values from the sensor + to physical units. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateAITorqueBridgeTwoPointLinChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, + ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_double, + ctypes.c_double, ctypes.c_int, ctypes.c_double, ctypes.c_double, + ctypes.c_int, ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + min_val, max_val, units.value, bridge_config.value, + voltage_excit_source.value, voltage_excit_val, + nominal_bridge_resistance, first_electrical_val, + second_electrical_val, electrical_units.value, first_physical_val, + second_physical_val, physical_units.value, custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_ai_velocity_iepe_chan( + self, physical_channel, name_to_assign_to_channel="", + terminal_config=TerminalConfiguration.DEFAULT, min_val=-50.0, + max_val=50.0, units=VelocityUnits.INCHES_PER_SECOND, + sensitivity=100.0, + sensitivity_units=VelocityIEPESensorSensitivityUnits.M_VOLTS_PER_INCH_PER_SECOND, + current_excit_source=ExcitationSource.INTERNAL, + current_excit_val=0.002, custom_scale_name=""): + """ + Creates channel(s) that use an IEPE velocity sensor to measure + velocity. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + terminal_config (Optional[nidaqmx.constants.TerminalConfiguration]): + Specifies the input terminal configuration for the + channel. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.VelocityUnits]): Specifies + in which unit to return velocity measurements from the + channel. + sensitivity (Optional[float]): Is the sensitivity of the + sensor. This value is in the units you specify with the + **sensitivity_units** input. Refer to the sensor + documentation to determine this value. + sensitivity_units (Optional[nidaqmx.constants.VelocityIEPESensorSensitivityUnits]): + Specifies the units of the **sensitivity** input. + current_excit_source (Optional[nidaqmx.constants.ExcitationSource]): + Specifies the source of excitation. + current_excit_val (Optional[float]): Specifies in amperes + the amount of excitation to supply to the sensor. Refer + to the sensor documentation to determine this value. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateAIVelocityIEPEChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_int, + ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_double, + ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + terminal_config.value, min_val, max_val, units.value, sensitivity, + sensitivity_units.value, current_excit_source.value, + current_excit_val, custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_ai_voltage_chan( + self, physical_channel, name_to_assign_to_channel="", + terminal_config=TerminalConfiguration.DEFAULT, min_val=-5.0, + max_val=5.0, units=VoltageUnits.VOLTS, custom_scale_name=""): + """ + Creates channel(s) to measure voltage. If the measurement + requires the use of internal excitation or you need excitation + to scale the voltage, use the AI Custom Voltage with Excitation + instance of this function. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + terminal_config (Optional[nidaqmx.constants.TerminalConfiguration]): + Specifies the input terminal configuration for the + channel. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.VoltageUnits]): Specifies + the units to use to return voltage measurements. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateAIVoltageChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_int, + ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + terminal_config.value, min_val, max_val, units.value, + custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_ai_voltage_chan_with_excit( + self, physical_channel, name_to_assign_to_channel="", + terminal_config=TerminalConfiguration.DEFAULT, min_val=-10.0, + max_val=10.0, units=VoltageUnits.VOLTS, + bridge_config=BridgeConfiguration.NO_BRIDGE, + voltage_excit_source=ExcitationSource.INTERNAL, + voltage_excit_val=0.0, use_excit_for_scaling=False, + custom_scale_name=""): + """ + Creates channel(s) to measure voltage. Use this instance for + custom sensors that require excitation. You can use the + excitation to scale the measurement. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + terminal_config (Optional[nidaqmx.constants.TerminalConfiguration]): + Specifies the input terminal configuration for the + channel. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.VoltageUnits]): Specifies + the units to use to return voltage measurements. + bridge_config (Optional[nidaqmx.constants.BridgeConfiguration]): + Specifies what type of Wheatstone bridge the sensor is. + voltage_excit_source (Optional[nidaqmx.constants.ExcitationSource]): + Specifies the source of excitation. + voltage_excit_val (Optional[float]): Specifies in volts the + amount of excitation supplied to the sensor. Refer to + the sensor documentation to determine appropriate + excitation values. + use_excit_for_scaling (Optional[bool]): Specifies if NI- + DAQmx divides the measurement by the excitation. You + should typically set **use_excit_for_scaling** to True + for ratiometric transducers. If you set + **use_excit_for_scaling** to True, set **max_val** and + **min_val** to reflect the scaling. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateAIVoltageChanWithExcit + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_int, + ctypes.c_int, ctypes.c_int, ctypes.c_double, c_bool32, + ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + terminal_config.value, min_val, max_val, units.value, + bridge_config.value, voltage_excit_source.value, + voltage_excit_val, use_excit_for_scaling, custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_ai_voltage_rms_chan( + self, physical_channel, name_to_assign_to_channel="", + terminal_config=TerminalConfiguration.DEFAULT, min_val=-5.0, + max_val=5.0, units=VoltageUnits.VOLTS, custom_scale_name=""): + """ + Creates channel(s) to measure voltage RMS, the average (mean) + power of the acquired voltage. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + terminal_config (Optional[nidaqmx.constants.TerminalConfiguration]): + Specifies the input terminal configuration for the + channel. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.VoltageUnits]): Specifies + the units to use to return voltage measurements. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateAIVoltageRMSChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_int, + ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + terminal_config.value, min_val, max_val, units.value, + custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_teds_ai_accel_chan( + self, physical_channel, name_to_assign_to_channel="", + terminal_config=TerminalConfiguration.DEFAULT, min_val=-5.0, + max_val=5.0, units=AccelUnits.G, + current_excit_source=ExcitationSource.INTERNAL, + current_excit_val=0.004, custom_scale_name=""): + """ + Creates channel(s) that use an accelerometer to measure + acceleration. You must configure the physical channel(s) with + TEDS information to use this function. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + terminal_config (Optional[nidaqmx.constants.TerminalConfiguration]): + Specifies the input terminal configuration for the + channel. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.AccelUnits]): Specifies + the units to use to return acceleration measurements + from the channel. + current_excit_source (Optional[nidaqmx.constants.ExcitationSource]): + Specifies the source of excitation. + current_excit_val (Optional[float]): Specifies in amperes + the amount of excitation to supply to the sensor. Refer + to the sensor documentation to determine this value. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateTEDSAIAccelChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_int, + ctypes.c_int, ctypes.c_double, ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + terminal_config.value, min_val, max_val, units.value, + current_excit_source.value, current_excit_val, custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_teds_ai_bridge_chan( + self, physical_channel, name_to_assign_to_channel="", + min_val=-0.002, max_val=0.002, units=TEDSUnits.FROM_TEDS, + voltage_excit_source=ExcitationSource.INTERNAL, + voltage_excit_val=2.5, custom_scale_name=""): + """ + Creates channel(s) that measure a Wheatstone bridge. You must + configure the physical channel(s) with TEDS information to use + this function. Use this instance with bridge-based sensors that + measure phenomena other than strain, force, pressure, or torque, + or that scale data to physical units NI-DAQmx does not support. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.TEDSUnits]): Specifies in + which unit to return measurements from the channel. + voltage_excit_source (Optional[nidaqmx.constants.ExcitationSource]): + Specifies the source of excitation. + voltage_excit_val (Optional[float]): Specifies in volts the + amount of excitation supplied to the sensor. Refer to + the sensor documentation to determine appropriate + excitation values. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateTEDSAIBridgeChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, + ctypes.c_double, ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + min_val, max_val, units.value, voltage_excit_source.value, + voltage_excit_val, custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_teds_ai_current_chan( + self, physical_channel, name_to_assign_to_channel="", + terminal_config=TerminalConfiguration.DEFAULT, min_val=-0.01, + max_val=0.01, units=TEDSUnits.FROM_TEDS, + shunt_resistor_loc=CurrentShuntResistorLocation.LET_DRIVER_CHOOSE, + ext_shunt_resistor_val=249.0, custom_scale_name=""): + """ + Creates channel(s) to measure current. You must configure the + physical channel(s) with TEDS information to use this function. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + terminal_config (Optional[nidaqmx.constants.TerminalConfiguration]): + Specifies the input terminal configuration for the + channel. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.TEDSUnits]): Specifies the + units to use to return measurements. + shunt_resistor_loc (Optional[nidaqmx.constants.CurrentShuntResistorLocation]): + Specifies the location of the shunt resistor. For + devices with built-in shunt resistors, specify the + location as **INTERNAL**. For devices that do not have + built-in shunt resistors, you must attach an external + one, set this input to **EXTERNAL** and use the + **ext_shunt_resistor_val** input to specify the value of + the resistor. + ext_shunt_resistor_val (Optional[float]): Specifies in ohms + the resistance of an external shunt resistor. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateTEDSAICurrentChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_int, + ctypes.c_int, ctypes.c_double, ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + terminal_config.value, min_val, max_val, units.value, + shunt_resistor_loc.value, ext_shunt_resistor_val, + custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_teds_ai_force_bridge_chan( + self, physical_channel, name_to_assign_to_channel="", + min_val=-100.0, max_val=100.0, units=ForceUnits.POUNDS, + voltage_excit_source=ExcitationSource.INTERNAL, + voltage_excit_val=2.5, custom_scale_name=""): + """ + Creates channel(s) that use a Wheatstone bridge to measure force + or load. You must configure the physical channel(s) with TEDS + information to use this function. NI-DAQmx scales electrical + values to physical values according to that TEDS information. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.ForceUnits]): Specifies in + which unit to return force measurements from the + channel. + voltage_excit_source (Optional[nidaqmx.constants.ExcitationSource]): + Specifies the source of excitation. + voltage_excit_val (Optional[float]): Specifies in volts the + amount of excitation supplied to the sensor. Refer to + the sensor documentation to determine appropriate + excitation values. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateTEDSAIForceBridgeChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, + ctypes.c_double, ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + min_val, max_val, units.value, voltage_excit_source.value, + voltage_excit_val, custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_teds_ai_force_iepe_chan( + self, physical_channel, name_to_assign_to_channel="", + terminal_config=TerminalConfiguration.DEFAULT, min_val=-2000.0, + max_val=2000.0, units=ForceUnits.NEWTONS, + current_excit_source=ExcitationSource.INTERNAL, + current_excit_val=0.001, custom_scale_name=""): + """ + Creates channel(s) that use an IEPE force sensor to measure + force or load. You must configure the physical channel(s) with + TEDS information to use this function. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + terminal_config (Optional[nidaqmx.constants.TerminalConfiguration]): + Specifies the input terminal configuration for the + channel. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.ForceUnits]): Specifies in + which unit to return force measurements from the + channel. + current_excit_source (Optional[nidaqmx.constants.ExcitationSource]): + Specifies the source of excitation. + current_excit_val (Optional[float]): Specifies in amperes + the amount of excitation to supply to the sensor. Refer + to the sensor documentation to determine this value. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateTEDSAIForceIEPEChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_int, + ctypes.c_int, ctypes.c_double, ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + terminal_config.value, min_val, max_val, units.value, + current_excit_source.value, current_excit_val, custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_teds_ai_microphone_chan( + self, physical_channel, name_to_assign_to_channel="", + terminal_config=TerminalConfiguration.DEFAULT, + units=SoundPressureUnits.PA, max_snd_press_level=100.0, + current_excit_source=ExcitationSource.INTERNAL, + current_excit_val=0.004, custom_scale_name=""): + """ + Creates channel(s) that use a microphone to measure sound + pressure. You must configure the physical channel(s) with TEDS + information to use this function. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. You must use + physical channels that you configured with TEDS + information. The DAQmx physical channel constant lists + all physical channels on devices and modules installed + in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + terminal_config (Optional[nidaqmx.constants.TerminalConfiguration]): + Specifies the input terminal configuration for the + channel. + units (Optional[nidaqmx.constants.SoundPressureUnits]): + Specifies the units to use to return sound pressure + measurements. + max_snd_press_level (Optional[float]): Is the maximum + instantaneous sound pressure level you expect to + measure. This value is in decibels, referenced to 20 + micropascals. + current_excit_source (Optional[nidaqmx.constants.ExcitationSource]): + Specifies the source of excitation. + current_excit_val (Optional[float]): Specifies in amperes + the amount of excitation to supply to the sensor. Refer + to the sensor documentation to determine this value. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateTEDSAIMicrophoneChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_int, ctypes.c_int, ctypes.c_double, ctypes.c_int, + ctypes.c_double, ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + terminal_config.value, units.value, max_snd_press_level, + current_excit_source.value, current_excit_val, custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_teds_ai_pos_lvdt_chan( + self, physical_channel, name_to_assign_to_channel="", + min_val=-0.1, max_val=0.1, units=LengthUnits.METERS, + voltage_excit_source=ExcitationSource.INTERNAL, + voltage_excit_val=1.0, voltage_excit_freq=2500.0, + ac_excit_wire_mode=ACExcitWireMode.FOUR_WIRE, + custom_scale_name=""): + """ + Creates channel(s) that use an LVDT to measure linear position. + You must configure the physical channel(s) with TEDS information + to use this function. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.LengthUnits]): Specifies + the units to use to return linear position measurements + from the channel. + voltage_excit_source (Optional[nidaqmx.constants.ExcitationSource]): + Specifies the source of excitation. + voltage_excit_val (Optional[float]): Specifies in volts the + amount of excitation supplied to the sensor. Refer to + the sensor documentation to determine appropriate + excitation values. + voltage_excit_freq (Optional[float]): Specifies in hertz the + excitation frequency that the sensor requires. Refer to + the sensor documentation to determine this value. + ac_excit_wire_mode (Optional[nidaqmx.constants.ACExcitWireMode]): + Is the number of leads on the sensor. Some sensors + require you to tie leads together to create a four- or + five- wire sensor. Refer to the sensor documentation for + more information. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateTEDSAIPosLVDTChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + min_val, max_val, units.value, voltage_excit_source.value, + voltage_excit_val, voltage_excit_freq, ac_excit_wire_mode.value, + custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_teds_ai_pos_rvdt_chan( + self, physical_channel, name_to_assign_to_channel="", + min_val=-70.0, max_val=70.0, units=AngleUnits.DEGREES, + voltage_excit_source=ExcitationSource.INTERNAL, + voltage_excit_val=1.0, voltage_excit_freq=2500.0, + ac_excit_wire_mode=ACExcitWireMode.FOUR_WIRE, + custom_scale_name=""): + """ + Creates channel(s) that use an RVDT to measure angular position. + You must configure the physical channel(s) with TEDS information + to use this function. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.AngleUnits]): Specifies + the units to use to return angular position measurements + from the channel. + voltage_excit_source (Optional[nidaqmx.constants.ExcitationSource]): + Specifies the source of excitation. + voltage_excit_val (Optional[float]): Specifies in volts the + amount of excitation supplied to the sensor. Refer to + the sensor documentation to determine appropriate + excitation values. + voltage_excit_freq (Optional[float]): Specifies in hertz the + excitation frequency that the sensor requires. Refer to + the sensor documentation to determine this value. + ac_excit_wire_mode (Optional[nidaqmx.constants.ACExcitWireMode]): + Is the number of leads on the sensor. Some sensors + require you to tie leads together to create a four- or + five- wire sensor. Refer to the sensor documentation for + more information. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateTEDSAIPosRVDTChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + min_val, max_val, units.value, voltage_excit_source.value, + voltage_excit_val, voltage_excit_freq, ac_excit_wire_mode.value, + custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_teds_ai_pressure_bridge_chan( + self, physical_channel, name_to_assign_to_channel="", + min_val=-100.0, max_val=100.0, + units=PressureUnits.POUNDS_PER_SQ_INCH, + voltage_excit_source=ExcitationSource.INTERNAL, + voltage_excit_val=2.5, custom_scale_name=""): + """ + Creates channel(s) that use a Wheatstone bridge to measure + pressure. You must configure the physical channel(s) with TEDS + information to use this function. NI-DAQmx scales electrical + values to physical values according to that TEDS information. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.PressureUnits]): Specifies + in which unit to return pressure measurements from the + channel. + voltage_excit_source (Optional[nidaqmx.constants.ExcitationSource]): + Specifies the source of excitation. + voltage_excit_val (Optional[float]): Specifies in volts the + amount of excitation supplied to the sensor. Refer to + the sensor documentation to determine appropriate + excitation values. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateTEDSAIPressureBridgeChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, + ctypes.c_double, ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + min_val, max_val, units.value, voltage_excit_source.value, + voltage_excit_val, custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_teds_ai_resistance_chan( + self, physical_channel, name_to_assign_to_channel="", + min_val=100.0, max_val=1000.0, units=TEDSUnits.FROM_TEDS, + resistance_config=ResistanceConfiguration.TWO_WIRE, + current_excit_source=ExcitationSource.EXTERNAL, + current_excit_val=0.001, custom_scale_name=""): + """ + Creates channel(s) to measure resistance. You must configure the + physical channel(s) with TEDS information to use this function. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.TEDSUnits]): Specifies the + units to use to return measurements. + resistance_config (Optional[nidaqmx.constants.ResistanceConfiguration]): + Specifies the number of wires to use for resistive + measurements. + current_excit_source (Optional[nidaqmx.constants.ExcitationSource]): + Specifies the source of excitation. + current_excit_val (Optional[float]): Specifies in amperes + the amount of excitation to supply to the sensor. Refer + to the sensor documentation to determine this value. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateTEDSAIResistanceChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, + ctypes.c_int, ctypes.c_double, ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + min_val, max_val, units.value, resistance_config.value, + current_excit_source.value, current_excit_val, custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_teds_ai_rtd_chan( + self, physical_channel, name_to_assign_to_channel="", min_val=0.0, + max_val=100.0, units=TemperatureUnits.DEG_C, + resistance_config=ResistanceConfiguration.TWO_WIRE, + current_excit_source=ExcitationSource.EXTERNAL, + current_excit_val=0.0025): + """ + Creates channel(s) that use an RTD to measure temperature. You + must configure the physical channel(s) with TEDS information to + use this function. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.TemperatureUnits]): + Specifies the units to use to return temperature + measurements. + resistance_config (Optional[nidaqmx.constants.ResistanceConfiguration]): + Specifies the number of wires to use for resistive + measurements. + current_excit_source (Optional[nidaqmx.constants.ExcitationSource]): + Specifies the source of excitation. + current_excit_val (Optional[float]): Specifies in amperes + the amount of excitation to supply to the sensor. Refer + to the sensor documentation to determine this value. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateTEDSAIRTDChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, + ctypes.c_int, ctypes.c_double] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + min_val, max_val, units.value, resistance_config.value, + current_excit_source.value, current_excit_val) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_teds_ai_strain_gage_chan( + self, physical_channel, name_to_assign_to_channel="", + min_val=-0.001, max_val=0.001, units=StrainUnits.STRAIN, + voltage_excit_source=ExcitationSource.INTERNAL, + voltage_excit_val=2.5, initial_bridge_voltage=0.0, + lead_wire_resistance=0.0, custom_scale_name=""): + """ + Creates channel(s) to measure strain. You must configure the + physical channel(s) with TEDS information to use this function. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.StrainUnits]): Specifies + the units to use to return strain measurements. + voltage_excit_source (Optional[nidaqmx.constants.ExcitationSource]): + Specifies information about the bridge configuration and + measurement. + voltage_excit_val (Optional[float]): Specifies information + about the bridge configuration and measurement. + initial_bridge_voltage (Optional[float]): Specifies + information about the bridge configuration and + measurement. + lead_wire_resistance (Optional[float]): Specifies + information about the bridge configuration and + measurement. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateTEDSAIStrainGageChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, + ctypes.c_double, ctypes.c_double, ctypes.c_double, ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + min_val, max_val, units.value, voltage_excit_source.value, + voltage_excit_val, initial_bridge_voltage, lead_wire_resistance, + custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_teds_ai_thrmcpl_chan( + self, physical_channel, name_to_assign_to_channel="", min_val=0.0, + max_val=100.0, units=TemperatureUnits.DEG_C, + cjc_source=CJCSource.CONSTANT_USER_VALUE, cjc_val=25.0, + cjc_channel=""): + """ + Creates channel(s) that use a thermocouple to measure + temperature. You must configure the physical channel(s) with + TEDS information to use this function. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.TemperatureUnits]): + Specifies the units to use to return temperature + measurements. + cjc_source (Optional[nidaqmx.constants.CJCSource]): + Specifies the source of cold-junction compensation. + cjc_val (Optional[float]): Specifies in **units** the + temperature of the cold junction if you set + **cjc_source** to **CONSTANT_VALUE**. + cjc_channel (Optional[str]): Specifies the channel that + acquires the temperature of the thermocouple cold- + junction if you set **cjc_source** to **CHANNEL**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateTEDSAIThrmcplChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, + ctypes.c_double, ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + min_val, max_val, units.value, cjc_source.value, cjc_val, + cjc_channel) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_teds_ai_thrmstr_chan_iex( + self, physical_channel, name_to_assign_to_channel="", min_val=0.0, + max_val=100.0, units=TemperatureUnits.DEG_C, + resistance_config=ResistanceConfiguration.FOUR_WIRE, + current_excit_source=ExcitationSource.EXTERNAL, + current_excit_val=0.00015): + """ + Creates channel(s) that use a thermistor to measure temperature. + Use this instance when the thermistor requires current + excitation. You must configure the physical channel(s) with TEDS + information to use this function. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.TemperatureUnits]): + Specifies the units to use to return temperature + measurements. + resistance_config (Optional[nidaqmx.constants.ResistanceConfiguration]): + Specifies the number of wires to use for resistive + measurements. + current_excit_source (Optional[nidaqmx.constants.ExcitationSource]): + Specifies the source of excitation. + current_excit_val (Optional[float]): Specifies in amperes + the amount of excitation to supply to the sensor. Refer + to the sensor documentation to determine this value. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateTEDSAIThrmstrChanIex + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, + ctypes.c_int, ctypes.c_double] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + min_val, max_val, units.value, resistance_config.value, + current_excit_source.value, current_excit_val) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_teds_ai_thrmstr_chan_vex( + self, physical_channel, name_to_assign_to_channel="", min_val=0.0, + max_val=100.0, units=TemperatureUnits.DEG_C, + resistance_config=ResistanceConfiguration.FOUR_WIRE, + voltage_excit_source=ExcitationSource.EXTERNAL, + voltage_excit_val=2.5, r_1=5000.0): + """ + Creates channel(s) that use a thermistor to measure temperature. + Use this instance when the thermistor requires voltage + excitation. You must configure the physical channel(s) with TEDS + information to use this function. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.TemperatureUnits]): + Specifies the units to use to return temperature + measurements. + resistance_config (Optional[nidaqmx.constants.ResistanceConfiguration]): + Specifies the number of wires to use for resistive + measurements. + voltage_excit_source (Optional[nidaqmx.constants.ExcitationSource]): + Specifies the source of excitation. + voltage_excit_val (Optional[float]): Specifies in volts the + amount of excitation supplied to the sensor. Refer to + the sensor documentation to determine appropriate + excitation values. + r_1 (Optional[float]): Specifies in ohms the value of the + reference resistor. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateTEDSAIThrmstrChanVex + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, + ctypes.c_int, ctypes.c_double, ctypes.c_double] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + min_val, max_val, units.value, resistance_config.value, + voltage_excit_source.value, voltage_excit_val, r_1) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_teds_ai_torque_bridge_chan( + self, physical_channel, name_to_assign_to_channel="", + min_val=-100.0, max_val=100.0, units=TorqueUnits.INCH_POUNDS, + voltage_excit_source=ExcitationSource.INTERNAL, + voltage_excit_val=2.5, custom_scale_name=""): + """ + Creates channel(s) that use a Wheatstone bridge to measure + torque. You must configure the physical channel(s) with TEDS + information to use this function. NI-DAQmx scales electrical + values to physical values according to that TEDS information. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.TorqueUnits]): Specifies + in which unit to return torque measurements from the + channel. + voltage_excit_source (Optional[nidaqmx.constants.ExcitationSource]): + Specifies the source of excitation. + voltage_excit_val (Optional[float]): Specifies in volts the + amount of excitation supplied to the sensor. Refer to + the sensor documentation to determine appropriate + excitation values. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateTEDSAITorqueBridgeChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, + ctypes.c_double, ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + min_val, max_val, units.value, voltage_excit_source.value, + voltage_excit_val, custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_teds_ai_voltage_chan( + self, physical_channel, name_to_assign_to_channel="", + terminal_config=TerminalConfiguration.DEFAULT, min_val=-5.0, + max_val=5.0, units=TEDSUnits.FROM_TEDS, custom_scale_name=""): + """ + Creates channel(s) to measure voltage. You must configure the + physical channel(s) with TEDS information to use this function. + If the measurement requires the use of internal excitation or + you need excitation to scale the voltage, use the TEDS AI Custom + Voltage with Excitation instance of this function. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + terminal_config (Optional[nidaqmx.constants.TerminalConfiguration]): + Specifies the input terminal configuration for the + channel. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.TEDSUnits]): Specifies the + units to use to return measurements. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateTEDSAIVoltageChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_int, + ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + terminal_config.value, min_val, max_val, units.value, + custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_teds_ai_voltage_chan_with_excit( + self, physical_channel, name_to_assign_to_channel="", + terminal_config=TerminalConfiguration.DEFAULT, min_val=-10.0, + max_val=10.0, units=TEDSUnits.FROM_TEDS, + voltage_excit_source=ExcitationSource.INTERNAL, + voltage_excit_val=0.0, custom_scale_name=""): + """ + Creates channel(s) to measure voltage. Use this instance for + custom sensors that require excitation. You can use the + excitation to scale the measurement. You must configure the + physical channel(s) with TEDS information to use this function. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + terminal_config (Optional[nidaqmx.constants.TerminalConfiguration]): + Specifies the input terminal configuration for the + channel. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.TEDSUnits]): Specifies the + units to use to return measurements. + voltage_excit_source (Optional[nidaqmx.constants.ExcitationSource]): + Specifies the source of excitation. + voltage_excit_val (Optional[float]): Specifies in volts the + amount of excitation supplied to the sensor. Refer to + the sensor documentation to determine appropriate + excitation values. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ai_channel.AIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateTEDSAIVoltageChanWithExcit + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_int, + ctypes.c_int, ctypes.c_double, ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + terminal_config.value, min_val, max_val, units.value, + voltage_excit_source.value, voltage_excit_val, custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + diff --git a/nidaqmx/_task_modules/ao_channel_collection.py b/nidaqmx/_task_modules/ao_channel_collection.py new file mode 100644 index 00000000..17da7a4a --- /dev/null +++ b/nidaqmx/_task_modules/ao_channel_collection.py @@ -0,0 +1,182 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import ctypes + +from nidaqmx._lib import lib_importer, ctypes_byte_str +from nidaqmx.errors import check_for_error +from nidaqmx._task_modules.channels.ao_channel import AOChannel +from nidaqmx._task_modules.channel_collection import ChannelCollection +from nidaqmx.utils import unflatten_channel_string +from nidaqmx.constants import ( + CurrentUnits, FuncGenType, VoltageUnits) + + +class AOChannelCollection(ChannelCollection): + """ + Contains the collection of analog output channels for a DAQmx Task. + """ + def __init__(self, task_handle): + super(AOChannelCollection, self).__init__(task_handle) + + def _create_chan(self, physical_channel, name_to_assign_to_channel=''): + """ + Creates and returns an AOChannel object. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. + name_to_assign_to_channel (Optional[str]): Specifies a name to + assign to the virtual channel this method creates. + Returns: + nidaqmx._task_modules.channels.ao_channel.AOChannel: + + Specifies the newly created AOChannel object. + """ + if name_to_assign_to_channel: + num_channels = len(unflatten_channel_string(physical_channel)) + + if num_channels > 1: + name = '{0}0:{1}'.format( + name_to_assign_to_channel, num_channels-1) + else: + name = name_to_assign_to_channel + else: + name = physical_channel + + return AOChannel(self._handle, name) + + def add_ao_current_chan( + self, physical_channel, name_to_assign_to_channel="", min_val=0.0, + max_val=0.02, units=CurrentUnits.AMPS, custom_scale_name=""): + """ + Creates channel(s) to generate current. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.CurrentUnits]): Specifies + the units to use to generate current. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ao_channel.AOChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateAOCurrentChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + min_val, max_val, units.value, custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_ao_func_gen_chan( + self, physical_channel, name_to_assign_to_channel="", + type=FuncGenType.SINE, freq=1000.0, amplitude=5.0, offset=0.0): + """ + Creates a channel for continually generating a waveform on the + selected physical channel. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + type (Optional[nidaqmx.constants.FuncGenType]): Specifies + the kind of waveform to generate. + freq (Optional[float]): Is the frequency of the waveform to + generate in hertz. + amplitude (Optional[float]): Is the zero-to-peak amplitude + of the waveform to generate in volts. Zero and negative + values are valid. + offset (Optional[float]): Is the voltage offset of the + waveform to generate. + Returns: + nidaqmx._task_modules.channels.ao_channel.AOChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateAOFuncGenChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_double] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + type.value, freq, amplitude, offset) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + + def add_ao_voltage_chan( + self, physical_channel, name_to_assign_to_channel="", + min_val=-10.0, max_val=10.0, units=VoltageUnits.VOLTS, + custom_scale_name=""): + """ + Creates channel(s) to generate voltage. + + Args: + physical_channel (str): Specifies the names of the physical + channels to use to create virtual channels. The DAQmx + physical channel constant lists all physical channels on + devices and modules installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to generate. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to generate. + units (Optional[nidaqmx.constants.VoltageUnits]): Specifies + the units to use to generate voltage. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ao_channel.AOChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateAOVoltageChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes_byte_str] + + error_code = cfunc( + self._handle, physical_channel, name_to_assign_to_channel, + min_val, max_val, units.value, custom_scale_name) + check_for_error(error_code) + + return self._create_chan(physical_channel, name_to_assign_to_channel) + diff --git a/nidaqmx/_task_modules/channel_collection.py b/nidaqmx/_task_modules/channel_collection.py new file mode 100644 index 00000000..970c3292 --- /dev/null +++ b/nidaqmx/_task_modules/channel_collection.py @@ -0,0 +1,140 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import ctypes +import six +from collections import Sequence + +from nidaqmx._lib import lib_importer, ctypes_byte_str +from nidaqmx._task_modules.channels.channel import Channel +from nidaqmx.errors import ( + check_for_error, is_string_buffer_too_small, is_array_buffer_too_small, + DaqError) +from nidaqmx.error_codes import DAQmxErrors +from nidaqmx.utils import unflatten_channel_string, flatten_channel_string + + +class ChannelCollection(Sequence): + """ + Contains the collection of channels for a DAQmx Task. + + This class defines methods that implements a container object. + """ + def __init__(self, task_handle): + self._handle = task_handle + + def __contains__(self, item): + channel_names = self.channel_names + + if isinstance(item, six.string_types): + items = unflatten_channel_string(item) + elif isinstance(item, Channel): + items = item.channel_names + + return all([item in channel_names for item in items]) + + def __eq__(self, other): + if isinstance(other, self.__class__): + return self._handle == other._handle + return False + + def __getitem__(self, index): + """ + Indexes a subset of virtual channels on this channel collection. + + Args: + index: The value of the index. The following index types are + supported: + - str: Name of the virtual channel. You also can specify a + string that contains a list or range of names to this + input. If you have a list of names, use the DAQmx + Flatten Channel String function to convert the list to a + string. + - int: Index/position of the virtual channel in the collection. + - slice: Range of the indexes/positions of virtual channels in + the collection. + Returns: + nidaqmx._task_modules.channels.channel.Channel: + + Indicates a channel object representing the subset of virtual + channels indexed. + """ + if isinstance(index, six.integer_types): + channel_names = self.channel_names[index] + elif isinstance(index, slice): + channel_names = flatten_channel_string(self.channel_names[index]) + elif isinstance(index, six.string_types): + channel_names = index + else: + raise DaqError( + 'Invalid index type "{0}" used to access channels.' + .format(type(index)), DAQmxErrors.UNKNOWN.value) + + if channel_names: + return Channel._factory(self._handle, channel_names) + else: + raise DaqError( + 'You cannot specify an empty index when indexing channels.\n' + 'Index used: {0}'.format(index), DAQmxErrors.UNKNOWN.value) + + def __hash__(self): + return hash(self._handle.value) + + def __iter__(self): + for channel_name in self.channel_names: + yield Channel._factory(self._handle, channel_name) + + def __len__(self): + return len(self.channel_names) + + def __ne__(self, other): + return not self.__eq__(other) + + def __reversed__(self): + channel_names = self.channel_names + channel_names.reverse() + + for channel_name in channel_names: + yield Channel._factory(self._handle, channel_name) + + @property + def all(self): + """ + :class:`nidaqmx._task_modules.channels.channel.Channel`: + Specifies a channel object that represents the entire list of + virtual channels on this channel collection. + """ + # Passing a blank string means all channels. + return Channel._factory(self._handle, '') + + @property + def channel_names(self): + """ + List[str]: Specifies the entire list of virtual channels on this + channel collection. + """ + cfunc = lib_importer.windll.DAQmxGetTaskChannels + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return unflatten_channel_string(val.value.decode('ascii')) diff --git a/nidaqmx/_task_modules/channels/__init__.py b/nidaqmx/_task_modules/channels/__init__.py new file mode 100644 index 00000000..b91495cc --- /dev/null +++ b/nidaqmx/_task_modules/channels/__init__.py @@ -0,0 +1,17 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + + +__author__ = 'National Instruments' +__all__ = ['channel'] + + +from nidaqmx._task_modules.channels.channel import Channel +from nidaqmx._task_modules.channels.ai_channel import AIChannel +from nidaqmx._task_modules.channels.ao_channel import AOChannel +from nidaqmx._task_modules.channels.ci_channel import CIChannel +from nidaqmx._task_modules.channels.co_channel import COChannel +from nidaqmx._task_modules.channels.di_channel import DIChannel +from nidaqmx._task_modules.channels.do_channel import DOChannel \ No newline at end of file diff --git a/nidaqmx/_task_modules/channels/ai_channel.py b/nidaqmx/_task_modules/channels/ai_channel.py new file mode 100644 index 00000000..8781ada3 --- /dev/null +++ b/nidaqmx/_task_modules/channels/ai_channel.py @@ -0,0 +1,6760 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import ctypes +import numpy + +from nidaqmx._lib import lib_importer, wrapped_ndpointer, ctypes_byte_str +from nidaqmx.scale import Scale +from nidaqmx.errors import ( + check_for_error, is_string_buffer_too_small, is_array_buffer_too_small) +from nidaqmx._task_modules.channels.channel import Channel +from nidaqmx.utils import unflatten_channel_string +from nidaqmx.constants import ( + ACExcitWireMode, ADCTimingMode, AccelChargeSensitivityUnits, + AccelSensitivityUnits, AccelUnits, AngleUnits, AutoZeroType, + BridgeConfiguration, BridgeElectricalUnits, BridgePhysicalUnits, + BridgeShuntCalSource, BridgeUnits, CJCSource, ChargeUnits, Coupling, + CurrentShuntResistorLocation, CurrentUnits, DataJustification, + DataTransferActiveTransferMode, DigitalWidthUnits, + EddyCurrentProxProbeSensitivityUnits, ExcitationDCorAC, + ExcitationIdleOutputBehavior, ExcitationSource, + ExcitationVoltageOrCurrent, FilterResponse, FilterType, + ForceIEPESensorSensitivityUnits, ForceUnits, FrequencyUnits, Impedance1, + InputDataTransferCondition, LVDTSensitivityUnits, LengthUnits, + PressureUnits, RTDType, RVDTSensitivityUnits, RawDataCompressionType, + ResistanceConfiguration, ResistanceUnits, ResolutionType, ScaleType, + Sense, ShuntCalSelect, SoundPressureUnits, SourceSelection, + StrainGageBridgeType, StrainGageRosetteMeasurementType, + StrainGageRosetteType, StrainUnits, TemperatureUnits, + TerminalConfiguration, ThermocoupleType, TorqueUnits, UsageTypeAI, + VelocityIEPESensorSensitivityUnits, VelocityUnits, VoltageUnits) + + +class AIChannel(Channel): + """ + Represents one or more analog input virtual channels and their properties. + """ + __slots__ = [] + + def __repr__(self): + return 'AIChannel(name={0})'.format(self._name) + + @property + def ai_ac_excit_freq(self): + """ + float: Specifies the AC excitation frequency in Hertz. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIACExcitFreq + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_ac_excit_freq.setter + def ai_ac_excit_freq(self, val): + cfunc = lib_importer.windll.DAQmxSetAIACExcitFreq + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_ac_excit_freq.deleter + def ai_ac_excit_freq(self): + cfunc = lib_importer.windll.DAQmxResetAIACExcitFreq + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_ac_excit_sync_enable(self): + """ + bool: Specifies whether to synchronize the AC excitation source + of the channel to that of another channel. Synchronize the + excitation sources of multiple channels to use multichannel + sensors. Set this property to False for the master channel + and to True for the slave channels. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetAIACExcitSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_ac_excit_sync_enable.setter + def ai_ac_excit_sync_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetAIACExcitSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_ac_excit_sync_enable.deleter + def ai_ac_excit_sync_enable(self): + cfunc = lib_importer.windll.DAQmxResetAIACExcitSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_ac_excit_wire_mode(self): + """ + :class:`nidaqmx.constants.ACExcitWireMode`: Specifies the number + of leads on the LVDT or RVDT. Some sensors require you to + tie leads together to create a four- or five- wire sensor. + Refer to the sensor documentation for more information. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIACExcitWireMode + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return ACExcitWireMode(val.value) + + @ai_ac_excit_wire_mode.setter + def ai_ac_excit_wire_mode(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIACExcitWireMode + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_ac_excit_wire_mode.deleter + def ai_ac_excit_wire_mode(self): + cfunc = lib_importer.windll.DAQmxResetAIACExcitWireMode + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_accel_4_wire_dc_voltage_sensitivity(self): + """ + float: Specifies the sensitivity of the 4 wire DC voltage + acceleration sensor connected to the channel. This value is + the units you specify with + AI.Accel.4WireDCVoltage.SensitivityUnits. Refer to the + sensor documentation to determine this value. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIAccel4WireDCVoltageSensitivity + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_accel_4_wire_dc_voltage_sensitivity.setter + def ai_accel_4_wire_dc_voltage_sensitivity(self, val): + cfunc = lib_importer.windll.DAQmxSetAIAccel4WireDCVoltageSensitivity + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_accel_4_wire_dc_voltage_sensitivity.deleter + def ai_accel_4_wire_dc_voltage_sensitivity(self): + cfunc = lib_importer.windll.DAQmxResetAIAccel4WireDCVoltageSensitivity + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_accel_4_wire_dc_voltage_sensitivity_units(self): + """ + :class:`nidaqmx.constants.AccelSensitivityUnits`: Specifies the + units of AI.Accel.4WireDCVoltage.Sensitivity. + """ + val = ctypes.c_int() + + cfunc = (lib_importer.windll. + DAQmxGetAIAccel4WireDCVoltageSensitivityUnits) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return AccelSensitivityUnits(val.value) + + @ai_accel_4_wire_dc_voltage_sensitivity_units.setter + def ai_accel_4_wire_dc_voltage_sensitivity_units(self, val): + val = val.value + cfunc = (lib_importer.windll. + DAQmxSetAIAccel4WireDCVoltageSensitivityUnits) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_accel_4_wire_dc_voltage_sensitivity_units.deleter + def ai_accel_4_wire_dc_voltage_sensitivity_units(self): + cfunc = (lib_importer.windll. + DAQmxResetAIAccel4WireDCVoltageSensitivityUnits) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_accel_charge_sensitivity(self): + """ + float: Specifies the sensitivity of the charge acceleration + sensor connected to the channel. This value is the units you + specify with AI.Accel.Charge.SensitivityUnits. Refer to the + sensor documentation to determine this value. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIAccelChargeSensitivity + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_accel_charge_sensitivity.setter + def ai_accel_charge_sensitivity(self, val): + cfunc = lib_importer.windll.DAQmxSetAIAccelChargeSensitivity + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_accel_charge_sensitivity.deleter + def ai_accel_charge_sensitivity(self): + cfunc = lib_importer.windll.DAQmxResetAIAccelChargeSensitivity + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_accel_charge_sensitivity_units(self): + """ + :class:`nidaqmx.constants.AccelChargeSensitivityUnits`: + Specifies the units of AI.Accel.Charge.Sensitivity. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIAccelChargeSensitivityUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return AccelChargeSensitivityUnits(val.value) + + @ai_accel_charge_sensitivity_units.setter + def ai_accel_charge_sensitivity_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIAccelChargeSensitivityUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_accel_charge_sensitivity_units.deleter + def ai_accel_charge_sensitivity_units(self): + cfunc = lib_importer.windll.DAQmxResetAIAccelChargeSensitivityUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_accel_sensitivity(self): + """ + float: Specifies the sensitivity of the accelerometer. This + value is in the units you specify with + **ai_accel_sensitivity_units**. Refer to the sensor + documentation to determine this value. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIAccelSensitivity + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_accel_sensitivity.setter + def ai_accel_sensitivity(self, val): + cfunc = lib_importer.windll.DAQmxSetAIAccelSensitivity + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_accel_sensitivity.deleter + def ai_accel_sensitivity(self): + cfunc = lib_importer.windll.DAQmxResetAIAccelSensitivity + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_accel_sensitivity_units(self): + """ + :class:`nidaqmx.constants.AccelSensitivityUnits`: Specifies the + units of **ai_accel_sensitivity**. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIAccelSensitivityUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return AccelSensitivityUnits(val.value) + + @ai_accel_sensitivity_units.setter + def ai_accel_sensitivity_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIAccelSensitivityUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_accel_sensitivity_units.deleter + def ai_accel_sensitivity_units(self): + cfunc = lib_importer.windll.DAQmxResetAIAccelSensitivityUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_accel_units(self): + """ + :class:`nidaqmx.constants.AccelUnits`: Specifies the units to + use to return acceleration measurements from the channel. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIAccelUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return AccelUnits(val.value) + + @ai_accel_units.setter + def ai_accel_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIAccelUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_accel_units.deleter + def ai_accel_units(self): + cfunc = lib_importer.windll.DAQmxResetAIAccelUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_acceld_b_ref(self): + """ + float: Specifies the decibel reference level in the units of the + channel. When you read samples as a waveform, the decibel + reference level is included in the waveform attributes. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIAcceldBRef + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_acceld_b_ref.setter + def ai_acceld_b_ref(self, val): + cfunc = lib_importer.windll.DAQmxSetAIAcceldBRef + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_acceld_b_ref.deleter + def ai_acceld_b_ref(self): + cfunc = lib_importer.windll.DAQmxResetAIAcceldBRef + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_atten(self): + """ + float: Specifies the amount of attenuation to use. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIAtten + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_atten.setter + def ai_atten(self, val): + cfunc = lib_importer.windll.DAQmxSetAIAtten + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_atten.deleter + def ai_atten(self): + cfunc = lib_importer.windll.DAQmxResetAIAtten + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_auto_zero_mode(self): + """ + :class:`nidaqmx.constants.AutoZeroType`: Specifies how often to + measure ground. NI-DAQmx subtracts the measured ground + voltage from every sample. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIAutoZeroMode + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return AutoZeroType(val.value) + + @ai_auto_zero_mode.setter + def ai_auto_zero_mode(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIAutoZeroMode + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_auto_zero_mode.deleter + def ai_auto_zero_mode(self): + cfunc = lib_importer.windll.DAQmxResetAIAutoZeroMode + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_averaging_win_size(self): + """ + int: Specifies the number of samples to average while acquiring + data. Increasing the number of samples to average reduces + noise in your measurement. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetAIAveragingWinSize + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_averaging_win_size.setter + def ai_averaging_win_size(self, val): + cfunc = lib_importer.windll.DAQmxSetAIAveragingWinSize + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_averaging_win_size.deleter + def ai_averaging_win_size(self): + cfunc = lib_importer.windll.DAQmxResetAIAveragingWinSize + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_bridge_balance_coarse_pot(self): + """ + int: Specifies by how much to compensate for offset in the + signal. This value can be between 0 and 127. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIBridgeBalanceCoarsePot + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_bridge_balance_coarse_pot.setter + def ai_bridge_balance_coarse_pot(self, val): + cfunc = lib_importer.windll.DAQmxSetAIBridgeBalanceCoarsePot + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_bridge_balance_coarse_pot.deleter + def ai_bridge_balance_coarse_pot(self): + cfunc = lib_importer.windll.DAQmxResetAIBridgeBalanceCoarsePot + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_bridge_balance_fine_pot(self): + """ + int: Specifies by how much to compensate for offset in the + signal. This value can be between 0 and 4095. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIBridgeBalanceFinePot + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_bridge_balance_fine_pot.setter + def ai_bridge_balance_fine_pot(self, val): + cfunc = lib_importer.windll.DAQmxSetAIBridgeBalanceFinePot + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_bridge_balance_fine_pot.deleter + def ai_bridge_balance_fine_pot(self): + cfunc = lib_importer.windll.DAQmxResetAIBridgeBalanceFinePot + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_bridge_cfg(self): + """ + :class:`nidaqmx.constants.BridgeConfiguration`: Specifies the + type of Wheatstone bridge connected to the channel. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIBridgeCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return BridgeConfiguration(val.value) + + @ai_bridge_cfg.setter + def ai_bridge_cfg(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIBridgeCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_bridge_cfg.deleter + def ai_bridge_cfg(self): + cfunc = lib_importer.windll.DAQmxResetAIBridgeCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_bridge_electrical_units(self): + """ + :class:`nidaqmx.constants.BridgeElectricalUnits`: Specifies from + which electrical unit to scale data. Select the same unit + that the sensor data sheet or calibration certificate uses + for electrical values. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIBridgeElectricalUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return BridgeElectricalUnits(val.value) + + @ai_bridge_electrical_units.setter + def ai_bridge_electrical_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIBridgeElectricalUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_bridge_electrical_units.deleter + def ai_bridge_electrical_units(self): + cfunc = lib_importer.windll.DAQmxResetAIBridgeElectricalUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_bridge_initial_ratio(self): + """ + float: Specifies in volts per volt the ratio of output voltage + from the bridge to excitation voltage supplied to the bridge + while not under load. NI-DAQmx subtracts this value from any + measurements before applying scaling equations. If you set + **ai_bridge_initial_voltage**, NI-DAQmx coerces this + property to **ai_bridge_initial_voltage** divided by + **ai_excit_actual_val**. If you set this property, NI-DAQmx + coerces **ai_bridge_initial_voltage** to the value of this + property times **ai_excit_actual_val**. If you set both this + property and **ai_bridge_initial_voltage**, and their values + conflict, NI-DAQmx returns an error. To avoid this error, + reset one property to its default value before setting the + other. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIBridgeInitialRatio + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_bridge_initial_ratio.setter + def ai_bridge_initial_ratio(self, val): + cfunc = lib_importer.windll.DAQmxSetAIBridgeInitialRatio + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_bridge_initial_ratio.deleter + def ai_bridge_initial_ratio(self): + cfunc = lib_importer.windll.DAQmxResetAIBridgeInitialRatio + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_bridge_initial_voltage(self): + """ + float: Specifies in volts the output voltage of the bridge while + not under load. NI-DAQmx subtracts this value from any + measurements before applying scaling equations. If you set + **ai_bridge_initial_ratio**, NI-DAQmx coerces this property + to **ai_bridge_initial_ratio** times + **ai_excit_actual_val**. This property is set by DAQmx + Perform Bridge Offset Nulling Calibration. If you set this + property, NI-DAQmx coerces **ai_bridge_initial_ratio** to + the value of this property divided by + **ai_excit_actual_val**. If you set both this property and + **ai_bridge_initial_ratio**, and their values conflict, NI- + DAQmx returns an error. To avoid this error, reset one + property to its default value before setting the other. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIBridgeInitialVoltage + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_bridge_initial_voltage.setter + def ai_bridge_initial_voltage(self, val): + cfunc = lib_importer.windll.DAQmxSetAIBridgeInitialVoltage + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_bridge_initial_voltage.deleter + def ai_bridge_initial_voltage(self): + cfunc = lib_importer.windll.DAQmxResetAIBridgeInitialVoltage + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_bridge_nom_resistance(self): + """ + float: Specifies in ohms the resistance of the bridge while not + under load. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIBridgeNomResistance + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_bridge_nom_resistance.setter + def ai_bridge_nom_resistance(self, val): + cfunc = lib_importer.windll.DAQmxSetAIBridgeNomResistance + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_bridge_nom_resistance.deleter + def ai_bridge_nom_resistance(self): + cfunc = lib_importer.windll.DAQmxResetAIBridgeNomResistance + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_bridge_physical_units(self): + """ + :class:`nidaqmx.constants.BridgePhysicalUnits`: Specifies to + which physical unit to scale electrical data. Select the + same unit that the sensor data sheet or calibration + certificate uses for physical values. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIBridgePhysicalUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return BridgePhysicalUnits(val.value) + + @ai_bridge_physical_units.setter + def ai_bridge_physical_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIBridgePhysicalUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_bridge_physical_units.deleter + def ai_bridge_physical_units(self): + cfunc = lib_importer.windll.DAQmxResetAIBridgePhysicalUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_bridge_poly_forward_coeff(self): + """ + List[float]: Specifies an list of coefficients for the + polynomial that converts electrical values to physical + values. Each element of the list corresponds to a term of + the equation. For example, if index three of the list is 9, + the fourth term of the equation is 9x^3. + """ + cfunc = lib_importer.windll.DAQmxGetAIBridgePolyForwardCoeff + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + wrapped_ndpointer(dtype=numpy.float64, flags=('C','W')), + ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.float64) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.tolist() + + @ai_bridge_poly_forward_coeff.setter + def ai_bridge_poly_forward_coeff(self, val): + val = numpy.float64(val) + cfunc = lib_importer.windll.DAQmxSetAIBridgePolyForwardCoeff + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + wrapped_ndpointer(dtype=numpy.float64, flags=('C','W')), + ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, val, len(val)) + check_for_error(error_code) + + @ai_bridge_poly_forward_coeff.deleter + def ai_bridge_poly_forward_coeff(self): + cfunc = lib_importer.windll.DAQmxResetAIBridgePolyForwardCoeff + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_bridge_poly_reverse_coeff(self): + """ + List[float]: Specifies an list of coefficients for the + polynomial that converts physical values to electrical + values. Each element of the list corresponds to a term of + the equation. For example, if index three of the list is 9, + the fourth term of the equation is 9x^3. + """ + cfunc = lib_importer.windll.DAQmxGetAIBridgePolyReverseCoeff + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + wrapped_ndpointer(dtype=numpy.float64, flags=('C','W')), + ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.float64) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.tolist() + + @ai_bridge_poly_reverse_coeff.setter + def ai_bridge_poly_reverse_coeff(self, val): + val = numpy.float64(val) + cfunc = lib_importer.windll.DAQmxSetAIBridgePolyReverseCoeff + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + wrapped_ndpointer(dtype=numpy.float64, flags=('C','W')), + ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, val, len(val)) + check_for_error(error_code) + + @ai_bridge_poly_reverse_coeff.deleter + def ai_bridge_poly_reverse_coeff(self): + cfunc = lib_importer.windll.DAQmxResetAIBridgePolyReverseCoeff + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_bridge_scale_type(self): + """ + :class:`nidaqmx.constants.ScaleType`: Specifies the scaling type + to use when scaling electrical values from the sensor to + physical units. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIBridgeScaleType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return ScaleType(val.value) + + @ai_bridge_scale_type.setter + def ai_bridge_scale_type(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIBridgeScaleType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_bridge_scale_type.deleter + def ai_bridge_scale_type(self): + cfunc = lib_importer.windll.DAQmxResetAIBridgeScaleType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_bridge_shunt_cal_enable(self): + """ + bool: Specifies whether to enable a shunt calibration switch. + Use **ai_bridge_shunt_cal_select** to select the switch(es) + to enable. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetAIBridgeShuntCalEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_bridge_shunt_cal_enable.setter + def ai_bridge_shunt_cal_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetAIBridgeShuntCalEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_bridge_shunt_cal_enable.deleter + def ai_bridge_shunt_cal_enable(self): + cfunc = lib_importer.windll.DAQmxResetAIBridgeShuntCalEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_bridge_shunt_cal_gain_adjust(self): + """ + float: Specifies the result of a shunt calibration. This + property is set by DAQmx Perform Shunt Calibration. NI-DAQmx + multiplies data read from the channel by the value of this + property. This value should be close to 1.0. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIBridgeShuntCalGainAdjust + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_bridge_shunt_cal_gain_adjust.setter + def ai_bridge_shunt_cal_gain_adjust(self, val): + cfunc = lib_importer.windll.DAQmxSetAIBridgeShuntCalGainAdjust + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_bridge_shunt_cal_gain_adjust.deleter + def ai_bridge_shunt_cal_gain_adjust(self): + cfunc = lib_importer.windll.DAQmxResetAIBridgeShuntCalGainAdjust + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_bridge_shunt_cal_select(self): + """ + :class:`nidaqmx.constants.ShuntCalSelect`: Specifies which shunt + calibration switch(es) to enable. Use + **ai_bridge_shunt_cal_enable** to enable the switch(es) you + specify with this property. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIBridgeShuntCalSelect + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return ShuntCalSelect(val.value) + + @ai_bridge_shunt_cal_select.setter + def ai_bridge_shunt_cal_select(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIBridgeShuntCalSelect + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_bridge_shunt_cal_select.deleter + def ai_bridge_shunt_cal_select(self): + cfunc = lib_importer.windll.DAQmxResetAIBridgeShuntCalSelect + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_bridge_shunt_cal_shunt_cal_a_actual_resistance(self): + """ + float: Specifies in ohms the actual value of the internal shunt + calibration A resistor. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetAIBridgeShuntCalShuntCalAActualResistance) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_bridge_shunt_cal_shunt_cal_a_actual_resistance.setter + def ai_bridge_shunt_cal_shunt_cal_a_actual_resistance(self, val): + cfunc = (lib_importer.windll. + DAQmxSetAIBridgeShuntCalShuntCalAActualResistance) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_bridge_shunt_cal_shunt_cal_a_actual_resistance.deleter + def ai_bridge_shunt_cal_shunt_cal_a_actual_resistance(self): + cfunc = (lib_importer.windll. + DAQmxResetAIBridgeShuntCalShuntCalAActualResistance) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_bridge_shunt_cal_shunt_cal_a_resistance(self): + """ + float: Specifies in ohms the desired value of the internal shunt + calibration A resistor. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetAIBridgeShuntCalShuntCalAResistance) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_bridge_shunt_cal_shunt_cal_a_resistance.setter + def ai_bridge_shunt_cal_shunt_cal_a_resistance(self, val): + cfunc = (lib_importer.windll. + DAQmxSetAIBridgeShuntCalShuntCalAResistance) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_bridge_shunt_cal_shunt_cal_a_resistance.deleter + def ai_bridge_shunt_cal_shunt_cal_a_resistance(self): + cfunc = (lib_importer.windll. + DAQmxResetAIBridgeShuntCalShuntCalAResistance) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_bridge_shunt_cal_shunt_cal_a_src(self): + """ + :class:`nidaqmx.constants.BridgeShuntCalSource`: Specifies + whether to use internal or external shunt when Shunt Cal A + is selected. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIBridgeShuntCalShuntCalASource + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return BridgeShuntCalSource(val.value) + + @ai_bridge_shunt_cal_shunt_cal_a_src.setter + def ai_bridge_shunt_cal_shunt_cal_a_src(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIBridgeShuntCalShuntCalASource + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_bridge_shunt_cal_shunt_cal_a_src.deleter + def ai_bridge_shunt_cal_shunt_cal_a_src(self): + cfunc = lib_importer.windll.DAQmxResetAIBridgeShuntCalShuntCalASource + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_bridge_shunt_cal_shunt_cal_b_actual_resistance(self): + """ + float: Specifies in ohms the actual value of the internal shunt + calibration B resistor. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetAIBridgeShuntCalShuntCalBActualResistance) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_bridge_shunt_cal_shunt_cal_b_actual_resistance.setter + def ai_bridge_shunt_cal_shunt_cal_b_actual_resistance(self, val): + cfunc = (lib_importer.windll. + DAQmxSetAIBridgeShuntCalShuntCalBActualResistance) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_bridge_shunt_cal_shunt_cal_b_actual_resistance.deleter + def ai_bridge_shunt_cal_shunt_cal_b_actual_resistance(self): + cfunc = (lib_importer.windll. + DAQmxResetAIBridgeShuntCalShuntCalBActualResistance) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_bridge_shunt_cal_shunt_cal_b_resistance(self): + """ + float: Specifies in ohms the desired value of the internal shunt + calibration B resistor. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetAIBridgeShuntCalShuntCalBResistance) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_bridge_shunt_cal_shunt_cal_b_resistance.setter + def ai_bridge_shunt_cal_shunt_cal_b_resistance(self, val): + cfunc = (lib_importer.windll. + DAQmxSetAIBridgeShuntCalShuntCalBResistance) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_bridge_shunt_cal_shunt_cal_b_resistance.deleter + def ai_bridge_shunt_cal_shunt_cal_b_resistance(self): + cfunc = (lib_importer.windll. + DAQmxResetAIBridgeShuntCalShuntCalBResistance) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_bridge_table_electrical_vals(self): + """ + List[float]: Specifies the list of electrical values that map to + the values in **ai_bridge_table_physical_vals**. Specify + this value in the unit indicated by + **ai_bridge_electrical_units**. + """ + cfunc = lib_importer.windll.DAQmxGetAIBridgeTableElectricalVals + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + wrapped_ndpointer(dtype=numpy.float64, flags=('C','W')), + ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.float64) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.tolist() + + @ai_bridge_table_electrical_vals.setter + def ai_bridge_table_electrical_vals(self, val): + val = numpy.float64(val) + cfunc = lib_importer.windll.DAQmxSetAIBridgeTableElectricalVals + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + wrapped_ndpointer(dtype=numpy.float64, flags=('C','W')), + ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, val, len(val)) + check_for_error(error_code) + + @ai_bridge_table_electrical_vals.deleter + def ai_bridge_table_electrical_vals(self): + cfunc = lib_importer.windll.DAQmxResetAIBridgeTableElectricalVals + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_bridge_table_physical_vals(self): + """ + List[float]: Specifies the list of physical values that map to + the values in **ai_bridge_table_electrical_vals**. Specify + this value in the unit indicated by + **ai_bridge_physical_units**. + """ + cfunc = lib_importer.windll.DAQmxGetAIBridgeTablePhysicalVals + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + wrapped_ndpointer(dtype=numpy.float64, flags=('C','W')), + ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.float64) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.tolist() + + @ai_bridge_table_physical_vals.setter + def ai_bridge_table_physical_vals(self, val): + val = numpy.float64(val) + cfunc = lib_importer.windll.DAQmxSetAIBridgeTablePhysicalVals + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + wrapped_ndpointer(dtype=numpy.float64, flags=('C','W')), + ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, val, len(val)) + check_for_error(error_code) + + @ai_bridge_table_physical_vals.deleter + def ai_bridge_table_physical_vals(self): + cfunc = lib_importer.windll.DAQmxResetAIBridgeTablePhysicalVals + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_bridge_two_point_lin_first_electrical_val(self): + """ + float: Specifies the first electrical value, corresponding to + **ai_bridge_two_point_lin_first_physical_val**. Specify this + value in the unit indicated by + **ai_bridge_electrical_units**. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetAIBridgeTwoPointLinFirstElectricalVal) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_bridge_two_point_lin_first_electrical_val.setter + def ai_bridge_two_point_lin_first_electrical_val(self, val): + cfunc = (lib_importer.windll. + DAQmxSetAIBridgeTwoPointLinFirstElectricalVal) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_bridge_two_point_lin_first_electrical_val.deleter + def ai_bridge_two_point_lin_first_electrical_val(self): + cfunc = (lib_importer.windll. + DAQmxResetAIBridgeTwoPointLinFirstElectricalVal) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_bridge_two_point_lin_first_physical_val(self): + """ + float: Specifies the first physical value, corresponding to + **ai_bridge_two_point_lin_first_electrical_val**. Specify + this value in the unit indicated by + **ai_bridge_physical_units**. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetAIBridgeTwoPointLinFirstPhysicalVal) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_bridge_two_point_lin_first_physical_val.setter + def ai_bridge_two_point_lin_first_physical_val(self, val): + cfunc = (lib_importer.windll. + DAQmxSetAIBridgeTwoPointLinFirstPhysicalVal) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_bridge_two_point_lin_first_physical_val.deleter + def ai_bridge_two_point_lin_first_physical_val(self): + cfunc = (lib_importer.windll. + DAQmxResetAIBridgeTwoPointLinFirstPhysicalVal) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_bridge_two_point_lin_second_electrical_val(self): + """ + float: Specifies the second electrical value, corresponding to + **ai_bridge_two_point_lin_second_physical_val**. Specify + this value in the unit indicated by + **ai_bridge_electrical_units**. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetAIBridgeTwoPointLinSecondElectricalVal) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_bridge_two_point_lin_second_electrical_val.setter + def ai_bridge_two_point_lin_second_electrical_val(self, val): + cfunc = (lib_importer.windll. + DAQmxSetAIBridgeTwoPointLinSecondElectricalVal) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_bridge_two_point_lin_second_electrical_val.deleter + def ai_bridge_two_point_lin_second_electrical_val(self): + cfunc = (lib_importer.windll. + DAQmxResetAIBridgeTwoPointLinSecondElectricalVal) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_bridge_two_point_lin_second_physical_val(self): + """ + float: Specifies the second physical value, corresponding to + **ai_bridge_two_point_lin_second_electrical_val**. Specify + this value in the unit indicated by + **ai_bridge_physical_units**. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetAIBridgeTwoPointLinSecondPhysicalVal) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_bridge_two_point_lin_second_physical_val.setter + def ai_bridge_two_point_lin_second_physical_val(self, val): + cfunc = (lib_importer.windll. + DAQmxSetAIBridgeTwoPointLinSecondPhysicalVal) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_bridge_two_point_lin_second_physical_val.deleter + def ai_bridge_two_point_lin_second_physical_val(self): + cfunc = (lib_importer.windll. + DAQmxResetAIBridgeTwoPointLinSecondPhysicalVal) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_bridge_units(self): + """ + :class:`nidaqmx.constants.BridgeUnits`: Specifies in which unit + to return voltage ratios from the channel. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIBridgeUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return BridgeUnits(val.value) + + @ai_bridge_units.setter + def ai_bridge_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIBridgeUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_bridge_units.deleter + def ai_bridge_units(self): + cfunc = lib_importer.windll.DAQmxResetAIBridgeUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_charge_units(self): + """ + :class:`nidaqmx.constants.ChargeUnits`: Specifies the units to + use to return charge measurements from the channel. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIChargeUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return ChargeUnits(val.value) + + @ai_charge_units.setter + def ai_charge_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIChargeUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_charge_units.deleter + def ai_charge_units(self): + cfunc = lib_importer.windll.DAQmxResetAIChargeUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_coupling(self): + """ + :class:`nidaqmx.constants.Coupling`: Specifies the coupling for + the channel. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAICoupling + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return Coupling(val.value) + + @ai_coupling.setter + def ai_coupling(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAICoupling + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_coupling.deleter + def ai_coupling(self): + cfunc = lib_importer.windll.DAQmxResetAICoupling + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_current_acrms_units(self): + """ + :class:`nidaqmx.constants.CurrentUnits`: Specifies the units to + use to return current RMS measurements from the channel. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAICurrentACRMSUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return CurrentUnits(val.value) + + @ai_current_acrms_units.setter + def ai_current_acrms_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAICurrentACRMSUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_current_acrms_units.deleter + def ai_current_acrms_units(self): + cfunc = lib_importer.windll.DAQmxResetAICurrentACRMSUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_current_shunt_loc(self): + """ + :class:`nidaqmx.constants.CurrentShuntResistorLocation`: + Specifies the shunt resistor location for current + measurements. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAICurrentShuntLoc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return CurrentShuntResistorLocation(val.value) + + @ai_current_shunt_loc.setter + def ai_current_shunt_loc(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAICurrentShuntLoc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_current_shunt_loc.deleter + def ai_current_shunt_loc(self): + cfunc = lib_importer.windll.DAQmxResetAICurrentShuntLoc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_current_shunt_resistance(self): + """ + float: Specifies in ohms the external shunt resistance for + current measurements. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAICurrentShuntResistance + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_current_shunt_resistance.setter + def ai_current_shunt_resistance(self, val): + cfunc = lib_importer.windll.DAQmxSetAICurrentShuntResistance + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_current_shunt_resistance.deleter + def ai_current_shunt_resistance(self): + cfunc = lib_importer.windll.DAQmxResetAICurrentShuntResistance + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_current_units(self): + """ + :class:`nidaqmx.constants.CurrentUnits`: Specifies the units to + use to return current measurements from the channel. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAICurrentUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return CurrentUnits(val.value) + + @ai_current_units.setter + def ai_current_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAICurrentUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_current_units.deleter + def ai_current_units(self): + cfunc = lib_importer.windll.DAQmxResetAICurrentUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_custom_scale(self): + """ + :class:`nidaqmx.system.scale.Scale`: Specifies the name of a + custom scale for the channel. + """ + cfunc = lib_importer.windll.DAQmxGetAICustomScaleName + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return Scale(val.value.decode('ascii')) + + @ai_custom_scale.setter + def ai_custom_scale(self, val): + val = val.name + cfunc = lib_importer.windll.DAQmxSetAICustomScaleName + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_custom_scale.deleter + def ai_custom_scale(self): + cfunc = lib_importer.windll.DAQmxResetAICustomScaleName + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_data_xfer_custom_threshold(self): + """ + int: Specifies the number of samples that must be in the FIFO to + transfer data from the device if **ai_data_xfer_req_cond** + is + **InputDataTransferCondition.ONBOARD_MEMORY_CUSTOM_THRESHOLD**. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetAIDataXferCustomThreshold + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_data_xfer_custom_threshold.setter + def ai_data_xfer_custom_threshold(self, val): + cfunc = lib_importer.windll.DAQmxSetAIDataXferCustomThreshold + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_data_xfer_custom_threshold.deleter + def ai_data_xfer_custom_threshold(self): + cfunc = lib_importer.windll.DAQmxResetAIDataXferCustomThreshold + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_data_xfer_mech(self): + """ + :class:`nidaqmx.constants.DataTransferActiveTransferMode`: + Specifies the data transfer mode for the device. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIDataXferMech + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return DataTransferActiveTransferMode(val.value) + + @ai_data_xfer_mech.setter + def ai_data_xfer_mech(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIDataXferMech + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_data_xfer_mech.deleter + def ai_data_xfer_mech(self): + cfunc = lib_importer.windll.DAQmxResetAIDataXferMech + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_data_xfer_req_cond(self): + """ + :class:`nidaqmx.constants.InputDataTransferCondition`: Specifies + under what condition to transfer data from the onboard + memory of the device to the buffer. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIDataXferReqCond + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return InputDataTransferCondition(val.value) + + @ai_data_xfer_req_cond.setter + def ai_data_xfer_req_cond(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIDataXferReqCond + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_data_xfer_req_cond.deleter + def ai_data_xfer_req_cond(self): + cfunc = lib_importer.windll.DAQmxResetAIDataXferReqCond + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_dev_scaling_coeff(self): + """ + List[float]: Indicates the coefficients of a polynomial equation + that NI-DAQmx uses to scale values from the native format of + the device to volts. Each element of the list corresponds to + a term of the equation. For example, if index two of the + list is 4, the third term of the equation is 4x^2. Scaling + coefficients do not account for any custom scales or sensors + contained by the channel. + """ + cfunc = lib_importer.windll.DAQmxGetAIDevScalingCoeff + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + wrapped_ndpointer(dtype=numpy.float64, flags=('C','W')), + ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.float64) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.tolist() + + @property + def ai_dig_fltr_bandpass_center_freq(self): + """ + float: Specifies the center frequency of the passband for the + digital filter. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIDigFltrBandpassCenterFreq + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_dig_fltr_bandpass_center_freq.setter + def ai_dig_fltr_bandpass_center_freq(self, val): + cfunc = lib_importer.windll.DAQmxSetAIDigFltrBandpassCenterFreq + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_dig_fltr_bandpass_center_freq.deleter + def ai_dig_fltr_bandpass_center_freq(self): + cfunc = lib_importer.windll.DAQmxResetAIDigFltrBandpassCenterFreq + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_dig_fltr_bandpass_width(self): + """ + float: Specifies the width of the passband centered around the + center frequency for the digital filter. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIDigFltrBandpassWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_dig_fltr_bandpass_width.setter + def ai_dig_fltr_bandpass_width(self, val): + cfunc = lib_importer.windll.DAQmxSetAIDigFltrBandpassWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_dig_fltr_bandpass_width.deleter + def ai_dig_fltr_bandpass_width(self): + cfunc = lib_importer.windll.DAQmxResetAIDigFltrBandpassWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_dig_fltr_coeff(self): + """ + List[float]: Specifies the digital filter coefficients. + """ + cfunc = lib_importer.windll.DAQmxGetAIDigFltrCoeff + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + wrapped_ndpointer(dtype=numpy.float64, flags=('C','W')), + ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.float64) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.tolist() + + @ai_dig_fltr_coeff.setter + def ai_dig_fltr_coeff(self, val): + val = numpy.float64(val) + cfunc = lib_importer.windll.DAQmxSetAIDigFltrCoeff + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + wrapped_ndpointer(dtype=numpy.float64, flags=('C','W')), + ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, val, len(val)) + check_for_error(error_code) + + @ai_dig_fltr_coeff.deleter + def ai_dig_fltr_coeff(self): + cfunc = lib_importer.windll.DAQmxResetAIDigFltrCoeff + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_dig_fltr_enable(self): + """ + bool: Specifies whether the digital filter is enabled or + disabled. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetAIDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_dig_fltr_enable.setter + def ai_dig_fltr_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetAIDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_dig_fltr_enable.deleter + def ai_dig_fltr_enable(self): + cfunc = lib_importer.windll.DAQmxResetAIDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_dig_fltr_highpass_cutoff_freq(self): + """ + float: Specifies the highpass cutoff frequency of the digital + filter. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIDigFltrHighpassCutoffFreq + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_dig_fltr_highpass_cutoff_freq.setter + def ai_dig_fltr_highpass_cutoff_freq(self, val): + cfunc = lib_importer.windll.DAQmxSetAIDigFltrHighpassCutoffFreq + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_dig_fltr_highpass_cutoff_freq.deleter + def ai_dig_fltr_highpass_cutoff_freq(self): + cfunc = lib_importer.windll.DAQmxResetAIDigFltrHighpassCutoffFreq + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_dig_fltr_lowpass_cutoff_freq(self): + """ + float: Specifies the lowpass cutoff frequency of the digital + filter. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIDigFltrLowpassCutoffFreq + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_dig_fltr_lowpass_cutoff_freq.setter + def ai_dig_fltr_lowpass_cutoff_freq(self, val): + cfunc = lib_importer.windll.DAQmxSetAIDigFltrLowpassCutoffFreq + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_dig_fltr_lowpass_cutoff_freq.deleter + def ai_dig_fltr_lowpass_cutoff_freq(self): + cfunc = lib_importer.windll.DAQmxResetAIDigFltrLowpassCutoffFreq + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_dig_fltr_notch_center_freq(self): + """ + float: Specifies the center frequency of the stopband for the + digital filter. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIDigFltrNotchCenterFreq + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_dig_fltr_notch_center_freq.setter + def ai_dig_fltr_notch_center_freq(self, val): + cfunc = lib_importer.windll.DAQmxSetAIDigFltrNotchCenterFreq + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_dig_fltr_notch_center_freq.deleter + def ai_dig_fltr_notch_center_freq(self): + cfunc = lib_importer.windll.DAQmxResetAIDigFltrNotchCenterFreq + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_dig_fltr_notch_width(self): + """ + float: Specifies the width of the stopband centered around the + center frequency for the digital filter. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIDigFltrNotchWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_dig_fltr_notch_width.setter + def ai_dig_fltr_notch_width(self, val): + cfunc = lib_importer.windll.DAQmxSetAIDigFltrNotchWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_dig_fltr_notch_width.deleter + def ai_dig_fltr_notch_width(self): + cfunc = lib_importer.windll.DAQmxResetAIDigFltrNotchWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_dig_fltr_order(self): + """ + int: Specifies the order of the digital filter. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetAIDigFltrOrder + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_dig_fltr_order.setter + def ai_dig_fltr_order(self, val): + cfunc = lib_importer.windll.DAQmxSetAIDigFltrOrder + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_dig_fltr_order.deleter + def ai_dig_fltr_order(self): + cfunc = lib_importer.windll.DAQmxResetAIDigFltrOrder + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_dig_fltr_response(self): + """ + :class:`nidaqmx.constants.FilterResponse`: Specifies the digital + filter response. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIDigFltrResponse + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return FilterResponse(val.value) + + @ai_dig_fltr_response.setter + def ai_dig_fltr_response(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIDigFltrResponse + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_dig_fltr_response.deleter + def ai_dig_fltr_response(self): + cfunc = lib_importer.windll.DAQmxResetAIDigFltrResponse + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_dig_fltr_type(self): + """ + :class:`nidaqmx.constants.FilterType`: Specifies the digital + filter type. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIDigFltrType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return FilterType(val.value) + + @ai_dig_fltr_type.setter + def ai_dig_fltr_type(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIDigFltrType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_dig_fltr_type.deleter + def ai_dig_fltr_type(self): + cfunc = lib_importer.windll.DAQmxResetAIDigFltrType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_dither_enable(self): + """ + bool: Specifies whether to enable dithering. Dithering adds + Gaussian noise to the input signal. You can use dithering to + achieve higher resolution measurements by over sampling the + input signal and averaging the results. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetAIDitherEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_dither_enable.setter + def ai_dither_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetAIDitherEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_dither_enable.deleter + def ai_dither_enable(self): + cfunc = lib_importer.windll.DAQmxResetAIDitherEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_eddy_current_prox_sensitivity(self): + """ + float: Specifies the sensitivity of the eddy current proximity + probe . This value is in the units you specify with + **ai_eddy_current_prox_sensitivity_units**. Refer to the + sensor documentation to determine this value. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetAIEddyCurrentProxProbeSensitivity) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_eddy_current_prox_sensitivity.setter + def ai_eddy_current_prox_sensitivity(self, val): + cfunc = (lib_importer.windll. + DAQmxSetAIEddyCurrentProxProbeSensitivity) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_eddy_current_prox_sensitivity.deleter + def ai_eddy_current_prox_sensitivity(self): + cfunc = (lib_importer.windll. + DAQmxResetAIEddyCurrentProxProbeSensitivity) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_eddy_current_prox_sensitivity_units(self): + """ + :class:`nidaqmx.constants.EddyCurrentProxProbeSensitivityUnits`: + Specifies the units of **ai_eddy_current_prox_sensitivity**. + """ + val = ctypes.c_int() + + cfunc = (lib_importer.windll. + DAQmxGetAIEddyCurrentProxProbeSensitivityUnits) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return EddyCurrentProxProbeSensitivityUnits(val.value) + + @ai_eddy_current_prox_sensitivity_units.setter + def ai_eddy_current_prox_sensitivity_units(self, val): + val = val.value + cfunc = (lib_importer.windll. + DAQmxSetAIEddyCurrentProxProbeSensitivityUnits) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_eddy_current_prox_sensitivity_units.deleter + def ai_eddy_current_prox_sensitivity_units(self): + cfunc = (lib_importer.windll. + DAQmxResetAIEddyCurrentProxProbeSensitivityUnits) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_eddy_current_prox_units(self): + """ + :class:`nidaqmx.constants.LengthUnits`: Specifies the units to + use to return proximity measurements from the channel. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIEddyCurrentProxProbeUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return LengthUnits(val.value) + + @ai_eddy_current_prox_units.setter + def ai_eddy_current_prox_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIEddyCurrentProxProbeUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_eddy_current_prox_units.deleter + def ai_eddy_current_prox_units(self): + cfunc = lib_importer.windll.DAQmxResetAIEddyCurrentProxProbeUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_enhanced_alias_rejection_enable(self): + """ + bool: Specifies whether to enable enhanced alias rejection. + Leave this property set to the default value for most + applications. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetAIEnhancedAliasRejectionEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_enhanced_alias_rejection_enable.setter + def ai_enhanced_alias_rejection_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetAIEnhancedAliasRejectionEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_enhanced_alias_rejection_enable.deleter + def ai_enhanced_alias_rejection_enable(self): + cfunc = lib_importer.windll.DAQmxResetAIEnhancedAliasRejectionEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_excit_actual_val(self): + """ + float: Specifies the actual amount of excitation supplied by an + internal excitation source. If you read an internal + excitation source more precisely with an external device, + set this property to the value you read. NI-DAQmx ignores + this value for external excitation. When performing shunt + calibration, some devices set this property automatically. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIExcitActualVal + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_excit_actual_val.setter + def ai_excit_actual_val(self, val): + cfunc = lib_importer.windll.DAQmxSetAIExcitActualVal + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_excit_actual_val.deleter + def ai_excit_actual_val(self): + cfunc = lib_importer.windll.DAQmxResetAIExcitActualVal + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_excit_d_cor_ac(self): + """ + :class:`nidaqmx.constants.ExcitationDCorAC`: Specifies if the + excitation supply is DC or AC. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIExcitDCorAC + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return ExcitationDCorAC(val.value) + + @ai_excit_d_cor_ac.setter + def ai_excit_d_cor_ac(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIExcitDCorAC + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_excit_d_cor_ac.deleter + def ai_excit_d_cor_ac(self): + cfunc = lib_importer.windll.DAQmxResetAIExcitDCorAC + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_excit_idle_output_behavior(self): + """ + :class:`nidaqmx.constants.ExcitationIdleOutputBehavior`: + Specifies whether this channel will disable excitation after + the task is uncommitted. Setting this to Zero Volts or Amps + disables excitation after task uncommit. Setting this + attribute to Maintain Existing Value leaves the excitation + on after task uncommit. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIExcitIdleOutputBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return ExcitationIdleOutputBehavior(val.value) + + @ai_excit_idle_output_behavior.setter + def ai_excit_idle_output_behavior(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIExcitIdleOutputBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_excit_idle_output_behavior.deleter + def ai_excit_idle_output_behavior(self): + cfunc = lib_importer.windll.DAQmxResetAIExcitIdleOutputBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_excit_sense(self): + """ + :class:`nidaqmx.constants.Sense`: Specifies whether to use local + or remote sense to sense excitation. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIExcitSense + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return Sense(val.value) + + @ai_excit_sense.setter + def ai_excit_sense(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIExcitSense + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_excit_sense.deleter + def ai_excit_sense(self): + cfunc = lib_importer.windll.DAQmxResetAIExcitSense + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_excit_src(self): + """ + :class:`nidaqmx.constants.ExcitationSource`: Specifies the + source of excitation. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIExcitSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return ExcitationSource(val.value) + + @ai_excit_src.setter + def ai_excit_src(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIExcitSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_excit_src.deleter + def ai_excit_src(self): + cfunc = lib_importer.windll.DAQmxResetAIExcitSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_excit_use_for_scaling(self): + """ + bool: Specifies if NI-DAQmx divides the measurement by the + excitation. You should typically set this property to True + for ratiometric transducers. If you set this property to + True, set **ai_max** and **ai_min** to reflect the scaling. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetAIExcitUseForScaling + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_excit_use_for_scaling.setter + def ai_excit_use_for_scaling(self, val): + cfunc = lib_importer.windll.DAQmxSetAIExcitUseForScaling + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_excit_use_for_scaling.deleter + def ai_excit_use_for_scaling(self): + cfunc = lib_importer.windll.DAQmxResetAIExcitUseForScaling + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_excit_use_multiplexed(self): + """ + bool: Specifies if the SCXI-1122 multiplexes the excitation to + the upper half of the channels as it advances through the + scan list. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetAIExcitUseMultiplexed + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_excit_use_multiplexed.setter + def ai_excit_use_multiplexed(self, val): + cfunc = lib_importer.windll.DAQmxSetAIExcitUseMultiplexed + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_excit_use_multiplexed.deleter + def ai_excit_use_multiplexed(self): + cfunc = lib_importer.windll.DAQmxResetAIExcitUseMultiplexed + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_excit_val(self): + """ + float: Specifies the amount of excitation that the sensor + requires. If **ai_excit_voltage_or_current** is + **ExcitationVoltageOrCurrent.USE_VOLTAGE**, this value is in + volts. If **ai_excit_voltage_or_current** is + **ExcitationVoltageOrCurrent.USE_CURRENT**, this value is in + amperes. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIExcitVal + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_excit_val.setter + def ai_excit_val(self, val): + cfunc = lib_importer.windll.DAQmxSetAIExcitVal + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_excit_val.deleter + def ai_excit_val(self): + cfunc = lib_importer.windll.DAQmxResetAIExcitVal + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_excit_voltage_or_current(self): + """ + :class:`nidaqmx.constants.ExcitationVoltageOrCurrent`: Specifies + if the channel uses current or voltage excitation. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIExcitVoltageOrCurrent + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return ExcitationVoltageOrCurrent(val.value) + + @ai_excit_voltage_or_current.setter + def ai_excit_voltage_or_current(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIExcitVoltageOrCurrent + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_excit_voltage_or_current.deleter + def ai_excit_voltage_or_current(self): + cfunc = lib_importer.windll.DAQmxResetAIExcitVoltageOrCurrent + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_filter_delay(self): + """ + float: Indicates the amount of time between when the ADC samples + data and when the sample is read by the host device. This + value is in the units you specify with + **ai_filter_delay_units**. You can adjust this amount of + time using **ai_filter_delay_adjustment**. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIFilterDelay + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def ai_filter_delay_adjustment(self): + """ + float: Specifies the amount of filter delay that gets removed if + **ai_remove_filter_delay** is enabled. This delay adjustment + is in addition to the value indicated by + **ai_filter_delay**. This delay adjustment is in the units + you specify with **ai_filter_delay_units**. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIFilterDelayAdjustment + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_filter_delay_adjustment.setter + def ai_filter_delay_adjustment(self, val): + cfunc = lib_importer.windll.DAQmxSetAIFilterDelayAdjustment + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_filter_delay_adjustment.deleter + def ai_filter_delay_adjustment(self): + cfunc = lib_importer.windll.DAQmxResetAIFilterDelayAdjustment + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_filter_delay_units(self): + """ + :class:`nidaqmx.constants.DigitalWidthUnits`: Specifies the + units of **ai_filter_delay** and + **ai_filter_delay_adjustment**. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIFilterDelayUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return DigitalWidthUnits(val.value) + + @ai_filter_delay_units.setter + def ai_filter_delay_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIFilterDelayUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_filter_delay_units.deleter + def ai_filter_delay_units(self): + cfunc = lib_importer.windll.DAQmxResetAIFilterDelayUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_force_iepe_sensor_sensitivity(self): + """ + float: Specifies the sensitivity of the IEPE force sensor + connected to the channel. Specify this value in the unit + indicated by **ai_force_iepe_sensor_sensitivity_units**. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIForceIEPESensorSensitivity + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_force_iepe_sensor_sensitivity.setter + def ai_force_iepe_sensor_sensitivity(self, val): + cfunc = lib_importer.windll.DAQmxSetAIForceIEPESensorSensitivity + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_force_iepe_sensor_sensitivity.deleter + def ai_force_iepe_sensor_sensitivity(self): + cfunc = lib_importer.windll.DAQmxResetAIForceIEPESensorSensitivity + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_force_iepe_sensor_sensitivity_units(self): + """ + :class:`nidaqmx.constants.ForceIEPESensorSensitivityUnits`: + Specifies the units for + **ai_force_iepe_sensor_sensitivity**. + """ + val = ctypes.c_int() + + cfunc = (lib_importer.windll. + DAQmxGetAIForceIEPESensorSensitivityUnits) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return ForceIEPESensorSensitivityUnits(val.value) + + @ai_force_iepe_sensor_sensitivity_units.setter + def ai_force_iepe_sensor_sensitivity_units(self, val): + val = val.value + cfunc = (lib_importer.windll. + DAQmxSetAIForceIEPESensorSensitivityUnits) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_force_iepe_sensor_sensitivity_units.deleter + def ai_force_iepe_sensor_sensitivity_units(self): + cfunc = (lib_importer.windll. + DAQmxResetAIForceIEPESensorSensitivityUnits) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_force_read_from_chan(self): + """ + bool: Specifies whether to read from the channel if it is a + cold-junction compensation channel. By default, DAQmx Read + does not return data from cold-junction compensation + channels. Setting this property to True forces read + operations to return the cold-junction compensation channel + data with the other channels in the task. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetAIForceReadFromChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_force_read_from_chan.setter + def ai_force_read_from_chan(self, val): + cfunc = lib_importer.windll.DAQmxSetAIForceReadFromChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_force_read_from_chan.deleter + def ai_force_read_from_chan(self): + cfunc = lib_importer.windll.DAQmxResetAIForceReadFromChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_force_units(self): + """ + :class:`nidaqmx.constants.ForceUnits`: Specifies in which unit + to return force or load measurements from the channel. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIForceUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return ForceUnits(val.value) + + @ai_force_units.setter + def ai_force_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIForceUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_force_units.deleter + def ai_force_units(self): + cfunc = lib_importer.windll.DAQmxResetAIForceUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_freq_hyst(self): + """ + float: Specifies in volts a window below + **ai_freq_thresh_voltage**. The input voltage must pass + below **ai_freq_thresh_voltage** minus this value before NI- + DAQmx recognizes a waveform repetition at + **ai_freq_thresh_voltage**. Hysteresis can improve the + measurement accuracy when the signal contains noise or + jitter. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIFreqHyst + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_freq_hyst.setter + def ai_freq_hyst(self, val): + cfunc = lib_importer.windll.DAQmxSetAIFreqHyst + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_freq_hyst.deleter + def ai_freq_hyst(self): + cfunc = lib_importer.windll.DAQmxResetAIFreqHyst + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_freq_thresh_voltage(self): + """ + float: Specifies the voltage level at which to recognize + waveform repetitions. You should select a voltage level that + occurs only once within the entire period of a waveform. You + also can select a voltage that occurs only once while the + voltage rises or falls. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIFreqThreshVoltage + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_freq_thresh_voltage.setter + def ai_freq_thresh_voltage(self, val): + cfunc = lib_importer.windll.DAQmxSetAIFreqThreshVoltage + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_freq_thresh_voltage.deleter + def ai_freq_thresh_voltage(self): + cfunc = lib_importer.windll.DAQmxResetAIFreqThreshVoltage + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_freq_units(self): + """ + :class:`nidaqmx.constants.FrequencyUnits`: Specifies the units + to use to return frequency measurements from the channel. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIFreqUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return FrequencyUnits(val.value) + + @ai_freq_units.setter + def ai_freq_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIFreqUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_freq_units.deleter + def ai_freq_units(self): + cfunc = lib_importer.windll.DAQmxResetAIFreqUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_gain(self): + """ + float: Specifies a gain factor to apply to the channel. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIGain + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_gain.setter + def ai_gain(self, val): + cfunc = lib_importer.windll.DAQmxSetAIGain + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_gain.deleter + def ai_gain(self): + cfunc = lib_importer.windll.DAQmxResetAIGain + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_impedance(self): + """ + :class:`nidaqmx.constants.Impedance1`: Specifies the input + impedance of the channel. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIImpedance + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return Impedance1(val.value) + + @ai_impedance.setter + def ai_impedance(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIImpedance + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_impedance.deleter + def ai_impedance(self): + cfunc = lib_importer.windll.DAQmxResetAIImpedance + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_input_src(self): + """ + str: Specifies the source of the channel. You can use the signal + from the I/O connector or one of several calibration + signals. Certain devices have a single calibration signal + bus. For these devices, you must specify the same + calibration signal for all channels you connect to a + calibration signal. + """ + cfunc = lib_importer.windll.DAQmxGetAIInputSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ai_input_src.setter + def ai_input_src(self, val): + cfunc = lib_importer.windll.DAQmxSetAIInputSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_input_src.deleter + def ai_input_src(self): + cfunc = lib_importer.windll.DAQmxResetAIInputSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_lead_wire_resistance(self): + """ + float: Specifies in ohms the resistance of the wires that lead + to the sensor. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAILeadWireResistance + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_lead_wire_resistance.setter + def ai_lead_wire_resistance(self, val): + cfunc = lib_importer.windll.DAQmxSetAILeadWireResistance + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_lead_wire_resistance.deleter + def ai_lead_wire_resistance(self): + cfunc = lib_importer.windll.DAQmxResetAILeadWireResistance + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_lossy_lsb_removal_compressed_samp_size(self): + """ + int: Specifies the number of bits to return in a raw sample when + **ai_raw_data_compression_type** is set to + **RawDataCompressionType.LOSSY_LSB_REMOVAL**. + """ + val = ctypes.c_uint() + + cfunc = (lib_importer.windll. + DAQmxGetAILossyLSBRemovalCompressedSampSize) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_lossy_lsb_removal_compressed_samp_size.setter + def ai_lossy_lsb_removal_compressed_samp_size(self, val): + cfunc = (lib_importer.windll. + DAQmxSetAILossyLSBRemovalCompressedSampSize) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_lossy_lsb_removal_compressed_samp_size.deleter + def ai_lossy_lsb_removal_compressed_samp_size(self): + cfunc = (lib_importer.windll. + DAQmxResetAILossyLSBRemovalCompressedSampSize) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_lowpass_cutoff_freq(self): + """ + float: Specifies the frequency in Hertz that corresponds to the + -3dB cutoff of the filter. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAILowpassCutoffFreq + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_lowpass_cutoff_freq.setter + def ai_lowpass_cutoff_freq(self, val): + cfunc = lib_importer.windll.DAQmxSetAILowpassCutoffFreq + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_lowpass_cutoff_freq.deleter + def ai_lowpass_cutoff_freq(self): + cfunc = lib_importer.windll.DAQmxResetAILowpassCutoffFreq + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_lowpass_enable(self): + """ + bool: Specifies whether to enable the lowpass filter of the + channel. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetAILowpassEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_lowpass_enable.setter + def ai_lowpass_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetAILowpassEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_lowpass_enable.deleter + def ai_lowpass_enable(self): + cfunc = lib_importer.windll.DAQmxResetAILowpassEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_lowpass_switch_cap_clk_src(self): + """ + :class:`nidaqmx.constants.SourceSelection`: Specifies the source + of the filter clock. If you need a higher resolution for the + filter, you can supply an external clock to increase the + resolution. Refer to the SCXI-1141/1142/1143 User Manual for + more information. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAILowpassSwitchCapClkSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return SourceSelection(val.value) + + @ai_lowpass_switch_cap_clk_src.setter + def ai_lowpass_switch_cap_clk_src(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAILowpassSwitchCapClkSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_lowpass_switch_cap_clk_src.deleter + def ai_lowpass_switch_cap_clk_src(self): + cfunc = lib_importer.windll.DAQmxResetAILowpassSwitchCapClkSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_lowpass_switch_cap_ext_clk_div(self): + """ + int: Specifies the divisor for the external clock when you set + **ai_lowpass_switch_cap_clk_src** to + **SourceSelection.EXTERNAL**. On the SCXI-1141, SCXI-1142, + and SCXI-1143, NI-DAQmx determines the filter cutoff by + using the equation f/(100*n), where f is the external + frequency, and n is the external clock divisor. Refer to the + SCXI-1141/1142/1143 User Manual for more information. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetAILowpassSwitchCapExtClkDiv + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_lowpass_switch_cap_ext_clk_div.setter + def ai_lowpass_switch_cap_ext_clk_div(self, val): + cfunc = lib_importer.windll.DAQmxSetAILowpassSwitchCapExtClkDiv + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_lowpass_switch_cap_ext_clk_div.deleter + def ai_lowpass_switch_cap_ext_clk_div(self): + cfunc = lib_importer.windll.DAQmxResetAILowpassSwitchCapExtClkDiv + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_lowpass_switch_cap_ext_clk_freq(self): + """ + float: Specifies the frequency of the external clock when you + set **ai_lowpass_switch_cap_clk_src** to + **SourceSelection.EXTERNAL**. NI-DAQmx uses this frequency + to set the pre- and post- filters on the SCXI-1141, + SCXI-1142, and SCXI-1143. On those devices, NI-DAQmx + determines the filter cutoff by using the equation + f/(100*n), where f is the external frequency, and n is the + external clock divisor. Refer to the SCXI-1141/1142/1143 + User Manual for more information. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAILowpassSwitchCapExtClkFreq + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_lowpass_switch_cap_ext_clk_freq.setter + def ai_lowpass_switch_cap_ext_clk_freq(self, val): + cfunc = lib_importer.windll.DAQmxSetAILowpassSwitchCapExtClkFreq + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_lowpass_switch_cap_ext_clk_freq.deleter + def ai_lowpass_switch_cap_ext_clk_freq(self): + cfunc = lib_importer.windll.DAQmxResetAILowpassSwitchCapExtClkFreq + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_lowpass_switch_cap_out_clk_div(self): + """ + int: Specifies the divisor for the output clock. NI-DAQmx uses + the cutoff frequency to determine the output clock + frequency. Refer to the SCXI-1141/1142/1143 User Manual for + more information. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetAILowpassSwitchCapOutClkDiv + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_lowpass_switch_cap_out_clk_div.setter + def ai_lowpass_switch_cap_out_clk_div(self, val): + cfunc = lib_importer.windll.DAQmxSetAILowpassSwitchCapOutClkDiv + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_lowpass_switch_cap_out_clk_div.deleter + def ai_lowpass_switch_cap_out_clk_div(self): + cfunc = lib_importer.windll.DAQmxResetAILowpassSwitchCapOutClkDiv + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_max(self): + """ + float: Specifies the maximum value you expect to measure. This + value is in the units you specify with a units property. + When you query this property, it returns the coerced maximum + value that the device can measure with the current settings. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIMax + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_max.setter + def ai_max(self, val): + cfunc = lib_importer.windll.DAQmxSetAIMax + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_max.deleter + def ai_max(self): + cfunc = lib_importer.windll.DAQmxResetAIMax + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_meas_type(self): + """ + :class:`nidaqmx.constants.UsageTypeAI`: Indicates the + measurement to take with the analog input channel and in + some cases, such as for temperature measurements, the sensor + to use. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIMeasType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return UsageTypeAI(val.value) + + @property + def ai_mem_map_enable(self): + """ + bool: Specifies for NI-DAQmx to map hardware registers to the + memory space of the application, if possible. Normally, NI- + DAQmx maps hardware registers to memory accessible only to + the kernel. Mapping the registers to the memory space of the + application increases performance. However, if the + application accesses the memory space mapped to the + registers, it can adversely affect the operation of the + device and possibly result in a system crash. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetAIMemMapEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_mem_map_enable.setter + def ai_mem_map_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetAIMemMapEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_mem_map_enable.deleter + def ai_mem_map_enable(self): + cfunc = lib_importer.windll.DAQmxResetAIMemMapEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_microphone_sensitivity(self): + """ + float: Specifies the sensitivity of the microphone. This value + is in mV/Pa. Refer to the sensor documentation to determine + this value. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIMicrophoneSensitivity + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_microphone_sensitivity.setter + def ai_microphone_sensitivity(self, val): + cfunc = lib_importer.windll.DAQmxSetAIMicrophoneSensitivity + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_microphone_sensitivity.deleter + def ai_microphone_sensitivity(self): + cfunc = lib_importer.windll.DAQmxResetAIMicrophoneSensitivity + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_min(self): + """ + float: Specifies the minimum value you expect to measure. This + value is in the units you specify with a units property. + When you query this property, it returns the coerced minimum + value that the device can measure with the current settings. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIMin + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_min.setter + def ai_min(self, val): + cfunc = lib_importer.windll.DAQmxSetAIMin + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_min.deleter + def ai_min(self): + cfunc = lib_importer.windll.DAQmxResetAIMin + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_open_chan_detect_enable(self): + """ + bool: Specifies whether to enable open channel detection. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetAIOpenChanDetectEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_open_chan_detect_enable.setter + def ai_open_chan_detect_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetAIOpenChanDetectEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_open_chan_detect_enable.deleter + def ai_open_chan_detect_enable(self): + cfunc = lib_importer.windll.DAQmxResetAIOpenChanDetectEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_open_thrmcpl_detect_enable(self): + """ + bool: Specifies whether to apply the open thermocouple detection + bias voltage to the channel. Changing the value of this + property on a channel may require settling time before the + data returned is valid. To compensate for this settling + time, discard unsettled data or add a delay between + committing and starting the task. Refer to your device + specifications for the required settling time. When open + thermocouple detection is enabled, use + **open_thrmcpl_chans_exist** to determine if any channels + were open. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetAIOpenThrmcplDetectEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_open_thrmcpl_detect_enable.setter + def ai_open_thrmcpl_detect_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetAIOpenThrmcplDetectEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_open_thrmcpl_detect_enable.deleter + def ai_open_thrmcpl_detect_enable(self): + cfunc = lib_importer.windll.DAQmxResetAIOpenThrmcplDetectEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_pressure_units(self): + """ + :class:`nidaqmx.constants.PressureUnits`: Specifies in which + unit to return pressure measurements from the channel. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIPressureUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return PressureUnits(val.value) + + @ai_pressure_units.setter + def ai_pressure_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIPressureUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_pressure_units.deleter + def ai_pressure_units(self): + cfunc = lib_importer.windll.DAQmxResetAIPressureUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_probe_atten(self): + """ + float: Specifies the amount of attenuation provided by the probe + connected to the channel. Specify this attenuation as a + ratio. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIProbeAtten + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_probe_atten.setter + def ai_probe_atten(self, val): + cfunc = lib_importer.windll.DAQmxSetAIProbeAtten + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_probe_atten.deleter + def ai_probe_atten(self): + cfunc = lib_importer.windll.DAQmxResetAIProbeAtten + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_raw_data_compression_type(self): + """ + :class:`nidaqmx.constants.RawDataCompressionType`: Specifies the + type of compression to apply to raw samples returned from + the device. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIRawDataCompressionType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return RawDataCompressionType(val.value) + + @ai_raw_data_compression_type.setter + def ai_raw_data_compression_type(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIRawDataCompressionType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_raw_data_compression_type.deleter + def ai_raw_data_compression_type(self): + cfunc = lib_importer.windll.DAQmxResetAIRawDataCompressionType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_raw_samp_justification(self): + """ + :class:`nidaqmx.constants.DataJustification`: Indicates the + justification of a raw sample from the device. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIRawSampJustification + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return DataJustification(val.value) + + @property + def ai_raw_samp_size(self): + """ + int: Indicates in bits the size of a raw sample from the device. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetAIRawSampSize + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def ai_remove_filter_delay(self): + """ + bool: Specifies if filter delay removal is enabled on the + device. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetAIRemoveFilterDelay + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_remove_filter_delay.setter + def ai_remove_filter_delay(self, val): + cfunc = lib_importer.windll.DAQmxSetAIRemoveFilterDelay + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_remove_filter_delay.deleter + def ai_remove_filter_delay(self): + cfunc = lib_importer.windll.DAQmxResetAIRemoveFilterDelay + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_resistance_cfg(self): + """ + :class:`nidaqmx.constants.ResistanceConfiguration`: Specifies + the resistance configuration for the channel. NI-DAQmx uses + this value for any resistance-based measurements, including + temperature measurement using a thermistor or RTD. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIResistanceCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return ResistanceConfiguration(val.value) + + @ai_resistance_cfg.setter + def ai_resistance_cfg(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIResistanceCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_resistance_cfg.deleter + def ai_resistance_cfg(self): + cfunc = lib_importer.windll.DAQmxResetAIResistanceCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_resistance_units(self): + """ + :class:`nidaqmx.constants.ResistanceUnits`: Specifies the units + to use to return resistance measurements. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIResistanceUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return ResistanceUnits(val.value) + + @ai_resistance_units.setter + def ai_resistance_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIResistanceUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_resistance_units.deleter + def ai_resistance_units(self): + cfunc = lib_importer.windll.DAQmxResetAIResistanceUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_resolution(self): + """ + float: Indicates the resolution of the analog-to-digital + converter of the channel. This value is in the units you + specify with **ai_resolution_units**. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIResolution + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def ai_resolution_units(self): + """ + :class:`nidaqmx.constants.ResolutionType`: Indicates the units + of **ai_resolution**. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIResolutionUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return ResolutionType(val.value) + + @property + def ai_rng_high(self): + """ + float: Specifies the upper limit of the input range of the + device. This value is in the native units of the device. On + E Series devices, for example, the native units is volts. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIRngHigh + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_rng_high.setter + def ai_rng_high(self, val): + cfunc = lib_importer.windll.DAQmxSetAIRngHigh + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_rng_high.deleter + def ai_rng_high(self): + cfunc = lib_importer.windll.DAQmxResetAIRngHigh + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_rng_low(self): + """ + float: Specifies the lower limit of the input range of the + device. This value is in the native units of the device. On + E Series devices, for example, the native units is volts. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIRngLow + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_rng_low.setter + def ai_rng_low(self, val): + cfunc = lib_importer.windll.DAQmxSetAIRngLow + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_rng_low.deleter + def ai_rng_low(self): + cfunc = lib_importer.windll.DAQmxResetAIRngLow + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_rosette_strain_gage_gage_orientation(self): + """ + float: Specifies gage orientation in degrees with respect to the + X axis. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIRosetteStrainGageOrientation + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_rosette_strain_gage_gage_orientation.setter + def ai_rosette_strain_gage_gage_orientation(self, val): + cfunc = lib_importer.windll.DAQmxSetAIRosetteStrainGageOrientation + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_rosette_strain_gage_gage_orientation.deleter + def ai_rosette_strain_gage_gage_orientation(self): + cfunc = lib_importer.windll.DAQmxResetAIRosetteStrainGageOrientation + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_rosette_strain_gage_rosette_meas_type(self): + """ + :class:`nidaqmx.constants.StrainGageRosetteMeasurementType`: + Specifies the type of rosette measurement. + """ + val = ctypes.c_int() + + cfunc = (lib_importer.windll. + DAQmxGetAIRosetteStrainGageRosetteMeasType) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return StrainGageRosetteMeasurementType(val.value) + + @ai_rosette_strain_gage_rosette_meas_type.setter + def ai_rosette_strain_gage_rosette_meas_type(self, val): + val = val.value + cfunc = (lib_importer.windll. + DAQmxSetAIRosetteStrainGageRosetteMeasType) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_rosette_strain_gage_rosette_meas_type.deleter + def ai_rosette_strain_gage_rosette_meas_type(self): + cfunc = (lib_importer.windll. + DAQmxResetAIRosetteStrainGageRosetteMeasType) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_rosette_strain_gage_rosette_type(self): + """ + :class:`nidaqmx.constants.StrainGageRosetteType`: Indicates the + type of rosette gage. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIRosetteStrainGageRosetteType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return StrainGageRosetteType(val.value) + + @property + def ai_rosette_strain_gage_strain_chans(self): + """ + List[str]: Indicates the raw strain channels that comprise the + strain rosette. + """ + cfunc = lib_importer.windll.DAQmxGetAIRosetteStrainGageStrainChans + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return unflatten_channel_string(val.value.decode('ascii')) + + @property + def ai_rtd_a(self): + """ + float: Specifies the 'A' constant of the Callendar-Van Dusen + equation. NI-DAQmx requires this value when you use a custom + RTD. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIRTDA + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_rtd_a.setter + def ai_rtd_a(self, val): + cfunc = lib_importer.windll.DAQmxSetAIRTDA + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_rtd_a.deleter + def ai_rtd_a(self): + cfunc = lib_importer.windll.DAQmxResetAIRTDA + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_rtd_b(self): + """ + float: Specifies the 'B' constant of the Callendar-Van Dusen + equation. NI-DAQmx requires this value when you use a custom + RTD. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIRTDB + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_rtd_b.setter + def ai_rtd_b(self, val): + cfunc = lib_importer.windll.DAQmxSetAIRTDB + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_rtd_b.deleter + def ai_rtd_b(self): + cfunc = lib_importer.windll.DAQmxResetAIRTDB + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_rtd_c(self): + """ + float: Specifies the 'C' constant of the Callendar-Van Dusen + equation. NI-DAQmx requires this value when you use a custom + RTD. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIRTDC + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_rtd_c.setter + def ai_rtd_c(self, val): + cfunc = lib_importer.windll.DAQmxSetAIRTDC + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_rtd_c.deleter + def ai_rtd_c(self): + cfunc = lib_importer.windll.DAQmxResetAIRTDC + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_rtd_r_0(self): + """ + float: Specifies in ohms the sensor resistance at 0 deg C. The + Callendar-Van Dusen equation requires this value. Refer to + the sensor documentation to determine this value. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIRTDR0 + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_rtd_r_0.setter + def ai_rtd_r_0(self, val): + cfunc = lib_importer.windll.DAQmxSetAIRTDR0 + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_rtd_r_0.deleter + def ai_rtd_r_0(self): + cfunc = lib_importer.windll.DAQmxResetAIRTDR0 + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_rtd_type(self): + """ + :class:`nidaqmx.constants.RTDType`: Specifies the type of RTD + connected to the channel. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIRTDType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return RTDType(val.value) + + @ai_rtd_type.setter + def ai_rtd_type(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIRTDType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_rtd_type.deleter + def ai_rtd_type(self): + cfunc = lib_importer.windll.DAQmxResetAIRTDType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_samp_and_hold_enable(self): + """ + bool: Specifies whether to enable the sample and hold circuitry + of the device. When you disable sample and hold circuitry, a + small voltage offset might be introduced into the signal. + You can eliminate this offset by using **ai_auto_zero_mode** + to perform an auto zero on the channel. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetAISampAndHoldEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_samp_and_hold_enable.setter + def ai_samp_and_hold_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetAISampAndHoldEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_samp_and_hold_enable.deleter + def ai_samp_and_hold_enable(self): + cfunc = lib_importer.windll.DAQmxResetAISampAndHoldEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_sound_pressure_max_sound_pressure_lvl(self): + """ + float: Specifies the maximum instantaneous sound pressure level + you expect to measure. This value is in decibels, referenced + to 20 micropascals. NI-DAQmx uses the maximum sound pressure + level to calculate values in pascals for **ai_max** and + **ai_min** for the channel. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIMaxSoundPressureLvl + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_sound_pressure_max_sound_pressure_lvl.setter + def ai_sound_pressure_max_sound_pressure_lvl(self, val): + cfunc = lib_importer.windll.DAQmxSetAIMaxSoundPressureLvl + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_sound_pressure_max_sound_pressure_lvl.deleter + def ai_sound_pressure_max_sound_pressure_lvl(self): + cfunc = lib_importer.windll.DAQmxResetAIMaxSoundPressureLvl + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_sound_pressure_units(self): + """ + :class:`nidaqmx.constants.SoundPressureUnits`: Specifies the + units to use to return sound pressure measurements from the + channel. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAISoundPressureUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return SoundPressureUnits(val.value) + + @ai_sound_pressure_units.setter + def ai_sound_pressure_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAISoundPressureUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_sound_pressure_units.deleter + def ai_sound_pressure_units(self): + cfunc = lib_importer.windll.DAQmxResetAISoundPressureUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_sound_pressured_b_ref(self): + """ + float: Specifies the decibel reference level in the units of the + channel. When you read samples as a waveform, the decibel + reference level is included in the waveform attributes. NI- + DAQmx also uses the decibel reference level when converting + **ai_sound_pressure_max_sound_pressure_lvl** to a voltage + level. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAISoundPressuredBRef + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_sound_pressured_b_ref.setter + def ai_sound_pressured_b_ref(self, val): + cfunc = lib_importer.windll.DAQmxSetAISoundPressuredBRef + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_sound_pressured_b_ref.deleter + def ai_sound_pressured_b_ref(self): + cfunc = lib_importer.windll.DAQmxResetAISoundPressuredBRef + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_strain_force_read_from_chan(self): + """ + bool: Specifies whether the data is returned by DAQmx Read when + set on a raw strain channel that is part of a rosette + configuration. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetAIStrainGageForceReadFromChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_strain_force_read_from_chan.setter + def ai_strain_force_read_from_chan(self, val): + cfunc = lib_importer.windll.DAQmxSetAIStrainGageForceReadFromChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_strain_force_read_from_chan.deleter + def ai_strain_force_read_from_chan(self): + cfunc = lib_importer.windll.DAQmxResetAIStrainGageForceReadFromChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_strain_gage_cfg(self): + """ + :class:`nidaqmx.constants.StrainGageBridgeType`: Specifies the + bridge configuration of the strain gages. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIStrainGageCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return StrainGageBridgeType(val.value) + + @ai_strain_gage_cfg.setter + def ai_strain_gage_cfg(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIStrainGageCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_strain_gage_cfg.deleter + def ai_strain_gage_cfg(self): + cfunc = lib_importer.windll.DAQmxResetAIStrainGageCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_strain_gage_gage_factor(self): + """ + float: Specifies the sensitivity of the strain gage. Gage + factor relates the change in electrical resistance to the + change in strain. Refer to the sensor documentation for this + value. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIStrainGageGageFactor + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_strain_gage_gage_factor.setter + def ai_strain_gage_gage_factor(self, val): + cfunc = lib_importer.windll.DAQmxSetAIStrainGageGageFactor + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_strain_gage_gage_factor.deleter + def ai_strain_gage_gage_factor(self): + cfunc = lib_importer.windll.DAQmxResetAIStrainGageGageFactor + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_strain_gage_poisson_ratio(self): + """ + float: Specifies the ratio of lateral strain to axial strain in + the material you are measuring. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIStrainGagePoissonRatio + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_strain_gage_poisson_ratio.setter + def ai_strain_gage_poisson_ratio(self, val): + cfunc = lib_importer.windll.DAQmxSetAIStrainGagePoissonRatio + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_strain_gage_poisson_ratio.deleter + def ai_strain_gage_poisson_ratio(self): + cfunc = lib_importer.windll.DAQmxResetAIStrainGagePoissonRatio + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_strain_units(self): + """ + :class:`nidaqmx.constants.StrainUnits`: Specifies the units to + use to return strain measurements from the channel. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIStrainUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return StrainUnits(val.value) + + @ai_strain_units.setter + def ai_strain_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIStrainUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_strain_units.deleter + def ai_strain_units(self): + cfunc = lib_importer.windll.DAQmxResetAIStrainUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_teds_is_teds(self): + """ + bool: Indicates if the virtual channel was initialized using a + TEDS bitstream from the corresponding physical channel. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetAIIsTEDS + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def ai_teds_units(self): + """ + str: Indicates the units defined by TEDS information associated + with the channel. + """ + cfunc = lib_importer.windll.DAQmxGetAITEDSUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @property + def ai_temp_units(self): + """ + :class:`nidaqmx.constants.TemperatureUnits`: Specifies the units + to use to return temperature measurements from the channel. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAITempUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return TemperatureUnits(val.value) + + @ai_temp_units.setter + def ai_temp_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAITempUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_temp_units.deleter + def ai_temp_units(self): + cfunc = lib_importer.windll.DAQmxResetAITempUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_term_cfg(self): + """ + :class:`nidaqmx.constants.TerminalConfiguration`: Specifies the + terminal configuration for the channel. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAITermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return TerminalConfiguration(val.value) + + @ai_term_cfg.setter + def ai_term_cfg(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAITermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_term_cfg.deleter + def ai_term_cfg(self): + cfunc = lib_importer.windll.DAQmxResetAITermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_thrmcpl_cjc_chan(self): + """ + :class:`nidaqmx._task_modules.channels.channel.Channel`: + Indicates the channel that acquires the temperature of the + cold junction if **ai_thrmcpl_cjc_src** is + **CJCSource1.SCANNABLE_CHANNEL**. If the channel is a + temperature channel, NI-DAQmx acquires the temperature in + the correct units. Other channel types, such as a resistance + channel with a custom sensor, must use a custom scale to + scale values to degrees Celsius. + """ + cfunc = lib_importer.windll.DAQmxGetAIThrmcplCJCChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return Channel._factory(self._handle, val.value.decode('ascii')) + + @property + def ai_thrmcpl_cjc_src(self): + """ + :class:`nidaqmx.constants.CJCSource`: Indicates the source of + cold-junction compensation. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIThrmcplCJCSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return CJCSource(val.value) + + @property + def ai_thrmcpl_cjc_val(self): + """ + float: Specifies the temperature of the cold junction if + **ai_thrmcpl_cjc_src** is + **CJCSource1.CONSTANT_USER_VALUE**. Specify this value in + the units of the measurement. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIThrmcplCJCVal + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_thrmcpl_cjc_val.setter + def ai_thrmcpl_cjc_val(self, val): + cfunc = lib_importer.windll.DAQmxSetAIThrmcplCJCVal + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_thrmcpl_cjc_val.deleter + def ai_thrmcpl_cjc_val(self): + cfunc = lib_importer.windll.DAQmxResetAIThrmcplCJCVal + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_thrmcpl_lead_offset_voltage(self): + """ + float: Specifies the lead offset nulling voltage to subtract + from measurements on a device. This property is ignored if + open thermocouple detection is disabled. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIThrmcplLeadOffsetVoltage + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_thrmcpl_lead_offset_voltage.setter + def ai_thrmcpl_lead_offset_voltage(self, val): + cfunc = lib_importer.windll.DAQmxSetAIThrmcplLeadOffsetVoltage + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_thrmcpl_lead_offset_voltage.deleter + def ai_thrmcpl_lead_offset_voltage(self): + cfunc = lib_importer.windll.DAQmxResetAIThrmcplLeadOffsetVoltage + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_thrmcpl_scale_type(self): + """ + :class:`nidaqmx.constants.ScaleType`: Specifies the method or + equation form that the thermocouple scale uses. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIThrmcplScaleType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return ScaleType(val.value) + + @ai_thrmcpl_scale_type.setter + def ai_thrmcpl_scale_type(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIThrmcplScaleType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_thrmcpl_scale_type.deleter + def ai_thrmcpl_scale_type(self): + cfunc = lib_importer.windll.DAQmxResetAIThrmcplScaleType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_thrmcpl_type(self): + """ + :class:`nidaqmx.constants.ThermocoupleType`: Specifies the type + of thermocouple connected to the channel. Thermocouple types + differ in composition and measurement range. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIThrmcplType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return ThermocoupleType(val.value) + + @ai_thrmcpl_type.setter + def ai_thrmcpl_type(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIThrmcplType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_thrmcpl_type.deleter + def ai_thrmcpl_type(self): + cfunc = lib_importer.windll.DAQmxResetAIThrmcplType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_thrmstr_a(self): + """ + float: Specifies the 'A' constant of the Steinhart-Hart + thermistor equation. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIThrmstrA + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_thrmstr_a.setter + def ai_thrmstr_a(self, val): + cfunc = lib_importer.windll.DAQmxSetAIThrmstrA + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_thrmstr_a.deleter + def ai_thrmstr_a(self): + cfunc = lib_importer.windll.DAQmxResetAIThrmstrA + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_thrmstr_b(self): + """ + float: Specifies the 'B' constant of the Steinhart-Hart + thermistor equation. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIThrmstrB + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_thrmstr_b.setter + def ai_thrmstr_b(self, val): + cfunc = lib_importer.windll.DAQmxSetAIThrmstrB + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_thrmstr_b.deleter + def ai_thrmstr_b(self): + cfunc = lib_importer.windll.DAQmxResetAIThrmstrB + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_thrmstr_c(self): + """ + float: Specifies the 'C' constant of the Steinhart-Hart + thermistor equation. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIThrmstrC + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_thrmstr_c.setter + def ai_thrmstr_c(self, val): + cfunc = lib_importer.windll.DAQmxSetAIThrmstrC + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_thrmstr_c.deleter + def ai_thrmstr_c(self): + cfunc = lib_importer.windll.DAQmxResetAIThrmstrC + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_thrmstr_r_1(self): + """ + float: Specifies in ohms the value of the reference resistor for + the thermistor if you use voltage excitation. NI-DAQmx + ignores this value for current excitation. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIThrmstrR1 + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_thrmstr_r_1.setter + def ai_thrmstr_r_1(self, val): + cfunc = lib_importer.windll.DAQmxSetAIThrmstrR1 + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_thrmstr_r_1.deleter + def ai_thrmstr_r_1(self): + cfunc = lib_importer.windll.DAQmxResetAIThrmstrR1 + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_torque_units(self): + """ + :class:`nidaqmx.constants.TorqueUnits`: Specifies in which unit + to return torque measurements from the channel. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAITorqueUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return TorqueUnits(val.value) + + @ai_torque_units.setter + def ai_torque_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAITorqueUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_torque_units.deleter + def ai_torque_units(self): + cfunc = lib_importer.windll.DAQmxResetAITorqueUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_usb_xfer_req_count(self): + """ + int: Specifies the maximum number of simultaneous USB transfers + used to stream data. Modify this value to affect performance + under different combinations of operating system and device. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetAIUsbXferReqCount + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_usb_xfer_req_count.setter + def ai_usb_xfer_req_count(self, val): + cfunc = lib_importer.windll.DAQmxSetAIUsbXferReqCount + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_usb_xfer_req_count.deleter + def ai_usb_xfer_req_count(self): + cfunc = lib_importer.windll.DAQmxResetAIUsbXferReqCount + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_usb_xfer_req_size(self): + """ + int: Specifies the maximum size of a USB transfer request in + bytes. Modify this value to affect performance under + different combinations of operating system and device. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetAIUsbXferReqSize + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_usb_xfer_req_size.setter + def ai_usb_xfer_req_size(self, val): + cfunc = lib_importer.windll.DAQmxSetAIUsbXferReqSize + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_usb_xfer_req_size.deleter + def ai_usb_xfer_req_size(self): + cfunc = lib_importer.windll.DAQmxResetAIUsbXferReqSize + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_velocity_iepe_sensor_sensitivity(self): + """ + float: Specifies the sensitivity of the IEPE velocity sensor + connected to the channel. Specify this value in the unit + indicated by **ai_velocity_iepe_sensor_sensitivity_units**. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIVelocityIEPESensorSensitivity + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_velocity_iepe_sensor_sensitivity.setter + def ai_velocity_iepe_sensor_sensitivity(self, val): + cfunc = lib_importer.windll.DAQmxSetAIVelocityIEPESensorSensitivity + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_velocity_iepe_sensor_sensitivity.deleter + def ai_velocity_iepe_sensor_sensitivity(self): + cfunc = lib_importer.windll.DAQmxResetAIVelocityIEPESensorSensitivity + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_velocity_iepe_sensor_sensitivity_units(self): + """ + :class:`nidaqmx.constants.VelocityIEPESensorSensitivityUnits`: + Specifies the units for + **ai_velocity_iepe_sensor_sensitivity**. + """ + val = ctypes.c_int() + + cfunc = (lib_importer.windll. + DAQmxGetAIVelocityIEPESensorSensitivityUnits) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return VelocityIEPESensorSensitivityUnits(val.value) + + @ai_velocity_iepe_sensor_sensitivity_units.setter + def ai_velocity_iepe_sensor_sensitivity_units(self, val): + val = val.value + cfunc = (lib_importer.windll. + DAQmxSetAIVelocityIEPESensorSensitivityUnits) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_velocity_iepe_sensor_sensitivity_units.deleter + def ai_velocity_iepe_sensor_sensitivity_units(self): + cfunc = (lib_importer.windll. + DAQmxResetAIVelocityIEPESensorSensitivityUnits) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_velocity_iepe_sensord_b_ref(self): + """ + float: Specifies the decibel reference level in the units of the + channel. When you read samples as a waveform, the decibel + reference level is included in the waveform attributes. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIVelocityIEPESensordBRef + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_velocity_iepe_sensord_b_ref.setter + def ai_velocity_iepe_sensord_b_ref(self, val): + cfunc = lib_importer.windll.DAQmxSetAIVelocityIEPESensordBRef + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_velocity_iepe_sensord_b_ref.deleter + def ai_velocity_iepe_sensord_b_ref(self): + cfunc = lib_importer.windll.DAQmxResetAIVelocityIEPESensordBRef + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_velocity_units(self): + """ + :class:`nidaqmx.constants.VelocityUnits`: Specifies in which + unit to return velocity measurements from the channel. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIVelocityUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return VelocityUnits(val.value) + + @ai_velocity_units.setter + def ai_velocity_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIVelocityUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_velocity_units.deleter + def ai_velocity_units(self): + cfunc = lib_importer.windll.DAQmxResetAIVelocityUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_voltage_acrms_units(self): + """ + :class:`nidaqmx.constants.VoltageUnits`: Specifies the units to + use to return voltage RMS measurements from the channel. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIVoltageACRMSUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return VoltageUnits(val.value) + + @ai_voltage_acrms_units.setter + def ai_voltage_acrms_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIVoltageACRMSUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_voltage_acrms_units.deleter + def ai_voltage_acrms_units(self): + cfunc = lib_importer.windll.DAQmxResetAIVoltageACRMSUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_voltage_units(self): + """ + :class:`nidaqmx.constants.VoltageUnits`: Specifies the units to + use to return voltage measurements from the channel. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIVoltageUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return VoltageUnits(val.value) + + @ai_voltage_units.setter + def ai_voltage_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIVoltageUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_voltage_units.deleter + def ai_voltage_units(self): + cfunc = lib_importer.windll.DAQmxResetAIVoltageUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ai_voltaged_b_ref(self): + """ + float: Specifies the decibel reference level in the units of the + channel. When you read samples as a waveform, the decibel + reference level is included in the waveform attributes. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIVoltagedBRef + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_voltaged_b_ref.setter + def ai_voltaged_b_ref(self, val): + cfunc = lib_importer.windll.DAQmxSetAIVoltagedBRef + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ai_voltaged_b_ref.deleter + def ai_voltaged_b_ref(self): + cfunc = lib_importer.windll.DAQmxResetAIVoltagedBRef + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def aiadc_custom_timing_mode(self): + """ + int: Specifies the timing mode of the ADC when + **aiadc_timing_mode** is **ADCTimingMode.CUSTOM**. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetAIADCCustomTimingMode + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @aiadc_custom_timing_mode.setter + def aiadc_custom_timing_mode(self, val): + cfunc = lib_importer.windll.DAQmxSetAIADCCustomTimingMode + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @aiadc_custom_timing_mode.deleter + def aiadc_custom_timing_mode(self): + cfunc = lib_importer.windll.DAQmxResetAIADCCustomTimingMode + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def aiadc_timing_mode(self): + """ + :class:`nidaqmx.constants.ADCTimingMode`: Specifies the ADC + timing mode, controlling the tradeoff between speed and + effective resolution. Some ADC timing modes provide + increased powerline noise rejection. On devices that have an + AI Convert clock, this setting affects both the maximum and + default values for **ai_conv_rate**. You must use the same + ADC timing mode for all channels on a device, but you can + use different ADC timing modes for different devices in the + same task. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIADCTimingMode + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return ADCTimingMode(val.value) + + @aiadc_timing_mode.setter + def aiadc_timing_mode(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIADCTimingMode + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @aiadc_timing_mode.deleter + def aiadc_timing_mode(self): + cfunc = lib_importer.windll.DAQmxResetAIADCTimingMode + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def aidc_offset(self): + """ + float: Specifies the DC value to add to the input range of the + device. Use **ai_rng_high** and **ai_rng_low** to specify + the input range. This offset is in the native units of the + device . + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIDCOffset + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @aidc_offset.setter + def aidc_offset(self, val): + cfunc = lib_importer.windll.DAQmxSetAIDCOffset + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @aidc_offset.deleter + def aidc_offset(self): + cfunc = lib_importer.windll.DAQmxResetAIDCOffset + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ailvdt_sensitivity(self): + """ + float: Specifies the sensitivity of the LVDT. This value is in + the units you specify with **ailvdt_sensitivity_units**. + Refer to the sensor documentation to determine this value. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAILVDTSensitivity + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ailvdt_sensitivity.setter + def ailvdt_sensitivity(self, val): + cfunc = lib_importer.windll.DAQmxSetAILVDTSensitivity + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ailvdt_sensitivity.deleter + def ailvdt_sensitivity(self): + cfunc = lib_importer.windll.DAQmxResetAILVDTSensitivity + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ailvdt_sensitivity_units(self): + """ + :class:`nidaqmx.constants.LVDTSensitivityUnits`: Specifies the + units of **ailvdt_sensitivity**. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAILVDTSensitivityUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return LVDTSensitivityUnits(val.value) + + @ailvdt_sensitivity_units.setter + def ailvdt_sensitivity_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAILVDTSensitivityUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ailvdt_sensitivity_units.deleter + def ailvdt_sensitivity_units(self): + cfunc = lib_importer.windll.DAQmxResetAILVDTSensitivityUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ailvdt_units(self): + """ + :class:`nidaqmx.constants.LengthUnits`: Specifies the units to + use to return linear position measurements from the channel. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAILVDTUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return LengthUnits(val.value) + + @ailvdt_units.setter + def ailvdt_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAILVDTUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ailvdt_units.deleter + def ailvdt_units(self): + cfunc = lib_importer.windll.DAQmxResetAILVDTUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def airvdt_sensitivity(self): + """ + float: Specifies the sensitivity of the RVDT. This value is in + the units you specify with **airvdt_sensitivity_units**. + Refer to the sensor documentation to determine this value. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIRVDTSensitivity + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @airvdt_sensitivity.setter + def airvdt_sensitivity(self, val): + cfunc = lib_importer.windll.DAQmxSetAIRVDTSensitivity + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @airvdt_sensitivity.deleter + def airvdt_sensitivity(self): + cfunc = lib_importer.windll.DAQmxResetAIRVDTSensitivity + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def airvdt_sensitivity_units(self): + """ + :class:`nidaqmx.constants.RVDTSensitivityUnits`: Specifies the + units of **airvdt_sensitivity**. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIRVDTSensitivityUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return RVDTSensitivityUnits(val.value) + + @airvdt_sensitivity_units.setter + def airvdt_sensitivity_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIRVDTSensitivityUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @airvdt_sensitivity_units.deleter + def airvdt_sensitivity_units(self): + cfunc = lib_importer.windll.DAQmxResetAIRVDTSensitivityUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def airvdt_units(self): + """ + :class:`nidaqmx.constants.AngleUnits`: Specifies the units to + use to return angular position measurements from the + channel. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIRVDTUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return AngleUnits(val.value) + + @airvdt_units.setter + def airvdt_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIRVDTUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @airvdt_units.deleter + def airvdt_units(self): + cfunc = lib_importer.windll.DAQmxResetAIRVDTUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + diff --git a/nidaqmx/_task_modules/channels/ao_channel.py b/nidaqmx/_task_modules/channels/ao_channel.py new file mode 100644 index 00000000..6780290d --- /dev/null +++ b/nidaqmx/_task_modules/channels/ao_channel.py @@ -0,0 +1,1768 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import ctypes +import numpy + +from nidaqmx._lib import lib_importer, wrapped_ndpointer, ctypes_byte_str +from nidaqmx.scale import Scale +from nidaqmx.errors import ( + check_for_error, is_string_buffer_too_small, is_array_buffer_too_small) +from nidaqmx._task_modules.channels.channel import Channel +from nidaqmx.constants import ( + AOIdleOutputBehavior, CurrentUnits, DataTransferActiveTransferMode, + DigitalWidthUnits, FuncGenType, ModulationType, + OutputDataTransferCondition, ResolutionType, SourceSelection, + TerminalConfiguration, UsageTypeAO, VoltageUnits) + + +class AOChannel(Channel): + """ + Represents one or more analog output virtual channels and their properties. + """ + __slots__ = [] + + def __repr__(self): + return 'AOChannel(name={0})'.format(self._name) + + @property + def ao_current_units(self): + """ + :class:`nidaqmx.constants.CurrentUnits`: Specifies in what units + to generate current on the channel. Write data to the + channel in the units you select. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAOCurrentUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return CurrentUnits(val.value) + + @ao_current_units.setter + def ao_current_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAOCurrentUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ao_current_units.deleter + def ao_current_units(self): + cfunc = lib_importer.windll.DAQmxResetAOCurrentUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ao_custom_scale(self): + """ + :class:`nidaqmx.system.scale.Scale`: Specifies the name of a + custom scale for the channel. + """ + cfunc = lib_importer.windll.DAQmxGetAOCustomScaleName + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return Scale(val.value.decode('ascii')) + + @ao_custom_scale.setter + def ao_custom_scale(self, val): + val = val.name + cfunc = lib_importer.windll.DAQmxSetAOCustomScaleName + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ao_custom_scale.deleter + def ao_custom_scale(self): + cfunc = lib_importer.windll.DAQmxResetAOCustomScaleName + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ao_dac_offset_ext_src(self): + """ + str: Specifies the source of the DAC offset voltage if + **ao_dac_offset_src** is **SourceSelection.EXTERNAL**. The + valid sources for this signal vary by device. + """ + cfunc = lib_importer.windll.DAQmxGetAODACOffsetExtSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ao_dac_offset_ext_src.setter + def ao_dac_offset_ext_src(self, val): + cfunc = lib_importer.windll.DAQmxSetAODACOffsetExtSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ao_dac_offset_ext_src.deleter + def ao_dac_offset_ext_src(self): + cfunc = lib_importer.windll.DAQmxResetAODACOffsetExtSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ao_dac_offset_src(self): + """ + :class:`nidaqmx.constants.SourceSelection`: Specifies the source + of the DAC offset voltage. The value of this voltage source + determines the full-scale value of the DAC. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAODACOffsetSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return SourceSelection(val.value) + + @ao_dac_offset_src.setter + def ao_dac_offset_src(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAODACOffsetSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ao_dac_offset_src.deleter + def ao_dac_offset_src(self): + cfunc = lib_importer.windll.DAQmxResetAODACOffsetSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ao_dac_offset_val(self): + """ + float: Specifies in volts the value of the DAC offset voltage. + To achieve best accuracy, the DAC offset value should be + hand calibrated. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAODACOffsetVal + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ao_dac_offset_val.setter + def ao_dac_offset_val(self, val): + cfunc = lib_importer.windll.DAQmxSetAODACOffsetVal + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ao_dac_offset_val.deleter + def ao_dac_offset_val(self): + cfunc = lib_importer.windll.DAQmxResetAODACOffsetVal + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ao_dac_ref_allow_conn_to_gnd(self): + """ + bool: Specifies whether to allow grounding the internal DAC + reference at run time. You must set this property to True + and set **ao_dac_ref_src** to **SourceSelection.INTERNAL** + before you can set **ao_dac_ref_conn_to_gnd** to True. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetAODACRefAllowConnToGnd + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ao_dac_ref_allow_conn_to_gnd.setter + def ao_dac_ref_allow_conn_to_gnd(self, val): + cfunc = lib_importer.windll.DAQmxSetAODACRefAllowConnToGnd + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ao_dac_ref_allow_conn_to_gnd.deleter + def ao_dac_ref_allow_conn_to_gnd(self): + cfunc = lib_importer.windll.DAQmxResetAODACRefAllowConnToGnd + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ao_dac_ref_conn_to_gnd(self): + """ + bool: Specifies whether to ground the internal DAC reference. + Grounding the internal DAC reference has the effect of + grounding all analog output channels and stopping waveform + generation across all analog output channels regardless of + whether the channels belong to the current task. You can + ground the internal DAC reference only when + **ao_dac_ref_src** is **SourceSelection.INTERNAL** and + **ao_dac_ref_allow_conn_to_gnd** is True. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetAODACRefConnToGnd + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ao_dac_ref_conn_to_gnd.setter + def ao_dac_ref_conn_to_gnd(self, val): + cfunc = lib_importer.windll.DAQmxSetAODACRefConnToGnd + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ao_dac_ref_conn_to_gnd.deleter + def ao_dac_ref_conn_to_gnd(self): + cfunc = lib_importer.windll.DAQmxResetAODACRefConnToGnd + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ao_dac_ref_ext_src(self): + """ + str: Specifies the source of the DAC reference voltage if + **ao_dac_ref_src** is **SourceSelection.EXTERNAL**. The + valid sources for this signal vary by device. + """ + cfunc = lib_importer.windll.DAQmxGetAODACRefExtSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ao_dac_ref_ext_src.setter + def ao_dac_ref_ext_src(self, val): + cfunc = lib_importer.windll.DAQmxSetAODACRefExtSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ao_dac_ref_ext_src.deleter + def ao_dac_ref_ext_src(self): + cfunc = lib_importer.windll.DAQmxResetAODACRefExtSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ao_dac_ref_src(self): + """ + :class:`nidaqmx.constants.SourceSelection`: Specifies the source + of the DAC reference voltage. The value of this voltage + source determines the full-scale value of the DAC. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAODACRefSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return SourceSelection(val.value) + + @ao_dac_ref_src.setter + def ao_dac_ref_src(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAODACRefSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ao_dac_ref_src.deleter + def ao_dac_ref_src(self): + cfunc = lib_importer.windll.DAQmxResetAODACRefSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ao_dac_ref_val(self): + """ + float: Specifies in volts the value of the DAC reference + voltage. This voltage determines the full-scale range of the + DAC. Smaller reference voltages result in smaller ranges, + but increased resolution. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAODACRefVal + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ao_dac_ref_val.setter + def ao_dac_ref_val(self, val): + cfunc = lib_importer.windll.DAQmxSetAODACRefVal + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ao_dac_ref_val.deleter + def ao_dac_ref_val(self): + cfunc = lib_importer.windll.DAQmxResetAODACRefVal + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ao_dac_rng_high(self): + """ + float: Specifies the upper limit of the output range of the + device. This value is in the native units of the device. On + E Series devices, for example, the native units is volts. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAODACRngHigh + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ao_dac_rng_high.setter + def ao_dac_rng_high(self, val): + cfunc = lib_importer.windll.DAQmxSetAODACRngHigh + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ao_dac_rng_high.deleter + def ao_dac_rng_high(self): + cfunc = lib_importer.windll.DAQmxResetAODACRngHigh + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ao_dac_rng_low(self): + """ + float: Specifies the lower limit of the output range of the + device. This value is in the native units of the device. On + E Series devices, for example, the native units is volts. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAODACRngLow + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ao_dac_rng_low.setter + def ao_dac_rng_low(self, val): + cfunc = lib_importer.windll.DAQmxSetAODACRngLow + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ao_dac_rng_low.deleter + def ao_dac_rng_low(self): + cfunc = lib_importer.windll.DAQmxResetAODACRngLow + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ao_data_xfer_mech(self): + """ + :class:`nidaqmx.constants.DataTransferActiveTransferMode`: + Specifies the data transfer mode for the device. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAODataXferMech + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return DataTransferActiveTransferMode(val.value) + + @ao_data_xfer_mech.setter + def ao_data_xfer_mech(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAODataXferMech + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ao_data_xfer_mech.deleter + def ao_data_xfer_mech(self): + cfunc = lib_importer.windll.DAQmxResetAODataXferMech + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ao_data_xfer_req_cond(self): + """ + :class:`nidaqmx.constants.OutputDataTransferCondition`: + Specifies under what condition to transfer data from the + buffer to the onboard memory of the device. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAODataXferReqCond + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return OutputDataTransferCondition(val.value) + + @ao_data_xfer_req_cond.setter + def ao_data_xfer_req_cond(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAODataXferReqCond + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ao_data_xfer_req_cond.deleter + def ao_data_xfer_req_cond(self): + cfunc = lib_importer.windll.DAQmxResetAODataXferReqCond + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ao_dev_scaling_coeff(self): + """ + List[float]: Indicates the coefficients of a linear equation + that NI-DAQmx uses to scale values from a voltage to the + native format of the device. Each element of the list + corresponds to a term of the equation. The first element of + the list corresponds to the y-intercept, and the second + element corresponds to the slope. Scaling coefficients do + not account for any custom scales that may be applied to the + channel. + """ + cfunc = lib_importer.windll.DAQmxGetAODevScalingCoeff + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + wrapped_ndpointer(dtype=numpy.float64, flags=('C','W')), + ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.float64) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.tolist() + + @property + def ao_enhanced_image_rejection_enable(self): + """ + bool: Specifies whether to enable the DAC interpolation filter. + Disable the interpolation filter to improve DAC signal-to- + noise ratio at the expense of degraded image rejection. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetAOEnhancedImageRejectionEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ao_enhanced_image_rejection_enable.setter + def ao_enhanced_image_rejection_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetAOEnhancedImageRejectionEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ao_enhanced_image_rejection_enable.deleter + def ao_enhanced_image_rejection_enable(self): + cfunc = lib_importer.windll.DAQmxResetAOEnhancedImageRejectionEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ao_filter_delay(self): + """ + float: Specifies the amount of time between when the sample is + written by the host device and when the sample is output by + the DAC. This value is in the units you specify with + **ao_filter_delay_units**. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAOFilterDelay + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ao_filter_delay.setter + def ao_filter_delay(self, val): + cfunc = lib_importer.windll.DAQmxSetAOFilterDelay + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ao_filter_delay.deleter + def ao_filter_delay(self): + cfunc = lib_importer.windll.DAQmxResetAOFilterDelay + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ao_filter_delay_adjustment(self): + """ + float: Specifies an additional amount of time to wait between + when the sample is written by the host device and when the + sample is output by the DAC. This delay adjustment is in + addition to the value indicated by **ao_filter_delay**. This + delay adjustment is in the units you specify with + **ao_filter_delay_units**. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAOFilterDelayAdjustment + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ao_filter_delay_adjustment.setter + def ao_filter_delay_adjustment(self, val): + cfunc = lib_importer.windll.DAQmxSetAOFilterDelayAdjustment + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ao_filter_delay_adjustment.deleter + def ao_filter_delay_adjustment(self): + cfunc = lib_importer.windll.DAQmxResetAOFilterDelayAdjustment + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ao_filter_delay_units(self): + """ + :class:`nidaqmx.constants.DigitalWidthUnits`: Specifies the + units of **ao_filter_delay** and + **ao_filter_delay_adjustment**. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAOFilterDelayUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return DigitalWidthUnits(val.value) + + @ao_filter_delay_units.setter + def ao_filter_delay_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAOFilterDelayUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ao_filter_delay_units.deleter + def ao_filter_delay_units(self): + cfunc = lib_importer.windll.DAQmxResetAOFilterDelayUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ao_func_gen_amplitude(self): + """ + float: Specifies the zero-to-peak amplitude of the waveform to + generate in volts. Zero and negative values are valid. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAOFuncGenAmplitude + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ao_func_gen_amplitude.setter + def ao_func_gen_amplitude(self, val): + cfunc = lib_importer.windll.DAQmxSetAOFuncGenAmplitude + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ao_func_gen_amplitude.deleter + def ao_func_gen_amplitude(self): + cfunc = lib_importer.windll.DAQmxResetAOFuncGenAmplitude + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ao_func_gen_fm_deviation(self): + """ + float: Specifies the FM deviation in hertz per volt when + **ao_func_gen_modulation_type** is **ModulationType.FM**. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAOFuncGenFMDeviation + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ao_func_gen_fm_deviation.setter + def ao_func_gen_fm_deviation(self, val): + cfunc = lib_importer.windll.DAQmxSetAOFuncGenFMDeviation + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ao_func_gen_fm_deviation.deleter + def ao_func_gen_fm_deviation(self): + cfunc = lib_importer.windll.DAQmxResetAOFuncGenFMDeviation + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ao_func_gen_freq(self): + """ + float: Specifies the frequency of the waveform to generate in + hertz. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAOFuncGenFreq + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ao_func_gen_freq.setter + def ao_func_gen_freq(self, val): + cfunc = lib_importer.windll.DAQmxSetAOFuncGenFreq + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ao_func_gen_freq.deleter + def ao_func_gen_freq(self): + cfunc = lib_importer.windll.DAQmxResetAOFuncGenFreq + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ao_func_gen_modulation_type(self): + """ + :class:`nidaqmx.constants.ModulationType`: Specifies if the + device generates a modulated version of the waveform using + the original waveform as a carrier and input from an + external terminal as the signal. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAOFuncGenModulationType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return ModulationType(val.value) + + @ao_func_gen_modulation_type.setter + def ao_func_gen_modulation_type(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAOFuncGenModulationType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ao_func_gen_modulation_type.deleter + def ao_func_gen_modulation_type(self): + cfunc = lib_importer.windll.DAQmxResetAOFuncGenModulationType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ao_func_gen_offset(self): + """ + float: Specifies the voltage offset of the waveform to generate. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAOFuncGenOffset + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ao_func_gen_offset.setter + def ao_func_gen_offset(self, val): + cfunc = lib_importer.windll.DAQmxSetAOFuncGenOffset + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ao_func_gen_offset.deleter + def ao_func_gen_offset(self): + cfunc = lib_importer.windll.DAQmxResetAOFuncGenOffset + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ao_func_gen_square_duty_cycle(self): + """ + float: Specifies the square wave duty cycle of the waveform to + generate. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAOFuncGenSquareDutyCycle + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ao_func_gen_square_duty_cycle.setter + def ao_func_gen_square_duty_cycle(self, val): + cfunc = lib_importer.windll.DAQmxSetAOFuncGenSquareDutyCycle + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ao_func_gen_square_duty_cycle.deleter + def ao_func_gen_square_duty_cycle(self): + cfunc = lib_importer.windll.DAQmxResetAOFuncGenSquareDutyCycle + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ao_func_gen_type(self): + """ + :class:`nidaqmx.constants.FuncGenType`: Specifies the kind of + the waveform to generate. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAOFuncGenType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return FuncGenType(val.value) + + @ao_func_gen_type.setter + def ao_func_gen_type(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAOFuncGenType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ao_func_gen_type.deleter + def ao_func_gen_type(self): + cfunc = lib_importer.windll.DAQmxResetAOFuncGenType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ao_gain(self): + """ + float: Specifies in decibels the gain factor to apply to the + channel. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAOGain + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ao_gain.setter + def ao_gain(self, val): + cfunc = lib_importer.windll.DAQmxSetAOGain + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ao_gain.deleter + def ao_gain(self): + cfunc = lib_importer.windll.DAQmxResetAOGain + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ao_idle_output_behavior(self): + """ + :class:`nidaqmx.constants.AOIdleOutputBehavior`: Specifies the + state of the channel when no generation is in progress. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAOIdleOutputBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return AOIdleOutputBehavior(val.value) + + @ao_idle_output_behavior.setter + def ao_idle_output_behavior(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAOIdleOutputBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ao_idle_output_behavior.deleter + def ao_idle_output_behavior(self): + cfunc = lib_importer.windll.DAQmxResetAOIdleOutputBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ao_load_impedance(self): + """ + float: Specifies in ohms the load impedance connected to the + analog output channel. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAOLoadImpedance + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ao_load_impedance.setter + def ao_load_impedance(self, val): + cfunc = lib_importer.windll.DAQmxSetAOLoadImpedance + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ao_load_impedance.deleter + def ao_load_impedance(self): + cfunc = lib_importer.windll.DAQmxResetAOLoadImpedance + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ao_max(self): + """ + float: Specifies the maximum value you expect to generate. The + value is in the units you specify with a units property. If + you try to write a value larger than the maximum value, NI- + DAQmx generates an error. NI-DAQmx might coerce this value + to a smaller value if other task settings restrict the + device from generating the desired maximum. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAOMax + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ao_max.setter + def ao_max(self, val): + cfunc = lib_importer.windll.DAQmxSetAOMax + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ao_max.deleter + def ao_max(self): + cfunc = lib_importer.windll.DAQmxResetAOMax + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ao_mem_map_enable(self): + """ + bool: Specifies for NI-DAQmx to map hardware registers to the + memory space of the application, if possible. Normally, NI- + DAQmx maps hardware registers to memory accessible only to + the kernel. Mapping the registers to the memory space of the + application increases performance. However, if the + application accesses the memory space mapped to the + registers, it can adversely affect the operation of the + device and possibly result in a system crash. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetAOMemMapEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ao_mem_map_enable.setter + def ao_mem_map_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetAOMemMapEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ao_mem_map_enable.deleter + def ao_mem_map_enable(self): + cfunc = lib_importer.windll.DAQmxResetAOMemMapEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ao_min(self): + """ + float: Specifies the minimum value you expect to generate. The + value is in the units you specify with a units property. If + you try to write a value smaller than the minimum value, NI- + DAQmx generates an error. NI-DAQmx might coerce this value + to a larger value if other task settings restrict the device + from generating the desired minimum. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAOMin + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ao_min.setter + def ao_min(self, val): + cfunc = lib_importer.windll.DAQmxSetAOMin + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ao_min.deleter + def ao_min(self): + cfunc = lib_importer.windll.DAQmxResetAOMin + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ao_output_impedance(self): + """ + float: Specifies in ohms the impedance of the analog output + stage of the device. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAOOutputImpedance + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ao_output_impedance.setter + def ao_output_impedance(self, val): + cfunc = lib_importer.windll.DAQmxSetAOOutputImpedance + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ao_output_impedance.deleter + def ao_output_impedance(self): + cfunc = lib_importer.windll.DAQmxResetAOOutputImpedance + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ao_output_type(self): + """ + :class:`nidaqmx.constants.UsageTypeAO`: Indicates whether the + channel generates voltage, current, or a waveform. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAOOutputType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return UsageTypeAO(val.value) + + @property + def ao_reglitch_enable(self): + """ + bool: Specifies whether to enable reglitching. The output of a + DAC normally glitches whenever the DAC is updated with a new + value. The amount of glitching differs from code to code and + is generally largest at major code transitions. Reglitching + generates uniform glitch energy at each code transition and + provides for more uniform glitches. Uniform glitch energy + makes it easier to filter out the noise introduced from + glitching during spectrum analysis. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetAOReglitchEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ao_reglitch_enable.setter + def ao_reglitch_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetAOReglitchEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ao_reglitch_enable.deleter + def ao_reglitch_enable(self): + cfunc = lib_importer.windll.DAQmxResetAOReglitchEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ao_resolution(self): + """ + float: Indicates the resolution of the digital-to-analog + converter of the channel. This value is in the units you + specify with **ao_resolution_units**. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAOResolution + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def ao_resolution_units(self): + """ + :class:`nidaqmx.constants.ResolutionType`: Specifies the units + of **ao_resolution**. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAOResolutionUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return ResolutionType(val.value) + + @ao_resolution_units.setter + def ao_resolution_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAOResolutionUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ao_resolution_units.deleter + def ao_resolution_units(self): + cfunc = lib_importer.windll.DAQmxResetAOResolutionUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ao_term_cfg(self): + """ + :class:`nidaqmx.constants.TerminalConfiguration`: Specifies the + terminal configuration of the channel. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAOTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return TerminalConfiguration(val.value) + + @ao_term_cfg.setter + def ao_term_cfg(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAOTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ao_term_cfg.deleter + def ao_term_cfg(self): + cfunc = lib_importer.windll.DAQmxResetAOTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ao_usb_xfer_req_count(self): + """ + int: Specifies the maximum number of simultaneous USB transfers + used to stream data. Modify this value to affect performance + under different combinations of operating system and device. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetAOUsbXferReqCount + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ao_usb_xfer_req_count.setter + def ao_usb_xfer_req_count(self, val): + cfunc = lib_importer.windll.DAQmxSetAOUsbXferReqCount + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ao_usb_xfer_req_count.deleter + def ao_usb_xfer_req_count(self): + cfunc = lib_importer.windll.DAQmxResetAOUsbXferReqCount + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ao_usb_xfer_req_size(self): + """ + int: Specifies the maximum size of a USB transfer request in + bytes. Modify this value to affect performance under + different combinations of operating system and device. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetAOUsbXferReqSize + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ao_usb_xfer_req_size.setter + def ao_usb_xfer_req_size(self, val): + cfunc = lib_importer.windll.DAQmxSetAOUsbXferReqSize + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ao_usb_xfer_req_size.deleter + def ao_usb_xfer_req_size(self): + cfunc = lib_importer.windll.DAQmxResetAOUsbXferReqSize + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ao_use_only_on_brd_mem(self): + """ + bool: Specifies whether to write samples directly to the onboard + memory of the device, bypassing the memory buffer. + Generally, you cannot update onboard memory directly after + you start the task. Onboard memory includes data FIFOs. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetAOUseOnlyOnBrdMem + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ao_use_only_on_brd_mem.setter + def ao_use_only_on_brd_mem(self, val): + cfunc = lib_importer.windll.DAQmxSetAOUseOnlyOnBrdMem + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ao_use_only_on_brd_mem.deleter + def ao_use_only_on_brd_mem(self): + cfunc = lib_importer.windll.DAQmxResetAOUseOnlyOnBrdMem + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ao_voltage_current_limit(self): + """ + float: Specifies the current limit, in amperes, for the voltage + channel. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAOVoltageCurrentLimit + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ao_voltage_current_limit.setter + def ao_voltage_current_limit(self, val): + cfunc = lib_importer.windll.DAQmxSetAOVoltageCurrentLimit + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ao_voltage_current_limit.deleter + def ao_voltage_current_limit(self): + cfunc = lib_importer.windll.DAQmxResetAOVoltageCurrentLimit + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ao_voltage_units(self): + """ + :class:`nidaqmx.constants.VoltageUnits`: Specifies in what units + to generate voltage on the channel. Write data to the + channel in the units you select. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAOVoltageUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return VoltageUnits(val.value) + + @ao_voltage_units.setter + def ao_voltage_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAOVoltageUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ao_voltage_units.deleter + def ao_voltage_units(self): + cfunc = lib_importer.windll.DAQmxResetAOVoltageUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + diff --git a/nidaqmx/_task_modules/channels/channel.py b/nidaqmx/_task_modules/channels/channel.py new file mode 100644 index 00000000..d8e9c3d2 --- /dev/null +++ b/nidaqmx/_task_modules/channels/channel.py @@ -0,0 +1,361 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import ctypes +import numpy + +import nidaqmx +from nidaqmx._lib import lib_importer, ctypes_byte_str +from nidaqmx.system.physical_channel import PhysicalChannel +from nidaqmx.errors import ( + check_for_error, is_string_buffer_too_small, is_array_buffer_too_small) +from nidaqmx.utils import flatten_channel_string, unflatten_channel_string +from nidaqmx.constants import ( + ChannelType, _Save) + + +class Channel(object): + """ + Represents virtual channel or a list of virtual channels. + """ + __slots__ = ['_handle', '_name', '__weakref__'] + + def __init__(self, task_handle, virtual_or_physical_name): + """ + Args: + task_handle (TaskHandle): Specifies the handle of the task that + this channel is associated with. + virtual_or_physical_name (str): Specifies the flattened virtual or + physical name of a channel. + """ + self._handle = task_handle + self._name = virtual_or_physical_name + + def __add__(self, other): + if not isinstance(other, self.__class__): + raise NotImplementedError( + 'Cannot concatenate objects of type {0} and {1}' + .format(self.__class__, other.__class__)) + + if self._handle != other._handle: + raise NotImplementedError( + 'Cannot concatenate Channel objects from different tasks.') + + name = flatten_channel_string([self.name, other.name]) + return Channel._factory(self._handle, name) + + def __contains__(self, item): + channel_names = self.channel_names + + if isinstance(item, str): + items = unflatten_channel_string(item) + elif isinstance(item, Channel): + items = item.channel_names + + return all([item in channel_names for item in items]) + + def __eq__(self, other): + if isinstance(other, self.__class__): + return (self._handle == other._handle and + set(self.channel_names) == set(other.channel_names)) + return False + + def __hash__(self): + return hash((self._handle.value, frozenset(self.channel_names))) + + def __iadd__(self, other): + return self.__add__(other) + + def __iter__(self): + for channel_name in self.channel_names: + yield Channel._factory(self._handle, channel_name) + + def __len__(self): + return len(self.channel_names) + + def __ne__(self, other): + return not self.__eq__(other) + + def __reversed__(self): + channel_names = self.channel_names + channel_names.reverse() + + for channel_name in channel_names: + yield Channel._factory(self._handle, channel_name) + + def __repr__(self): + return 'Channel(name={0})'.format(self.name) + + @staticmethod + def _factory(task_handle, virtual_or_physical_name): + """ + Implements the factory pattern for nidaqmx channels. + + Args: + task_handle (TaskHandle): Specifies the handle of the task that + this channel is associated with. + virtual_or_physical_name (str): Specifies the flattened virtual + or physical name of a channel. + Returns: + nidaqmx._task_modules.channels.channel.Channel: + + Indicates an object that represents the specified channel. + """ + chan_type = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetChanType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + task_handle, virtual_or_physical_name, ctypes.byref(chan_type)) + check_for_error(error_code) + + channel_type = ChannelType(chan_type.value) + + if channel_type == ChannelType.ANALOG_INPUT: + return nidaqmx._task_modules.channels.AIChannel( + task_handle, virtual_or_physical_name) + elif channel_type == ChannelType.ANALOG_OUTPUT: + return nidaqmx._task_modules.channels.AOChannel( + task_handle, virtual_or_physical_name) + elif channel_type == ChannelType.COUNTER_INPUT: + return nidaqmx._task_modules.channels.CIChannel( + task_handle, virtual_or_physical_name) + elif channel_type == ChannelType.COUNTER_OUTPUT: + return nidaqmx._task_modules.channels.COChannel( + task_handle, virtual_or_physical_name) + elif channel_type == ChannelType.DIGITAL_INPUT: + return nidaqmx._task_modules.channels.DIChannel( + task_handle, virtual_or_physical_name) + elif channel_type == ChannelType.DIGITAL_OUTPUT: + return nidaqmx._task_modules.channels.DOChannel( + task_handle, virtual_or_physical_name) + + @property + def name(self): + """ + str: Specifies the name of the virtual channel this object + represents. + """ + if self._name: + return self._name + else: + return self._all_channels_name + + @property + def channel_names(self): + """ + List[str]: Specifies the unflattened list of the virtual channels. + """ + if self._name: + return unflatten_channel_string(self._name) + else: + return unflatten_channel_string(self._all_channels_name) + + @property + def _all_channels_name(self): + """ + str: Specifies the flattened names of all the virtual channels in + the task. + """ + cfunc = lib_importer.windll.DAQmxGetTaskChannels + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @property + def chan_type(self): + """ + :class:`nidaqmx.constants.ChannelType`: Indicates the type of + the virtual channel. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetChanType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return ChannelType(val.value) + + @property + def description(self): + """ + str: Specifies a user-defined description for the channel. + """ + cfunc = lib_importer.windll.DAQmxGetChanDescr + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @description.setter + def description(self, val): + cfunc = lib_importer.windll.DAQmxSetChanDescr + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @description.deleter + def description(self): + cfunc = lib_importer.windll.DAQmxResetChanDescr + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def is_global(self): + """ + bool: Indicates whether the channel is a global channel. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetChanIsGlobal + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def physical_channel(self): + """ + :class:`nidaqmx.system.physical_channel.PhysicalChannel`: + Specifies the name of the physical channel upon which this + virtual channel is based. + """ + cfunc = lib_importer.windll.DAQmxGetPhysicalChanName + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return PhysicalChannel(val.value.decode('ascii')) + + @physical_channel.setter + def physical_channel(self, val): + val = val.name + cfunc = lib_importer.windll.DAQmxSetPhysicalChanName + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + def save(self, save_as="", author="", overwrite_existing_channel=False, + allow_interactive_editing=True, allow_interactive_deletion=True): + """ + Saves this local or global channel to MAX as a global channel. + + Args: + save_as (Optional[str]): Is the name to save the task, + global channel, or custom scale as. If you do not + specify a value for this input, NI-DAQmx uses the name + currently assigned to the task, global channel, or + custom scale. + author (Optional[str]): Is a name to store with the task, + global channel, or custom scale. + overwrite_existing_channel (Optional[bool]): Specifies whether to + overwrite a global channel of the same name if one is already + saved in MAX. If this input is False and a global channel of + the same name is already saved in MAX, this function returns + an error. + allow_interactive_editing (Optional[bool]): Specifies whether to + allow the task, global channel, or custom scale to be edited + in the DAQ Assistant. If allow_interactive_editing is True, + the DAQ Assistant must support all task or global channel + settings. + allow_interactive_deletion (Optional[bool]): Specifies whether + to allow the task, global channel, or custom scale to be + deleted through MAX. + """ + options = 0 + if overwrite_existing_channel: + options |= _Save.OVERWRITE.value + if allow_interactive_editing: + options |= _Save.ALLOW_INTERACTIVE_EDITING.value + if allow_interactive_deletion: + options |= _Save.ALLOW_INTERACTIVE_DELETION.value + + cfunc = lib_importer.windll.DAQmxSaveGlobalChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes_byte_str, ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, save_as, author, options) + check_for_error(error_code) diff --git a/nidaqmx/_task_modules/channels/ci_channel.py b/nidaqmx/_task_modules/channels/ci_channel.py new file mode 100644 index 00000000..ecf26eed --- /dev/null +++ b/nidaqmx/_task_modules/channels/ci_channel.py @@ -0,0 +1,9707 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import ctypes +import numpy + +from nidaqmx._lib import lib_importer, ctypes_byte_str +from nidaqmx.scale import Scale +from nidaqmx.errors import ( + check_for_error, is_string_buffer_too_small, is_array_buffer_too_small) +from nidaqmx._task_modules.channels.channel import Channel +from nidaqmx.constants import ( + AngleUnits, AngularVelocityUnits, CountDirection, CounterFrequencyMethod, + DataTransferActiveTransferMode, Edge, EncoderType, EncoderZIndexPhase, + FrequencyUnits, GpsSignalType, InputDataTransferCondition, LengthUnits, + Level, LogicLvlBehavior, SampClkOverrunBehavior, TerminalConfiguration, + TimeUnits, UsageTypeCI, VelocityUnits) + + +class CIChannel(Channel): + """ + Represents one or more counter input virtual channels and their properties. + """ + __slots__ = [] + + def __repr__(self): + return 'CIChannel(name={0})'.format(self._name) + + @property + def ci_ang_encoder_initial_angle(self): + """ + float: Specifies the starting angle of the encoder. This value + is in the units you specify with **ci_ang_encoder_units**. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetCIAngEncoderInitialAngle + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_ang_encoder_initial_angle.setter + def ci_ang_encoder_initial_angle(self, val): + cfunc = lib_importer.windll.DAQmxSetCIAngEncoderInitialAngle + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_ang_encoder_initial_angle.deleter + def ci_ang_encoder_initial_angle(self): + cfunc = lib_importer.windll.DAQmxResetCIAngEncoderInitialAngle + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_ang_encoder_pulses_per_rev(self): + """ + int: Specifies the number of pulses the encoder generates per + revolution. This value is the number of pulses on either + signal A or signal B, not the total number of pulses on both + signal A and signal B. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetCIAngEncoderPulsesPerRev + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_ang_encoder_pulses_per_rev.setter + def ci_ang_encoder_pulses_per_rev(self, val): + cfunc = lib_importer.windll.DAQmxSetCIAngEncoderPulsesPerRev + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_ang_encoder_pulses_per_rev.deleter + def ci_ang_encoder_pulses_per_rev(self): + cfunc = lib_importer.windll.DAQmxResetCIAngEncoderPulsesPerRev + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_ang_encoder_units(self): + """ + :class:`nidaqmx.constants.AngleUnits`: Specifies the units to + use to return angular position measurements from the + channel. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIAngEncoderUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return AngleUnits(val.value) + + @ci_ang_encoder_units.setter + def ci_ang_encoder_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIAngEncoderUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_ang_encoder_units.deleter + def ci_ang_encoder_units(self): + cfunc = lib_importer.windll.DAQmxResetCIAngEncoderUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_count(self): + """ + int: Indicates the current value of the count register. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetCICount + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def ci_count_edges_active_edge(self): + """ + :class:`nidaqmx.constants.Edge`: Specifies on which edges to + increment or decrement the counter. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCICountEdgesActiveEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return Edge(val.value) + + @ci_count_edges_active_edge.setter + def ci_count_edges_active_edge(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCICountEdgesActiveEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_count_edges_active_edge.deleter + def ci_count_edges_active_edge(self): + cfunc = lib_importer.windll.DAQmxResetCICountEdgesActiveEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_count_edges_count_dir_dig_fltr_enable(self): + """ + bool: Specifies whether to apply the pulse width filter to the + signal. + """ + val = ctypes.c_bool() + + cfunc = (lib_importer.windll. + DAQmxGetCICountEdgesCountDirDigFltrEnable) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_count_edges_count_dir_dig_fltr_enable.setter + def ci_count_edges_count_dir_dig_fltr_enable(self, val): + cfunc = (lib_importer.windll. + DAQmxSetCICountEdgesCountDirDigFltrEnable) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_count_edges_count_dir_dig_fltr_enable.deleter + def ci_count_edges_count_dir_dig_fltr_enable(self): + cfunc = (lib_importer.windll. + DAQmxResetCICountEdgesCountDirDigFltrEnable) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_count_edges_count_dir_dig_fltr_min_pulse_width(self): + """ + float: Specifies in seconds the minimum pulse width the filter + recognizes. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetCICountEdgesCountDirDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_count_edges_count_dir_dig_fltr_min_pulse_width.setter + def ci_count_edges_count_dir_dig_fltr_min_pulse_width(self, val): + cfunc = (lib_importer.windll. + DAQmxSetCICountEdgesCountDirDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_count_edges_count_dir_dig_fltr_min_pulse_width.deleter + def ci_count_edges_count_dir_dig_fltr_min_pulse_width(self): + cfunc = (lib_importer.windll. + DAQmxResetCICountEdgesCountDirDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_count_edges_count_dir_dig_fltr_timebase_rate(self): + """ + float: Specifies in hertz the rate of the pulse width filter + timebase. NI-DAQmx uses this value to compute settings for + the filter. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetCICountEdgesCountDirDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_count_edges_count_dir_dig_fltr_timebase_rate.setter + def ci_count_edges_count_dir_dig_fltr_timebase_rate(self, val): + cfunc = (lib_importer.windll. + DAQmxSetCICountEdgesCountDirDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_count_edges_count_dir_dig_fltr_timebase_rate.deleter + def ci_count_edges_count_dir_dig_fltr_timebase_rate(self): + cfunc = (lib_importer.windll. + DAQmxResetCICountEdgesCountDirDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_count_edges_count_dir_dig_fltr_timebase_src(self): + """ + str: Specifies the input terminal of the signal to use as the + timebase of the pulse width filter. + """ + cfunc = (lib_importer.windll. + DAQmxGetCICountEdgesCountDirDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_count_edges_count_dir_dig_fltr_timebase_src.setter + def ci_count_edges_count_dir_dig_fltr_timebase_src(self, val): + cfunc = (lib_importer.windll. + DAQmxSetCICountEdgesCountDirDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_count_edges_count_dir_dig_fltr_timebase_src.deleter + def ci_count_edges_count_dir_dig_fltr_timebase_src(self): + cfunc = (lib_importer.windll. + DAQmxResetCICountEdgesCountDirDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_count_edges_count_dir_dig_sync_enable(self): + """ + bool: Specifies whether to synchronize recognition of + transitions in the signal to the internal timebase of the + device. + """ + val = ctypes.c_bool() + + cfunc = (lib_importer.windll. + DAQmxGetCICountEdgesCountDirDigSyncEnable) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_count_edges_count_dir_dig_sync_enable.setter + def ci_count_edges_count_dir_dig_sync_enable(self, val): + cfunc = (lib_importer.windll. + DAQmxSetCICountEdgesCountDirDigSyncEnable) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_count_edges_count_dir_dig_sync_enable.deleter + def ci_count_edges_count_dir_dig_sync_enable(self): + cfunc = (lib_importer.windll. + DAQmxResetCICountEdgesCountDirDigSyncEnable) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_count_edges_count_dir_logic_lvl_behavior(self): + """ + :class:`nidaqmx.constants.LogicLvlBehavior`: Specifies the logic + level behavior on the count reset line. + """ + val = ctypes.c_int() + + cfunc = (lib_importer.windll. + DAQmxGetCICountEdgesCountDirLogicLvlBehavior) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return LogicLvlBehavior(val.value) + + @ci_count_edges_count_dir_logic_lvl_behavior.setter + def ci_count_edges_count_dir_logic_lvl_behavior(self, val): + val = val.value + cfunc = (lib_importer.windll. + DAQmxSetCICountEdgesCountDirLogicLvlBehavior) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_count_edges_count_dir_logic_lvl_behavior.deleter + def ci_count_edges_count_dir_logic_lvl_behavior(self): + cfunc = (lib_importer.windll. + DAQmxResetCICountEdgesCountDirLogicLvlBehavior) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_count_edges_count_dir_term_cfg(self): + """ + :class:`nidaqmx.constants.TerminalConfiguration`: Specifies the + input terminal configuration. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCICountEdgesCountDirTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return TerminalConfiguration(val.value) + + @ci_count_edges_count_dir_term_cfg.setter + def ci_count_edges_count_dir_term_cfg(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCICountEdgesCountDirTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_count_edges_count_dir_term_cfg.deleter + def ci_count_edges_count_dir_term_cfg(self): + cfunc = lib_importer.windll.DAQmxResetCICountEdgesCountDirTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_count_edges_count_reset_active_edge(self): + """ + :class:`nidaqmx.constants.Edge`: Specifies on which edge of the + signal to reset the count. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCICountEdgesCountResetActiveEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return Edge(val.value) + + @ci_count_edges_count_reset_active_edge.setter + def ci_count_edges_count_reset_active_edge(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCICountEdgesCountResetActiveEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_count_edges_count_reset_active_edge.deleter + def ci_count_edges_count_reset_active_edge(self): + cfunc = lib_importer.windll.DAQmxResetCICountEdgesCountResetActiveEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_count_edges_count_reset_dig_fltr_enable(self): + """ + bool: Specifies whether to apply the pulse width filter to the + signal. + """ + val = ctypes.c_bool() + + cfunc = (lib_importer.windll. + DAQmxGetCICountEdgesCountResetDigFltrEnable) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_count_edges_count_reset_dig_fltr_enable.setter + def ci_count_edges_count_reset_dig_fltr_enable(self, val): + cfunc = (lib_importer.windll. + DAQmxSetCICountEdgesCountResetDigFltrEnable) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_count_edges_count_reset_dig_fltr_enable.deleter + def ci_count_edges_count_reset_dig_fltr_enable(self): + cfunc = (lib_importer.windll. + DAQmxResetCICountEdgesCountResetDigFltrEnable) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_count_edges_count_reset_dig_fltr_min_pulse_width(self): + """ + float: Specifies the minimum pulse width the filter recognizes. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetCICountEdgesCountResetDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_count_edges_count_reset_dig_fltr_min_pulse_width.setter + def ci_count_edges_count_reset_dig_fltr_min_pulse_width(self, val): + cfunc = (lib_importer.windll. + DAQmxSetCICountEdgesCountResetDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_count_edges_count_reset_dig_fltr_min_pulse_width.deleter + def ci_count_edges_count_reset_dig_fltr_min_pulse_width(self): + cfunc = (lib_importer.windll. + DAQmxResetCICountEdgesCountResetDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_count_edges_count_reset_dig_fltr_timebase_rate(self): + """ + float: Specifies in hertz the rate of the pulse width filter + timebase. NI-DAQmx uses this value to compute settings for + the filter. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetCICountEdgesCountResetDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_count_edges_count_reset_dig_fltr_timebase_rate.setter + def ci_count_edges_count_reset_dig_fltr_timebase_rate(self, val): + cfunc = (lib_importer.windll. + DAQmxSetCICountEdgesCountResetDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_count_edges_count_reset_dig_fltr_timebase_rate.deleter + def ci_count_edges_count_reset_dig_fltr_timebase_rate(self): + cfunc = (lib_importer.windll. + DAQmxResetCICountEdgesCountResetDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_count_edges_count_reset_dig_fltr_timebase_src(self): + """ + str: Specifies the input of the signal to use as the timebase of + the pulse width filter. + """ + cfunc = (lib_importer.windll. + DAQmxGetCICountEdgesCountResetDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_count_edges_count_reset_dig_fltr_timebase_src.setter + def ci_count_edges_count_reset_dig_fltr_timebase_src(self, val): + cfunc = (lib_importer.windll. + DAQmxSetCICountEdgesCountResetDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_count_edges_count_reset_dig_fltr_timebase_src.deleter + def ci_count_edges_count_reset_dig_fltr_timebase_src(self): + cfunc = (lib_importer.windll. + DAQmxResetCICountEdgesCountResetDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_count_edges_count_reset_dig_sync_enable(self): + """ + bool: Specifies whether to synchronize recognition of + transitions in the signal to the internal timebase of the + device. + """ + val = ctypes.c_bool() + + cfunc = (lib_importer.windll. + DAQmxGetCICountEdgesCountResetDigSyncEnable) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_count_edges_count_reset_dig_sync_enable.setter + def ci_count_edges_count_reset_dig_sync_enable(self, val): + cfunc = (lib_importer.windll. + DAQmxSetCICountEdgesCountResetDigSyncEnable) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_count_edges_count_reset_dig_sync_enable.deleter + def ci_count_edges_count_reset_dig_sync_enable(self): + cfunc = (lib_importer.windll. + DAQmxResetCICountEdgesCountResetDigSyncEnable) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_count_edges_count_reset_enable(self): + """ + bool: Specifies whether to reset the count on the active edge + specified with **ci_count_edges_count_reset_term**. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCICountEdgesCountResetEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_count_edges_count_reset_enable.setter + def ci_count_edges_count_reset_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetCICountEdgesCountResetEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_count_edges_count_reset_enable.deleter + def ci_count_edges_count_reset_enable(self): + cfunc = lib_importer.windll.DAQmxResetCICountEdgesCountResetEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_count_edges_count_reset_logic_lvl_behavior(self): + """ + :class:`nidaqmx.constants.LogicLvlBehavior`: Specifies the logic + level behavior on the count reset line. + """ + val = ctypes.c_int() + + cfunc = (lib_importer.windll. + DAQmxGetCICountEdgesCountResetLogicLvlBehavior) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return LogicLvlBehavior(val.value) + + @ci_count_edges_count_reset_logic_lvl_behavior.setter + def ci_count_edges_count_reset_logic_lvl_behavior(self, val): + val = val.value + cfunc = (lib_importer.windll. + DAQmxSetCICountEdgesCountResetLogicLvlBehavior) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_count_edges_count_reset_logic_lvl_behavior.deleter + def ci_count_edges_count_reset_logic_lvl_behavior(self): + cfunc = (lib_importer.windll. + DAQmxResetCICountEdgesCountResetLogicLvlBehavior) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_count_edges_count_reset_reset_cnt(self): + """ + int: Specifies the value to reset the count to. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetCICountEdgesCountResetResetCnt + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_count_edges_count_reset_reset_cnt.setter + def ci_count_edges_count_reset_reset_cnt(self, val): + cfunc = lib_importer.windll.DAQmxSetCICountEdgesCountResetResetCnt + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_count_edges_count_reset_reset_cnt.deleter + def ci_count_edges_count_reset_reset_cnt(self): + cfunc = lib_importer.windll.DAQmxResetCICountEdgesCountResetResetCnt + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_count_edges_count_reset_term(self): + """ + str: Specifies the input terminal of the signal to reset the + count. + """ + cfunc = lib_importer.windll.DAQmxGetCICountEdgesCountResetTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_count_edges_count_reset_term.setter + def ci_count_edges_count_reset_term(self, val): + cfunc = lib_importer.windll.DAQmxSetCICountEdgesCountResetTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_count_edges_count_reset_term.deleter + def ci_count_edges_count_reset_term(self): + cfunc = lib_importer.windll.DAQmxResetCICountEdgesCountResetTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_count_edges_count_reset_term_cfg(self): + """ + :class:`nidaqmx.constants.TerminalConfiguration`: Specifies the + input terminal configuration. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCICountEdgesCountResetTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return TerminalConfiguration(val.value) + + @ci_count_edges_count_reset_term_cfg.setter + def ci_count_edges_count_reset_term_cfg(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCICountEdgesCountResetTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_count_edges_count_reset_term_cfg.deleter + def ci_count_edges_count_reset_term_cfg(self): + cfunc = lib_importer.windll.DAQmxResetCICountEdgesCountResetTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_count_edges_dig_fltr_enable(self): + """ + bool: Specifies whether to apply the pulse width filter to the + signal. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCICountEdgesDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_count_edges_dig_fltr_enable.setter + def ci_count_edges_dig_fltr_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetCICountEdgesDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_count_edges_dig_fltr_enable.deleter + def ci_count_edges_dig_fltr_enable(self): + cfunc = lib_importer.windll.DAQmxResetCICountEdgesDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_count_edges_dig_fltr_min_pulse_width(self): + """ + float: Specifies in seconds the minimum pulse width the filter + recognizes. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetCICountEdgesDigFltrMinPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_count_edges_dig_fltr_min_pulse_width.setter + def ci_count_edges_dig_fltr_min_pulse_width(self, val): + cfunc = lib_importer.windll.DAQmxSetCICountEdgesDigFltrMinPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_count_edges_dig_fltr_min_pulse_width.deleter + def ci_count_edges_dig_fltr_min_pulse_width(self): + cfunc = lib_importer.windll.DAQmxResetCICountEdgesDigFltrMinPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_count_edges_dig_fltr_timebase_rate(self): + """ + float: Specifies in hertz the rate of the pulse width filter + timebase. NI-DAQmx uses this value to compute settings for + the filter. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetCICountEdgesDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_count_edges_dig_fltr_timebase_rate.setter + def ci_count_edges_dig_fltr_timebase_rate(self, val): + cfunc = lib_importer.windll.DAQmxSetCICountEdgesDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_count_edges_dig_fltr_timebase_rate.deleter + def ci_count_edges_dig_fltr_timebase_rate(self): + cfunc = lib_importer.windll.DAQmxResetCICountEdgesDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_count_edges_dig_fltr_timebase_src(self): + """ + str: Specifies the input terminal of the signal to use as the + timebase of the pulse width filter. + """ + cfunc = lib_importer.windll.DAQmxGetCICountEdgesDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_count_edges_dig_fltr_timebase_src.setter + def ci_count_edges_dig_fltr_timebase_src(self, val): + cfunc = lib_importer.windll.DAQmxSetCICountEdgesDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_count_edges_dig_fltr_timebase_src.deleter + def ci_count_edges_dig_fltr_timebase_src(self): + cfunc = lib_importer.windll.DAQmxResetCICountEdgesDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_count_edges_dig_sync_enable(self): + """ + bool: Specifies whether to synchronize recognition of + transitions in the signal to the internal timebase of the + device. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCICountEdgesDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_count_edges_dig_sync_enable.setter + def ci_count_edges_dig_sync_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetCICountEdgesDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_count_edges_dig_sync_enable.deleter + def ci_count_edges_dig_sync_enable(self): + cfunc = lib_importer.windll.DAQmxResetCICountEdgesDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_count_edges_dir(self): + """ + :class:`nidaqmx.constants.CountDirection`: Specifies whether to + increment or decrement the counter on each edge. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCICountEdgesDir + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return CountDirection(val.value) + + @ci_count_edges_dir.setter + def ci_count_edges_dir(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCICountEdgesDir + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_count_edges_dir.deleter + def ci_count_edges_dir(self): + cfunc = lib_importer.windll.DAQmxResetCICountEdgesDir + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_count_edges_dir_term(self): + """ + str: Specifies the source terminal of the digital signal that + controls the count direction if **ci_count_edges_dir** is + **CountDirection1.EXTERNAL_SOURCE**. + """ + cfunc = lib_importer.windll.DAQmxGetCICountEdgesDirTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_count_edges_dir_term.setter + def ci_count_edges_dir_term(self, val): + cfunc = lib_importer.windll.DAQmxSetCICountEdgesDirTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_count_edges_dir_term.deleter + def ci_count_edges_dir_term(self): + cfunc = lib_importer.windll.DAQmxResetCICountEdgesDirTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_count_edges_gate_dig_fltr_enable(self): + """ + bool: Specifies whether to apply the pulse width filter to the + gate input signal. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCICountEdgesGateDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_count_edges_gate_dig_fltr_enable.setter + def ci_count_edges_gate_dig_fltr_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetCICountEdgesGateDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_count_edges_gate_dig_fltr_enable.deleter + def ci_count_edges_gate_dig_fltr_enable(self): + cfunc = lib_importer.windll.DAQmxResetCICountEdgesGateDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_count_edges_gate_dig_fltr_min_pulse_width(self): + """ + float: Specifies in seconds the minimum pulse width the digital + filter recognizes. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetCICountEdgesGateDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_count_edges_gate_dig_fltr_min_pulse_width.setter + def ci_count_edges_gate_dig_fltr_min_pulse_width(self, val): + cfunc = (lib_importer.windll. + DAQmxSetCICountEdgesGateDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_count_edges_gate_dig_fltr_min_pulse_width.deleter + def ci_count_edges_gate_dig_fltr_min_pulse_width(self): + cfunc = (lib_importer.windll. + DAQmxResetCICountEdgesGateDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_count_edges_gate_dig_fltr_timebase_rate(self): + """ + float: Specifies in hertz the rate of the pulse width filter + timebase. NI-DAQmx uses this value to compute settings for + the filter. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetCICountEdgesGateDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_count_edges_gate_dig_fltr_timebase_rate.setter + def ci_count_edges_gate_dig_fltr_timebase_rate(self, val): + cfunc = (lib_importer.windll. + DAQmxSetCICountEdgesGateDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_count_edges_gate_dig_fltr_timebase_rate.deleter + def ci_count_edges_gate_dig_fltr_timebase_rate(self): + cfunc = (lib_importer.windll. + DAQmxResetCICountEdgesGateDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_count_edges_gate_dig_fltr_timebase_src(self): + """ + str: Specifies the input terminal of the signal to use as the + timebase of the pulse width filter. + """ + cfunc = (lib_importer.windll. + DAQmxGetCICountEdgesGateDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_count_edges_gate_dig_fltr_timebase_src.setter + def ci_count_edges_gate_dig_fltr_timebase_src(self, val): + cfunc = (lib_importer.windll. + DAQmxSetCICountEdgesGateDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_count_edges_gate_dig_fltr_timebase_src.deleter + def ci_count_edges_gate_dig_fltr_timebase_src(self): + cfunc = (lib_importer.windll. + DAQmxResetCICountEdgesGateDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_count_edges_gate_enable(self): + """ + bool: Specifies whether to enable the functionality to gate the + counter input signal for a count edges measurement. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCICountEdgesGateEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_count_edges_gate_enable.setter + def ci_count_edges_gate_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetCICountEdgesGateEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_count_edges_gate_enable.deleter + def ci_count_edges_gate_enable(self): + cfunc = lib_importer.windll.DAQmxResetCICountEdgesGateEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_count_edges_gate_logic_lvl_behavior(self): + """ + :class:`nidaqmx.constants.LogicLvlBehavior`: Specifies the logic + level behavior on the gate input line. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCICountEdgesGateLogicLvlBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return LogicLvlBehavior(val.value) + + @ci_count_edges_gate_logic_lvl_behavior.setter + def ci_count_edges_gate_logic_lvl_behavior(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCICountEdgesGateLogicLvlBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_count_edges_gate_logic_lvl_behavior.deleter + def ci_count_edges_gate_logic_lvl_behavior(self): + cfunc = lib_importer.windll.DAQmxResetCICountEdgesGateLogicLvlBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_count_edges_gate_term(self): + """ + str: Specifies the gate terminal. + """ + cfunc = lib_importer.windll.DAQmxGetCICountEdgesGateTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_count_edges_gate_term.setter + def ci_count_edges_gate_term(self, val): + cfunc = lib_importer.windll.DAQmxSetCICountEdgesGateTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_count_edges_gate_term.deleter + def ci_count_edges_gate_term(self): + cfunc = lib_importer.windll.DAQmxResetCICountEdgesGateTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_count_edges_gate_term_cfg(self): + """ + :class:`nidaqmx.constants.TerminalConfiguration`: Specifies the + gate terminal configuration. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCICountEdgesGateTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return TerminalConfiguration(val.value) + + @ci_count_edges_gate_term_cfg.setter + def ci_count_edges_gate_term_cfg(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCICountEdgesGateTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_count_edges_gate_term_cfg.deleter + def ci_count_edges_gate_term_cfg(self): + cfunc = lib_importer.windll.DAQmxResetCICountEdgesGateTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_count_edges_gate_when(self): + """ + :class:`nidaqmx.constants.Level`: Specifies whether the counter + gates input pulses while the signal is high or low. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCICountEdgesGateWhen + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return Level(val.value) + + @ci_count_edges_gate_when.setter + def ci_count_edges_gate_when(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCICountEdgesGateWhen + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_count_edges_gate_when.deleter + def ci_count_edges_gate_when(self): + cfunc = lib_importer.windll.DAQmxResetCICountEdgesGateWhen + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_count_edges_initial_cnt(self): + """ + int: Specifies the starting value from which to count. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetCICountEdgesInitialCnt + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_count_edges_initial_cnt.setter + def ci_count_edges_initial_cnt(self, val): + cfunc = lib_importer.windll.DAQmxSetCICountEdgesInitialCnt + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_count_edges_initial_cnt.deleter + def ci_count_edges_initial_cnt(self): + cfunc = lib_importer.windll.DAQmxResetCICountEdgesInitialCnt + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_count_edges_logic_lvl_behavior(self): + """ + :class:`nidaqmx.constants.LogicLvlBehavior`: Specifies the logic + level behavior on the input line. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCICountEdgesLogicLvlBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return LogicLvlBehavior(val.value) + + @ci_count_edges_logic_lvl_behavior.setter + def ci_count_edges_logic_lvl_behavior(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCICountEdgesLogicLvlBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_count_edges_logic_lvl_behavior.deleter + def ci_count_edges_logic_lvl_behavior(self): + cfunc = lib_importer.windll.DAQmxResetCICountEdgesLogicLvlBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_count_edges_term(self): + """ + str: Specifies the input terminal of the signal to measure. + """ + cfunc = lib_importer.windll.DAQmxGetCICountEdgesTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_count_edges_term.setter + def ci_count_edges_term(self, val): + cfunc = lib_importer.windll.DAQmxSetCICountEdgesTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_count_edges_term.deleter + def ci_count_edges_term(self): + cfunc = lib_importer.windll.DAQmxResetCICountEdgesTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_count_edges_term_cfg(self): + """ + :class:`nidaqmx.constants.TerminalConfiguration`: Specifies the + input terminal configuration. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCICountEdgesTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return TerminalConfiguration(val.value) + + @ci_count_edges_term_cfg.setter + def ci_count_edges_term_cfg(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCICountEdgesTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_count_edges_term_cfg.deleter + def ci_count_edges_term_cfg(self): + cfunc = lib_importer.windll.DAQmxResetCICountEdgesTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_ctr_timebase_active_edge(self): + """ + :class:`nidaqmx.constants.Edge`: Specifies whether a timebase + cycle is from rising edge to rising edge or from falling + edge to falling edge. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCICtrTimebaseActiveEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return Edge(val.value) + + @ci_ctr_timebase_active_edge.setter + def ci_ctr_timebase_active_edge(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCICtrTimebaseActiveEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_ctr_timebase_active_edge.deleter + def ci_ctr_timebase_active_edge(self): + cfunc = lib_importer.windll.DAQmxResetCICtrTimebaseActiveEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_ctr_timebase_dig_fltr_enable(self): + """ + bool: Specifies whether to apply the pulse width filter to the + signal. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCICtrTimebaseDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_ctr_timebase_dig_fltr_enable.setter + def ci_ctr_timebase_dig_fltr_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetCICtrTimebaseDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_ctr_timebase_dig_fltr_enable.deleter + def ci_ctr_timebase_dig_fltr_enable(self): + cfunc = lib_importer.windll.DAQmxResetCICtrTimebaseDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_ctr_timebase_dig_fltr_min_pulse_width(self): + """ + float: Specifies in seconds the minimum pulse width the filter + recognizes. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetCICtrTimebaseDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_ctr_timebase_dig_fltr_min_pulse_width.setter + def ci_ctr_timebase_dig_fltr_min_pulse_width(self, val): + cfunc = (lib_importer.windll. + DAQmxSetCICtrTimebaseDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_ctr_timebase_dig_fltr_min_pulse_width.deleter + def ci_ctr_timebase_dig_fltr_min_pulse_width(self): + cfunc = (lib_importer.windll. + DAQmxResetCICtrTimebaseDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_ctr_timebase_dig_fltr_timebase_rate(self): + """ + float: Specifies in hertz the rate of the pulse width filter + timebase. NI-DAQmx uses this value to compute settings for + the filter. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetCICtrTimebaseDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_ctr_timebase_dig_fltr_timebase_rate.setter + def ci_ctr_timebase_dig_fltr_timebase_rate(self, val): + cfunc = lib_importer.windll.DAQmxSetCICtrTimebaseDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_ctr_timebase_dig_fltr_timebase_rate.deleter + def ci_ctr_timebase_dig_fltr_timebase_rate(self): + cfunc = lib_importer.windll.DAQmxResetCICtrTimebaseDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_ctr_timebase_dig_fltr_timebase_src(self): + """ + str: Specifies the input terminal of the signal to use as the + timebase of the pulse width filter. + """ + cfunc = lib_importer.windll.DAQmxGetCICtrTimebaseDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_ctr_timebase_dig_fltr_timebase_src.setter + def ci_ctr_timebase_dig_fltr_timebase_src(self, val): + cfunc = lib_importer.windll.DAQmxSetCICtrTimebaseDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_ctr_timebase_dig_fltr_timebase_src.deleter + def ci_ctr_timebase_dig_fltr_timebase_src(self): + cfunc = lib_importer.windll.DAQmxResetCICtrTimebaseDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_ctr_timebase_dig_sync_enable(self): + """ + bool: Specifies whether to synchronize recognition of + transitions in the signal to the internal timebase of the + device. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCICtrTimebaseDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_ctr_timebase_dig_sync_enable.setter + def ci_ctr_timebase_dig_sync_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetCICtrTimebaseDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_ctr_timebase_dig_sync_enable.deleter + def ci_ctr_timebase_dig_sync_enable(self): + cfunc = lib_importer.windll.DAQmxResetCICtrTimebaseDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_ctr_timebase_master_timebase_div(self): + """ + int: Specifies the divisor for an external counter timebase. You + can divide the counter timebase in order to measure slower + signals without causing the count register to roll over. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetCICtrTimebaseMasterTimebaseDiv + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_ctr_timebase_master_timebase_div.setter + def ci_ctr_timebase_master_timebase_div(self, val): + cfunc = lib_importer.windll.DAQmxSetCICtrTimebaseMasterTimebaseDiv + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_ctr_timebase_master_timebase_div.deleter + def ci_ctr_timebase_master_timebase_div(self): + cfunc = lib_importer.windll.DAQmxResetCICtrTimebaseMasterTimebaseDiv + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_ctr_timebase_rate(self): + """ + float: Specifies in Hertz the frequency of the counter timebase. + Specifying the rate of a counter timebase allows you to take + measurements in terms of time or frequency rather than in + ticks of the timebase. If you use an external timebase and + do not specify the rate, you can take measurements only in + terms of ticks of the timebase. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetCICtrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_ctr_timebase_rate.setter + def ci_ctr_timebase_rate(self, val): + cfunc = lib_importer.windll.DAQmxSetCICtrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_ctr_timebase_rate.deleter + def ci_ctr_timebase_rate(self): + cfunc = lib_importer.windll.DAQmxResetCICtrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_ctr_timebase_src(self): + """ + str: Specifies the terminal of the timebase to use for the + counter. + """ + cfunc = lib_importer.windll.DAQmxGetCICtrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_ctr_timebase_src.setter + def ci_ctr_timebase_src(self, val): + cfunc = lib_importer.windll.DAQmxSetCICtrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_ctr_timebase_src.deleter + def ci_ctr_timebase_src(self): + cfunc = lib_importer.windll.DAQmxResetCICtrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_custom_scale(self): + """ + :class:`nidaqmx.system.scale.Scale`: Specifies the name of a + custom scale for the channel. + """ + cfunc = lib_importer.windll.DAQmxGetCICustomScaleName + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return Scale(val.value.decode('ascii')) + + @ci_custom_scale.setter + def ci_custom_scale(self, val): + val = val.name + cfunc = lib_importer.windll.DAQmxSetCICustomScaleName + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_custom_scale.deleter + def ci_custom_scale(self): + cfunc = lib_importer.windll.DAQmxResetCICustomScaleName + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_data_xfer_mech(self): + """ + :class:`nidaqmx.constants.DataTransferActiveTransferMode`: + Specifies the data transfer mode for the channel. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIDataXferMech + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return DataTransferActiveTransferMode(val.value) + + @ci_data_xfer_mech.setter + def ci_data_xfer_mech(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIDataXferMech + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_data_xfer_mech.deleter + def ci_data_xfer_mech(self): + cfunc = lib_importer.windll.DAQmxResetCIDataXferMech + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_data_xfer_req_cond(self): + """ + :class:`nidaqmx.constants.InputDataTransferCondition`: Specifies + under what condition to transfer data from the onboard + memory of the device to the buffer. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIDataXferReqCond + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return InputDataTransferCondition(val.value) + + @ci_data_xfer_req_cond.setter + def ci_data_xfer_req_cond(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIDataXferReqCond + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_data_xfer_req_cond.deleter + def ci_data_xfer_req_cond(self): + cfunc = lib_importer.windll.DAQmxResetCIDataXferReqCond + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_dup_count_prevention(self): + """ + bool: Specifies whether to enable duplicate count prevention for + the channel. Duplicate count prevention is enabled by + default. Setting **ci_prescaler** disables duplicate count + prevention unless you explicitly enable it. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCIDupCountPrevention + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_dup_count_prevention.setter + def ci_dup_count_prevention(self, val): + cfunc = lib_importer.windll.DAQmxSetCIDupCountPrevention + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_dup_count_prevention.deleter + def ci_dup_count_prevention(self): + cfunc = lib_importer.windll.DAQmxResetCIDupCountPrevention + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_duty_cycle_dig_fltr_enable(self): + """ + bool: Specifies whether to apply the pulse width filter to the + signal. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCIDutyCycleDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_duty_cycle_dig_fltr_enable.setter + def ci_duty_cycle_dig_fltr_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetCIDutyCycleDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_duty_cycle_dig_fltr_enable.deleter + def ci_duty_cycle_dig_fltr_enable(self): + cfunc = lib_importer.windll.DAQmxResetCIDutyCycleDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_duty_cycle_dig_fltr_min_pulse_width(self): + """ + float: Specifies in seconds the minimum pulse width the digital + filter recognizes. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetCIDutyCycleDigFltrMinPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_duty_cycle_dig_fltr_min_pulse_width.setter + def ci_duty_cycle_dig_fltr_min_pulse_width(self, val): + cfunc = lib_importer.windll.DAQmxSetCIDutyCycleDigFltrMinPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_duty_cycle_dig_fltr_min_pulse_width.deleter + def ci_duty_cycle_dig_fltr_min_pulse_width(self): + cfunc = lib_importer.windll.DAQmxResetCIDutyCycleDigFltrMinPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_duty_cycle_dig_fltr_timebase_rate(self): + """ + float: Specifies in hertz the rate of the pulse width filter + timebase. NI-DAQmx uses this value to compute settings for + the filter. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetCIDutyCycleDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_duty_cycle_dig_fltr_timebase_rate.setter + def ci_duty_cycle_dig_fltr_timebase_rate(self, val): + cfunc = lib_importer.windll.DAQmxSetCIDutyCycleDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_duty_cycle_dig_fltr_timebase_rate.deleter + def ci_duty_cycle_dig_fltr_timebase_rate(self): + cfunc = lib_importer.windll.DAQmxResetCIDutyCycleDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_duty_cycle_dig_fltr_timebase_src(self): + """ + str: Specifies the input terminal of the signal to use as the + timebase of the pulse width filter. + """ + cfunc = lib_importer.windll.DAQmxGetCIDutyCycleDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_duty_cycle_dig_fltr_timebase_src.setter + def ci_duty_cycle_dig_fltr_timebase_src(self, val): + cfunc = lib_importer.windll.DAQmxSetCIDutyCycleDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_duty_cycle_dig_fltr_timebase_src.deleter + def ci_duty_cycle_dig_fltr_timebase_src(self): + cfunc = lib_importer.windll.DAQmxResetCIDutyCycleDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_duty_cycle_logic_lvl_behavior(self): + """ + :class:`nidaqmx.constants.LogicLvlBehavior`: Specifies the logic + level behavior on the input line. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIDutyCycleLogicLvlBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return LogicLvlBehavior(val.value) + + @ci_duty_cycle_logic_lvl_behavior.setter + def ci_duty_cycle_logic_lvl_behavior(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIDutyCycleLogicLvlBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_duty_cycle_logic_lvl_behavior.deleter + def ci_duty_cycle_logic_lvl_behavior(self): + cfunc = lib_importer.windll.DAQmxResetCIDutyCycleLogicLvlBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_duty_cycle_starting_edge(self): + """ + :class:`nidaqmx.constants.Edge`: Specifies which edge of the + input signal to begin the duty cycle measurement. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIDutyCycleStartingEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return Edge(val.value) + + @ci_duty_cycle_starting_edge.setter + def ci_duty_cycle_starting_edge(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIDutyCycleStartingEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_duty_cycle_starting_edge.deleter + def ci_duty_cycle_starting_edge(self): + cfunc = lib_importer.windll.DAQmxResetCIDutyCycleStartingEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_duty_cycle_term(self): + """ + str: Specifies the input terminal of the signal to measure. + """ + cfunc = lib_importer.windll.DAQmxGetCIDutyCycleTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_duty_cycle_term.setter + def ci_duty_cycle_term(self, val): + cfunc = lib_importer.windll.DAQmxSetCIDutyCycleTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_duty_cycle_term.deleter + def ci_duty_cycle_term(self): + cfunc = lib_importer.windll.DAQmxResetCIDutyCycleTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_duty_cycle_term_cfg(self): + """ + :class:`nidaqmx.constants.TerminalConfiguration`: Specifies the + input terminal configuration. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIDutyCycleTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return TerminalConfiguration(val.value) + + @ci_duty_cycle_term_cfg.setter + def ci_duty_cycle_term_cfg(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIDutyCycleTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_duty_cycle_term_cfg.deleter + def ci_duty_cycle_term_cfg(self): + cfunc = lib_importer.windll.DAQmxResetCIDutyCycleTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_encoder_a_input_dig_fltr_enable(self): + """ + bool: Specifies whether to apply the pulse width filter to the + signal. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCIEncoderAInputDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_encoder_a_input_dig_fltr_enable.setter + def ci_encoder_a_input_dig_fltr_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetCIEncoderAInputDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_encoder_a_input_dig_fltr_enable.deleter + def ci_encoder_a_input_dig_fltr_enable(self): + cfunc = lib_importer.windll.DAQmxResetCIEncoderAInputDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_encoder_a_input_dig_fltr_min_pulse_width(self): + """ + float: Specifies in seconds the minimum pulse width the filter + recognizes. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetCIEncoderAInputDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_encoder_a_input_dig_fltr_min_pulse_width.setter + def ci_encoder_a_input_dig_fltr_min_pulse_width(self, val): + cfunc = (lib_importer.windll. + DAQmxSetCIEncoderAInputDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_encoder_a_input_dig_fltr_min_pulse_width.deleter + def ci_encoder_a_input_dig_fltr_min_pulse_width(self): + cfunc = (lib_importer.windll. + DAQmxResetCIEncoderAInputDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_encoder_a_input_dig_fltr_timebase_rate(self): + """ + float: Specifies in hertz the rate of the pulse width filter + timebase. NI-DAQmx uses this value to compute settings for + the filter. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetCIEncoderAInputDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_encoder_a_input_dig_fltr_timebase_rate.setter + def ci_encoder_a_input_dig_fltr_timebase_rate(self, val): + cfunc = (lib_importer.windll. + DAQmxSetCIEncoderAInputDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_encoder_a_input_dig_fltr_timebase_rate.deleter + def ci_encoder_a_input_dig_fltr_timebase_rate(self): + cfunc = (lib_importer.windll. + DAQmxResetCIEncoderAInputDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_encoder_a_input_dig_fltr_timebase_src(self): + """ + str: Specifies the input terminal of the signal to use as the + timebase of the pulse width filter. + """ + cfunc = (lib_importer.windll. + DAQmxGetCIEncoderAInputDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_encoder_a_input_dig_fltr_timebase_src.setter + def ci_encoder_a_input_dig_fltr_timebase_src(self, val): + cfunc = (lib_importer.windll. + DAQmxSetCIEncoderAInputDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_encoder_a_input_dig_fltr_timebase_src.deleter + def ci_encoder_a_input_dig_fltr_timebase_src(self): + cfunc = (lib_importer.windll. + DAQmxResetCIEncoderAInputDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_encoder_a_input_dig_sync_enable(self): + """ + bool: Specifies whether to synchronize recognition of + transitions in the signal to the internal timebase of the + device. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCIEncoderAInputDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_encoder_a_input_dig_sync_enable.setter + def ci_encoder_a_input_dig_sync_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetCIEncoderAInputDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_encoder_a_input_dig_sync_enable.deleter + def ci_encoder_a_input_dig_sync_enable(self): + cfunc = lib_importer.windll.DAQmxResetCIEncoderAInputDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_encoder_a_input_logic_lvl_behavior(self): + """ + :class:`nidaqmx.constants.LogicLvlBehavior`: Specifies the logic + level behavior on the input line. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIEncoderAInputLogicLvlBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return LogicLvlBehavior(val.value) + + @ci_encoder_a_input_logic_lvl_behavior.setter + def ci_encoder_a_input_logic_lvl_behavior(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIEncoderAInputLogicLvlBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_encoder_a_input_logic_lvl_behavior.deleter + def ci_encoder_a_input_logic_lvl_behavior(self): + cfunc = lib_importer.windll.DAQmxResetCIEncoderAInputLogicLvlBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_encoder_a_input_term(self): + """ + str: Specifies the terminal to which signal A is connected. + """ + cfunc = lib_importer.windll.DAQmxGetCIEncoderAInputTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_encoder_a_input_term.setter + def ci_encoder_a_input_term(self, val): + cfunc = lib_importer.windll.DAQmxSetCIEncoderAInputTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_encoder_a_input_term.deleter + def ci_encoder_a_input_term(self): + cfunc = lib_importer.windll.DAQmxResetCIEncoderAInputTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_encoder_a_input_term_cfg(self): + """ + :class:`nidaqmx.constants.TerminalConfiguration`: Specifies the + input terminal configuration. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIEncoderAInputTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return TerminalConfiguration(val.value) + + @ci_encoder_a_input_term_cfg.setter + def ci_encoder_a_input_term_cfg(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIEncoderAInputTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_encoder_a_input_term_cfg.deleter + def ci_encoder_a_input_term_cfg(self): + cfunc = lib_importer.windll.DAQmxResetCIEncoderAInputTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_encoder_b_input_dig_fltr_enable(self): + """ + bool: Specifies whether to apply the pulse width filter to the + signal. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCIEncoderBInputDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_encoder_b_input_dig_fltr_enable.setter + def ci_encoder_b_input_dig_fltr_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetCIEncoderBInputDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_encoder_b_input_dig_fltr_enable.deleter + def ci_encoder_b_input_dig_fltr_enable(self): + cfunc = lib_importer.windll.DAQmxResetCIEncoderBInputDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_encoder_b_input_dig_fltr_min_pulse_width(self): + """ + float: Specifies in seconds the minimum pulse width the filter + recognizes. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetCIEncoderBInputDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_encoder_b_input_dig_fltr_min_pulse_width.setter + def ci_encoder_b_input_dig_fltr_min_pulse_width(self, val): + cfunc = (lib_importer.windll. + DAQmxSetCIEncoderBInputDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_encoder_b_input_dig_fltr_min_pulse_width.deleter + def ci_encoder_b_input_dig_fltr_min_pulse_width(self): + cfunc = (lib_importer.windll. + DAQmxResetCIEncoderBInputDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_encoder_b_input_dig_fltr_timebase_rate(self): + """ + float: Specifies in hertz the rate of the pulse width filter + timebase. NI-DAQmx uses this value to compute settings for + the filter. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetCIEncoderBInputDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_encoder_b_input_dig_fltr_timebase_rate.setter + def ci_encoder_b_input_dig_fltr_timebase_rate(self, val): + cfunc = (lib_importer.windll. + DAQmxSetCIEncoderBInputDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_encoder_b_input_dig_fltr_timebase_rate.deleter + def ci_encoder_b_input_dig_fltr_timebase_rate(self): + cfunc = (lib_importer.windll. + DAQmxResetCIEncoderBInputDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_encoder_b_input_dig_fltr_timebase_src(self): + """ + str: Specifies the input terminal of the signal to use as the + timebase of the pulse width filter. + """ + cfunc = (lib_importer.windll. + DAQmxGetCIEncoderBInputDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_encoder_b_input_dig_fltr_timebase_src.setter + def ci_encoder_b_input_dig_fltr_timebase_src(self, val): + cfunc = (lib_importer.windll. + DAQmxSetCIEncoderBInputDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_encoder_b_input_dig_fltr_timebase_src.deleter + def ci_encoder_b_input_dig_fltr_timebase_src(self): + cfunc = (lib_importer.windll. + DAQmxResetCIEncoderBInputDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_encoder_b_input_dig_sync_enable(self): + """ + bool: Specifies whether to synchronize recognition of + transitions in the signal to the internal timebase of the + device. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCIEncoderBInputDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_encoder_b_input_dig_sync_enable.setter + def ci_encoder_b_input_dig_sync_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetCIEncoderBInputDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_encoder_b_input_dig_sync_enable.deleter + def ci_encoder_b_input_dig_sync_enable(self): + cfunc = lib_importer.windll.DAQmxResetCIEncoderBInputDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_encoder_b_input_logic_lvl_behavior(self): + """ + :class:`nidaqmx.constants.LogicLvlBehavior`: Specifies the logic + level behavior on the input line. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIEncoderBInputLogicLvlBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return LogicLvlBehavior(val.value) + + @ci_encoder_b_input_logic_lvl_behavior.setter + def ci_encoder_b_input_logic_lvl_behavior(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIEncoderBInputLogicLvlBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_encoder_b_input_logic_lvl_behavior.deleter + def ci_encoder_b_input_logic_lvl_behavior(self): + cfunc = lib_importer.windll.DAQmxResetCIEncoderBInputLogicLvlBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_encoder_b_input_term(self): + """ + str: Specifies the terminal to which signal B is connected. + """ + cfunc = lib_importer.windll.DAQmxGetCIEncoderBInputTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_encoder_b_input_term.setter + def ci_encoder_b_input_term(self, val): + cfunc = lib_importer.windll.DAQmxSetCIEncoderBInputTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_encoder_b_input_term.deleter + def ci_encoder_b_input_term(self): + cfunc = lib_importer.windll.DAQmxResetCIEncoderBInputTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_encoder_b_input_term_cfg(self): + """ + :class:`nidaqmx.constants.TerminalConfiguration`: Specifies the + input terminal configuration. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIEncoderBInputTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return TerminalConfiguration(val.value) + + @ci_encoder_b_input_term_cfg.setter + def ci_encoder_b_input_term_cfg(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIEncoderBInputTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_encoder_b_input_term_cfg.deleter + def ci_encoder_b_input_term_cfg(self): + cfunc = lib_importer.windll.DAQmxResetCIEncoderBInputTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_encoder_decoding_type(self): + """ + :class:`nidaqmx.constants.EncoderType`: Specifies how to count + and interpret the pulses the encoder generates on signal A + and signal B. **EncoderType2.X_1**, **EncoderType2.X_2**, + and **EncoderType2.X_4** are valid for quadrature encoders + only. **EncoderType2.TWO_PULSE_COUNTING** is valid for two- + pulse encoders only. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIEncoderDecodingType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return EncoderType(val.value) + + @ci_encoder_decoding_type.setter + def ci_encoder_decoding_type(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIEncoderDecodingType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_encoder_decoding_type.deleter + def ci_encoder_decoding_type(self): + cfunc = lib_importer.windll.DAQmxResetCIEncoderDecodingType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_encoder_z_index_enable(self): + """ + bool: Specifies whether to use Z indexing for the channel. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCIEncoderZIndexEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_encoder_z_index_enable.setter + def ci_encoder_z_index_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetCIEncoderZIndexEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_encoder_z_index_enable.deleter + def ci_encoder_z_index_enable(self): + cfunc = lib_importer.windll.DAQmxResetCIEncoderZIndexEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_encoder_z_index_phase(self): + """ + :class:`nidaqmx.constants.EncoderZIndexPhase`: Specifies the + states at which signal A and signal B must be while signal Z + is high for NI-DAQmx to reset the measurement. If signal Z + is never high while signal A and signal B are high, for + example, you must choose a phase other than + **EncoderZIndexPhase1.AHIGH_BHIGH**. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIEncoderZIndexPhase + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return EncoderZIndexPhase(val.value) + + @ci_encoder_z_index_phase.setter + def ci_encoder_z_index_phase(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIEncoderZIndexPhase + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_encoder_z_index_phase.deleter + def ci_encoder_z_index_phase(self): + cfunc = lib_importer.windll.DAQmxResetCIEncoderZIndexPhase + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_encoder_z_index_val(self): + """ + float: Specifies the value to which to reset the measurement + when signal Z is high and signal A and signal B are at the + states you specify with **ci_encoder_z_index_phase**. + Specify this value in the units of the measurement. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetCIEncoderZIndexVal + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_encoder_z_index_val.setter + def ci_encoder_z_index_val(self, val): + cfunc = lib_importer.windll.DAQmxSetCIEncoderZIndexVal + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_encoder_z_index_val.deleter + def ci_encoder_z_index_val(self): + cfunc = lib_importer.windll.DAQmxResetCIEncoderZIndexVal + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_encoder_z_input_dig_fltr_enable(self): + """ + bool: Specifies whether to apply the pulse width filter to the + signal. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCIEncoderZInputDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_encoder_z_input_dig_fltr_enable.setter + def ci_encoder_z_input_dig_fltr_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetCIEncoderZInputDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_encoder_z_input_dig_fltr_enable.deleter + def ci_encoder_z_input_dig_fltr_enable(self): + cfunc = lib_importer.windll.DAQmxResetCIEncoderZInputDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_encoder_z_input_dig_fltr_min_pulse_width(self): + """ + float: Specifies in seconds the minimum pulse width the filter + recognizes. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetCIEncoderZInputDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_encoder_z_input_dig_fltr_min_pulse_width.setter + def ci_encoder_z_input_dig_fltr_min_pulse_width(self, val): + cfunc = (lib_importer.windll. + DAQmxSetCIEncoderZInputDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_encoder_z_input_dig_fltr_min_pulse_width.deleter + def ci_encoder_z_input_dig_fltr_min_pulse_width(self): + cfunc = (lib_importer.windll. + DAQmxResetCIEncoderZInputDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_encoder_z_input_dig_fltr_timebase_rate(self): + """ + float: Specifies in hertz the rate of the pulse width filter + timebase. NI-DAQmx uses this value to compute settings for + the filter. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetCIEncoderZInputDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_encoder_z_input_dig_fltr_timebase_rate.setter + def ci_encoder_z_input_dig_fltr_timebase_rate(self, val): + cfunc = (lib_importer.windll. + DAQmxSetCIEncoderZInputDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_encoder_z_input_dig_fltr_timebase_rate.deleter + def ci_encoder_z_input_dig_fltr_timebase_rate(self): + cfunc = (lib_importer.windll. + DAQmxResetCIEncoderZInputDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_encoder_z_input_dig_fltr_timebase_src(self): + """ + str: Specifies the input terminal of the signal to use as the + timebase of the pulse width filter. + """ + cfunc = (lib_importer.windll. + DAQmxGetCIEncoderZInputDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_encoder_z_input_dig_fltr_timebase_src.setter + def ci_encoder_z_input_dig_fltr_timebase_src(self, val): + cfunc = (lib_importer.windll. + DAQmxSetCIEncoderZInputDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_encoder_z_input_dig_fltr_timebase_src.deleter + def ci_encoder_z_input_dig_fltr_timebase_src(self): + cfunc = (lib_importer.windll. + DAQmxResetCIEncoderZInputDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_encoder_z_input_dig_sync_enable(self): + """ + bool: Specifies whether to synchronize recognition of + transitions in the signal to the internal timebase of the + device. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCIEncoderZInputDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_encoder_z_input_dig_sync_enable.setter + def ci_encoder_z_input_dig_sync_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetCIEncoderZInputDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_encoder_z_input_dig_sync_enable.deleter + def ci_encoder_z_input_dig_sync_enable(self): + cfunc = lib_importer.windll.DAQmxResetCIEncoderZInputDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_encoder_z_input_logic_lvl_behavior(self): + """ + :class:`nidaqmx.constants.LogicLvlBehavior`: Specifies the logic + level behavior on the input line. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIEncoderZInputLogicLvlBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return LogicLvlBehavior(val.value) + + @ci_encoder_z_input_logic_lvl_behavior.setter + def ci_encoder_z_input_logic_lvl_behavior(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIEncoderZInputLogicLvlBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_encoder_z_input_logic_lvl_behavior.deleter + def ci_encoder_z_input_logic_lvl_behavior(self): + cfunc = lib_importer.windll.DAQmxResetCIEncoderZInputLogicLvlBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_encoder_z_input_term(self): + """ + str: Specifies the terminal to which signal Z is connected. + """ + cfunc = lib_importer.windll.DAQmxGetCIEncoderZInputTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_encoder_z_input_term.setter + def ci_encoder_z_input_term(self, val): + cfunc = lib_importer.windll.DAQmxSetCIEncoderZInputTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_encoder_z_input_term.deleter + def ci_encoder_z_input_term(self): + cfunc = lib_importer.windll.DAQmxResetCIEncoderZInputTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_encoder_z_input_term_cfg(self): + """ + :class:`nidaqmx.constants.TerminalConfiguration`: Specifies the + input terminal configuration. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIEncoderZInputTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return TerminalConfiguration(val.value) + + @ci_encoder_z_input_term_cfg.setter + def ci_encoder_z_input_term_cfg(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIEncoderZInputTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_encoder_z_input_term_cfg.deleter + def ci_encoder_z_input_term_cfg(self): + cfunc = lib_importer.windll.DAQmxResetCIEncoderZInputTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_freq_dig_fltr_enable(self): + """ + bool: Specifies whether to apply the pulse width filter to the + signal. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCIFreqDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_freq_dig_fltr_enable.setter + def ci_freq_dig_fltr_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetCIFreqDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_freq_dig_fltr_enable.deleter + def ci_freq_dig_fltr_enable(self): + cfunc = lib_importer.windll.DAQmxResetCIFreqDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_freq_dig_fltr_min_pulse_width(self): + """ + float: Specifies in seconds the minimum pulse width the filter + recognizes. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetCIFreqDigFltrMinPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_freq_dig_fltr_min_pulse_width.setter + def ci_freq_dig_fltr_min_pulse_width(self, val): + cfunc = lib_importer.windll.DAQmxSetCIFreqDigFltrMinPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_freq_dig_fltr_min_pulse_width.deleter + def ci_freq_dig_fltr_min_pulse_width(self): + cfunc = lib_importer.windll.DAQmxResetCIFreqDigFltrMinPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_freq_dig_fltr_timebase_rate(self): + """ + float: Specifies in hertz the rate of the pulse width filter + timebase. NI-DAQmx uses this value to compute settings for + the filter. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetCIFreqDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_freq_dig_fltr_timebase_rate.setter + def ci_freq_dig_fltr_timebase_rate(self, val): + cfunc = lib_importer.windll.DAQmxSetCIFreqDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_freq_dig_fltr_timebase_rate.deleter + def ci_freq_dig_fltr_timebase_rate(self): + cfunc = lib_importer.windll.DAQmxResetCIFreqDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_freq_dig_fltr_timebase_src(self): + """ + str: Specifies the input terminal of the signal to use as the + timebase of the pulse width filter. + """ + cfunc = lib_importer.windll.DAQmxGetCIFreqDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_freq_dig_fltr_timebase_src.setter + def ci_freq_dig_fltr_timebase_src(self, val): + cfunc = lib_importer.windll.DAQmxSetCIFreqDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_freq_dig_fltr_timebase_src.deleter + def ci_freq_dig_fltr_timebase_src(self): + cfunc = lib_importer.windll.DAQmxResetCIFreqDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_freq_dig_sync_enable(self): + """ + bool: Specifies whether to synchronize recognition of + transitions in the signal to the internal timebase of the + device. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCIFreqDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_freq_dig_sync_enable.setter + def ci_freq_dig_sync_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetCIFreqDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_freq_dig_sync_enable.deleter + def ci_freq_dig_sync_enable(self): + cfunc = lib_importer.windll.DAQmxResetCIFreqDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_freq_div(self): + """ + int: Specifies the value by which to divide the input signal if + **ci_freq_meas_meth** is + **CounterFrequencyMethod.LARGE_RANGE_2_COUNTERS**. The + larger the divisor, the more accurate the measurement. + However, too large a value could cause the count register to + roll over, which results in an incorrect measurement. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetCIFreqDiv + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_freq_div.setter + def ci_freq_div(self, val): + cfunc = lib_importer.windll.DAQmxSetCIFreqDiv + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_freq_div.deleter + def ci_freq_div(self): + cfunc = lib_importer.windll.DAQmxResetCIFreqDiv + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_freq_enable_averaging(self): + """ + bool: Specifies whether to enable averaging mode for Sample + Clock-timed frequency measurements. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCIFreqEnableAveraging + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_freq_enable_averaging.setter + def ci_freq_enable_averaging(self, val): + cfunc = lib_importer.windll.DAQmxSetCIFreqEnableAveraging + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_freq_enable_averaging.deleter + def ci_freq_enable_averaging(self): + cfunc = lib_importer.windll.DAQmxResetCIFreqEnableAveraging + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_freq_logic_lvl_behavior(self): + """ + :class:`nidaqmx.constants.LogicLvlBehavior`: Specifies the logic + level behavior on the input line. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIFreqLogicLvlBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return LogicLvlBehavior(val.value) + + @ci_freq_logic_lvl_behavior.setter + def ci_freq_logic_lvl_behavior(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIFreqLogicLvlBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_freq_logic_lvl_behavior.deleter + def ci_freq_logic_lvl_behavior(self): + cfunc = lib_importer.windll.DAQmxResetCIFreqLogicLvlBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_freq_meas_meth(self): + """ + :class:`nidaqmx.constants.CounterFrequencyMethod`: Specifies the + method to use to measure the frequency of the signal. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIFreqMeasMeth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return CounterFrequencyMethod(val.value) + + @ci_freq_meas_meth.setter + def ci_freq_meas_meth(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIFreqMeasMeth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_freq_meas_meth.deleter + def ci_freq_meas_meth(self): + cfunc = lib_importer.windll.DAQmxResetCIFreqMeasMeth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_freq_meas_time(self): + """ + float: Specifies in seconds the length of time to measure the + frequency of the signal if **ci_freq_meas_meth** is + **CounterFrequencyMethod.HIGH_FREQUENCY_2_COUNTERS**. + Measurement accuracy increases with increased measurement + time and with increased signal frequency. If you measure a + high-frequency signal for too long, however, the count + register could roll over, which results in an incorrect + measurement. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetCIFreqMeasTime + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_freq_meas_time.setter + def ci_freq_meas_time(self, val): + cfunc = lib_importer.windll.DAQmxSetCIFreqMeasTime + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_freq_meas_time.deleter + def ci_freq_meas_time(self): + cfunc = lib_importer.windll.DAQmxResetCIFreqMeasTime + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_freq_starting_edge(self): + """ + :class:`nidaqmx.constants.Edge`: Specifies between which edges + to measure the frequency of the signal. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIFreqStartingEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return Edge(val.value) + + @ci_freq_starting_edge.setter + def ci_freq_starting_edge(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIFreqStartingEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_freq_starting_edge.deleter + def ci_freq_starting_edge(self): + cfunc = lib_importer.windll.DAQmxResetCIFreqStartingEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_freq_term(self): + """ + str: Specifies the input terminal of the signal to measure. + """ + cfunc = lib_importer.windll.DAQmxGetCIFreqTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_freq_term.setter + def ci_freq_term(self, val): + cfunc = lib_importer.windll.DAQmxSetCIFreqTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_freq_term.deleter + def ci_freq_term(self): + cfunc = lib_importer.windll.DAQmxResetCIFreqTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_freq_term_cfg(self): + """ + :class:`nidaqmx.constants.TerminalConfiguration`: Specifies the + input terminal configuration. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIFreqTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return TerminalConfiguration(val.value) + + @ci_freq_term_cfg.setter + def ci_freq_term_cfg(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIFreqTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_freq_term_cfg.deleter + def ci_freq_term_cfg(self): + cfunc = lib_importer.windll.DAQmxResetCIFreqTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_freq_units(self): + """ + :class:`nidaqmx.constants.FrequencyUnits`: Specifies the units + to use to return frequency measurements. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIFreqUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return FrequencyUnits(val.value) + + @ci_freq_units.setter + def ci_freq_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIFreqUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_freq_units.deleter + def ci_freq_units(self): + cfunc = lib_importer.windll.DAQmxResetCIFreqUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_gps_sync_method(self): + """ + :class:`nidaqmx.constants.GpsSignalType`: Specifies the method + to use to synchronize the counter to a GPS receiver. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIGPSSyncMethod + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return GpsSignalType(val.value) + + @ci_gps_sync_method.setter + def ci_gps_sync_method(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIGPSSyncMethod + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_gps_sync_method.deleter + def ci_gps_sync_method(self): + cfunc = lib_importer.windll.DAQmxResetCIGPSSyncMethod + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_gps_sync_src(self): + """ + str: Specifies the terminal to which the GPS synchronization + signal is connected. + """ + cfunc = lib_importer.windll.DAQmxGetCIGPSSyncSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_gps_sync_src.setter + def ci_gps_sync_src(self, val): + cfunc = lib_importer.windll.DAQmxSetCIGPSSyncSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_gps_sync_src.deleter + def ci_gps_sync_src(self): + cfunc = lib_importer.windll.DAQmxResetCIGPSSyncSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_lin_encoder_dist_per_pulse(self): + """ + float: Specifies the distance to measure for each pulse the + encoder generates on signal A or signal B. This value is in + the units you specify with **ci_lin_encoder_units**. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetCILinEncoderDistPerPulse + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_lin_encoder_dist_per_pulse.setter + def ci_lin_encoder_dist_per_pulse(self, val): + cfunc = lib_importer.windll.DAQmxSetCILinEncoderDistPerPulse + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_lin_encoder_dist_per_pulse.deleter + def ci_lin_encoder_dist_per_pulse(self): + cfunc = lib_importer.windll.DAQmxResetCILinEncoderDistPerPulse + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_lin_encoder_initial_pos(self): + """ + float: Specifies the position of the encoder when the + measurement begins. This value is in the units you specify + with **ci_lin_encoder_units**. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetCILinEncoderInitialPos + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_lin_encoder_initial_pos.setter + def ci_lin_encoder_initial_pos(self, val): + cfunc = lib_importer.windll.DAQmxSetCILinEncoderInitialPos + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_lin_encoder_initial_pos.deleter + def ci_lin_encoder_initial_pos(self): + cfunc = lib_importer.windll.DAQmxResetCILinEncoderInitialPos + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_lin_encoder_units(self): + """ + :class:`nidaqmx.constants.LengthUnits`: Specifies the units to + use to return linear encoder measurements from the channel. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCILinEncoderUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return LengthUnits(val.value) + + @ci_lin_encoder_units.setter + def ci_lin_encoder_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCILinEncoderUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_lin_encoder_units.deleter + def ci_lin_encoder_units(self): + cfunc = lib_importer.windll.DAQmxResetCILinEncoderUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_max(self): + """ + float: Specifies the maximum value you expect to measure. This + value is in the units you specify with a units property. + When you query this property, it returns the coerced maximum + value that the hardware can measure with the current + settings. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetCIMax + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_max.setter + def ci_max(self, val): + cfunc = lib_importer.windll.DAQmxSetCIMax + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_max.deleter + def ci_max(self): + cfunc = lib_importer.windll.DAQmxResetCIMax + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_max_meas_period(self): + """ + float: Specifies the maximum period (in seconds) in which the + device will recognize signals. For frequency measurements, a + signal with a higher period than the one set in this + property will return 0 Hz. For duty cycle, the device will + return 0 or 1 depending on the state of the line during the + max defined period of time. Period measurements will return + NaN. Pulse width measurement will return zero. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetCIMaxMeasPeriod + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_max_meas_period.setter + def ci_max_meas_period(self, val): + cfunc = lib_importer.windll.DAQmxSetCIMaxMeasPeriod + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_max_meas_period.deleter + def ci_max_meas_period(self): + cfunc = lib_importer.windll.DAQmxResetCIMaxMeasPeriod + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_meas_type(self): + """ + :class:`nidaqmx.constants.UsageTypeCI`: Indicates the + measurement to take with the channel. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIMeasType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return UsageTypeCI(val.value) + + @property + def ci_mem_map_enable(self): + """ + bool: Specifies for NI-DAQmx to map hardware registers to the + memory space of the application, if possible. Normally, NI- + DAQmx maps hardware registers to memory accessible only to + the kernel. Mapping the registers to the memory space of the + application increases performance. However, if the + application accesses the memory space mapped to the + registers, it can adversely affect the operation of the + device and possibly result in a system crash. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCIMemMapEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_mem_map_enable.setter + def ci_mem_map_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetCIMemMapEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_mem_map_enable.deleter + def ci_mem_map_enable(self): + cfunc = lib_importer.windll.DAQmxResetCIMemMapEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_min(self): + """ + float: Specifies the minimum value you expect to measure. This + value is in the units you specify with a units property. + When you query this property, it returns the coerced minimum + value that the hardware can measure with the current + settings. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetCIMin + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_min.setter + def ci_min(self, val): + cfunc = lib_importer.windll.DAQmxSetCIMin + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_min.deleter + def ci_min(self): + cfunc = lib_importer.windll.DAQmxResetCIMin + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_num_possibly_invalid_samps(self): + """ + int: Indicates the number of samples that the device might have + overwritten before it could transfer them to the buffer. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetCINumPossiblyInvalidSamps + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def ci_output_state(self): + """ + :class:`nidaqmx.constants.Level`: Indicates the current state of + the out terminal of the counter. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIOutputState + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return Level(val.value) + + @property + def ci_period_dig_fltr_enable(self): + """ + bool: Specifies whether to apply the pulse width filter to the + signal. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCIPeriodDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_period_dig_fltr_enable.setter + def ci_period_dig_fltr_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetCIPeriodDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_period_dig_fltr_enable.deleter + def ci_period_dig_fltr_enable(self): + cfunc = lib_importer.windll.DAQmxResetCIPeriodDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_period_dig_fltr_min_pulse_width(self): + """ + float: Specifies in seconds the minimum pulse width the filter + recognizes. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetCIPeriodDigFltrMinPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_period_dig_fltr_min_pulse_width.setter + def ci_period_dig_fltr_min_pulse_width(self, val): + cfunc = lib_importer.windll.DAQmxSetCIPeriodDigFltrMinPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_period_dig_fltr_min_pulse_width.deleter + def ci_period_dig_fltr_min_pulse_width(self): + cfunc = lib_importer.windll.DAQmxResetCIPeriodDigFltrMinPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_period_dig_fltr_timebase_rate(self): + """ + float: Specifies in hertz the rate of the pulse width filter + timebase. NI-DAQmx uses this value to compute settings for + the filter. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetCIPeriodDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_period_dig_fltr_timebase_rate.setter + def ci_period_dig_fltr_timebase_rate(self, val): + cfunc = lib_importer.windll.DAQmxSetCIPeriodDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_period_dig_fltr_timebase_rate.deleter + def ci_period_dig_fltr_timebase_rate(self): + cfunc = lib_importer.windll.DAQmxResetCIPeriodDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_period_dig_fltr_timebase_src(self): + """ + str: Specifies the input terminal of the signal to use as the + timebase of the pulse width filter. + """ + cfunc = lib_importer.windll.DAQmxGetCIPeriodDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_period_dig_fltr_timebase_src.setter + def ci_period_dig_fltr_timebase_src(self, val): + cfunc = lib_importer.windll.DAQmxSetCIPeriodDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_period_dig_fltr_timebase_src.deleter + def ci_period_dig_fltr_timebase_src(self): + cfunc = lib_importer.windll.DAQmxResetCIPeriodDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_period_dig_sync_enable(self): + """ + bool: Specifies whether to synchronize recognition of + transitions in the signal to the internal timebase of the + device. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCIPeriodDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_period_dig_sync_enable.setter + def ci_period_dig_sync_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetCIPeriodDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_period_dig_sync_enable.deleter + def ci_period_dig_sync_enable(self): + cfunc = lib_importer.windll.DAQmxResetCIPeriodDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_period_div(self): + """ + int: Specifies the value by which to divide the input signal if + **ci_period_meas_meth** is + **CounterFrequencyMethod.LARGE_RANGE_2_COUNTERS**. The + larger the divisor, the more accurate the measurement. + However, too large a value could cause the count register to + roll over, which results in an incorrect measurement. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetCIPeriodDiv + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_period_div.setter + def ci_period_div(self, val): + cfunc = lib_importer.windll.DAQmxSetCIPeriodDiv + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_period_div.deleter + def ci_period_div(self): + cfunc = lib_importer.windll.DAQmxResetCIPeriodDiv + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_period_enable_averaging(self): + """ + bool: Specifies whether to enable averaging mode for Sample + Clock-timed period measurements. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCIPeriodEnableAveraging + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_period_enable_averaging.setter + def ci_period_enable_averaging(self, val): + cfunc = lib_importer.windll.DAQmxSetCIPeriodEnableAveraging + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_period_enable_averaging.deleter + def ci_period_enable_averaging(self): + cfunc = lib_importer.windll.DAQmxResetCIPeriodEnableAveraging + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_period_logic_lvl_behavior(self): + """ + :class:`nidaqmx.constants.LogicLvlBehavior`: Specifies the logic + level behavior on the input line. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIPeriodLogicLvlBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return LogicLvlBehavior(val.value) + + @ci_period_logic_lvl_behavior.setter + def ci_period_logic_lvl_behavior(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIPeriodLogicLvlBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_period_logic_lvl_behavior.deleter + def ci_period_logic_lvl_behavior(self): + cfunc = lib_importer.windll.DAQmxResetCIPeriodLogicLvlBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_period_meas_meth(self): + """ + :class:`nidaqmx.constants.CounterFrequencyMethod`: Specifies the + method to use to measure the period of the signal. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIPeriodMeasMeth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return CounterFrequencyMethod(val.value) + + @ci_period_meas_meth.setter + def ci_period_meas_meth(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIPeriodMeasMeth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_period_meas_meth.deleter + def ci_period_meas_meth(self): + cfunc = lib_importer.windll.DAQmxResetCIPeriodMeasMeth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_period_meas_time(self): + """ + float: Specifies in seconds the length of time to measure the + period of the signal if **ci_period_meas_meth** is + **CounterFrequencyMethod.HIGH_FREQUENCY_2_COUNTERS**. + Measurement accuracy increases with increased measurement + time and with increased signal frequency. If you measure a + high-frequency signal for too long, however, the count + register could roll over, which results in an incorrect + measurement. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetCIPeriodMeasTime + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_period_meas_time.setter + def ci_period_meas_time(self, val): + cfunc = lib_importer.windll.DAQmxSetCIPeriodMeasTime + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_period_meas_time.deleter + def ci_period_meas_time(self): + cfunc = lib_importer.windll.DAQmxResetCIPeriodMeasTime + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_period_starting_edge(self): + """ + :class:`nidaqmx.constants.Edge`: Specifies between which edges + to measure the period of the signal. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIPeriodStartingEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return Edge(val.value) + + @ci_period_starting_edge.setter + def ci_period_starting_edge(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIPeriodStartingEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_period_starting_edge.deleter + def ci_period_starting_edge(self): + cfunc = lib_importer.windll.DAQmxResetCIPeriodStartingEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_period_term(self): + """ + str: Specifies the input terminal of the signal to measure. + """ + cfunc = lib_importer.windll.DAQmxGetCIPeriodTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_period_term.setter + def ci_period_term(self, val): + cfunc = lib_importer.windll.DAQmxSetCIPeriodTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_period_term.deleter + def ci_period_term(self): + cfunc = lib_importer.windll.DAQmxResetCIPeriodTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_period_term_cfg(self): + """ + :class:`nidaqmx.constants.TerminalConfiguration`: Specifies the + input terminal configuration. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIPeriodTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return TerminalConfiguration(val.value) + + @ci_period_term_cfg.setter + def ci_period_term_cfg(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIPeriodTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_period_term_cfg.deleter + def ci_period_term_cfg(self): + cfunc = lib_importer.windll.DAQmxResetCIPeriodTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_period_units(self): + """ + :class:`nidaqmx.constants.TimeUnits`: Specifies the unit to use + to return period measurements. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIPeriodUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return TimeUnits(val.value) + + @ci_period_units.setter + def ci_period_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIPeriodUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_period_units.deleter + def ci_period_units(self): + cfunc = lib_importer.windll.DAQmxResetCIPeriodUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_prescaler(self): + """ + int: Specifies the divisor to apply to the signal you connect to + the counter source terminal. Scaled data that you read takes + this setting into account. You should use a prescaler only + when you connect an external signal to the counter source + terminal and when that signal has a higher frequency than + the fastest onboard timebase. Setting this value disables + duplicate count prevention unless you explicitly set + **ci_dup_count_prevention** to True. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetCIPrescaler + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_prescaler.setter + def ci_prescaler(self, val): + cfunc = lib_importer.windll.DAQmxSetCIPrescaler + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_prescaler.deleter + def ci_prescaler(self): + cfunc = lib_importer.windll.DAQmxResetCIPrescaler + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_pulse_freq_dig_fltr_enable(self): + """ + bool: Specifies whether to apply a digital filter to the signal + to measure. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCIPulseFreqDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_pulse_freq_dig_fltr_enable.setter + def ci_pulse_freq_dig_fltr_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetCIPulseFreqDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_pulse_freq_dig_fltr_enable.deleter + def ci_pulse_freq_dig_fltr_enable(self): + cfunc = lib_importer.windll.DAQmxResetCIPulseFreqDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_pulse_freq_dig_fltr_min_pulse_width(self): + """ + float: Specifies in seconds the minimum pulse width the filter + recognizes. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetCIPulseFreqDigFltrMinPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_pulse_freq_dig_fltr_min_pulse_width.setter + def ci_pulse_freq_dig_fltr_min_pulse_width(self, val): + cfunc = lib_importer.windll.DAQmxSetCIPulseFreqDigFltrMinPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_pulse_freq_dig_fltr_min_pulse_width.deleter + def ci_pulse_freq_dig_fltr_min_pulse_width(self): + cfunc = lib_importer.windll.DAQmxResetCIPulseFreqDigFltrMinPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_pulse_freq_dig_fltr_timebase_rate(self): + """ + float: Specifies in hertz the rate of the digital filter + timebase. NI-DAQmx uses this value to compute settings for + the filter. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetCIPulseFreqDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_pulse_freq_dig_fltr_timebase_rate.setter + def ci_pulse_freq_dig_fltr_timebase_rate(self, val): + cfunc = lib_importer.windll.DAQmxSetCIPulseFreqDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_pulse_freq_dig_fltr_timebase_rate.deleter + def ci_pulse_freq_dig_fltr_timebase_rate(self): + cfunc = lib_importer.windll.DAQmxResetCIPulseFreqDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_pulse_freq_dig_fltr_timebase_src(self): + """ + str: Specifies the terminal of the signal to use as the timebase + of the digital filter. + """ + cfunc = lib_importer.windll.DAQmxGetCIPulseFreqDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_pulse_freq_dig_fltr_timebase_src.setter + def ci_pulse_freq_dig_fltr_timebase_src(self, val): + cfunc = lib_importer.windll.DAQmxSetCIPulseFreqDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_pulse_freq_dig_fltr_timebase_src.deleter + def ci_pulse_freq_dig_fltr_timebase_src(self): + cfunc = lib_importer.windll.DAQmxResetCIPulseFreqDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_pulse_freq_dig_sync_enable(self): + """ + bool: Specifies whether to synchronize recognition of + transitions in the signal to the internal timebase of the + device. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCIPulseFreqDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_pulse_freq_dig_sync_enable.setter + def ci_pulse_freq_dig_sync_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetCIPulseFreqDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_pulse_freq_dig_sync_enable.deleter + def ci_pulse_freq_dig_sync_enable(self): + cfunc = lib_importer.windll.DAQmxResetCIPulseFreqDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_pulse_freq_logic_lvl_behavior(self): + """ + :class:`nidaqmx.constants.LogicLvlBehavior`: Specifies the logic + level behavior on the count reset line. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIPulseFreqLogicLvlBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return LogicLvlBehavior(val.value) + + @ci_pulse_freq_logic_lvl_behavior.setter + def ci_pulse_freq_logic_lvl_behavior(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIPulseFreqLogicLvlBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_pulse_freq_logic_lvl_behavior.deleter + def ci_pulse_freq_logic_lvl_behavior(self): + cfunc = lib_importer.windll.DAQmxResetCIPulseFreqLogicLvlBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_pulse_freq_starting_edge(self): + """ + :class:`nidaqmx.constants.Edge`: Specifies on which edge of the + input signal to begin pulse measurement. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIPulseFreqStartEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return Edge(val.value) + + @ci_pulse_freq_starting_edge.setter + def ci_pulse_freq_starting_edge(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIPulseFreqStartEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_pulse_freq_starting_edge.deleter + def ci_pulse_freq_starting_edge(self): + cfunc = lib_importer.windll.DAQmxResetCIPulseFreqStartEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_pulse_freq_term(self): + """ + str: Specifies the input terminal of the signal to measure. + """ + cfunc = lib_importer.windll.DAQmxGetCIPulseFreqTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_pulse_freq_term.setter + def ci_pulse_freq_term(self, val): + cfunc = lib_importer.windll.DAQmxSetCIPulseFreqTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_pulse_freq_term.deleter + def ci_pulse_freq_term(self): + cfunc = lib_importer.windll.DAQmxResetCIPulseFreqTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_pulse_freq_term_cfg(self): + """ + :class:`nidaqmx.constants.TerminalConfiguration`: Specifies the + input terminal configuration. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIPulseFreqTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return TerminalConfiguration(val.value) + + @ci_pulse_freq_term_cfg.setter + def ci_pulse_freq_term_cfg(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIPulseFreqTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_pulse_freq_term_cfg.deleter + def ci_pulse_freq_term_cfg(self): + cfunc = lib_importer.windll.DAQmxResetCIPulseFreqTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_pulse_freq_units(self): + """ + :class:`nidaqmx.constants.FrequencyUnits`: Specifies the units + to use to return pulse specifications in terms of frequency. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIPulseFreqUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return FrequencyUnits(val.value) + + @ci_pulse_freq_units.setter + def ci_pulse_freq_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIPulseFreqUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_pulse_freq_units.deleter + def ci_pulse_freq_units(self): + cfunc = lib_importer.windll.DAQmxResetCIPulseFreqUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_pulse_ticks_dig_fltr_enable(self): + """ + bool: Specifies whether to apply a digital filter to the signal + to measure. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCIPulseTicksDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_pulse_ticks_dig_fltr_enable.setter + def ci_pulse_ticks_dig_fltr_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetCIPulseTicksDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_pulse_ticks_dig_fltr_enable.deleter + def ci_pulse_ticks_dig_fltr_enable(self): + cfunc = lib_importer.windll.DAQmxResetCIPulseTicksDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_pulse_ticks_dig_fltr_min_pulse_width(self): + """ + float: Specifies in seconds the minimum pulse width the filter + recognizes. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetCIPulseTicksDigFltrMinPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_pulse_ticks_dig_fltr_min_pulse_width.setter + def ci_pulse_ticks_dig_fltr_min_pulse_width(self, val): + cfunc = lib_importer.windll.DAQmxSetCIPulseTicksDigFltrMinPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_pulse_ticks_dig_fltr_min_pulse_width.deleter + def ci_pulse_ticks_dig_fltr_min_pulse_width(self): + cfunc = lib_importer.windll.DAQmxResetCIPulseTicksDigFltrMinPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_pulse_ticks_dig_fltr_timebase_rate(self): + """ + float: Specifies in hertz the rate of the digital filter + timebase. NI-DAQmx uses this value to compute settings for + the filter. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetCIPulseTicksDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_pulse_ticks_dig_fltr_timebase_rate.setter + def ci_pulse_ticks_dig_fltr_timebase_rate(self, val): + cfunc = lib_importer.windll.DAQmxSetCIPulseTicksDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_pulse_ticks_dig_fltr_timebase_rate.deleter + def ci_pulse_ticks_dig_fltr_timebase_rate(self): + cfunc = lib_importer.windll.DAQmxResetCIPulseTicksDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_pulse_ticks_dig_fltr_timebase_src(self): + """ + str: Specifies the terminal of the signal to use as the timebase + of the digital filter. + """ + cfunc = lib_importer.windll.DAQmxGetCIPulseTicksDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_pulse_ticks_dig_fltr_timebase_src.setter + def ci_pulse_ticks_dig_fltr_timebase_src(self, val): + cfunc = lib_importer.windll.DAQmxSetCIPulseTicksDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_pulse_ticks_dig_fltr_timebase_src.deleter + def ci_pulse_ticks_dig_fltr_timebase_src(self): + cfunc = lib_importer.windll.DAQmxResetCIPulseTicksDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_pulse_ticks_dig_sync_enable(self): + """ + bool: Specifies whether to synchronize recognition of + transitions in the signal to the internal timebase of the + device. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCIPulseTicksDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_pulse_ticks_dig_sync_enable.setter + def ci_pulse_ticks_dig_sync_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetCIPulseTicksDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_pulse_ticks_dig_sync_enable.deleter + def ci_pulse_ticks_dig_sync_enable(self): + cfunc = lib_importer.windll.DAQmxResetCIPulseTicksDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_pulse_ticks_logic_lvl_behavior(self): + """ + :class:`nidaqmx.constants.LogicLvlBehavior`: Specifies the logic + level behavior on the count reset line. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIPulseTicksLogicLvlBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return LogicLvlBehavior(val.value) + + @ci_pulse_ticks_logic_lvl_behavior.setter + def ci_pulse_ticks_logic_lvl_behavior(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIPulseTicksLogicLvlBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_pulse_ticks_logic_lvl_behavior.deleter + def ci_pulse_ticks_logic_lvl_behavior(self): + cfunc = lib_importer.windll.DAQmxResetCIPulseTicksLogicLvlBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_pulse_ticks_starting_edge(self): + """ + :class:`nidaqmx.constants.Edge`: Specifies on which edge of the + input signal to begin pulse measurement. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIPulseTicksStartEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return Edge(val.value) + + @ci_pulse_ticks_starting_edge.setter + def ci_pulse_ticks_starting_edge(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIPulseTicksStartEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_pulse_ticks_starting_edge.deleter + def ci_pulse_ticks_starting_edge(self): + cfunc = lib_importer.windll.DAQmxResetCIPulseTicksStartEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_pulse_ticks_term(self): + """ + str: Specifies the input terminal of the signal to measure. + """ + cfunc = lib_importer.windll.DAQmxGetCIPulseTicksTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_pulse_ticks_term.setter + def ci_pulse_ticks_term(self, val): + cfunc = lib_importer.windll.DAQmxSetCIPulseTicksTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_pulse_ticks_term.deleter + def ci_pulse_ticks_term(self): + cfunc = lib_importer.windll.DAQmxResetCIPulseTicksTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_pulse_ticks_term_cfg(self): + """ + :class:`nidaqmx.constants.TerminalConfiguration`: Specifies the + input terminal configuration. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIPulseTicksTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return TerminalConfiguration(val.value) + + @ci_pulse_ticks_term_cfg.setter + def ci_pulse_ticks_term_cfg(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIPulseTicksTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_pulse_ticks_term_cfg.deleter + def ci_pulse_ticks_term_cfg(self): + cfunc = lib_importer.windll.DAQmxResetCIPulseTicksTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_pulse_time_dig_fltr_enable(self): + """ + bool: Specifies whether to apply a digital filter to the signal + to measure. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCIPulseTimeDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_pulse_time_dig_fltr_enable.setter + def ci_pulse_time_dig_fltr_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetCIPulseTimeDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_pulse_time_dig_fltr_enable.deleter + def ci_pulse_time_dig_fltr_enable(self): + cfunc = lib_importer.windll.DAQmxResetCIPulseTimeDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_pulse_time_dig_fltr_min_pulse_width(self): + """ + float: Specifies in seconds the minimum pulse width the filter + recognizes. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetCIPulseTimeDigFltrMinPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_pulse_time_dig_fltr_min_pulse_width.setter + def ci_pulse_time_dig_fltr_min_pulse_width(self, val): + cfunc = lib_importer.windll.DAQmxSetCIPulseTimeDigFltrMinPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_pulse_time_dig_fltr_min_pulse_width.deleter + def ci_pulse_time_dig_fltr_min_pulse_width(self): + cfunc = lib_importer.windll.DAQmxResetCIPulseTimeDigFltrMinPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_pulse_time_dig_fltr_timebase_rate(self): + """ + float: Specifies in hertz the rate of the digital filter + timebase. NI-DAQmx uses this value to compute settings for + the filter. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetCIPulseTimeDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_pulse_time_dig_fltr_timebase_rate.setter + def ci_pulse_time_dig_fltr_timebase_rate(self, val): + cfunc = lib_importer.windll.DAQmxSetCIPulseTimeDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_pulse_time_dig_fltr_timebase_rate.deleter + def ci_pulse_time_dig_fltr_timebase_rate(self): + cfunc = lib_importer.windll.DAQmxResetCIPulseTimeDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_pulse_time_dig_fltr_timebase_src(self): + """ + str: Specifies the terminal of the signal to use as the timebase + of the digital filter. + """ + cfunc = lib_importer.windll.DAQmxGetCIPulseTimeDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_pulse_time_dig_fltr_timebase_src.setter + def ci_pulse_time_dig_fltr_timebase_src(self, val): + cfunc = lib_importer.windll.DAQmxSetCIPulseTimeDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_pulse_time_dig_fltr_timebase_src.deleter + def ci_pulse_time_dig_fltr_timebase_src(self): + cfunc = lib_importer.windll.DAQmxResetCIPulseTimeDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_pulse_time_dig_sync_enable(self): + """ + bool: Specifies whether to synchronize recognition of + transitions in the signal to the internal timebase of the + device. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCIPulseTimeDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_pulse_time_dig_sync_enable.setter + def ci_pulse_time_dig_sync_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetCIPulseTimeDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_pulse_time_dig_sync_enable.deleter + def ci_pulse_time_dig_sync_enable(self): + cfunc = lib_importer.windll.DAQmxResetCIPulseTimeDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_pulse_time_logic_lvl_behavior(self): + """ + :class:`nidaqmx.constants.LogicLvlBehavior`: Specifies the logic + level behavior on the count reset line. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIPulseTimeLogicLvlBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return LogicLvlBehavior(val.value) + + @ci_pulse_time_logic_lvl_behavior.setter + def ci_pulse_time_logic_lvl_behavior(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIPulseTimeLogicLvlBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_pulse_time_logic_lvl_behavior.deleter + def ci_pulse_time_logic_lvl_behavior(self): + cfunc = lib_importer.windll.DAQmxResetCIPulseTimeLogicLvlBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_pulse_time_starting_edge(self): + """ + :class:`nidaqmx.constants.Edge`: Specifies on which edge of the + input signal to begin pulse measurement. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIPulseTimeStartEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return Edge(val.value) + + @ci_pulse_time_starting_edge.setter + def ci_pulse_time_starting_edge(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIPulseTimeStartEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_pulse_time_starting_edge.deleter + def ci_pulse_time_starting_edge(self): + cfunc = lib_importer.windll.DAQmxResetCIPulseTimeStartEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_pulse_time_term(self): + """ + str: Specifies the input terminal of the signal to measure. + """ + cfunc = lib_importer.windll.DAQmxGetCIPulseTimeTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_pulse_time_term.setter + def ci_pulse_time_term(self, val): + cfunc = lib_importer.windll.DAQmxSetCIPulseTimeTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_pulse_time_term.deleter + def ci_pulse_time_term(self): + cfunc = lib_importer.windll.DAQmxResetCIPulseTimeTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_pulse_time_term_cfg(self): + """ + :class:`nidaqmx.constants.TerminalConfiguration`: Specifies the + input terminal configuration. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIPulseTimeTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return TerminalConfiguration(val.value) + + @ci_pulse_time_term_cfg.setter + def ci_pulse_time_term_cfg(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIPulseTimeTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_pulse_time_term_cfg.deleter + def ci_pulse_time_term_cfg(self): + cfunc = lib_importer.windll.DAQmxResetCIPulseTimeTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_pulse_time_units(self): + """ + :class:`nidaqmx.constants.TimeUnits`: Specifies the units to use + to return pulse specifications in terms of high time and low + time. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIPulseTimeUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return TimeUnits(val.value) + + @ci_pulse_time_units.setter + def ci_pulse_time_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIPulseTimeUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_pulse_time_units.deleter + def ci_pulse_time_units(self): + cfunc = lib_importer.windll.DAQmxResetCIPulseTimeUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_pulse_width_dig_fltr_enable(self): + """ + bool: Specifies whether to apply the pulse width filter to the + signal. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCIPulseWidthDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_pulse_width_dig_fltr_enable.setter + def ci_pulse_width_dig_fltr_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetCIPulseWidthDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_pulse_width_dig_fltr_enable.deleter + def ci_pulse_width_dig_fltr_enable(self): + cfunc = lib_importer.windll.DAQmxResetCIPulseWidthDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_pulse_width_dig_fltr_min_pulse_width(self): + """ + float: Specifies in seconds the minimum pulse width the filter + recognizes. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetCIPulseWidthDigFltrMinPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_pulse_width_dig_fltr_min_pulse_width.setter + def ci_pulse_width_dig_fltr_min_pulse_width(self, val): + cfunc = lib_importer.windll.DAQmxSetCIPulseWidthDigFltrMinPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_pulse_width_dig_fltr_min_pulse_width.deleter + def ci_pulse_width_dig_fltr_min_pulse_width(self): + cfunc = lib_importer.windll.DAQmxResetCIPulseWidthDigFltrMinPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_pulse_width_dig_fltr_timebase_rate(self): + """ + float: Specifies in hertz the rate of the pulse width filter + timebase. NI-DAQmx uses this value to compute settings for + the filter. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetCIPulseWidthDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_pulse_width_dig_fltr_timebase_rate.setter + def ci_pulse_width_dig_fltr_timebase_rate(self, val): + cfunc = lib_importer.windll.DAQmxSetCIPulseWidthDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_pulse_width_dig_fltr_timebase_rate.deleter + def ci_pulse_width_dig_fltr_timebase_rate(self): + cfunc = lib_importer.windll.DAQmxResetCIPulseWidthDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_pulse_width_dig_fltr_timebase_src(self): + """ + str: Specifies the input terminal of the signal to use as the + timebase of the pulse width filter. + """ + cfunc = lib_importer.windll.DAQmxGetCIPulseWidthDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_pulse_width_dig_fltr_timebase_src.setter + def ci_pulse_width_dig_fltr_timebase_src(self, val): + cfunc = lib_importer.windll.DAQmxSetCIPulseWidthDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_pulse_width_dig_fltr_timebase_src.deleter + def ci_pulse_width_dig_fltr_timebase_src(self): + cfunc = lib_importer.windll.DAQmxResetCIPulseWidthDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_pulse_width_dig_sync_enable(self): + """ + bool: Specifies whether to synchronize recognition of + transitions in the signal to the internal timebase of the + device. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCIPulseWidthDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_pulse_width_dig_sync_enable.setter + def ci_pulse_width_dig_sync_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetCIPulseWidthDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_pulse_width_dig_sync_enable.deleter + def ci_pulse_width_dig_sync_enable(self): + cfunc = lib_importer.windll.DAQmxResetCIPulseWidthDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_pulse_width_logic_lvl_behavior(self): + """ + :class:`nidaqmx.constants.LogicLvlBehavior`: Specifies the logic + level behavior on the input line. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIPulseWidthLogicLvlBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return LogicLvlBehavior(val.value) + + @ci_pulse_width_logic_lvl_behavior.setter + def ci_pulse_width_logic_lvl_behavior(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIPulseWidthLogicLvlBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_pulse_width_logic_lvl_behavior.deleter + def ci_pulse_width_logic_lvl_behavior(self): + cfunc = lib_importer.windll.DAQmxResetCIPulseWidthLogicLvlBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_pulse_width_starting_edge(self): + """ + :class:`nidaqmx.constants.Edge`: Specifies on which edge of the + input signal to begin each pulse width measurement. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIPulseWidthStartingEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return Edge(val.value) + + @ci_pulse_width_starting_edge.setter + def ci_pulse_width_starting_edge(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIPulseWidthStartingEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_pulse_width_starting_edge.deleter + def ci_pulse_width_starting_edge(self): + cfunc = lib_importer.windll.DAQmxResetCIPulseWidthStartingEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_pulse_width_term(self): + """ + str: Specifies the input terminal of the signal to measure. + """ + cfunc = lib_importer.windll.DAQmxGetCIPulseWidthTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_pulse_width_term.setter + def ci_pulse_width_term(self, val): + cfunc = lib_importer.windll.DAQmxSetCIPulseWidthTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_pulse_width_term.deleter + def ci_pulse_width_term(self): + cfunc = lib_importer.windll.DAQmxResetCIPulseWidthTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_pulse_width_term_cfg(self): + """ + :class:`nidaqmx.constants.TerminalConfiguration`: Specifies the + input terminal configuration. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIPulseWidthTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return TerminalConfiguration(val.value) + + @ci_pulse_width_term_cfg.setter + def ci_pulse_width_term_cfg(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIPulseWidthTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_pulse_width_term_cfg.deleter + def ci_pulse_width_term_cfg(self): + cfunc = lib_importer.windll.DAQmxResetCIPulseWidthTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_pulse_width_units(self): + """ + :class:`nidaqmx.constants.TimeUnits`: Specifies the units to use + to return pulse width measurements. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIPulseWidthUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return TimeUnits(val.value) + + @ci_pulse_width_units.setter + def ci_pulse_width_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIPulseWidthUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_pulse_width_units.deleter + def ci_pulse_width_units(self): + cfunc = lib_importer.windll.DAQmxResetCIPulseWidthUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_samp_clk_overrun_behavior(self): + """ + :class:`nidaqmx.constants.SampClkOverrunBehavior`: Specifies the + counter behavior when data is read but a new value was not + detected during a sample clock. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCISampClkOverrunBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return SampClkOverrunBehavior(val.value) + + @ci_samp_clk_overrun_behavior.setter + def ci_samp_clk_overrun_behavior(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCISampClkOverrunBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_samp_clk_overrun_behavior.deleter + def ci_samp_clk_overrun_behavior(self): + cfunc = lib_importer.windll.DAQmxResetCISampClkOverrunBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_samp_clk_overrun_sentinel_val(self): + """ + int: Specifies the sentinel value returned when the No New + Sample Behavior is set to Sentinel Value. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCISampClkOverrunSentinelVal + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_samp_clk_overrun_sentinel_val.setter + def ci_samp_clk_overrun_sentinel_val(self, val): + cfunc = lib_importer.windll.DAQmxSetCISampClkOverrunSentinelVal + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_samp_clk_overrun_sentinel_val.deleter + def ci_samp_clk_overrun_sentinel_val(self): + cfunc = lib_importer.windll.DAQmxResetCISampClkOverrunSentinelVal + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_semi_period_dig_fltr_enable(self): + """ + bool: Specifies whether to apply the pulse width filter to the + signal. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCISemiPeriodDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_semi_period_dig_fltr_enable.setter + def ci_semi_period_dig_fltr_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetCISemiPeriodDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_semi_period_dig_fltr_enable.deleter + def ci_semi_period_dig_fltr_enable(self): + cfunc = lib_importer.windll.DAQmxResetCISemiPeriodDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_semi_period_dig_fltr_min_pulse_width(self): + """ + float: Specifies in seconds the minimum pulse width the filter + recognizes. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetCISemiPeriodDigFltrMinPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_semi_period_dig_fltr_min_pulse_width.setter + def ci_semi_period_dig_fltr_min_pulse_width(self, val): + cfunc = lib_importer.windll.DAQmxSetCISemiPeriodDigFltrMinPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_semi_period_dig_fltr_min_pulse_width.deleter + def ci_semi_period_dig_fltr_min_pulse_width(self): + cfunc = lib_importer.windll.DAQmxResetCISemiPeriodDigFltrMinPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_semi_period_dig_fltr_timebase_rate(self): + """ + float: Specifies in hertz the rate of the pulse width filter + timebase. NI-DAQmx uses this value to compute settings for + the filter. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetCISemiPeriodDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_semi_period_dig_fltr_timebase_rate.setter + def ci_semi_period_dig_fltr_timebase_rate(self, val): + cfunc = lib_importer.windll.DAQmxSetCISemiPeriodDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_semi_period_dig_fltr_timebase_rate.deleter + def ci_semi_period_dig_fltr_timebase_rate(self): + cfunc = lib_importer.windll.DAQmxResetCISemiPeriodDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_semi_period_dig_fltr_timebase_src(self): + """ + str: Specifies the input terminal of the signal to use as the + timebase of the pulse width filter. + """ + cfunc = lib_importer.windll.DAQmxGetCISemiPeriodDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_semi_period_dig_fltr_timebase_src.setter + def ci_semi_period_dig_fltr_timebase_src(self, val): + cfunc = lib_importer.windll.DAQmxSetCISemiPeriodDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_semi_period_dig_fltr_timebase_src.deleter + def ci_semi_period_dig_fltr_timebase_src(self): + cfunc = lib_importer.windll.DAQmxResetCISemiPeriodDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_semi_period_dig_sync_enable(self): + """ + bool: Specifies whether to synchronize recognition of + transitions in the signal to the internal timebase of the + device. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCISemiPeriodDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_semi_period_dig_sync_enable.setter + def ci_semi_period_dig_sync_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetCISemiPeriodDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_semi_period_dig_sync_enable.deleter + def ci_semi_period_dig_sync_enable(self): + cfunc = lib_importer.windll.DAQmxResetCISemiPeriodDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_semi_period_logic_lvl_behavior(self): + """ + :class:`nidaqmx.constants.LogicLvlBehavior`: Specifies the logic + level behavior on the count reset line. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCISemiPeriodLogicLvlBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return LogicLvlBehavior(val.value) + + @ci_semi_period_logic_lvl_behavior.setter + def ci_semi_period_logic_lvl_behavior(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCISemiPeriodLogicLvlBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_semi_period_logic_lvl_behavior.deleter + def ci_semi_period_logic_lvl_behavior(self): + cfunc = lib_importer.windll.DAQmxResetCISemiPeriodLogicLvlBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_semi_period_starting_edge(self): + """ + :class:`nidaqmx.constants.Edge`: Specifies on which edge of the + input signal to begin semi-period measurement. Semi-period + measurements alternate between high time and low time, + starting on this edge. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCISemiPeriodStartingEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return Edge(val.value) + + @ci_semi_period_starting_edge.setter + def ci_semi_period_starting_edge(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCISemiPeriodStartingEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_semi_period_starting_edge.deleter + def ci_semi_period_starting_edge(self): + cfunc = lib_importer.windll.DAQmxResetCISemiPeriodStartingEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_semi_period_term(self): + """ + str: Specifies the input terminal of the signal to measure. + """ + cfunc = lib_importer.windll.DAQmxGetCISemiPeriodTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_semi_period_term.setter + def ci_semi_period_term(self, val): + cfunc = lib_importer.windll.DAQmxSetCISemiPeriodTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_semi_period_term.deleter + def ci_semi_period_term(self): + cfunc = lib_importer.windll.DAQmxResetCISemiPeriodTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_semi_period_term_cfg(self): + """ + :class:`nidaqmx.constants.TerminalConfiguration`: Specifies the + input terminal configuration. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCISemiPeriodTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return TerminalConfiguration(val.value) + + @ci_semi_period_term_cfg.setter + def ci_semi_period_term_cfg(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCISemiPeriodTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_semi_period_term_cfg.deleter + def ci_semi_period_term_cfg(self): + cfunc = lib_importer.windll.DAQmxResetCISemiPeriodTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_semi_period_units(self): + """ + :class:`nidaqmx.constants.TimeUnits`: Specifies the units to use + to return semi-period measurements. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCISemiPeriodUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return TimeUnits(val.value) + + @ci_semi_period_units.setter + def ci_semi_period_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCISemiPeriodUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_semi_period_units.deleter + def ci_semi_period_units(self): + cfunc = lib_importer.windll.DAQmxResetCISemiPeriodUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_thresh_voltage(self): + """ + float: Specifies the digital threshold value in Volts for high + and low input transitions. Some devices do not support this + for differential channels. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetCIThreshVoltage + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_thresh_voltage.setter + def ci_thresh_voltage(self, val): + cfunc = lib_importer.windll.DAQmxSetCIThreshVoltage + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_thresh_voltage.deleter + def ci_thresh_voltage(self): + cfunc = lib_importer.windll.DAQmxResetCIThreshVoltage + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_timestamp_initial_seconds(self): + """ + int: Specifies the number of seconds that elapsed since the + beginning of the current year. This value is ignored if + **ci_gps_sync_method** is **GpsSignalType1.IRIGB**. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetCITimestampInitialSeconds + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_timestamp_initial_seconds.setter + def ci_timestamp_initial_seconds(self, val): + cfunc = lib_importer.windll.DAQmxSetCITimestampInitialSeconds + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_timestamp_initial_seconds.deleter + def ci_timestamp_initial_seconds(self): + cfunc = lib_importer.windll.DAQmxResetCITimestampInitialSeconds + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_timestamp_units(self): + """ + :class:`nidaqmx.constants.TimeUnits`: Specifies the units to use + to return timestamp measurements. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCITimestampUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return TimeUnits(val.value) + + @ci_timestamp_units.setter + def ci_timestamp_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCITimestampUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_timestamp_units.deleter + def ci_timestamp_units(self): + cfunc = lib_importer.windll.DAQmxResetCITimestampUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_two_edge_sep_first_dig_fltr_enable(self): + """ + bool: Specifies whether to apply the pulse width filter to the + signal. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCITwoEdgeSepFirstDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_two_edge_sep_first_dig_fltr_enable.setter + def ci_two_edge_sep_first_dig_fltr_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetCITwoEdgeSepFirstDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_two_edge_sep_first_dig_fltr_enable.deleter + def ci_two_edge_sep_first_dig_fltr_enable(self): + cfunc = lib_importer.windll.DAQmxResetCITwoEdgeSepFirstDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_two_edge_sep_first_dig_fltr_min_pulse_width(self): + """ + float: Specifies in seconds the minimum pulse width the filter + recognizes. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetCITwoEdgeSepFirstDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_two_edge_sep_first_dig_fltr_min_pulse_width.setter + def ci_two_edge_sep_first_dig_fltr_min_pulse_width(self, val): + cfunc = (lib_importer.windll. + DAQmxSetCITwoEdgeSepFirstDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_two_edge_sep_first_dig_fltr_min_pulse_width.deleter + def ci_two_edge_sep_first_dig_fltr_min_pulse_width(self): + cfunc = (lib_importer.windll. + DAQmxResetCITwoEdgeSepFirstDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_two_edge_sep_first_dig_fltr_timebase_rate(self): + """ + float: Specifies in hertz the rate of the pulse width filter + timebase. NI-DAQmx uses this value to compute settings for + the filter. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetCITwoEdgeSepFirstDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_two_edge_sep_first_dig_fltr_timebase_rate.setter + def ci_two_edge_sep_first_dig_fltr_timebase_rate(self, val): + cfunc = (lib_importer.windll. + DAQmxSetCITwoEdgeSepFirstDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_two_edge_sep_first_dig_fltr_timebase_rate.deleter + def ci_two_edge_sep_first_dig_fltr_timebase_rate(self): + cfunc = (lib_importer.windll. + DAQmxResetCITwoEdgeSepFirstDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_two_edge_sep_first_dig_fltr_timebase_src(self): + """ + str: Specifies the input terminal of the signal to use as the + timebase of the pulse width filter. + """ + cfunc = (lib_importer.windll. + DAQmxGetCITwoEdgeSepFirstDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_two_edge_sep_first_dig_fltr_timebase_src.setter + def ci_two_edge_sep_first_dig_fltr_timebase_src(self, val): + cfunc = (lib_importer.windll. + DAQmxSetCITwoEdgeSepFirstDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_two_edge_sep_first_dig_fltr_timebase_src.deleter + def ci_two_edge_sep_first_dig_fltr_timebase_src(self): + cfunc = (lib_importer.windll. + DAQmxResetCITwoEdgeSepFirstDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_two_edge_sep_first_dig_sync_enable(self): + """ + bool: Specifies whether to synchronize recognition of + transitions in the signal to the internal timebase of the + device. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCITwoEdgeSepFirstDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_two_edge_sep_first_dig_sync_enable.setter + def ci_two_edge_sep_first_dig_sync_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetCITwoEdgeSepFirstDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_two_edge_sep_first_dig_sync_enable.deleter + def ci_two_edge_sep_first_dig_sync_enable(self): + cfunc = lib_importer.windll.DAQmxResetCITwoEdgeSepFirstDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_two_edge_sep_first_edge(self): + """ + :class:`nidaqmx.constants.Edge`: Specifies on which edge of the + first signal to start each measurement. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCITwoEdgeSepFirstEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return Edge(val.value) + + @ci_two_edge_sep_first_edge.setter + def ci_two_edge_sep_first_edge(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCITwoEdgeSepFirstEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_two_edge_sep_first_edge.deleter + def ci_two_edge_sep_first_edge(self): + cfunc = lib_importer.windll.DAQmxResetCITwoEdgeSepFirstEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_two_edge_sep_first_logic_lvl_behavior(self): + """ + :class:`nidaqmx.constants.LogicLvlBehavior`: Specifies the logic + level behavior on the input line. + """ + val = ctypes.c_int() + + cfunc = (lib_importer.windll. + DAQmxGetCITwoEdgeSepFirstLogicLvlBehavior) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return LogicLvlBehavior(val.value) + + @ci_two_edge_sep_first_logic_lvl_behavior.setter + def ci_two_edge_sep_first_logic_lvl_behavior(self, val): + val = val.value + cfunc = (lib_importer.windll. + DAQmxSetCITwoEdgeSepFirstLogicLvlBehavior) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_two_edge_sep_first_logic_lvl_behavior.deleter + def ci_two_edge_sep_first_logic_lvl_behavior(self): + cfunc = (lib_importer.windll. + DAQmxResetCITwoEdgeSepFirstLogicLvlBehavior) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_two_edge_sep_first_term(self): + """ + str: Specifies the source terminal of the digital signal that + starts each measurement. + """ + cfunc = lib_importer.windll.DAQmxGetCITwoEdgeSepFirstTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_two_edge_sep_first_term.setter + def ci_two_edge_sep_first_term(self, val): + cfunc = lib_importer.windll.DAQmxSetCITwoEdgeSepFirstTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_two_edge_sep_first_term.deleter + def ci_two_edge_sep_first_term(self): + cfunc = lib_importer.windll.DAQmxResetCITwoEdgeSepFirstTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_two_edge_sep_first_term_cfg(self): + """ + :class:`nidaqmx.constants.TerminalConfiguration`: Specifies the + input terminal configuration. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCITwoEdgeSepFirstTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return TerminalConfiguration(val.value) + + @ci_two_edge_sep_first_term_cfg.setter + def ci_two_edge_sep_first_term_cfg(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCITwoEdgeSepFirstTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_two_edge_sep_first_term_cfg.deleter + def ci_two_edge_sep_first_term_cfg(self): + cfunc = lib_importer.windll.DAQmxResetCITwoEdgeSepFirstTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_two_edge_sep_second_dig_fltr_enable(self): + """ + bool: Specifies whether to apply the pulse width filter to the + signal. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCITwoEdgeSepSecondDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_two_edge_sep_second_dig_fltr_enable.setter + def ci_two_edge_sep_second_dig_fltr_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetCITwoEdgeSepSecondDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_two_edge_sep_second_dig_fltr_enable.deleter + def ci_two_edge_sep_second_dig_fltr_enable(self): + cfunc = lib_importer.windll.DAQmxResetCITwoEdgeSepSecondDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_two_edge_sep_second_dig_fltr_min_pulse_width(self): + """ + float: Specifies in seconds the minimum pulse width the filter + recognizes. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetCITwoEdgeSepSecondDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_two_edge_sep_second_dig_fltr_min_pulse_width.setter + def ci_two_edge_sep_second_dig_fltr_min_pulse_width(self, val): + cfunc = (lib_importer.windll. + DAQmxSetCITwoEdgeSepSecondDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_two_edge_sep_second_dig_fltr_min_pulse_width.deleter + def ci_two_edge_sep_second_dig_fltr_min_pulse_width(self): + cfunc = (lib_importer.windll. + DAQmxResetCITwoEdgeSepSecondDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_two_edge_sep_second_dig_fltr_timebase_rate(self): + """ + float: Specifies in hertz the rate of the pulse width filter + timebase. NI-DAQmx uses this value to compute settings for + the filter. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetCITwoEdgeSepSecondDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_two_edge_sep_second_dig_fltr_timebase_rate.setter + def ci_two_edge_sep_second_dig_fltr_timebase_rate(self, val): + cfunc = (lib_importer.windll. + DAQmxSetCITwoEdgeSepSecondDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_two_edge_sep_second_dig_fltr_timebase_rate.deleter + def ci_two_edge_sep_second_dig_fltr_timebase_rate(self): + cfunc = (lib_importer.windll. + DAQmxResetCITwoEdgeSepSecondDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_two_edge_sep_second_dig_fltr_timebase_src(self): + """ + str: Specifies the input terminal of the signal to use as the + timebase of the pulse width filter. + """ + cfunc = (lib_importer.windll. + DAQmxGetCITwoEdgeSepSecondDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_two_edge_sep_second_dig_fltr_timebase_src.setter + def ci_two_edge_sep_second_dig_fltr_timebase_src(self, val): + cfunc = (lib_importer.windll. + DAQmxSetCITwoEdgeSepSecondDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_two_edge_sep_second_dig_fltr_timebase_src.deleter + def ci_two_edge_sep_second_dig_fltr_timebase_src(self): + cfunc = (lib_importer.windll. + DAQmxResetCITwoEdgeSepSecondDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_two_edge_sep_second_dig_sync_enable(self): + """ + bool: Specifies whether to synchronize recognition of + transitions in the signal to the internal timebase of the + device. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCITwoEdgeSepSecondDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_two_edge_sep_second_dig_sync_enable.setter + def ci_two_edge_sep_second_dig_sync_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetCITwoEdgeSepSecondDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_two_edge_sep_second_dig_sync_enable.deleter + def ci_two_edge_sep_second_dig_sync_enable(self): + cfunc = lib_importer.windll.DAQmxResetCITwoEdgeSepSecondDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_two_edge_sep_second_edge(self): + """ + :class:`nidaqmx.constants.Edge`: Specifies on which edge of the + second signal to stop each measurement. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCITwoEdgeSepSecondEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return Edge(val.value) + + @ci_two_edge_sep_second_edge.setter + def ci_two_edge_sep_second_edge(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCITwoEdgeSepSecondEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_two_edge_sep_second_edge.deleter + def ci_two_edge_sep_second_edge(self): + cfunc = lib_importer.windll.DAQmxResetCITwoEdgeSepSecondEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_two_edge_sep_second_logic_lvl_behavior(self): + """ + :class:`nidaqmx.constants.LogicLvlBehavior`: Specifies the logic + level behavior on the count reset line. + """ + val = ctypes.c_int() + + cfunc = (lib_importer.windll. + DAQmxGetCITwoEdgeSepSecondLogicLvlBehavior) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return LogicLvlBehavior(val.value) + + @ci_two_edge_sep_second_logic_lvl_behavior.setter + def ci_two_edge_sep_second_logic_lvl_behavior(self, val): + val = val.value + cfunc = (lib_importer.windll. + DAQmxSetCITwoEdgeSepSecondLogicLvlBehavior) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_two_edge_sep_second_logic_lvl_behavior.deleter + def ci_two_edge_sep_second_logic_lvl_behavior(self): + cfunc = (lib_importer.windll. + DAQmxResetCITwoEdgeSepSecondLogicLvlBehavior) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_two_edge_sep_second_term(self): + """ + str: Specifies the source terminal of the digital signal that + stops each measurement. + """ + cfunc = lib_importer.windll.DAQmxGetCITwoEdgeSepSecondTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_two_edge_sep_second_term.setter + def ci_two_edge_sep_second_term(self, val): + cfunc = lib_importer.windll.DAQmxSetCITwoEdgeSepSecondTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_two_edge_sep_second_term.deleter + def ci_two_edge_sep_second_term(self): + cfunc = lib_importer.windll.DAQmxResetCITwoEdgeSepSecondTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_two_edge_sep_second_term_cfg(self): + """ + :class:`nidaqmx.constants.TerminalConfiguration`: Specifies the + input terminal configuration. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCITwoEdgeSepSecondTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return TerminalConfiguration(val.value) + + @ci_two_edge_sep_second_term_cfg.setter + def ci_two_edge_sep_second_term_cfg(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCITwoEdgeSepSecondTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_two_edge_sep_second_term_cfg.deleter + def ci_two_edge_sep_second_term_cfg(self): + cfunc = lib_importer.windll.DAQmxResetCITwoEdgeSepSecondTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_two_edge_sep_units(self): + """ + :class:`nidaqmx.constants.TimeUnits`: Specifies the units to use + to return two-edge separation measurements from the channel. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCITwoEdgeSepUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return TimeUnits(val.value) + + @ci_two_edge_sep_units.setter + def ci_two_edge_sep_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCITwoEdgeSepUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_two_edge_sep_units.deleter + def ci_two_edge_sep_units(self): + cfunc = lib_importer.windll.DAQmxResetCITwoEdgeSepUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_usb_xfer_req_count(self): + """ + int: Specifies the maximum number of simultaneous USB transfers + used to stream data. Modify this value to affect performance + under different combinations of operating system and device. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetCIUsbXferReqCount + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_usb_xfer_req_count.setter + def ci_usb_xfer_req_count(self, val): + cfunc = lib_importer.windll.DAQmxSetCIUsbXferReqCount + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_usb_xfer_req_count.deleter + def ci_usb_xfer_req_count(self): + cfunc = lib_importer.windll.DAQmxResetCIUsbXferReqCount + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_usb_xfer_req_size(self): + """ + int: Specifies the maximum size of a USB transfer request in + bytes. Modify this value to affect performance under + different combinations of operating system and device. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetCIUsbXferReqSize + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_usb_xfer_req_size.setter + def ci_usb_xfer_req_size(self, val): + cfunc = lib_importer.windll.DAQmxSetCIUsbXferReqSize + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_usb_xfer_req_size.deleter + def ci_usb_xfer_req_size(self): + cfunc = lib_importer.windll.DAQmxResetCIUsbXferReqSize + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_velocity_a_input_dig_fltr_enable(self): + """ + bool: Specifies whether to apply the pulse width filter to the + signal. + """ + val = ctypes.c_bool() + + cfunc = (lib_importer.windll. + DAQmxGetCIVelocityEncoderAInputDigFltrEnable) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_velocity_a_input_dig_fltr_enable.setter + def ci_velocity_a_input_dig_fltr_enable(self, val): + cfunc = (lib_importer.windll. + DAQmxSetCIVelocityEncoderAInputDigFltrEnable) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_velocity_a_input_dig_fltr_enable.deleter + def ci_velocity_a_input_dig_fltr_enable(self): + cfunc = (lib_importer.windll. + DAQmxResetCIVelocityEncoderAInputDigFltrEnable) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_velocity_a_input_dig_fltr_min_pulse_width(self): + """ + float: Specifies in seconds the minimum pulse width the digital + filter recognizes. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetCIVelocityEncoderAInputDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_velocity_a_input_dig_fltr_min_pulse_width.setter + def ci_velocity_a_input_dig_fltr_min_pulse_width(self, val): + cfunc = (lib_importer.windll. + DAQmxSetCIVelocityEncoderAInputDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_velocity_a_input_dig_fltr_min_pulse_width.deleter + def ci_velocity_a_input_dig_fltr_min_pulse_width(self): + cfunc = (lib_importer.windll. + DAQmxResetCIVelocityEncoderAInputDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_velocity_a_input_dig_fltr_timebase_rate(self): + """ + float: Specifies in hertz the rate of the pulse width filter + timebase. NI-DAQmx uses this value to compute settings for + the filter. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetCIVelocityEncoderAInputDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_velocity_a_input_dig_fltr_timebase_rate.setter + def ci_velocity_a_input_dig_fltr_timebase_rate(self, val): + cfunc = (lib_importer.windll. + DAQmxSetCIVelocityEncoderAInputDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_velocity_a_input_dig_fltr_timebase_rate.deleter + def ci_velocity_a_input_dig_fltr_timebase_rate(self): + cfunc = (lib_importer.windll. + DAQmxResetCIVelocityEncoderAInputDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_velocity_a_input_dig_fltr_timebase_src(self): + """ + str: Specifies the input terminal of the signal to use as the + timebase of the pulse width filter. + """ + cfunc = (lib_importer.windll. + DAQmxGetCIVelocityEncoderAInputDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_velocity_a_input_dig_fltr_timebase_src.setter + def ci_velocity_a_input_dig_fltr_timebase_src(self, val): + cfunc = (lib_importer.windll. + DAQmxSetCIVelocityEncoderAInputDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_velocity_a_input_dig_fltr_timebase_src.deleter + def ci_velocity_a_input_dig_fltr_timebase_src(self): + cfunc = (lib_importer.windll. + DAQmxResetCIVelocityEncoderAInputDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_velocity_a_input_logic_lvl_behavior(self): + """ + :class:`nidaqmx.constants.LogicLvlBehavior`: Specifies the logic + level behavior of the input terminal. + """ + val = ctypes.c_int() + + cfunc = (lib_importer.windll. + DAQmxGetCIVelocityEncoderAInputLogicLvlBehavior) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return LogicLvlBehavior(val.value) + + @ci_velocity_a_input_logic_lvl_behavior.setter + def ci_velocity_a_input_logic_lvl_behavior(self, val): + val = val.value + cfunc = (lib_importer.windll. + DAQmxSetCIVelocityEncoderAInputLogicLvlBehavior) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_velocity_a_input_logic_lvl_behavior.deleter + def ci_velocity_a_input_logic_lvl_behavior(self): + cfunc = (lib_importer.windll. + DAQmxResetCIVelocityEncoderAInputLogicLvlBehavior) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_velocity_a_input_term(self): + """ + str: Specifies the terminal to which signal A is connected. + """ + cfunc = lib_importer.windll.DAQmxGetCIVelocityEncoderAInputTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_velocity_a_input_term.setter + def ci_velocity_a_input_term(self, val): + cfunc = lib_importer.windll.DAQmxSetCIVelocityEncoderAInputTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_velocity_a_input_term.deleter + def ci_velocity_a_input_term(self): + cfunc = lib_importer.windll.DAQmxResetCIVelocityEncoderAInputTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_velocity_a_input_term_cfg(self): + """ + :class:`nidaqmx.constants.TerminalConfiguration`: Specifies the + input terminal configuration. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIVelocityEncoderAInputTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return TerminalConfiguration(val.value) + + @ci_velocity_a_input_term_cfg.setter + def ci_velocity_a_input_term_cfg(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIVelocityEncoderAInputTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_velocity_a_input_term_cfg.deleter + def ci_velocity_a_input_term_cfg(self): + cfunc = lib_importer.windll.DAQmxResetCIVelocityEncoderAInputTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_velocity_ang_encoder_pulses_per_rev(self): + """ + int: Specifies the number of pulses the encoder generates per + revolution. This value is the number of pulses on either + signal A or signal B, not the total number of pulses on both + signal A and signal B. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetCIVelocityAngEncoderPulsesPerRev + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_velocity_ang_encoder_pulses_per_rev.setter + def ci_velocity_ang_encoder_pulses_per_rev(self, val): + cfunc = lib_importer.windll.DAQmxSetCIVelocityAngEncoderPulsesPerRev + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_velocity_ang_encoder_pulses_per_rev.deleter + def ci_velocity_ang_encoder_pulses_per_rev(self): + cfunc = lib_importer.windll.DAQmxResetCIVelocityAngEncoderPulsesPerRev + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_velocity_ang_encoder_units(self): + """ + :class:`nidaqmx.constants.AngularVelocityUnits`: Specifies the + units to use to return angular velocity counter + measurements. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIVelocityAngEncoderUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return AngularVelocityUnits(val.value) + + @ci_velocity_ang_encoder_units.setter + def ci_velocity_ang_encoder_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIVelocityAngEncoderUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_velocity_ang_encoder_units.deleter + def ci_velocity_ang_encoder_units(self): + cfunc = lib_importer.windll.DAQmxResetCIVelocityAngEncoderUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_velocity_b_input_dig_fltr_enable(self): + """ + bool: Specifies whether to apply the pulse width filter to the + signal. + """ + val = ctypes.c_bool() + + cfunc = (lib_importer.windll. + DAQmxGetCIVelocityEncoderBInputDigFltrEnable) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_velocity_b_input_dig_fltr_enable.setter + def ci_velocity_b_input_dig_fltr_enable(self, val): + cfunc = (lib_importer.windll. + DAQmxSetCIVelocityEncoderBInputDigFltrEnable) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_velocity_b_input_dig_fltr_enable.deleter + def ci_velocity_b_input_dig_fltr_enable(self): + cfunc = (lib_importer.windll. + DAQmxResetCIVelocityEncoderBInputDigFltrEnable) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_velocity_b_input_dig_fltr_min_pulse_width(self): + """ + float: Specifies in seconds the minimum pulse width the digital + filter recognizes. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetCIVelocityEncoderBInputDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_velocity_b_input_dig_fltr_min_pulse_width.setter + def ci_velocity_b_input_dig_fltr_min_pulse_width(self, val): + cfunc = (lib_importer.windll. + DAQmxSetCIVelocityEncoderBInputDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_velocity_b_input_dig_fltr_min_pulse_width.deleter + def ci_velocity_b_input_dig_fltr_min_pulse_width(self): + cfunc = (lib_importer.windll. + DAQmxResetCIVelocityEncoderBInputDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_velocity_b_input_dig_fltr_timebase_rate(self): + """ + float: Specifies in hertz the rate of the pulse width filter + timebase. NI-DAQmx uses this value to compute settings for + the filter. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetCIVelocityEncoderBInputDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_velocity_b_input_dig_fltr_timebase_rate.setter + def ci_velocity_b_input_dig_fltr_timebase_rate(self, val): + cfunc = (lib_importer.windll. + DAQmxSetCIVelocityEncoderBInputDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_velocity_b_input_dig_fltr_timebase_rate.deleter + def ci_velocity_b_input_dig_fltr_timebase_rate(self): + cfunc = (lib_importer.windll. + DAQmxResetCIVelocityEncoderBInputDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_velocity_b_input_dig_fltr_timebase_src(self): + """ + str: Specifies the input terminal of the signal to use as the + timebase of the pulse width filter. + """ + cfunc = (lib_importer.windll. + DAQmxGetCIVelocityEncoderBInputDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_velocity_b_input_dig_fltr_timebase_src.setter + def ci_velocity_b_input_dig_fltr_timebase_src(self, val): + cfunc = (lib_importer.windll. + DAQmxSetCIVelocityEncoderBInputDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_velocity_b_input_dig_fltr_timebase_src.deleter + def ci_velocity_b_input_dig_fltr_timebase_src(self): + cfunc = (lib_importer.windll. + DAQmxResetCIVelocityEncoderBInputDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_velocity_b_input_logic_lvl_behavior(self): + """ + :class:`nidaqmx.constants.LogicLvlBehavior`: Specifies the logic + level behavior of the input terminal. + """ + val = ctypes.c_int() + + cfunc = (lib_importer.windll. + DAQmxGetCIVelocityEncoderBInputLogicLvlBehavior) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return LogicLvlBehavior(val.value) + + @ci_velocity_b_input_logic_lvl_behavior.setter + def ci_velocity_b_input_logic_lvl_behavior(self, val): + val = val.value + cfunc = (lib_importer.windll. + DAQmxSetCIVelocityEncoderBInputLogicLvlBehavior) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_velocity_b_input_logic_lvl_behavior.deleter + def ci_velocity_b_input_logic_lvl_behavior(self): + cfunc = (lib_importer.windll. + DAQmxResetCIVelocityEncoderBInputLogicLvlBehavior) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_velocity_b_input_term(self): + """ + str: Specifies the terminal to which signal B is connected. + """ + cfunc = lib_importer.windll.DAQmxGetCIVelocityEncoderBInputTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ci_velocity_b_input_term.setter + def ci_velocity_b_input_term(self, val): + cfunc = lib_importer.windll.DAQmxSetCIVelocityEncoderBInputTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_velocity_b_input_term.deleter + def ci_velocity_b_input_term(self): + cfunc = lib_importer.windll.DAQmxResetCIVelocityEncoderBInputTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_velocity_b_input_term_cfg(self): + """ + :class:`nidaqmx.constants.TerminalConfiguration`: Specifies the + input terminal configuration. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIVelocityEncoderBInputTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return TerminalConfiguration(val.value) + + @ci_velocity_b_input_term_cfg.setter + def ci_velocity_b_input_term_cfg(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIVelocityEncoderBInputTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_velocity_b_input_term_cfg.deleter + def ci_velocity_b_input_term_cfg(self): + cfunc = lib_importer.windll.DAQmxResetCIVelocityEncoderBInputTermCfg + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_velocity_div(self): + """ + int: Specifies the value by which to divide the input signal. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetCIVelocityDiv + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_velocity_div.setter + def ci_velocity_div(self, val): + cfunc = lib_importer.windll.DAQmxSetCIVelocityDiv + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_velocity_div.deleter + def ci_velocity_div(self): + cfunc = lib_importer.windll.DAQmxResetCIVelocityDiv + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_velocity_encoder_decoding_type(self): + """ + :class:`nidaqmx.constants.EncoderType`: Specifies how to count + and interpret the pulses the encoder generates on signal A + and signal B. X1, X2, and X4 are valid for quadrature + encoders only. Two Pulse Counting is valid for two-pulse + encoders only. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIVelocityEncoderDecodingType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return EncoderType(val.value) + + @ci_velocity_encoder_decoding_type.setter + def ci_velocity_encoder_decoding_type(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIVelocityEncoderDecodingType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_velocity_encoder_decoding_type.deleter + def ci_velocity_encoder_decoding_type(self): + cfunc = lib_importer.windll.DAQmxResetCIVelocityEncoderDecodingType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_velocity_lin_encoder_dist_per_pulse(self): + """ + float: Specifies the distance to measure for each pulse the + encoder generates on signal A or signal B. This value is in + the units you specify in CI.Velocity.LinEncoder.DistUnits. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetCIVelocityLinEncoderDistPerPulse + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_velocity_lin_encoder_dist_per_pulse.setter + def ci_velocity_lin_encoder_dist_per_pulse(self, val): + cfunc = lib_importer.windll.DAQmxSetCIVelocityLinEncoderDistPerPulse + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_velocity_lin_encoder_dist_per_pulse.deleter + def ci_velocity_lin_encoder_dist_per_pulse(self): + cfunc = lib_importer.windll.DAQmxResetCIVelocityLinEncoderDistPerPulse + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_velocity_lin_encoder_units(self): + """ + :class:`nidaqmx.constants.VelocityUnits`: Specifies the units to + use to return linear encoder velocity measurements from the + channel. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCIVelocityLinEncoderUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return VelocityUnits(val.value) + + @ci_velocity_lin_encoder_units.setter + def ci_velocity_lin_encoder_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCIVelocityLinEncoderUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_velocity_lin_encoder_units.deleter + def ci_velocity_lin_encoder_units(self): + cfunc = lib_importer.windll.DAQmxResetCIVelocityLinEncoderUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def ci_velocity_meas_time(self): + """ + float: Specifies in seconds the length of time to measure the + velocity of the signal. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetCIVelocityMeasTime + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ci_velocity_meas_time.setter + def ci_velocity_meas_time(self, val): + cfunc = lib_importer.windll.DAQmxSetCIVelocityMeasTime + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @ci_velocity_meas_time.deleter + def ci_velocity_meas_time(self): + cfunc = lib_importer.windll.DAQmxResetCIVelocityMeasTime + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def citc_reached(self): + """ + bool: Indicates whether the counter rolled over. When you query + this property, NI-DAQmx resets it to False. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCITCReached + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + diff --git a/nidaqmx/_task_modules/channels/co_channel.py b/nidaqmx/_task_modules/channels/co_channel.py new file mode 100644 index 00000000..8aab3f89 --- /dev/null +++ b/nidaqmx/_task_modules/channels/co_channel.py @@ -0,0 +1,1459 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import ctypes +import numpy + +from nidaqmx._lib import lib_importer, ctypes_byte_str +from nidaqmx.scale import Scale +from nidaqmx.errors import ( + check_for_error, is_string_buffer_too_small, is_array_buffer_too_small) +from nidaqmx._task_modules.channels.channel import Channel +from nidaqmx.constants import ( + ConstrainedGenMode, DataTransferActiveTransferMode, Edge, FrequencyUnits, + Level, OutputDataTransferCondition, TimeUnits, UsageTypeCO) + + +class COChannel(Channel): + """ + Represents one or more counter output virtual channels and their properties. + """ + __slots__ = [] + + def __repr__(self): + return 'COChannel(name={0})'.format(self._name) + + @property + def co_auto_incr_cnt(self): + """ + int: Specifies a number of timebase ticks by which to increase + the time spent in the idle state for each successive pulse. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetCOAutoIncrCnt + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @co_auto_incr_cnt.setter + def co_auto_incr_cnt(self, val): + cfunc = lib_importer.windll.DAQmxSetCOAutoIncrCnt + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @co_auto_incr_cnt.deleter + def co_auto_incr_cnt(self): + cfunc = lib_importer.windll.DAQmxResetCOAutoIncrCnt + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def co_constrained_gen_mode(self): + """ + :class:`nidaqmx.constants.ConstrainedGenMode`: Specifies + constraints to apply when the counter generates pulses. + Constraining the counter reduces the device resources + required for counter operation. Constraining the counter can + also allow additional analog or counter tasks on the device + to run concurrently. For continuous counter tasks, NI-DAQmx + consumes no device resources when the counter is + constrained. For finite counter tasks, resource use + increases with the frequency regardless of the constraint + mode. However, fixed frequency constraints significantly + reduce resource usage, and fixed duty cycle constraint + marginally reduces it. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCOConstrainedGenMode + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return ConstrainedGenMode(val.value) + + @co_constrained_gen_mode.setter + def co_constrained_gen_mode(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCOConstrainedGenMode + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @co_constrained_gen_mode.deleter + def co_constrained_gen_mode(self): + cfunc = lib_importer.windll.DAQmxResetCOConstrainedGenMode + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def co_count(self): + """ + int: Indicates the current value of the count register. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetCOCount + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def co_ctr_timebase_active_edge(self): + """ + :class:`nidaqmx.constants.Edge`: Specifies whether a timebase + cycle is from rising edge to rising edge or from falling + edge to falling edge. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCOCtrTimebaseActiveEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return Edge(val.value) + + @co_ctr_timebase_active_edge.setter + def co_ctr_timebase_active_edge(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCOCtrTimebaseActiveEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @co_ctr_timebase_active_edge.deleter + def co_ctr_timebase_active_edge(self): + cfunc = lib_importer.windll.DAQmxResetCOCtrTimebaseActiveEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def co_ctr_timebase_dig_fltr_enable(self): + """ + bool: Specifies whether to apply the pulse width filter to the + signal. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCOCtrTimebaseDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @co_ctr_timebase_dig_fltr_enable.setter + def co_ctr_timebase_dig_fltr_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetCOCtrTimebaseDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @co_ctr_timebase_dig_fltr_enable.deleter + def co_ctr_timebase_dig_fltr_enable(self): + cfunc = lib_importer.windll.DAQmxResetCOCtrTimebaseDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def co_ctr_timebase_dig_fltr_min_pulse_width(self): + """ + float: Specifies in seconds the minimum pulse width the filter + recognizes. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetCOCtrTimebaseDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @co_ctr_timebase_dig_fltr_min_pulse_width.setter + def co_ctr_timebase_dig_fltr_min_pulse_width(self, val): + cfunc = (lib_importer.windll. + DAQmxSetCOCtrTimebaseDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @co_ctr_timebase_dig_fltr_min_pulse_width.deleter + def co_ctr_timebase_dig_fltr_min_pulse_width(self): + cfunc = (lib_importer.windll. + DAQmxResetCOCtrTimebaseDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def co_ctr_timebase_dig_fltr_timebase_rate(self): + """ + float: Specifies in hertz the rate of the pulse width filter + timebase. NI-DAQmx uses this value to compute settings for + the filter. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetCOCtrTimebaseDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @co_ctr_timebase_dig_fltr_timebase_rate.setter + def co_ctr_timebase_dig_fltr_timebase_rate(self, val): + cfunc = lib_importer.windll.DAQmxSetCOCtrTimebaseDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @co_ctr_timebase_dig_fltr_timebase_rate.deleter + def co_ctr_timebase_dig_fltr_timebase_rate(self): + cfunc = lib_importer.windll.DAQmxResetCOCtrTimebaseDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def co_ctr_timebase_dig_fltr_timebase_src(self): + """ + str: Specifies the input terminal of the signal to use as the + timebase of the pulse width filter. + """ + cfunc = lib_importer.windll.DAQmxGetCOCtrTimebaseDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @co_ctr_timebase_dig_fltr_timebase_src.setter + def co_ctr_timebase_dig_fltr_timebase_src(self, val): + cfunc = lib_importer.windll.DAQmxSetCOCtrTimebaseDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @co_ctr_timebase_dig_fltr_timebase_src.deleter + def co_ctr_timebase_dig_fltr_timebase_src(self): + cfunc = lib_importer.windll.DAQmxResetCOCtrTimebaseDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def co_ctr_timebase_dig_sync_enable(self): + """ + bool: Specifies whether to synchronize recognition of + transitions in the signal to the internal timebase of the + device. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCOCtrTimebaseDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @co_ctr_timebase_dig_sync_enable.setter + def co_ctr_timebase_dig_sync_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetCOCtrTimebaseDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @co_ctr_timebase_dig_sync_enable.deleter + def co_ctr_timebase_dig_sync_enable(self): + cfunc = lib_importer.windll.DAQmxResetCOCtrTimebaseDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def co_ctr_timebase_master_timebase_div(self): + """ + int: Specifies the divisor for an external counter timebase. You + can divide the counter timebase in order to generate slower + signals without causing the count register to roll over. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetCOCtrTimebaseMasterTimebaseDiv + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @co_ctr_timebase_master_timebase_div.setter + def co_ctr_timebase_master_timebase_div(self, val): + cfunc = lib_importer.windll.DAQmxSetCOCtrTimebaseMasterTimebaseDiv + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @co_ctr_timebase_master_timebase_div.deleter + def co_ctr_timebase_master_timebase_div(self): + cfunc = lib_importer.windll.DAQmxResetCOCtrTimebaseMasterTimebaseDiv + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def co_ctr_timebase_rate(self): + """ + float: Specifies in Hertz the frequency of the counter timebase. + Specifying the rate of a counter timebase allows you to + define output pulses in seconds rather than in ticks of the + timebase. If you use an external timebase and do not specify + the rate, you can define output pulses only in ticks of the + timebase. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetCOCtrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @co_ctr_timebase_rate.setter + def co_ctr_timebase_rate(self, val): + cfunc = lib_importer.windll.DAQmxSetCOCtrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @co_ctr_timebase_rate.deleter + def co_ctr_timebase_rate(self): + cfunc = lib_importer.windll.DAQmxResetCOCtrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def co_ctr_timebase_src(self): + """ + str: Specifies the terminal of the timebase to use for the + counter. Typically, NI-DAQmx uses one of the internal + counter timebases when generating pulses. Use this property + to specify an external timebase and produce custom pulse + widths that are not possible using the internal timebases. + """ + cfunc = lib_importer.windll.DAQmxGetCOCtrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @co_ctr_timebase_src.setter + def co_ctr_timebase_src(self, val): + cfunc = lib_importer.windll.DAQmxSetCOCtrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @co_ctr_timebase_src.deleter + def co_ctr_timebase_src(self): + cfunc = lib_importer.windll.DAQmxResetCOCtrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def co_data_xfer_mech(self): + """ + :class:`nidaqmx.constants.DataTransferActiveTransferMode`: + Specifies the data transfer mode for the device. For + buffered operations, use DMA or USB Bulk. For non-buffered + operations, use Polled. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCODataXferMech + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return DataTransferActiveTransferMode(val.value) + + @co_data_xfer_mech.setter + def co_data_xfer_mech(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCODataXferMech + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @co_data_xfer_mech.deleter + def co_data_xfer_mech(self): + cfunc = lib_importer.windll.DAQmxResetCODataXferMech + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def co_data_xfer_req_cond(self): + """ + :class:`nidaqmx.constants.OutputDataTransferCondition`: + Specifies under what condition to transfer data from the + buffer to the onboard memory of the device. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCODataXferReqCond + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return OutputDataTransferCondition(val.value) + + @co_data_xfer_req_cond.setter + def co_data_xfer_req_cond(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCODataXferReqCond + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @co_data_xfer_req_cond.deleter + def co_data_xfer_req_cond(self): + cfunc = lib_importer.windll.DAQmxResetCODataXferReqCond + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def co_enable_initial_delay_on_retrigger(self): + """ + bool: Specifies whether to apply the initial delay to + retriggered pulse trains. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCOEnableInitialDelayOnRetrigger + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @co_enable_initial_delay_on_retrigger.setter + def co_enable_initial_delay_on_retrigger(self, val): + cfunc = lib_importer.windll.DAQmxSetCOEnableInitialDelayOnRetrigger + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @co_enable_initial_delay_on_retrigger.deleter + def co_enable_initial_delay_on_retrigger(self): + cfunc = lib_importer.windll.DAQmxResetCOEnableInitialDelayOnRetrigger + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def co_mem_map_enable(self): + """ + bool: Specifies for NI-DAQmx to map hardware registers to the + memory space of the application, if possible. Normally, NI- + DAQmx maps hardware registers to memory accessible only to + the kernel. Mapping the registers to the memory space of the + application increases performance. However, if the + application accesses the memory space mapped to the + registers, it can adversely affect the operation of the + device and possibly result in a system crash. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCOMemMapEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @co_mem_map_enable.setter + def co_mem_map_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetCOMemMapEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @co_mem_map_enable.deleter + def co_mem_map_enable(self): + cfunc = lib_importer.windll.DAQmxResetCOMemMapEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def co_output_state(self): + """ + :class:`nidaqmx.constants.Level`: Indicates the current state of + the output terminal of the counter. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCOOutputState + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return Level(val.value) + + @property + def co_output_type(self): + """ + :class:`nidaqmx.constants.UsageTypeCO`: Indicates how to define + pulses generated on the channel. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCOOutputType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return UsageTypeCO(val.value) + + @property + def co_prescaler(self): + """ + int: Specifies the divisor to apply to the signal you connect to + the counter source terminal. Pulse generations defined by + frequency or time take this setting into account, but pulse + generations defined by ticks do not. You should use a + prescaler only when you connect an external signal to the + counter source terminal and when that signal has a higher + frequency than the fastest onboard timebase. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetCOPrescaler + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @co_prescaler.setter + def co_prescaler(self, val): + cfunc = lib_importer.windll.DAQmxSetCOPrescaler + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @co_prescaler.deleter + def co_prescaler(self): + cfunc = lib_importer.windll.DAQmxResetCOPrescaler + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def co_pulse_done(self): + """ + bool: Indicates if the task completed pulse generation. Use this + value for retriggerable pulse generation when you need to + determine if the device generated the current pulse. For + retriggerable tasks, when you query this property, NI-DAQmx + resets it to False. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCOPulseDone + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def co_pulse_duty_cyc(self): + """ + float: Specifies the duty cycle of the pulses. The duty cycle of + a signal is the width of the pulse divided by period. NI- + DAQmx uses this ratio and the pulse frequency to determine + the width of the pulses and the delay between pulses. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetCOPulseDutyCyc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @co_pulse_duty_cyc.setter + def co_pulse_duty_cyc(self, val): + cfunc = lib_importer.windll.DAQmxSetCOPulseDutyCyc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @co_pulse_duty_cyc.deleter + def co_pulse_duty_cyc(self): + cfunc = lib_importer.windll.DAQmxResetCOPulseDutyCyc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def co_pulse_freq(self): + """ + float: Specifies the frequency of the pulses to generate. This + value is in the units you specify with + **co_pulse_freq_units** or when you create the channel. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetCOPulseFreq + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @co_pulse_freq.setter + def co_pulse_freq(self, val): + cfunc = lib_importer.windll.DAQmxSetCOPulseFreq + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @co_pulse_freq.deleter + def co_pulse_freq(self): + cfunc = lib_importer.windll.DAQmxResetCOPulseFreq + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def co_pulse_freq_initial_delay(self): + """ + float: Specifies in seconds the amount of time to wait before + generating the first pulse. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetCOPulseFreqInitialDelay + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @co_pulse_freq_initial_delay.setter + def co_pulse_freq_initial_delay(self, val): + cfunc = lib_importer.windll.DAQmxSetCOPulseFreqInitialDelay + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @co_pulse_freq_initial_delay.deleter + def co_pulse_freq_initial_delay(self): + cfunc = lib_importer.windll.DAQmxResetCOPulseFreqInitialDelay + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def co_pulse_freq_units(self): + """ + :class:`nidaqmx.constants.FrequencyUnits`: Specifies the units + in which to define pulse frequency. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCOPulseFreqUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return FrequencyUnits(val.value) + + @co_pulse_freq_units.setter + def co_pulse_freq_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCOPulseFreqUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @co_pulse_freq_units.deleter + def co_pulse_freq_units(self): + cfunc = lib_importer.windll.DAQmxResetCOPulseFreqUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def co_pulse_high_ticks(self): + """ + int: Specifies the number of ticks the pulse is high. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetCOPulseHighTicks + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @co_pulse_high_ticks.setter + def co_pulse_high_ticks(self, val): + cfunc = lib_importer.windll.DAQmxSetCOPulseHighTicks + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @co_pulse_high_ticks.deleter + def co_pulse_high_ticks(self): + cfunc = lib_importer.windll.DAQmxResetCOPulseHighTicks + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def co_pulse_high_time(self): + """ + float: Specifies the amount of time that the pulse is at a high + voltage. This value is in the units you specify with + **co_pulse_time_units** or when you create the channel. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetCOPulseHighTime + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @co_pulse_high_time.setter + def co_pulse_high_time(self, val): + cfunc = lib_importer.windll.DAQmxSetCOPulseHighTime + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @co_pulse_high_time.deleter + def co_pulse_high_time(self): + cfunc = lib_importer.windll.DAQmxResetCOPulseHighTime + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def co_pulse_idle_state(self): + """ + :class:`nidaqmx.constants.Level`: Specifies the resting state of + the output terminal. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCOPulseIdleState + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return Level(val.value) + + @co_pulse_idle_state.setter + def co_pulse_idle_state(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCOPulseIdleState + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @co_pulse_idle_state.deleter + def co_pulse_idle_state(self): + cfunc = lib_importer.windll.DAQmxResetCOPulseIdleState + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def co_pulse_low_ticks(self): + """ + int: Specifies the number of ticks the pulse is low. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetCOPulseLowTicks + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @co_pulse_low_ticks.setter + def co_pulse_low_ticks(self, val): + cfunc = lib_importer.windll.DAQmxSetCOPulseLowTicks + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @co_pulse_low_ticks.deleter + def co_pulse_low_ticks(self): + cfunc = lib_importer.windll.DAQmxResetCOPulseLowTicks + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def co_pulse_low_time(self): + """ + float: Specifies the amount of time that the pulse is at a low + voltage. This value is in the units you specify with + **co_pulse_time_units** or when you create the channel. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetCOPulseLowTime + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @co_pulse_low_time.setter + def co_pulse_low_time(self, val): + cfunc = lib_importer.windll.DAQmxSetCOPulseLowTime + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @co_pulse_low_time.deleter + def co_pulse_low_time(self): + cfunc = lib_importer.windll.DAQmxResetCOPulseLowTime + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def co_pulse_term(self): + """ + str: Specifies on which terminal to generate pulses. + """ + cfunc = lib_importer.windll.DAQmxGetCOPulseTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @co_pulse_term.setter + def co_pulse_term(self, val): + cfunc = lib_importer.windll.DAQmxSetCOPulseTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @co_pulse_term.deleter + def co_pulse_term(self): + cfunc = lib_importer.windll.DAQmxResetCOPulseTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def co_pulse_ticks_initial_delay(self): + """ + int: Specifies the number of ticks to wait before generating the + first pulse. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetCOPulseTicksInitialDelay + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @co_pulse_ticks_initial_delay.setter + def co_pulse_ticks_initial_delay(self, val): + cfunc = lib_importer.windll.DAQmxSetCOPulseTicksInitialDelay + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @co_pulse_ticks_initial_delay.deleter + def co_pulse_ticks_initial_delay(self): + cfunc = lib_importer.windll.DAQmxResetCOPulseTicksInitialDelay + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def co_pulse_time_initial_delay(self): + """ + float: Specifies in seconds the amount of time to wait before + generating the first pulse. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetCOPulseTimeInitialDelay + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @co_pulse_time_initial_delay.setter + def co_pulse_time_initial_delay(self, val): + cfunc = lib_importer.windll.DAQmxSetCOPulseTimeInitialDelay + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @co_pulse_time_initial_delay.deleter + def co_pulse_time_initial_delay(self): + cfunc = lib_importer.windll.DAQmxResetCOPulseTimeInitialDelay + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def co_pulse_time_units(self): + """ + :class:`nidaqmx.constants.TimeUnits`: Specifies the units in + which to define high and low pulse time. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetCOPulseTimeUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return TimeUnits(val.value) + + @co_pulse_time_units.setter + def co_pulse_time_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetCOPulseTimeUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @co_pulse_time_units.deleter + def co_pulse_time_units(self): + cfunc = lib_importer.windll.DAQmxResetCOPulseTimeUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def co_rdy_for_new_val(self): + """ + bool: Indicates whether the counter is ready for new continuous + pulse train values. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCORdyForNewVal + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def co_usb_xfer_req_count(self): + """ + int: Specifies the maximum number of simultaneous USB transfers + used to stream data. Modify this value to affect performance + under different combinations of operating system and device. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetCOUsbXferReqCount + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @co_usb_xfer_req_count.setter + def co_usb_xfer_req_count(self, val): + cfunc = lib_importer.windll.DAQmxSetCOUsbXferReqCount + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @co_usb_xfer_req_count.deleter + def co_usb_xfer_req_count(self): + cfunc = lib_importer.windll.DAQmxResetCOUsbXferReqCount + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def co_usb_xfer_req_size(self): + """ + int: Specifies the maximum size of a USB transfer request in + bytes. Modify this value to affect performance under + different combinations of operating system and device. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetCOUsbXferReqSize + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @co_usb_xfer_req_size.setter + def co_usb_xfer_req_size(self, val): + cfunc = lib_importer.windll.DAQmxSetCOUsbXferReqSize + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @co_usb_xfer_req_size.deleter + def co_usb_xfer_req_size(self): + cfunc = lib_importer.windll.DAQmxResetCOUsbXferReqSize + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def co_use_only_on_brd_mem(self): + """ + bool: Specifies whether to write samples directly to the onboard + memory of the device, bypassing the memory buffer. + Generally, you cannot update onboard memory directly after + you start the task. Onboard memory includes data FIFOs. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetCOUseOnlyOnBrdMem + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @co_use_only_on_brd_mem.setter + def co_use_only_on_brd_mem(self, val): + cfunc = lib_importer.windll.DAQmxSetCOUseOnlyOnBrdMem + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @co_use_only_on_brd_mem.deleter + def co_use_only_on_brd_mem(self): + cfunc = lib_importer.windll.DAQmxResetCOUseOnlyOnBrdMem + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + diff --git a/nidaqmx/_task_modules/channels/di_channel.py b/nidaqmx/_task_modules/channels/di_channel.py new file mode 100644 index 00000000..8ed875de --- /dev/null +++ b/nidaqmx/_task_modules/channels/di_channel.py @@ -0,0 +1,674 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import ctypes +import numpy + +from nidaqmx._lib import lib_importer, ctypes_byte_str +from nidaqmx.errors import ( + check_for_error, is_string_buffer_too_small, is_array_buffer_too_small) +from nidaqmx._task_modules.channels.channel import Channel +from nidaqmx.constants import ( + ActiveOrInactiveEdgeSelection, DataTransferActiveTransferMode, + InputDataTransferCondition, LogicFamily) + + +class DIChannel(Channel): + """ + Represents one or more digital input virtual channels and their properties. + """ + __slots__ = [] + + def __repr__(self): + return 'DIChannel(name={0})'.format(self._name) + + @property + def di_acquire_on(self): + """ + :class:`nidaqmx.constants.ActiveOrInactiveEdgeSelection`: + Specifies on which edge of the sample clock to acquire + samples. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetDIAcquireOn + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return ActiveOrInactiveEdgeSelection(val.value) + + @di_acquire_on.setter + def di_acquire_on(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetDIAcquireOn + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @di_acquire_on.deleter + def di_acquire_on(self): + cfunc = lib_importer.windll.DAQmxResetDIAcquireOn + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def di_data_xfer_mech(self): + """ + :class:`nidaqmx.constants.DataTransferActiveTransferMode`: + Specifies the data transfer mode for the device. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetDIDataXferMech + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return DataTransferActiveTransferMode(val.value) + + @di_data_xfer_mech.setter + def di_data_xfer_mech(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetDIDataXferMech + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @di_data_xfer_mech.deleter + def di_data_xfer_mech(self): + cfunc = lib_importer.windll.DAQmxResetDIDataXferMech + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def di_data_xfer_req_cond(self): + """ + :class:`nidaqmx.constants.InputDataTransferCondition`: Specifies + under what condition to transfer data from the onboard + memory of the device to the buffer. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetDIDataXferReqCond + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return InputDataTransferCondition(val.value) + + @di_data_xfer_req_cond.setter + def di_data_xfer_req_cond(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetDIDataXferReqCond + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @di_data_xfer_req_cond.deleter + def di_data_xfer_req_cond(self): + cfunc = lib_importer.windll.DAQmxResetDIDataXferReqCond + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def di_dig_fltr_enable(self): + """ + bool: Specifies whether to enable the digital filter for the + line(s) or port(s). You can enable the filter on a line-by- + line basis. You do not have to enable the filter for all + lines in a channel. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetDIDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @di_dig_fltr_enable.setter + def di_dig_fltr_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetDIDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @di_dig_fltr_enable.deleter + def di_dig_fltr_enable(self): + cfunc = lib_importer.windll.DAQmxResetDIDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def di_dig_fltr_enable_bus_mode(self): + """ + bool: Specifies whether to enable bus mode for digital + filtering. If you set this property to True, NI-DAQmx treats + all lines that use common filtering settings as a bus. If + any line in the bus has jitter, all lines in the bus hold + state until the entire bus stabilizes, or until 2 times the + minimum pulse width elapses. If you set this property to + False, NI-DAQmx filters all lines individually. Jitter in + one line does not affect other lines. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetDIDigFltrEnableBusMode + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @di_dig_fltr_enable_bus_mode.setter + def di_dig_fltr_enable_bus_mode(self, val): + cfunc = lib_importer.windll.DAQmxSetDIDigFltrEnableBusMode + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @di_dig_fltr_enable_bus_mode.deleter + def di_dig_fltr_enable_bus_mode(self): + cfunc = lib_importer.windll.DAQmxResetDIDigFltrEnableBusMode + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def di_dig_fltr_min_pulse_width(self): + """ + float: Specifies in seconds the minimum pulse width the filter + recognizes as a valid high or low state transition. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetDIDigFltrMinPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @di_dig_fltr_min_pulse_width.setter + def di_dig_fltr_min_pulse_width(self, val): + cfunc = lib_importer.windll.DAQmxSetDIDigFltrMinPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @di_dig_fltr_min_pulse_width.deleter + def di_dig_fltr_min_pulse_width(self): + cfunc = lib_importer.windll.DAQmxResetDIDigFltrMinPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def di_dig_fltr_timebase_rate(self): + """ + float: Specifies in hertz the rate of the digital filter + timebase. NI-DAQmx uses this value to compute settings for + the filter. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetDIDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @di_dig_fltr_timebase_rate.setter + def di_dig_fltr_timebase_rate(self, val): + cfunc = lib_importer.windll.DAQmxSetDIDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @di_dig_fltr_timebase_rate.deleter + def di_dig_fltr_timebase_rate(self): + cfunc = lib_importer.windll.DAQmxResetDIDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def di_dig_fltr_timebase_src(self): + """ + str: Specifies the terminal of the signal to use as the timebase + of the digital filter. + """ + cfunc = lib_importer.windll.DAQmxGetDIDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_char_p, + ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @di_dig_fltr_timebase_src.setter + def di_dig_fltr_timebase_src(self, val): + cfunc = lib_importer.windll.DAQmxSetDIDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @di_dig_fltr_timebase_src.deleter + def di_dig_fltr_timebase_src(self): + cfunc = lib_importer.windll.DAQmxResetDIDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def di_dig_sync_enable(self): + """ + bool: Specifies whether to synchronize recognition of + transitions in the signal to the internal timebase of the + device. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetDIDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @di_dig_sync_enable.setter + def di_dig_sync_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetDIDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @di_dig_sync_enable.deleter + def di_dig_sync_enable(self): + cfunc = lib_importer.windll.DAQmxResetDIDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def di_invert_lines(self): + """ + bool: Specifies whether to invert the lines in the channel. If + you set this property to True, the lines are at high logic + when off and at low logic when on. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetDIInvertLines + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @di_invert_lines.setter + def di_invert_lines(self, val): + cfunc = lib_importer.windll.DAQmxSetDIInvertLines + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @di_invert_lines.deleter + def di_invert_lines(self): + cfunc = lib_importer.windll.DAQmxResetDIInvertLines + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def di_logic_family(self): + """ + :class:`nidaqmx.constants.LogicFamily`: Specifies the logic + family to use for acquisition. A logic family corresponds to + voltage thresholds that are compatible with a group of + voltage standards. Refer to the device documentation for + information on the logic high and logic low voltages for + these logic families. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetDILogicFamily + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return LogicFamily(val.value) + + @di_logic_family.setter + def di_logic_family(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetDILogicFamily + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @di_logic_family.deleter + def di_logic_family(self): + cfunc = lib_importer.windll.DAQmxResetDILogicFamily + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def di_mem_map_enable(self): + """ + bool: Specifies for NI-DAQmx to map hardware registers to the + memory space of the application, if possible. Normally, NI- + DAQmx maps hardware registers to memory accessible only to + the kernel. Mapping the registers to the memory space of the + application increases performance. However, if the + application accesses the memory space mapped to the + registers, it can adversely affect the operation of the + device and possibly result in a system crash. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetDIMemMapEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @di_mem_map_enable.setter + def di_mem_map_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetDIMemMapEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @di_mem_map_enable.deleter + def di_mem_map_enable(self): + cfunc = lib_importer.windll.DAQmxResetDIMemMapEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def di_num_lines(self): + """ + int: Indicates the number of digital lines in the channel. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetDINumLines + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def di_tristate(self): + """ + bool: Specifies whether to tristate the lines in the channel. If + you set this property to True, NI-DAQmx tristates the lines + in the channel. If you set this property to False, NI-DAQmx + does not modify the configuration of the lines even if the + lines were previously tristated. Set this property to False + to read lines in other tasks or to read output-only lines. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetDITristate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @di_tristate.setter + def di_tristate(self, val): + cfunc = lib_importer.windll.DAQmxSetDITristate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @di_tristate.deleter + def di_tristate(self): + cfunc = lib_importer.windll.DAQmxResetDITristate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def di_usb_xfer_req_count(self): + """ + int: Specifies the maximum number of simultaneous USB transfers + used to stream data. Modify this value to affect performance + under different combinations of operating system and device. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetDIUsbXferReqCount + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @di_usb_xfer_req_count.setter + def di_usb_xfer_req_count(self, val): + cfunc = lib_importer.windll.DAQmxSetDIUsbXferReqCount + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @di_usb_xfer_req_count.deleter + def di_usb_xfer_req_count(self): + cfunc = lib_importer.windll.DAQmxResetDIUsbXferReqCount + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def di_usb_xfer_req_size(self): + """ + int: Specifies the maximum size of a USB transfer request in + bytes. Modify this value to affect performance under + different combinations of operating system and device. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetDIUsbXferReqSize + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @di_usb_xfer_req_size.setter + def di_usb_xfer_req_size(self, val): + cfunc = lib_importer.windll.DAQmxSetDIUsbXferReqSize + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @di_usb_xfer_req_size.deleter + def di_usb_xfer_req_size(self): + cfunc = lib_importer.windll.DAQmxResetDIUsbXferReqSize + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + diff --git a/nidaqmx/_task_modules/channels/do_channel.py b/nidaqmx/_task_modules/channels/do_channel.py new file mode 100644 index 00000000..bae228b8 --- /dev/null +++ b/nidaqmx/_task_modules/channels/do_channel.py @@ -0,0 +1,739 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import ctypes +import numpy + +from nidaqmx._lib import lib_importer, ctypes_byte_str +from nidaqmx.errors import ( + check_for_error, is_string_buffer_too_small, is_array_buffer_too_small) +from nidaqmx._task_modules.channels.channel import Channel +from nidaqmx.constants import ( + ActiveOrInactiveEdgeSelection, DataTransferActiveTransferMode, + DigitalDriveType, Level, LogicFamily, OutputDataTransferCondition) + + +class DOChannel(Channel): + """ + Represents one or more digital output virtual channels and their properties. + """ + __slots__ = [] + + def __repr__(self): + return 'DOChannel(name={0})'.format(self._name) + + @property + def do_data_xfer_mech(self): + """ + :class:`nidaqmx.constants.DataTransferActiveTransferMode`: + Specifies the data transfer mode for the device. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetDODataXferMech + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return DataTransferActiveTransferMode(val.value) + + @do_data_xfer_mech.setter + def do_data_xfer_mech(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetDODataXferMech + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @do_data_xfer_mech.deleter + def do_data_xfer_mech(self): + cfunc = lib_importer.windll.DAQmxResetDODataXferMech + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def do_data_xfer_req_cond(self): + """ + :class:`nidaqmx.constants.OutputDataTransferCondition`: + Specifies under what condition to transfer data from the + buffer to the onboard memory of the device. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetDODataXferReqCond + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return OutputDataTransferCondition(val.value) + + @do_data_xfer_req_cond.setter + def do_data_xfer_req_cond(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetDODataXferReqCond + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @do_data_xfer_req_cond.deleter + def do_data_xfer_req_cond(self): + cfunc = lib_importer.windll.DAQmxResetDODataXferReqCond + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def do_generate_on(self): + """ + :class:`nidaqmx.constants.ActiveOrInactiveEdgeSelection`: + Specifies on which edge of the sample clock to generate + samples. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetDOGenerateOn + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return ActiveOrInactiveEdgeSelection(val.value) + + @do_generate_on.setter + def do_generate_on(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetDOGenerateOn + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @do_generate_on.deleter + def do_generate_on(self): + cfunc = lib_importer.windll.DAQmxResetDOGenerateOn + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def do_invert_lines(self): + """ + bool: Specifies whether to invert the lines in the channel. If + you set this property to True, the lines are at high logic + when off and at low logic when on. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetDOInvertLines + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @do_invert_lines.setter + def do_invert_lines(self, val): + cfunc = lib_importer.windll.DAQmxSetDOInvertLines + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @do_invert_lines.deleter + def do_invert_lines(self): + cfunc = lib_importer.windll.DAQmxResetDOInvertLines + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def do_line_states_done_state(self): + """ + :class:`nidaqmx.constants.Level`: Specifies the state of the + lines in a digital output task when the task completes + execution. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetDOLineStatesDoneState + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return Level(val.value) + + @do_line_states_done_state.setter + def do_line_states_done_state(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetDOLineStatesDoneState + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @do_line_states_done_state.deleter + def do_line_states_done_state(self): + cfunc = lib_importer.windll.DAQmxResetDOLineStatesDoneState + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def do_line_states_paused_state(self): + """ + :class:`nidaqmx.constants.Level`: Specifies the state of the + lines in a digital output task when the task pauses. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetDOLineStatesPausedState + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return Level(val.value) + + @do_line_states_paused_state.setter + def do_line_states_paused_state(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetDOLineStatesPausedState + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @do_line_states_paused_state.deleter + def do_line_states_paused_state(self): + cfunc = lib_importer.windll.DAQmxResetDOLineStatesPausedState + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def do_line_states_start_state(self): + """ + :class:`nidaqmx.constants.Level`: Specifies the state of the + lines in a digital output task when the task starts. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetDOLineStatesStartState + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return Level(val.value) + + @do_line_states_start_state.setter + def do_line_states_start_state(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetDOLineStatesStartState + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @do_line_states_start_state.deleter + def do_line_states_start_state(self): + cfunc = lib_importer.windll.DAQmxResetDOLineStatesStartState + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def do_logic_family(self): + """ + :class:`nidaqmx.constants.LogicFamily`: Specifies the logic + family to use for generation. A logic family corresponds to + voltage thresholds that are compatible with a group of + voltage standards. Refer to the device documentation for + information on the logic high and logic low voltages for + these logic families. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetDOLogicFamily + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return LogicFamily(val.value) + + @do_logic_family.setter + def do_logic_family(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetDOLogicFamily + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @do_logic_family.deleter + def do_logic_family(self): + cfunc = lib_importer.windll.DAQmxResetDOLogicFamily + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def do_mem_map_enable(self): + """ + bool: Specifies for NI-DAQmx to map hardware registers to the + memory space of the application, if possible. Normally, NI- + DAQmx maps hardware registers to memory accessible only to + the kernel. Mapping the registers to the memory space of the + application increases performance. However, if the + application accesses the memory space mapped to the + registers, it can adversely affect the operation of the + device and possibly result in a system crash. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetDOMemMapEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @do_mem_map_enable.setter + def do_mem_map_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetDOMemMapEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @do_mem_map_enable.deleter + def do_mem_map_enable(self): + cfunc = lib_importer.windll.DAQmxResetDOMemMapEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def do_num_lines(self): + """ + int: Indicates the number of digital lines in the channel. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetDONumLines + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def do_output_drive_type(self): + """ + :class:`nidaqmx.constants.DigitalDriveType`: Specifies the drive + type for digital output channels. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetDOOutputDriveType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return DigitalDriveType(val.value) + + @do_output_drive_type.setter + def do_output_drive_type(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetDOOutputDriveType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @do_output_drive_type.deleter + def do_output_drive_type(self): + cfunc = lib_importer.windll.DAQmxResetDOOutputDriveType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def do_overcurrent_auto_reenable(self): + """ + bool: Specifies whether to automatically reenable channels after + they no longer exceed the current limit specified by + **do_overcurrent_limit**. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetDOOvercurrentAutoReenable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @do_overcurrent_auto_reenable.setter + def do_overcurrent_auto_reenable(self, val): + cfunc = lib_importer.windll.DAQmxSetDOOvercurrentAutoReenable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @do_overcurrent_auto_reenable.deleter + def do_overcurrent_auto_reenable(self): + cfunc = lib_importer.windll.DAQmxResetDOOvercurrentAutoReenable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def do_overcurrent_limit(self): + """ + float: Specifies the current threshold in Amperes for the + channel. A value of 0 means the channel observes no limit. + Devices can monitor only a finite number of current + thresholds simultaneously. If you attempt to monitor + additional thresholds, NI-DAQmx returns an error. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetDOOvercurrentLimit + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @do_overcurrent_limit.setter + def do_overcurrent_limit(self, val): + cfunc = lib_importer.windll.DAQmxSetDOOvercurrentLimit + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @do_overcurrent_limit.deleter + def do_overcurrent_limit(self): + cfunc = lib_importer.windll.DAQmxResetDOOvercurrentLimit + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def do_overcurrent_reenable_period(self): + """ + float: Specifies the delay in seconds between the time a channel + no longer exceeds the current limit and the reactivation of + that channel, if **do_overcurrent_auto_reenable** is True. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetDOOvercurrentReenablePeriod + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @do_overcurrent_reenable_period.setter + def do_overcurrent_reenable_period(self, val): + cfunc = lib_importer.windll.DAQmxSetDOOvercurrentReenablePeriod + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @do_overcurrent_reenable_period.deleter + def do_overcurrent_reenable_period(self): + cfunc = lib_importer.windll.DAQmxResetDOOvercurrentReenablePeriod + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def do_tristate(self): + """ + bool: Specifies whether to stop driving the channel and set it + to a high-impedance state. You must commit the task for this + setting to take effect. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetDOTristate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @do_tristate.setter + def do_tristate(self, val): + cfunc = lib_importer.windll.DAQmxSetDOTristate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @do_tristate.deleter + def do_tristate(self): + cfunc = lib_importer.windll.DAQmxResetDOTristate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def do_usb_xfer_req_count(self): + """ + int: Specifies the maximum number of simultaneous USB transfers + used to stream data. Modify this value to affect performance + under different combinations of operating system and device. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetDOUsbXferReqCount + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @do_usb_xfer_req_count.setter + def do_usb_xfer_req_count(self, val): + cfunc = lib_importer.windll.DAQmxSetDOUsbXferReqCount + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @do_usb_xfer_req_count.deleter + def do_usb_xfer_req_count(self): + cfunc = lib_importer.windll.DAQmxResetDOUsbXferReqCount + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def do_usb_xfer_req_size(self): + """ + int: Specifies the maximum size of a USB transfer request in + bytes. Modify this value to affect performance under + different combinations of operating system and device. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetDOUsbXferReqSize + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @do_usb_xfer_req_size.setter + def do_usb_xfer_req_size(self, val): + cfunc = lib_importer.windll.DAQmxSetDOUsbXferReqSize + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_uint] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @do_usb_xfer_req_size.deleter + def do_usb_xfer_req_size(self): + cfunc = lib_importer.windll.DAQmxResetDOUsbXferReqSize + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + + @property + def do_use_only_on_brd_mem(self): + """ + bool: Specifies whether to write samples directly to the onboard + memory of the device, bypassing the memory buffer. + Generally, you cannot update onboard memory after you start + the task. Onboard memory includes data FIFOs. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetDOUseOnlyOnBrdMem + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @do_use_only_on_brd_mem.setter + def do_use_only_on_brd_mem(self, val): + cfunc = lib_importer.windll.DAQmxSetDOUseOnlyOnBrdMem + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._handle, self._name, val) + check_for_error(error_code) + + @do_use_only_on_brd_mem.deleter + def do_use_only_on_brd_mem(self): + cfunc = lib_importer.windll.DAQmxResetDOUseOnlyOnBrdMem + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._name) + check_for_error(error_code) + diff --git a/nidaqmx/_task_modules/ci_channel_collection.py b/nidaqmx/_task_modules/ci_channel_collection.py new file mode 100644 index 00000000..21f9acd4 --- /dev/null +++ b/nidaqmx/_task_modules/ci_channel_collection.py @@ -0,0 +1,954 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import ctypes +import numpy + +from nidaqmx._lib import lib_importer, ctypes_byte_str, c_bool32 +from nidaqmx.errors import check_for_error +from nidaqmx._task_modules.channels.ci_channel import CIChannel +from nidaqmx._task_modules.channel_collection import ChannelCollection +from nidaqmx.utils import unflatten_channel_string +from nidaqmx.constants import ( + AngleUnits, AngularVelocityUnits, CountDirection, CounterFrequencyMethod, + Edge, EncoderType, EncoderZIndexPhase, FrequencyUnits, GpsSignalType, + LengthUnits, TimeUnits, VelocityUnits) + + +class CIChannelCollection(ChannelCollection): + """ + Contains the collection of counter input channels for a DAQmx Task. + """ + def __init__(self, task_handle): + super(CIChannelCollection, self).__init__(task_handle) + + def _create_chan(self, counter, name_to_assign_to_channel=''): + """ + Creates and returns a CIChannel object. + + Args: + counter (str): Specifies the names of the counters to use to + create virtual channels. + name_to_assign_to_channel (Optional[str]): Specifies a name to + assign to the virtual channel this method creates. + Returns: + nidaqmx._task_modules.channels.ci_channel.CIChannel: + + Specifies the newly created CIChannel object. + """ + if name_to_assign_to_channel: + num_counters = len(unflatten_channel_string(counter)) + + if num_counters > 1: + name = '{0}0:{1}'.format( + name_to_assign_to_channel, num_counters-1) + else: + name = name_to_assign_to_channel + else: + name = counter + + return CIChannel(self._handle, name) + + def add_ci_ang_encoder_chan( + self, counter, name_to_assign_to_channel="", + decoding_type=EncoderType.X_4, zidx_enable=False, zidx_val=0, + zidx_phase=EncoderZIndexPhase.AHIGH_BHIGH, + units=AngleUnits.DEGREES, pulses_per_rev=24, initial_angle=0.0, + custom_scale_name=""): + """ + Creates a channel that uses an angular encoder to measure + angular position. With the exception of devices that support + multi-counter tasks, you can create only one counter input + channel at a time with this function because a task can contain + only one counter input channel. To read from multiple counters + simultaneously, use a separate task for each counter. Connect + the input signals to the default input terminals of the counter + unless you select different input terminals. + + Args: + counter (str): Specifies the name of the counter to use to + create the virtual channel. The DAQmx physical channel + constant lists all physical channels, including + counters, for devices installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + decoding_type (Optional[nidaqmx.constants.EncoderType]): + Specifies how to count and interpret the pulses the + encoder generates on signal A and signal B. **X_1**, + **X_2**, and **X_4** are valid for quadrature encoders + only. **TWO_PULSE_COUNTING** is valid only for two-pulse + encoders. + zidx_enable (Optional[bool]): Specifies whether to use Z + indexing for the channel. + zidx_val (Optional[float]): Specifies in **units** the value + to which to reset the measurement when signal Z is high + and signal A and signal B are at the states you specify + with **zidx_phase**. + zidx_phase (Optional[nidaqmx.constants.EncoderZIndexPhase]): + Specifies the states at which signal A and signal B must + be while signal Z is high for NI-DAQmx to reset the + measurement. If signal Z is never high while signal A + and signal B are high, for example, you must choose a + phase other than **A_HIGH_B_HIGH**. + units (Optional[nidaqmx.constants.AngleUnits]): Specifies + the units to use to return angular position measurements + from the channel. + pulses_per_rev (Optional[int]): Is the number of pulses the + encoder generates per revolution. This value is the + number of pulses on either signal A or signal B, not the + total number of pulses on both signal A and signal B. + initial_angle (Optional[float]): Is the starting angle of + the encoder. This value is in the units you specify with + the **units** input. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ci_channel.CIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateCIAngEncoderChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_int, c_bool32, ctypes.c_double, ctypes.c_int, + ctypes.c_int, ctypes.c_uint, ctypes.c_double, ctypes_byte_str] + + error_code = cfunc( + self._handle, counter, name_to_assign_to_channel, + decoding_type.value, zidx_enable, zidx_val, zidx_phase.value, + units.value, pulses_per_rev, initial_angle, custom_scale_name) + check_for_error(error_code) + + return self._create_chan(counter, name_to_assign_to_channel) + + def add_ci_ang_velocity_chan( + self, counter, name_to_assign_to_channel="", min_val=0.0, + max_val=1.0, decoding_type=EncoderType.X_4, + units=AngularVelocityUnits.RPM, pulses_per_rev=24, + custom_scale_name=""): + """ + Creates a channel to measure the angular velocity of a digital + signal. With the exception of devices that support multi-counter + tasks, you can create only one counter input channel at a time + with this function because a task can contain only one counter + input channel. To read from multiple counters simultaneously, + use a separate task for each counter. Connect the input signal + to the default input terminal of the counter unless you select a + different input terminal. + + Args: + counter (str): Specifies the name of the counter to use to + create the virtual channel. The DAQmx physical channel + constant lists all physical channels, including + counters, for devices installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + decoding_type (Optional[nidaqmx.constants.EncoderType]): + Specifies how to count and interpret the pulses the + encoder generates on signal A and signal B. **X_1**, + **X_2**, and **X_4** are valid for quadrature encoders + only. **TWO_PULSE_COUNTING** is valid only for two-pulse + encoders. + units (Optional[nidaqmx.constants.AngularVelocityUnits]): + Specifies in which unit to return velocity measurements + from the channel. + pulses_per_rev (Optional[int]): Is the number of pulses the + encoder generates per revolution. This value is the + number of pulses on either signal A or signal B, not the + total number of pulses on both signal A and signal B. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ci_channel.CIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateCIAngVelocityChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, + ctypes.c_uint, ctypes_byte_str] + + error_code = cfunc( + self._handle, counter, name_to_assign_to_channel, min_val, + max_val, decoding_type.value, units.value, pulses_per_rev, + custom_scale_name) + check_for_error(error_code) + + return self._create_chan(counter, name_to_assign_to_channel) + + def add_ci_count_edges_chan( + self, counter, name_to_assign_to_channel="", edge=Edge.RISING, + initial_count=0, count_direction=CountDirection.COUNT_UP): + """ + Creates a channel to count the number of rising or falling edges + of a digital signal. With the exception of devices that support + multi-counter tasks, you can create only one counter input + channel at a time with this function because a task can contain + only one counter input channel. To read from multiple counters + simultaneously, use a separate task for each counter. Connect + the input signal to the default input terminal of the counter + unless you select a different input terminal. + + Args: + counter (str): Specifies the name of the counter to use to + create the virtual channel. The DAQmx physical channel + constant lists all physical channels, including + counters, for devices installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + edge (Optional[nidaqmx.constants.Edge]): Specifies on which + edges of the input signal to increment or decrement the + count. + initial_count (Optional[int]): Is the value from which to + start counting. + count_direction (Optional[nidaqmx.constants.CountDirection]): + Specifies whether to increment or decrement the counter + on each edge. + Returns: + nidaqmx._task_modules.channels.ci_channel.CIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateCICountEdgesChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_int, ctypes.c_uint, ctypes.c_int] + + error_code = cfunc( + self._handle, counter, name_to_assign_to_channel, edge.value, + initial_count, count_direction.value) + check_for_error(error_code) + + return self._create_chan(counter, name_to_assign_to_channel) + + def add_ci_duty_cycle_chan( + self, counter, name_to_assign_to_channel="", min_freq=2.0, + max_freq=10000.0, edge=Edge.RISING, custom_scale_name=""): + """ + Creates channel(s) to duty cycle of a digital pulse. Connect the + input signal to the default input terminal of the counter unless + you select a different input terminal. With the exception of + devices that support multi-counter tasks, you can create only + one counter input channel at a time with this function because a + task can contain only one counter input channel. To read from + multiple counters simultaneously, use a separate task for each + counter. + + Args: + counter (str): Specifies the name of the counter to use to + create the virtual channel. The DAQmx physical channel + constant lists all physical channels, including + counters, for devices installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_freq (Optional[float]): Specifies the minimum frequency + you expect to measure. + max_freq (Optional[float]): Specifies the maximum frequency + you expect to measure. + edge (Optional[nidaqmx.constants.Edge]): Specifies between + which edges to measure the frequency or period of the + signal. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ci_channel.CIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateCIDutyCycleChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes_byte_str] + + error_code = cfunc( + self._handle, counter, name_to_assign_to_channel, min_freq, + max_freq, edge.value, custom_scale_name) + check_for_error(error_code) + + return self._create_chan(counter, name_to_assign_to_channel) + + def add_ci_freq_chan( + self, counter, name_to_assign_to_channel="", min_val=2.0, + max_val=100.0, units=FrequencyUnits.HZ, edge=Edge.RISING, + meas_method=CounterFrequencyMethod.LOW_FREQUENCY_1_COUNTER, + meas_time=0.001, divisor=4, custom_scale_name=""): + """ + Creates a channel to measure the frequency of a digital signal. + With the exception of devices that support multi-counter tasks, + you can create only one counter input channel at a time with + this function because a task can contain only one counter input + channel. To read from multiple counters simultaneously, use a + separate task for each counter. Connect the input signal to the + default input terminal of the counter unless you select a + different input terminal. + + Args: + counter (str): Specifies the name of the counter to use to + create the virtual channel. The DAQmx physical channel + constant lists all physical channels, including + counters, for devices installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.FrequencyUnits]): + Specifies the units to use to return frequency + measurements. + edge (Optional[nidaqmx.constants.Edge]): Specifies between + which edges to measure the frequency or period of the + signal. + meas_method (Optional[nidaqmx.constants.CounterFrequencyMethod]): + Specifies the method to use to calculate the period or + frequency of the signal. + meas_time (Optional[float]): Is the length of time in + seconds to measure the frequency or period of the signal + if **meas_method** is **HIGH_FREQUENCYWITH_2_COUNTERS**. + Leave this input unspecified if **meas_method** is not + **HIGH_FREQUENCYWITH_2_COUNTERS**. + divisor (Optional[int]): Is the value by which to divide the + input signal when **meas_method** is + **LARGE_RANGEWITH_2_COUNTERS**. Leave this input + unspecified if **meas_method** is not + **LARGE_RANGEWITH_2_COUNTERS**. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ci_channel.CIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateCIFreqChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, + ctypes.c_int, ctypes.c_double, ctypes.c_uint, ctypes_byte_str] + + error_code = cfunc( + self._handle, counter, name_to_assign_to_channel, min_val, + max_val, units.value, edge.value, meas_method.value, meas_time, + divisor, custom_scale_name) + check_for_error(error_code) + + return self._create_chan(counter, name_to_assign_to_channel) + + def add_ci_gps_timestamp_chan( + self, counter, name_to_assign_to_channel="", + units=TimeUnits.SECONDS, sync_method=GpsSignalType.IRIGB, + custom_scale_name=""): + """ + Creates a channel that uses a special purpose counter to take a + timestamp and synchronizes that counter to a GPS receiver. With + the exception of devices that support multi-counter tasks, you + can create only one counter input channel at a time with this + function because a task can contain only one counter input + channel. To read from multiple counters simultaneously, use a + separate task for each counter. Connect the input signals to the + default input terminals of the counter unless you select + different input terminals. + + Args: + counter (str): Specifies the name of the counter to use to + create the virtual channel. The DAQmx physical channel + constant lists all physical channels, including + counters, for devices installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + units (Optional[nidaqmx.constants.TimeUnits]): Specifies the + units to use to return the timestamp. + sync_method (Optional[nidaqmx.constants.GpsSignalType]): + Specifies the method to use to synchronize the counter + to a GPS receiver. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ci_channel.CIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateCIGPSTimestampChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_int, ctypes.c_int, ctypes_byte_str] + + error_code = cfunc( + self._handle, counter, name_to_assign_to_channel, units.value, + sync_method.value, custom_scale_name) + check_for_error(error_code) + + return self._create_chan(counter, name_to_assign_to_channel) + + def add_ci_lin_encoder_chan( + self, counter, name_to_assign_to_channel="", + decoding_type=EncoderType.X_4, zidx_enable=False, zidx_val=0, + zidx_phase=EncoderZIndexPhase.AHIGH_BHIGH, + units=LengthUnits.METERS, dist_per_pulse=0.001, initial_pos=0.0, + custom_scale_name=""): + """ + Creates a channel that uses a linear encoder to measure linear + position. With the exception of devices that support multi- + counter tasks, you can create only one counter input channel at + a time with this function because a task can contain only one + counter input channel. To read from multiple counters + simultaneously, use a separate task for each counter. Connect + the input signals to the default input terminals of the counter + unless you select different input terminals. + + Args: + counter (str): Specifies the name of the counter to use to + create the virtual channel. The DAQmx physical channel + constant lists all physical channels, including + counters, for devices installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + decoding_type (Optional[nidaqmx.constants.EncoderType]): + Specifies how to count and interpret the pulses the + encoder generates on signal A and signal B. **X_1**, + **X_2**, and **X_4** are valid for quadrature encoders + only. **TWO_PULSE_COUNTING** is valid only for two-pulse + encoders. + zidx_enable (Optional[bool]): Specifies whether to use Z + indexing for the channel. + zidx_val (Optional[float]): Specifies in **units** the value + to which to reset the measurement when signal Z is high + and signal A and signal B are at the states you specify + with **zidx_phase**. + zidx_phase (Optional[nidaqmx.constants.EncoderZIndexPhase]): + Specifies the states at which signal A and signal B must + be while signal Z is high for NI-DAQmx to reset the + measurement. If signal Z is never high while signal A + and signal B are high, for example, you must choose a + phase other than **A_HIGH_B_HIGH**. + units (Optional[nidaqmx.constants.LengthUnits]): Specifies + the units to use to return linear position measurements + from the channel. + dist_per_pulse (Optional[float]): Is the distance to measure + for each pulse the encoder generates on signal A or + signal B. This value is in the units you specify with + the **units** input. + initial_pos (Optional[float]): Is the position of the + encoder when you begin the measurement. This value is in + the units you specify with the **units** input. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ci_channel.CIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateCILinEncoderChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_int, c_bool32, ctypes.c_double, ctypes.c_int, + ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes_byte_str] + + error_code = cfunc( + self._handle, counter, name_to_assign_to_channel, + decoding_type.value, zidx_enable, zidx_val, zidx_phase.value, + units.value, dist_per_pulse, initial_pos, custom_scale_name) + check_for_error(error_code) + + return self._create_chan(counter, name_to_assign_to_channel) + + def add_ci_lin_velocity_chan( + self, counter, name_to_assign_to_channel="", min_val=0.0, + max_val=1.0, decoding_type=EncoderType.X_4, + units=VelocityUnits.METERS_PER_SECOND, dist_per_pulse=0.001, + custom_scale_name=""): + """ + Creates a channel that uses a linear encoder to measure linear + velocity. With the exception of devices that support multi- + counter tasks, you can create only one counter input channel at + a time with this function because a task can contain only one + counter input channel. To read from multiple counters + simultaneously, use a separate task for each counter. Connect + the input signal to the default input terminal of the counter + unless you select a different input terminal. + + Args: + counter (str): Specifies the name of the counter to use to + create the virtual channel. The DAQmx physical channel + constant lists all physical channels, including + counters, for devices installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + decoding_type (Optional[nidaqmx.constants.EncoderType]): + Specifies how to count and interpret the pulses the + encoder generates on signal A and signal B. **X_1**, + **X_2**, and **X_4** are valid for quadrature encoders + only. **TWO_PULSE_COUNTING** is valid only for two-pulse + encoders. + units (Optional[nidaqmx.constants.VelocityUnits]): Specifies + in which unit to return velocity measurements from the + channel. + dist_per_pulse (Optional[float]): Is the distance to measure + for each pulse the encoder generates on signal A or + signal B. This value is in the units you specify with + the **units** input. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ci_channel.CIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateCILinVelocityChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, + ctypes.c_double, ctypes_byte_str] + + error_code = cfunc( + self._handle, counter, name_to_assign_to_channel, min_val, + max_val, decoding_type.value, units.value, dist_per_pulse, + custom_scale_name) + check_for_error(error_code) + + return self._create_chan(counter, name_to_assign_to_channel) + + def add_ci_period_chan( + self, counter, name_to_assign_to_channel="", min_val=0.000001, + max_val=0.1, units=TimeUnits.SECONDS, edge=Edge.RISING, + meas_method=CounterFrequencyMethod.LOW_FREQUENCY_1_COUNTER, + meas_time=0.001, divisor=4, custom_scale_name=""): + """ + Creates a channel to measure the period of a digital signal. + With the exception of devices that support multi-counter tasks, + you can create only one counter input channel at a time with + this function because a task can contain only one counter input + channel. To read from multiple counters simultaneously, use a + separate task for each counter. Connect the input signal to the + default input terminal of the counter unless you select a + different input terminal. + + Args: + counter (str): Specifies the name of the counter to use to + create the virtual channel. The DAQmx physical channel + constant lists all physical channels, including + counters, for devices installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.TimeUnits]): Specifies the + units to use to return time or period measurements. + edge (Optional[nidaqmx.constants.Edge]): Specifies between + which edges to measure the frequency or period of the + signal. + meas_method (Optional[nidaqmx.constants.CounterFrequencyMethod]): + Specifies the method to use to calculate the period or + frequency of the signal. + meas_time (Optional[float]): Is the length of time in + seconds to measure the frequency or period of the signal + if **meas_method** is **HIGH_FREQUENCYWITH_2_COUNTERS**. + Leave this input unspecified if **meas_method** is not + **HIGH_FREQUENCYWITH_2_COUNTERS**. + divisor (Optional[int]): Is the value by which to divide the + input signal when **meas_method** is + **LARGE_RANGEWITH_2_COUNTERS**. Leave this input + unspecified if **meas_method** is not + **LARGE_RANGEWITH_2_COUNTERS**. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ci_channel.CIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateCIPeriodChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, + ctypes.c_int, ctypes.c_double, ctypes.c_uint, ctypes_byte_str] + + error_code = cfunc( + self._handle, counter, name_to_assign_to_channel, min_val, + max_val, units.value, edge.value, meas_method.value, meas_time, + divisor, custom_scale_name) + check_for_error(error_code) + + return self._create_chan(counter, name_to_assign_to_channel) + + def add_ci_pulse_chan_freq( + self, counter, name_to_assign_to_channel="", min_val=1000, + max_val=1000000, units=FrequencyUnits.HZ): + """ + Creates a channel to measure pulse specifications, returning the + measurements as pairs of frequency and duty cycle. With the + exception of devices that support multi-counter tasks, you can + create only one counter input channel at a time with this + function because a task can contain only one counter input + channel. To read from multiple counters simultaneously, use a + separate task for each counter. Connect the input signal to the + default input terminal of the counter unless you select a + different input terminal. + + Args: + counter (str): Specifies the name of the counter to use to + create the virtual channel. The DAQmx physical channel + constant lists all physical channels, including + counters, for devices installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.FrequencyUnits]): + Specifies the units to use to return pulse + specifications in terms of frequency. + Returns: + nidaqmx._task_modules.channels.ci_channel.CIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateCIPulseChanFreq + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int] + + error_code = cfunc( + self._handle, counter, name_to_assign_to_channel, min_val, + max_val, units.value) + check_for_error(error_code) + + return self._create_chan(counter, name_to_assign_to_channel) + + def add_ci_pulse_chan_ticks( + self, counter, name_to_assign_to_channel="", + source_terminal="OnboardClock", min_val=1000, max_val=1000000): + """ + Creates a channel to measure pulse specifications, returning the + measurements as pairs of high ticks and low ticks. With the + exception of devices that support multi-counter tasks, you can + create only one counter input channel at a time with this + function because a task can contain only one counter input + channel. To read from multiple counters simultaneously, use a + separate task for each counter. Connect the input signal to the + default input terminal of the counter unless you select a + different input terminal. + + Args: + counter (str): Specifies the name of the counter to use to + create the virtual channel. The DAQmx physical channel + constant lists all physical channels, including + counters, for devices installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + source_terminal (Optional[str]): Is the terminal to which + you connect a signal to use as the source of ticks. A + DAQmx terminal constant lists all terminals available on + devices installed in the system. You also can specify a + source terminal by specifying a string that contains a + terminal name. If you specify OnboardClock, or do not + specify any terminal, NI-DAQmx selects the fastest + onboard timebase available on the device. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + Returns: + nidaqmx._task_modules.channels.ci_channel.CIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateCIPulseChanTicks + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes_byte_str, ctypes.c_double, ctypes.c_double] + + error_code = cfunc( + self._handle, counter, name_to_assign_to_channel, source_terminal, + min_val, max_val) + check_for_error(error_code) + + return self._create_chan(counter, name_to_assign_to_channel) + + def add_ci_pulse_chan_time( + self, counter, name_to_assign_to_channel="", min_val=0.000001, + max_val=0.001, units=TimeUnits.SECONDS): + """ + Creates a channel to measure pulse specifications, returning the + measurements as pairs of high time and low time. With the + exception of devices that support multi-counter tasks, you can + create only one counter input channel at a time with this + function because a task can contain only one counter input + channel. To read from multiple counters simultaneously, use a + separate task for each counter. Connect the input signal to the + default input terminal of the counter unless you select a + different input terminal. + + Args: + counter (str): Specifies the name of the counter to use to + create the virtual channel. The DAQmx physical channel + constant lists all physical channels, including + counters, for devices installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.TimeUnits]): Specifies the + units to use to return pulse specifications in terms of + high time and low time. + Returns: + nidaqmx._task_modules.channels.ci_channel.CIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateCIPulseChanTime + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int] + + error_code = cfunc( + self._handle, counter, name_to_assign_to_channel, min_val, + max_val, units.value) + check_for_error(error_code) + + return self._create_chan(counter, name_to_assign_to_channel) + + def add_ci_pulse_width_chan( + self, counter, name_to_assign_to_channel="", min_val=0.000001, + max_val=0.1, units=TimeUnits.SECONDS, starting_edge=Edge.RISING, + custom_scale_name=""): + """ + Creates a channel to measure the width of a digital pulse. + **starting_edge** determines whether to measure a high pulse or + low pulse. With the exception of devices that support multi- + counter tasks, you can create only one counter input channel at + a time with this function because a task can contain only one + counter input channel. To read from multiple counters + simultaneously, use a separate task for each counter. Connect + the input signal to the default input terminal of the counter + unless you select a different input terminal. + + Args: + counter (str): Specifies the name of the counter to use to + create the virtual channel. The DAQmx physical channel + constant lists all physical channels, including + counters, for devices installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.TimeUnits]): Specifies the + units to use to return time or period measurements. + starting_edge (Optional[nidaqmx.constants.Edge]): Specifies + on which edge to begin measuring pulse width. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ci_channel.CIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateCIPulseWidthChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, + ctypes_byte_str] + + error_code = cfunc( + self._handle, counter, name_to_assign_to_channel, min_val, + max_val, units.value, starting_edge.value, custom_scale_name) + check_for_error(error_code) + + return self._create_chan(counter, name_to_assign_to_channel) + + def add_ci_semi_period_chan( + self, counter, name_to_assign_to_channel="", min_val=0.000001, + max_val=0.1, units=TimeUnits.SECONDS, custom_scale_name=""): + """ + Creates a channel to measure the time between state transitions + of a digital signal. With the exception of devices that support + multi-counter tasks, you can create only one counter input + channel at a time with this function because a task can contain + only one counter input channel. To read from multiple counters + simultaneously, use a separate task for each counter. Connect + the input signal to the default input terminal of the counter + unless you select a different input terminal. + + Args: + counter (str): Specifies the name of the counter to use to + create the virtual channel. The DAQmx physical channel + constant lists all physical channels, including + counters, for devices installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.TimeUnits]): Specifies the + units to use to return time or period measurements. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ci_channel.CIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateCISemiPeriodChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes_byte_str] + + error_code = cfunc( + self._handle, counter, name_to_assign_to_channel, min_val, + max_val, units.value, custom_scale_name) + check_for_error(error_code) + + return self._create_chan(counter, name_to_assign_to_channel) + + def add_ci_two_edge_sep_chan( + self, counter, name_to_assign_to_channel="", min_val=0.000001, + max_val=1.0, units=TimeUnits.SECONDS, first_edge=Edge.RISING, + second_edge=Edge.FALLING, custom_scale_name=""): + """ + Creates a channel that measures the amount of time between the + rising or falling edge of one digital signal and the rising or + falling edge of another digital signal. With the exception of + devices that support multi-counter tasks, you can create only + one counter input channel at a time with this function because a + task can contain only one counter input channel. To read from + multiple counters simultaneously, use a separate task for each + counter. Connect the input signals to the default input + terminals of the counter unless you select different input + terminals. + + Args: + counter (str): Specifies the name of the counter to use to + create the virtual channel. The DAQmx physical channel + constant lists all physical channels, including + counters, for devices installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + min_val (Optional[float]): Specifies in **units** the + minimum value you expect to measure. + max_val (Optional[float]): Specifies in **units** the + maximum value you expect to measure. + units (Optional[nidaqmx.constants.TimeUnits]): Specifies the + units to use to return time or period measurements. + first_edge (Optional[nidaqmx.constants.Edge]): Specifies on + which edge of the first signal to start each + measurement. + second_edge (Optional[nidaqmx.constants.Edge]): Specifies on + which edge of the second signal to stop each + measurement. + custom_scale_name (Optional[str]): Specifies the name of a + custom scale for the channel. If you want the channel to + use a custom scale, specify the name of the custom scale + to this input and set **units** to + **FROM_CUSTOM_SCALE**. + Returns: + nidaqmx._task_modules.channels.ci_channel.CIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateCITwoEdgeSepChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, + ctypes.c_int, ctypes_byte_str] + + error_code = cfunc( + self._handle, counter, name_to_assign_to_channel, min_val, + max_val, units.value, first_edge.value, second_edge.value, + custom_scale_name) + check_for_error(error_code) + + return self._create_chan(counter, name_to_assign_to_channel) + diff --git a/nidaqmx/_task_modules/co_channel_collection.py b/nidaqmx/_task_modules/co_channel_collection.py new file mode 100644 index 00000000..80c2d95c --- /dev/null +++ b/nidaqmx/_task_modules/co_channel_collection.py @@ -0,0 +1,202 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import ctypes +import numpy + +from nidaqmx._lib import lib_importer, ctypes_byte_str +from nidaqmx.errors import check_for_error +from nidaqmx._task_modules.channels.co_channel import COChannel +from nidaqmx._task_modules.channel_collection import ChannelCollection +from nidaqmx.utils import unflatten_channel_string +from nidaqmx.constants import ( + FrequencyUnits, Level, TimeUnits) + + +class COChannelCollection(ChannelCollection): + """ + Contains the collection of counter output channels for a DAQmx Task. + """ + def __init__(self, task_handle): + super(COChannelCollection, self).__init__(task_handle) + + def _create_chan(self, counter, name_to_assign_to_channel=''): + """ + Creates and returns a COChannel object. + + Args: + counter (str): Specifies the names of the counters to use to + create virtual channels. + name_to_assign_to_channel (Optional[str]): Specifies a name to + assign to the virtual channel this method creates. + Returns: + nidaqmx._task_modules.channels.co_channel.COChannel: + + Specifies the newly created COChannel object. + """ + if name_to_assign_to_channel: + num_counters = len(unflatten_channel_string(counter)) + + if num_counters > 1: + name = '{0}0:{1}'.format( + name_to_assign_to_channel, num_counters-1) + else: + name = name_to_assign_to_channel + else: + name = counter + + return COChannel(self._handle, name) + + def add_co_pulse_chan_freq( + self, counter, name_to_assign_to_channel="", + units=FrequencyUnits.HZ, idle_state=Level.LOW, initial_delay=0.0, + freq=1.0, duty_cycle=0.5): + """ + Creates channel(s) to generate digital pulses that **freq** and + **duty_cycle** define. The pulses appear on the default output + terminal of the counter unless you select a different output + terminal. + + Args: + counter (str): Specifies the names of the counters to use to + create the virtual channels. The DAQmx physical channel + constant lists all physical channels, including + counters, for devices installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + units (Optional[nidaqmx.constants.FrequencyUnits]): + Specifies the units in which to define pulse frequency. + idle_state (Optional[nidaqmx.constants.Level]): Specifies + the resting state of the output terminal. + initial_delay (Optional[float]): Is the amount of time in + seconds to wait before generating the first pulse. + freq (Optional[float]): Specifies at what frequency to + generate pulses. + duty_cycle (Optional[float]): Is the width of the pulse + divided by the pulse period. NI-DAQmx uses this ratio + combined with frequency to determine pulse width and the + interval between pulses. + Returns: + nidaqmx._task_modules.channels.co_channel.COChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateCOPulseChanFreq + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_int, ctypes.c_int, ctypes.c_double, ctypes.c_double, + ctypes.c_double] + + error_code = cfunc( + self._handle, counter, name_to_assign_to_channel, units.value, + idle_state.value, initial_delay, freq, duty_cycle) + check_for_error(error_code) + + return self._create_chan(counter, name_to_assign_to_channel) + + def add_co_pulse_chan_ticks( + self, counter, source_terminal, name_to_assign_to_channel="", + idle_state=Level.LOW, initial_delay=0, low_ticks=100, + high_ticks=100): + """ + Creates channel(s) to generate digital pulses defined by the + number of timebase ticks that the pulse is at a high state and + the number of timebase ticks that the pulse is at a low state. + The pulses appear on the default output terminal of the counter + unless you select a different output terminal. + + Args: + counter (str): Specifies the names of the counters to use to + create the virtual channels. The DAQmx physical channel + constant lists all physical channels, including + counters, for devices installed in the system. + source_terminal (str): Is the terminal to which you connect + an external timebase. A DAQmx terminal constant lists + all terminals available on devices installed in the + system. You also can specify a source terminal by + specifying a string that contains a terminal name. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + idle_state (Optional[nidaqmx.constants.Level]): Specifies + the resting state of the output terminal. + initial_delay (Optional[int]): Is the number of timebase + ticks to wait before generating the first pulse. + low_ticks (Optional[int]): Is the number of ticks the pulse + is low. + high_ticks (Optional[int]): Is the number of ticks the pulse + is high. + Returns: + nidaqmx._task_modules.channels.co_channel.COChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateCOPulseChanTicks + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes_byte_str, ctypes.c_int, ctypes.c_int, ctypes.c_int, + ctypes.c_int] + + error_code = cfunc( + self._handle, counter, name_to_assign_to_channel, source_terminal, + idle_state.value, initial_delay, low_ticks, high_ticks) + check_for_error(error_code) + + return self._create_chan(counter, name_to_assign_to_channel) + + def add_co_pulse_chan_time( + self, counter, name_to_assign_to_channel="", + units=TimeUnits.SECONDS, idle_state=Level.LOW, initial_delay=0.0, + low_time=0.01, high_time=0.01): + """ + Creates channel(s) to generate digital pulses defined by the + amount of time the pulse is at a high state and the amount of + time the pulse is at a low state. The pulses appear on the + default output terminal of the counter unless you select a + different output terminal. + + Args: + counter (str): Specifies the names of the counters to use to + create the virtual channels. The DAQmx physical channel + constant lists all physical channels, including + counters, for devices installed in the system. + name_to_assign_to_channel (Optional[str]): Specifies a name + to assign to the virtual channel this function creates. + If you do not specify a value for this input, NI-DAQmx + uses the physical channel name as the virtual channel + name. + units (Optional[nidaqmx.constants.TimeUnits]): Specifies the + units in which to define pulse high and low time. + idle_state (Optional[nidaqmx.constants.Level]): Specifies + the resting state of the output terminal. + initial_delay (Optional[float]): Is the amount of time in + seconds to wait before generating the first pulse. + low_time (Optional[float]): Is the amount of time the pulse + is low. + high_time (Optional[float]): Is the amount of time the pulse + is high. + Returns: + nidaqmx._task_modules.channels.co_channel.COChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateCOPulseChanTime + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_int, ctypes.c_int, ctypes.c_double, ctypes.c_double, + ctypes.c_double] + + error_code = cfunc( + self._handle, counter, name_to_assign_to_channel, units.value, + idle_state.value, initial_delay, low_time, high_time) + check_for_error(error_code) + + return self._create_chan(counter, name_to_assign_to_channel) + diff --git a/nidaqmx/_task_modules/di_channel_collection.py b/nidaqmx/_task_modules/di_channel_collection.py new file mode 100644 index 00000000..f580e072 --- /dev/null +++ b/nidaqmx/_task_modules/di_channel_collection.py @@ -0,0 +1,103 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import ctypes +import numpy + +from nidaqmx._lib import lib_importer, ctypes_byte_str +from nidaqmx.errors import check_for_error +from nidaqmx._task_modules.channels.di_channel import DIChannel +from nidaqmx._task_modules.channel_collection import ChannelCollection +from nidaqmx.utils import unflatten_channel_string +from nidaqmx.constants import ( + LineGrouping) + + +class DIChannelCollection(ChannelCollection): + """ + Contains the collection of digital input channels for a DAQmx Task. + """ + def __init__(self, task_handle): + super(DIChannelCollection, self).__init__(task_handle) + + def _create_chan(self, lines, line_grouping, name_to_assign_to_lines=''): + """ + Creates and returns a DIChannel object. + + Args: + lines (str): Specifies the names of the lines to use to + create virtual channels. + line_grouping (Optional[nidaqmx.constants.LineGrouping]): + Specifies how to group digital lines into one or more + virtual channels. + name_to_assign_to_lines (Optional[str]): Specifies a name to + assign to the virtual channel this method creates. + Returns: + nidaqmx._task_modules.channels.di_channel.DIChannel: + + Specifies the newly created DIChannel object. + """ + unflattened_lines = unflatten_channel_string(lines) + num_lines = len(unflattened_lines) + + if line_grouping == LineGrouping.CHAN_FOR_ALL_LINES: + if name_to_assign_to_lines or num_lines == 1: + name = lines + else: + name = unflattened_lines[0] + '...' + else: + if name_to_assign_to_lines: + if num_lines > 1: + name = '{0}0:{1}'.format( + name_to_assign_to_lines, num_lines-1) + else: + name = name_to_assign_to_lines + else: + name = lines + + return DIChannel(self._handle, name) + + def add_di_chan( + self, lines, name_to_assign_to_lines="", + line_grouping=LineGrouping.CHAN_FOR_ALL_LINES): + """ + Creates channel(s) to measure digital signals. You can group + digital lines into one digital channel or separate them into + multiple digital channels. If you specify one or more entire + ports in the **lines** input by using port physical channel + names, you cannot separate the ports into multiple channels. To + separate ports into multiple channels, use this function + multiple times with a different port each time. + + Args: + lines (str): Specifies the names of the digital lines or + ports to use to create virtual channels. The DAQmx + physical channel constant lists all lines and ports for + devices installed in the system. + name_to_assign_to_lines (Optional[str]): Specifies a name to + assign to the virtual channel this function creates. If + you do not specify a value for this input, NI-DAQmx uses + the physical channel name as the virtual channel name. + line_grouping (Optional[nidaqmx.constants.LineGrouping]): + Specifies how to group digital lines into one or more + virtual channels. If you specify one or more entire + ports with the **lines** input, you must set this input + to **one channel for all lines**. + Returns: + nidaqmx._task_modules.channels.di_channel.DIChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateDIChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_int] + + error_code = cfunc( + self._handle, lines, name_to_assign_to_lines, line_grouping.value) + check_for_error(error_code) + + return self._create_chan(lines, line_grouping, name_to_assign_to_lines) + diff --git a/nidaqmx/_task_modules/do_channel_collection.py b/nidaqmx/_task_modules/do_channel_collection.py new file mode 100644 index 00000000..5414c73d --- /dev/null +++ b/nidaqmx/_task_modules/do_channel_collection.py @@ -0,0 +1,103 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import ctypes +import numpy + +from nidaqmx._lib import lib_importer, ctypes_byte_str +from nidaqmx.errors import check_for_error +from nidaqmx._task_modules.channels.do_channel import DOChannel +from nidaqmx._task_modules.channel_collection import ChannelCollection +from nidaqmx.utils import unflatten_channel_string +from nidaqmx.constants import ( + LineGrouping) + + +class DOChannelCollection(ChannelCollection): + """ + Contains the collection of digital output channels for a DAQmx Task. + """ + def __init__(self, task_handle): + super(DOChannelCollection, self).__init__(task_handle) + + def _create_chan(self, lines, line_grouping, name_to_assign_to_lines=''): + """ + Creates and returns a DOChannel object. + + Args: + lines (str): Specifies the names of the lines to use to + create virtual channels. + line_grouping (Optional[nidaqmx.constants.LineGrouping]): + Specifies how to group digital lines into one or more + virtual channels. + name_to_assign_to_lines (Optional[str]): Specifies a name to + assign to the virtual channel this method creates. + Returns: + nidaqmx._task_modules.channels.do_channel.DOChannel: + + Specifies the newly created DOChannel object. + """ + unflattened_lines = unflatten_channel_string(lines) + num_lines = len(unflattened_lines) + + if line_grouping == LineGrouping.CHAN_FOR_ALL_LINES: + if name_to_assign_to_lines or num_lines == 1: + name = lines + else: + name = unflattened_lines[0] + '...' + else: + if name_to_assign_to_lines: + if num_lines > 1: + name = '{0}0:{1}'.format( + name_to_assign_to_lines, num_lines-1) + else: + name = name_to_assign_to_lines + else: + name = lines + + return DOChannel(self._handle, name) + + def add_do_chan( + self, lines, name_to_assign_to_lines="", + line_grouping=LineGrouping.CHAN_FOR_ALL_LINES): + """ + Creates channel(s) to generate digital signals. You can group + digital lines into one digital channel or separate them into + multiple digital channels. If you specify one or more entire + ports in **lines** input by using port physical channel names, + you cannot separate the ports into multiple channels. To + separate ports into multiple channels, use this function + multiple times with a different port each time. + + Args: + lines (str): Specifies the names of the digital lines or + ports to use to create virtual channels. The DAQmx + physical channel constant lists all lines and ports for + devices installed in the system. + name_to_assign_to_lines (Optional[str]): Specifies a name to + assign to the virtual channel this function creates. If + you do not specify a value for this input, NI-DAQmx uses + the physical channel name as the virtual channel name. + line_grouping (Optional[nidaqmx.constants.LineGrouping]): + Specifies how to group digital lines into one or more + virtual channels. If you specify one or more entire + ports with the **lines** input, you must set this input + to **one channel for all lines**. + Returns: + nidaqmx._task_modules.channels.do_channel.DOChannel: + + Indicates the newly created channel object. + """ + cfunc = lib_importer.windll.DAQmxCreateDOChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_int] + + error_code = cfunc( + self._handle, lines, name_to_assign_to_lines, line_grouping.value) + check_for_error(error_code) + + return self._create_chan(lines, line_grouping, name_to_assign_to_lines) + diff --git a/nidaqmx/_task_modules/export_signals.py b/nidaqmx/_task_modules/export_signals.py new file mode 100644 index 00000000..b22fc7c3 --- /dev/null +++ b/nidaqmx/_task_modules/export_signals.py @@ -0,0 +1,2253 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import ctypes +import numpy + +from nidaqmx._lib import lib_importer, ctypes_byte_str +from nidaqmx.errors import ( + check_for_error, is_string_buffer_too_small, is_array_buffer_too_small) +from nidaqmx.constants import ( + DeassertCondition, DigitalWidthUnits, ExportAction, Level, Polarity, + Signal) + + +class ExportSignals(object): + """ + Represents the exported signal configurations for a DAQmx task. + """ + def __init__(self, task_handle): + self._handle = task_handle + + @property + def adv_cmplt_event_delay(self): + """ + float: Specifies the output signal delay in periods of the + sample clock. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetExportedAdvCmpltEventDelayVal + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @adv_cmplt_event_delay.setter + def adv_cmplt_event_delay(self, val): + cfunc = lib_importer.windll.DAQmxSetExportedAdvCmpltEventDelayVal + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @adv_cmplt_event_delay.deleter + def adv_cmplt_event_delay(self): + cfunc = lib_importer.windll.DAQmxResetExportedAdvCmpltEventDelayVal + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def adv_cmplt_event_output_term(self): + """ + str: Specifies the terminal to which to route the Advance + Complete Event. + """ + cfunc = lib_importer.windll.DAQmxGetExportedAdvCmpltEventOutputTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @adv_cmplt_event_output_term.setter + def adv_cmplt_event_output_term(self, val): + cfunc = lib_importer.windll.DAQmxSetExportedAdvCmpltEventOutputTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @adv_cmplt_event_output_term.deleter + def adv_cmplt_event_output_term(self): + cfunc = lib_importer.windll.DAQmxResetExportedAdvCmpltEventOutputTerm + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def adv_cmplt_event_pulse_polarity(self): + """ + :class:`nidaqmx.constants.Polarity`: Specifies the polarity of + the exported Advance Complete Event. + """ + val = ctypes.c_int() + + cfunc = (lib_importer.windll. + DAQmxGetExportedAdvCmpltEventPulsePolarity) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return Polarity(val.value) + + @adv_cmplt_event_pulse_polarity.setter + def adv_cmplt_event_pulse_polarity(self, val): + val = val.value + cfunc = (lib_importer.windll. + DAQmxSetExportedAdvCmpltEventPulsePolarity) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @adv_cmplt_event_pulse_polarity.deleter + def adv_cmplt_event_pulse_polarity(self): + cfunc = (lib_importer.windll. + DAQmxResetExportedAdvCmpltEventPulsePolarity) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def adv_cmplt_event_pulse_width(self): + """ + float: Specifies the width of the exported Advance Complete + Event pulse. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetExportedAdvCmpltEventPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @adv_cmplt_event_pulse_width.setter + def adv_cmplt_event_pulse_width(self, val): + cfunc = lib_importer.windll.DAQmxSetExportedAdvCmpltEventPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @adv_cmplt_event_pulse_width.deleter + def adv_cmplt_event_pulse_width(self): + cfunc = lib_importer.windll.DAQmxResetExportedAdvCmpltEventPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def adv_trig_output_term(self): + """ + str: Specifies the terminal to which to route the Advance + Trigger. + """ + cfunc = lib_importer.windll.DAQmxGetExportedAdvTrigOutputTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @adv_trig_output_term.setter + def adv_trig_output_term(self, val): + cfunc = lib_importer.windll.DAQmxSetExportedAdvTrigOutputTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @adv_trig_output_term.deleter + def adv_trig_output_term(self): + cfunc = lib_importer.windll.DAQmxResetExportedAdvTrigOutputTerm + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def adv_trig_pulse_polarity(self): + """ + :class:`nidaqmx.constants.Polarity`: Indicates the polarity of + the exported Advance Trigger. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetExportedAdvTrigPulsePolarity + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return Polarity(val.value) + + @property + def adv_trig_pulse_width(self): + """ + float: Specifies the width of an exported Advance Trigger pulse. + Specify this value in the units you specify with + **adv_trig_pulse_width_units**. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetExportedAdvTrigPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @adv_trig_pulse_width.setter + def adv_trig_pulse_width(self, val): + cfunc = lib_importer.windll.DAQmxSetExportedAdvTrigPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @adv_trig_pulse_width.deleter + def adv_trig_pulse_width(self): + cfunc = lib_importer.windll.DAQmxResetExportedAdvTrigPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def adv_trig_pulse_width_units(self): + """ + :class:`nidaqmx.constants.DigitalWidthUnits`: Specifies the + units of **adv_trig_pulse_width**. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetExportedAdvTrigPulseWidthUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return DigitalWidthUnits(val.value) + + @adv_trig_pulse_width_units.setter + def adv_trig_pulse_width_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetExportedAdvTrigPulseWidthUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @adv_trig_pulse_width_units.deleter + def adv_trig_pulse_width_units(self): + cfunc = lib_importer.windll.DAQmxResetExportedAdvTrigPulseWidthUnits + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def ai_conv_clk_output_term(self): + """ + str: Specifies the terminal to which to route the AI Convert + Clock. + """ + cfunc = lib_importer.windll.DAQmxGetExportedAIConvClkOutputTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ai_conv_clk_output_term.setter + def ai_conv_clk_output_term(self, val): + cfunc = lib_importer.windll.DAQmxSetExportedAIConvClkOutputTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @ai_conv_clk_output_term.deleter + def ai_conv_clk_output_term(self): + cfunc = lib_importer.windll.DAQmxResetExportedAIConvClkOutputTerm + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def ai_conv_clk_pulse_polarity(self): + """ + :class:`nidaqmx.constants.Polarity`: Indicates the polarity of + the exported AI Convert Clock. The polarity is fixed and + independent of the active edge of the source of the AI + Convert Clock. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetExportedAIConvClkPulsePolarity + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return Polarity(val.value) + + @property + def ai_hold_cmplt_event_output_term(self): + """ + str: Specifies the terminal to which to route the AI Hold + Complete Event. + """ + cfunc = (lib_importer.windll. + DAQmxGetExportedAIHoldCmpltEventOutputTerm) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ai_hold_cmplt_event_output_term.setter + def ai_hold_cmplt_event_output_term(self, val): + cfunc = (lib_importer.windll. + DAQmxSetExportedAIHoldCmpltEventOutputTerm) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @ai_hold_cmplt_event_output_term.deleter + def ai_hold_cmplt_event_output_term(self): + cfunc = (lib_importer.windll. + DAQmxResetExportedAIHoldCmpltEventOutputTerm) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def ai_hold_cmplt_event_pulse_polarity(self): + """ + :class:`nidaqmx.constants.Polarity`: Specifies the polarity of + an exported AI Hold Complete Event pulse. + """ + val = ctypes.c_int() + + cfunc = (lib_importer.windll. + DAQmxGetExportedAIHoldCmpltEventPulsePolarity) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return Polarity(val.value) + + @ai_hold_cmplt_event_pulse_polarity.setter + def ai_hold_cmplt_event_pulse_polarity(self, val): + val = val.value + cfunc = (lib_importer.windll. + DAQmxSetExportedAIHoldCmpltEventPulsePolarity) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @ai_hold_cmplt_event_pulse_polarity.deleter + def ai_hold_cmplt_event_pulse_polarity(self): + cfunc = (lib_importer.windll. + DAQmxResetExportedAIHoldCmpltEventPulsePolarity) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def change_detect_event_output_term(self): + """ + str: Specifies the terminal to which to route the Change + Detection Event. + """ + cfunc = (lib_importer.windll. + DAQmxGetExportedChangeDetectEventOutputTerm) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @change_detect_event_output_term.setter + def change_detect_event_output_term(self, val): + cfunc = (lib_importer.windll. + DAQmxSetExportedChangeDetectEventOutputTerm) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @change_detect_event_output_term.deleter + def change_detect_event_output_term(self): + cfunc = (lib_importer.windll. + DAQmxResetExportedChangeDetectEventOutputTerm) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def change_detect_event_pulse_polarity(self): + """ + :class:`nidaqmx.constants.Polarity`: Specifies the polarity of + an exported Change Detection Event pulse. + """ + val = ctypes.c_int() + + cfunc = (lib_importer.windll. + DAQmxGetExportedChangeDetectEventPulsePolarity) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return Polarity(val.value) + + @change_detect_event_pulse_polarity.setter + def change_detect_event_pulse_polarity(self, val): + val = val.value + cfunc = (lib_importer.windll. + DAQmxSetExportedChangeDetectEventPulsePolarity) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @change_detect_event_pulse_polarity.deleter + def change_detect_event_pulse_polarity(self): + cfunc = (lib_importer.windll. + DAQmxResetExportedChangeDetectEventPulsePolarity) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def ctr_out_event_output_behavior(self): + """ + :class:`nidaqmx.constants.ExportAction`: Specifies whether the + exported Counter Output Event pulses or changes from one + state to the other when the counter reaches terminal count. + """ + val = ctypes.c_int() + + cfunc = (lib_importer.windll. + DAQmxGetExportedCtrOutEventOutputBehavior) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return ExportAction(val.value) + + @ctr_out_event_output_behavior.setter + def ctr_out_event_output_behavior(self, val): + val = val.value + cfunc = (lib_importer.windll. + DAQmxSetExportedCtrOutEventOutputBehavior) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @ctr_out_event_output_behavior.deleter + def ctr_out_event_output_behavior(self): + cfunc = (lib_importer.windll. + DAQmxResetExportedCtrOutEventOutputBehavior) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def ctr_out_event_output_term(self): + """ + str: Specifies the terminal to which to route the Counter Output + Event. + """ + cfunc = lib_importer.windll.DAQmxGetExportedCtrOutEventOutputTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ctr_out_event_output_term.setter + def ctr_out_event_output_term(self, val): + cfunc = lib_importer.windll.DAQmxSetExportedCtrOutEventOutputTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @ctr_out_event_output_term.deleter + def ctr_out_event_output_term(self): + cfunc = lib_importer.windll.DAQmxResetExportedCtrOutEventOutputTerm + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def ctr_out_event_pulse_polarity(self): + """ + :class:`nidaqmx.constants.Polarity`: Specifies the polarity of + the pulses at the output terminal of the counter when + **ctr_out_event_output_behavior** is + **ExportActions2.PULSE**. NI-DAQmx ignores this property if + **ctr_out_event_output_behavior** is + **ExportActions2.TOGGLE**. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetExportedCtrOutEventPulsePolarity + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return Polarity(val.value) + + @ctr_out_event_pulse_polarity.setter + def ctr_out_event_pulse_polarity(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetExportedCtrOutEventPulsePolarity + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @ctr_out_event_pulse_polarity.deleter + def ctr_out_event_pulse_polarity(self): + cfunc = lib_importer.windll.DAQmxResetExportedCtrOutEventPulsePolarity + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def ctr_out_event_toggle_idle_state(self): + """ + :class:`nidaqmx.constants.Level`: Specifies the initial state of + the output terminal of the counter when + **ctr_out_event_output_behavior** is + **ExportActions2.TOGGLE**. The terminal enters this state + when NI-DAQmx commits the task. + """ + val = ctypes.c_int() + + cfunc = (lib_importer.windll. + DAQmxGetExportedCtrOutEventToggleIdleState) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return Level(val.value) + + @ctr_out_event_toggle_idle_state.setter + def ctr_out_event_toggle_idle_state(self, val): + val = val.value + cfunc = (lib_importer.windll. + DAQmxSetExportedCtrOutEventToggleIdleState) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @ctr_out_event_toggle_idle_state.deleter + def ctr_out_event_toggle_idle_state(self): + cfunc = (lib_importer.windll. + DAQmxResetExportedCtrOutEventToggleIdleState) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def data_active_event_lvl_active_lvl(self): + """ + :class:`nidaqmx.constants.Polarity`: Specifies the polarity of + the exported Data Active Event. + """ + val = ctypes.c_int() + + cfunc = (lib_importer.windll. + DAQmxGetExportedDataActiveEventLvlActiveLvl) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return Polarity(val.value) + + @data_active_event_lvl_active_lvl.setter + def data_active_event_lvl_active_lvl(self, val): + val = val.value + cfunc = (lib_importer.windll. + DAQmxSetExportedDataActiveEventLvlActiveLvl) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @data_active_event_lvl_active_lvl.deleter + def data_active_event_lvl_active_lvl(self): + cfunc = (lib_importer.windll. + DAQmxResetExportedDataActiveEventLvlActiveLvl) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def data_active_event_output_term(self): + """ + str: Specifies the terminal to which to export the Data Active + Event. + """ + cfunc = (lib_importer.windll. + DAQmxGetExportedDataActiveEventOutputTerm) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @data_active_event_output_term.setter + def data_active_event_output_term(self, val): + cfunc = (lib_importer.windll. + DAQmxSetExportedDataActiveEventOutputTerm) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @data_active_event_output_term.deleter + def data_active_event_output_term(self): + cfunc = (lib_importer.windll. + DAQmxResetExportedDataActiveEventOutputTerm) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def divided_samp_clk_timebase_output_term(self): + """ + str: Specifies the terminal to which to route the Divided Sample + Clock Timebase. + """ + cfunc = (lib_importer.windll. + DAQmxGetExportedDividedSampClkTimebaseOutputTerm) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @divided_samp_clk_timebase_output_term.setter + def divided_samp_clk_timebase_output_term(self, val): + cfunc = (lib_importer.windll. + DAQmxSetExportedDividedSampClkTimebaseOutputTerm) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @divided_samp_clk_timebase_output_term.deleter + def divided_samp_clk_timebase_output_term(self): + cfunc = (lib_importer.windll. + DAQmxResetExportedDividedSampClkTimebaseOutputTerm) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def exported_10_m_hz_ref_clk_output_term(self): + """ + str: Specifies the terminal to which to route the 10MHz Clock. + """ + cfunc = lib_importer.windll.DAQmxGetExported10MHzRefClkOutputTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @exported_10_m_hz_ref_clk_output_term.setter + def exported_10_m_hz_ref_clk_output_term(self, val): + cfunc = lib_importer.windll.DAQmxSetExported10MHzRefClkOutputTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @exported_10_m_hz_ref_clk_output_term.deleter + def exported_10_m_hz_ref_clk_output_term(self): + cfunc = lib_importer.windll.DAQmxResetExported10MHzRefClkOutputTerm + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def exported_20_m_hz_timebase_output_term(self): + """ + str: Specifies the terminal to which to route the 20MHz + Timebase. + """ + cfunc = lib_importer.windll.DAQmxGetExported20MHzTimebaseOutputTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @exported_20_m_hz_timebase_output_term.setter + def exported_20_m_hz_timebase_output_term(self, val): + cfunc = lib_importer.windll.DAQmxSetExported20MHzTimebaseOutputTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @exported_20_m_hz_timebase_output_term.deleter + def exported_20_m_hz_timebase_output_term(self): + cfunc = lib_importer.windll.DAQmxResetExported20MHzTimebaseOutputTerm + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def hshk_event_delay(self): + """ + float: Specifies the number of seconds to delay after the + Handshake Trigger deasserts before asserting the Handshake + Event. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetExportedHshkEventDelay + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @hshk_event_delay.setter + def hshk_event_delay(self, val): + cfunc = lib_importer.windll.DAQmxSetExportedHshkEventDelay + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @hshk_event_delay.deleter + def hshk_event_delay(self): + cfunc = lib_importer.windll.DAQmxResetExportedHshkEventDelay + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def hshk_event_interlocked_assert_on_start(self): + """ + bool: Specifies to assert the Handshake Event when the task + starts if **hshk_event_output_behavior** is + **ExportActions5.INTERLOCKED**. + """ + val = ctypes.c_bool() + + cfunc = (lib_importer.windll. + DAQmxGetExportedHshkEventInterlockedAssertOnStart) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @hshk_event_interlocked_assert_on_start.setter + def hshk_event_interlocked_assert_on_start(self, val): + cfunc = (lib_importer.windll. + DAQmxSetExportedHshkEventInterlockedAssertOnStart) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_bool] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @hshk_event_interlocked_assert_on_start.deleter + def hshk_event_interlocked_assert_on_start(self): + cfunc = (lib_importer.windll. + DAQmxResetExportedHshkEventInterlockedAssertOnStart) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def hshk_event_interlocked_asserted_lvl(self): + """ + :class:`nidaqmx.constants.Level`: Specifies the asserted level + of the exported Handshake Event if + **hshk_event_output_behavior** is + **ExportActions5.INTERLOCKED**. + """ + val = ctypes.c_int() + + cfunc = (lib_importer.windll. + DAQmxGetExportedHshkEventInterlockedAssertedLvl) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return Level(val.value) + + @hshk_event_interlocked_asserted_lvl.setter + def hshk_event_interlocked_asserted_lvl(self, val): + val = val.value + cfunc = (lib_importer.windll. + DAQmxSetExportedHshkEventInterlockedAssertedLvl) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @hshk_event_interlocked_asserted_lvl.deleter + def hshk_event_interlocked_asserted_lvl(self): + cfunc = (lib_importer.windll. + DAQmxResetExportedHshkEventInterlockedAssertedLvl) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def hshk_event_interlocked_deassert_delay(self): + """ + float: Specifies in seconds the amount of time to wait after the + Handshake Trigger asserts before deasserting the Handshake + Event if **hshk_event_output_behavior** is + **ExportActions5.INTERLOCKED**. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetExportedHshkEventInterlockedDeassertDelay) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @hshk_event_interlocked_deassert_delay.setter + def hshk_event_interlocked_deassert_delay(self, val): + cfunc = (lib_importer.windll. + DAQmxSetExportedHshkEventInterlockedDeassertDelay) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @hshk_event_interlocked_deassert_delay.deleter + def hshk_event_interlocked_deassert_delay(self): + cfunc = (lib_importer.windll. + DAQmxResetExportedHshkEventInterlockedDeassertDelay) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def hshk_event_output_behavior(self): + """ + :class:`nidaqmx.constants.ExportAction`: Specifies the output + behavior of the Handshake Event. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetExportedHshkEventOutputBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return ExportAction(val.value) + + @hshk_event_output_behavior.setter + def hshk_event_output_behavior(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetExportedHshkEventOutputBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @hshk_event_output_behavior.deleter + def hshk_event_output_behavior(self): + cfunc = lib_importer.windll.DAQmxResetExportedHshkEventOutputBehavior + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def hshk_event_output_term(self): + """ + str: Specifies the terminal to which to route the Handshake + Event. + """ + cfunc = lib_importer.windll.DAQmxGetExportedHshkEventOutputTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @hshk_event_output_term.setter + def hshk_event_output_term(self, val): + cfunc = lib_importer.windll.DAQmxSetExportedHshkEventOutputTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @hshk_event_output_term.deleter + def hshk_event_output_term(self): + cfunc = lib_importer.windll.DAQmxResetExportedHshkEventOutputTerm + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def hshk_event_pulse_polarity(self): + """ + :class:`nidaqmx.constants.Polarity`: Specifies the polarity of + the exported Handshake Event if + **hshk_event_output_behavior** is **ExportActions5.PULSE**. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetExportedHshkEventPulsePolarity + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return Polarity(val.value) + + @hshk_event_pulse_polarity.setter + def hshk_event_pulse_polarity(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetExportedHshkEventPulsePolarity + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @hshk_event_pulse_polarity.deleter + def hshk_event_pulse_polarity(self): + cfunc = lib_importer.windll.DAQmxResetExportedHshkEventPulsePolarity + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def hshk_event_pulse_width(self): + """ + float: Specifies in seconds the pulse width of the exported + Handshake Event if **hshk_event_output_behavior** is + **ExportActions5.PULSE**. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetExportedHshkEventPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @hshk_event_pulse_width.setter + def hshk_event_pulse_width(self, val): + cfunc = lib_importer.windll.DAQmxSetExportedHshkEventPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @hshk_event_pulse_width.deleter + def hshk_event_pulse_width(self): + cfunc = lib_importer.windll.DAQmxResetExportedHshkEventPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def pause_trig_lvl_active_lvl(self): + """ + :class:`nidaqmx.constants.Polarity`: Specifies the active level + of the exported Pause Trigger. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetExportedPauseTrigLvlActiveLvl + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return Polarity(val.value) + + @pause_trig_lvl_active_lvl.setter + def pause_trig_lvl_active_lvl(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetExportedPauseTrigLvlActiveLvl + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @pause_trig_lvl_active_lvl.deleter + def pause_trig_lvl_active_lvl(self): + cfunc = lib_importer.windll.DAQmxResetExportedPauseTrigLvlActiveLvl + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def pause_trig_output_term(self): + """ + str: Specifies the terminal to which to route the Pause Trigger. + """ + cfunc = lib_importer.windll.DAQmxGetExportedPauseTrigOutputTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @pause_trig_output_term.setter + def pause_trig_output_term(self, val): + cfunc = lib_importer.windll.DAQmxSetExportedPauseTrigOutputTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @pause_trig_output_term.deleter + def pause_trig_output_term(self): + cfunc = lib_importer.windll.DAQmxResetExportedPauseTrigOutputTerm + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def rdy_for_start_event_lvl_active_lvl(self): + """ + :class:`nidaqmx.constants.Polarity`: Specifies the polarity of + the exported Ready for Start Event. + """ + val = ctypes.c_int() + + cfunc = (lib_importer.windll. + DAQmxGetExportedRdyForStartEventLvlActiveLvl) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return Polarity(val.value) + + @rdy_for_start_event_lvl_active_lvl.setter + def rdy_for_start_event_lvl_active_lvl(self, val): + val = val.value + cfunc = (lib_importer.windll. + DAQmxSetExportedRdyForStartEventLvlActiveLvl) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @rdy_for_start_event_lvl_active_lvl.deleter + def rdy_for_start_event_lvl_active_lvl(self): + cfunc = (lib_importer.windll. + DAQmxResetExportedRdyForStartEventLvlActiveLvl) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def rdy_for_start_event_output_term(self): + """ + str: Specifies the terminal to which to route the Ready for + Start Event. + """ + cfunc = (lib_importer.windll. + DAQmxGetExportedRdyForStartEventOutputTerm) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @rdy_for_start_event_output_term.setter + def rdy_for_start_event_output_term(self, val): + cfunc = (lib_importer.windll. + DAQmxSetExportedRdyForStartEventOutputTerm) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @rdy_for_start_event_output_term.deleter + def rdy_for_start_event_output_term(self): + cfunc = (lib_importer.windll. + DAQmxResetExportedRdyForStartEventOutputTerm) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def rdy_for_xfer_event_deassert_cond(self): + """ + :class:`nidaqmx.constants.DeassertCondition`: Specifies when the + ready for transfer event deasserts. + """ + val = ctypes.c_int() + + cfunc = (lib_importer.windll. + DAQmxGetExportedRdyForXferEventDeassertCond) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return DeassertCondition(val.value) + + @rdy_for_xfer_event_deassert_cond.setter + def rdy_for_xfer_event_deassert_cond(self, val): + val = val.value + cfunc = (lib_importer.windll. + DAQmxSetExportedRdyForXferEventDeassertCond) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @rdy_for_xfer_event_deassert_cond.deleter + def rdy_for_xfer_event_deassert_cond(self): + cfunc = (lib_importer.windll. + DAQmxResetExportedRdyForXferEventDeassertCond) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def rdy_for_xfer_event_deassert_cond_custom_threshold(self): + """ + int: Specifies in samples the threshold below which the Ready + for Transfer Event deasserts. This threshold is an amount of + space available in the onboard memory of the device. + **rdy_for_xfer_event_deassert_cond** must be + **DeassertCondition.ONBOARD_MEMORY_CUSTOM_THRESHOLD** to use + a custom threshold. + """ + val = ctypes.c_uint() + + cfunc = (lib_importer.windll. + DAQmxGetExportedRdyForXferEventDeassertCondCustomThreshold) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @rdy_for_xfer_event_deassert_cond_custom_threshold.setter + def rdy_for_xfer_event_deassert_cond_custom_threshold(self, val): + cfunc = (lib_importer.windll. + DAQmxSetExportedRdyForXferEventDeassertCondCustomThreshold) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_uint] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @rdy_for_xfer_event_deassert_cond_custom_threshold.deleter + def rdy_for_xfer_event_deassert_cond_custom_threshold(self): + cfunc = (lib_importer.windll. + DAQmxResetExportedRdyForXferEventDeassertCondCustomThreshold) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def rdy_for_xfer_event_lvl_active_lvl(self): + """ + :class:`nidaqmx.constants.Polarity`: Specifies the active level + of the exported Ready for Transfer Event. + """ + val = ctypes.c_int() + + cfunc = (lib_importer.windll. + DAQmxGetExportedRdyForXferEventLvlActiveLvl) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return Polarity(val.value) + + @rdy_for_xfer_event_lvl_active_lvl.setter + def rdy_for_xfer_event_lvl_active_lvl(self, val): + val = val.value + cfunc = (lib_importer.windll. + DAQmxSetExportedRdyForXferEventLvlActiveLvl) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @rdy_for_xfer_event_lvl_active_lvl.deleter + def rdy_for_xfer_event_lvl_active_lvl(self): + cfunc = (lib_importer.windll. + DAQmxResetExportedRdyForXferEventLvlActiveLvl) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def rdy_for_xfer_event_output_term(self): + """ + str: Specifies the terminal to which to route the Ready for + Transfer Event. + """ + cfunc = (lib_importer.windll. + DAQmxGetExportedRdyForXferEventOutputTerm) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @rdy_for_xfer_event_output_term.setter + def rdy_for_xfer_event_output_term(self, val): + cfunc = (lib_importer.windll. + DAQmxSetExportedRdyForXferEventOutputTerm) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @rdy_for_xfer_event_output_term.deleter + def rdy_for_xfer_event_output_term(self): + cfunc = (lib_importer.windll. + DAQmxResetExportedRdyForXferEventOutputTerm) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def ref_trig_output_term(self): + """ + str: Specifies the terminal to which to route the Reference + Trigger. + """ + cfunc = lib_importer.windll.DAQmxGetExportedRefTrigOutputTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ref_trig_output_term.setter + def ref_trig_output_term(self, val): + cfunc = lib_importer.windll.DAQmxSetExportedRefTrigOutputTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @ref_trig_output_term.deleter + def ref_trig_output_term(self): + cfunc = lib_importer.windll.DAQmxResetExportedRefTrigOutputTerm + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def ref_trig_pulse_polarity(self): + """ + :class:`nidaqmx.constants.Polarity`: Specifies the polarity of + the exported Reference Trigger. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetExportedRefTrigPulsePolarity + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return Polarity(val.value) + + @ref_trig_pulse_polarity.setter + def ref_trig_pulse_polarity(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetExportedRefTrigPulsePolarity + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @ref_trig_pulse_polarity.deleter + def ref_trig_pulse_polarity(self): + cfunc = lib_importer.windll.DAQmxResetExportedRefTrigPulsePolarity + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def samp_clk_delay_offset(self): + """ + float: Specifies in seconds the amount of time to offset the + exported Sample clock. Refer to timing diagrams for + generation applications in the device documentation for more + information about this value. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetExportedSampClkDelayOffset + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @samp_clk_delay_offset.setter + def samp_clk_delay_offset(self, val): + cfunc = lib_importer.windll.DAQmxSetExportedSampClkDelayOffset + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @samp_clk_delay_offset.deleter + def samp_clk_delay_offset(self): + cfunc = lib_importer.windll.DAQmxResetExportedSampClkDelayOffset + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def samp_clk_output_behavior(self): + """ + :class:`nidaqmx.constants.ExportAction`: Specifies whether the + exported Sample Clock issues a pulse at the beginning of a + sample or changes to a high state for the duration of the + sample. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetExportedSampClkOutputBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return ExportAction(val.value) + + @samp_clk_output_behavior.setter + def samp_clk_output_behavior(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetExportedSampClkOutputBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @samp_clk_output_behavior.deleter + def samp_clk_output_behavior(self): + cfunc = lib_importer.windll.DAQmxResetExportedSampClkOutputBehavior + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def samp_clk_output_term(self): + """ + str: Specifies the terminal to which to route the Sample Clock. + """ + cfunc = lib_importer.windll.DAQmxGetExportedSampClkOutputTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @samp_clk_output_term.setter + def samp_clk_output_term(self, val): + cfunc = lib_importer.windll.DAQmxSetExportedSampClkOutputTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @samp_clk_output_term.deleter + def samp_clk_output_term(self): + cfunc = lib_importer.windll.DAQmxResetExportedSampClkOutputTerm + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def samp_clk_pulse_polarity(self): + """ + :class:`nidaqmx.constants.Polarity`: Specifies the polarity of + the exported Sample Clock if **samp_clk_output_behavior** is + **ExportActions3.PULSE**. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetExportedSampClkPulsePolarity + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return Polarity(val.value) + + @samp_clk_pulse_polarity.setter + def samp_clk_pulse_polarity(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetExportedSampClkPulsePolarity + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @samp_clk_pulse_polarity.deleter + def samp_clk_pulse_polarity(self): + cfunc = lib_importer.windll.DAQmxResetExportedSampClkPulsePolarity + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def samp_clk_timebase_output_term(self): + """ + str: Specifies the terminal to which to route the Sample Clock + Timebase. + """ + cfunc = (lib_importer.windll. + DAQmxGetExportedSampClkTimebaseOutputTerm) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @samp_clk_timebase_output_term.setter + def samp_clk_timebase_output_term(self, val): + cfunc = (lib_importer.windll. + DAQmxSetExportedSampClkTimebaseOutputTerm) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @samp_clk_timebase_output_term.deleter + def samp_clk_timebase_output_term(self): + cfunc = (lib_importer.windll. + DAQmxResetExportedSampClkTimebaseOutputTerm) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def start_trig_output_term(self): + """ + str: Specifies the terminal to which to route the Start Trigger. + """ + cfunc = lib_importer.windll.DAQmxGetExportedStartTrigOutputTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @start_trig_output_term.setter + def start_trig_output_term(self, val): + cfunc = lib_importer.windll.DAQmxSetExportedStartTrigOutputTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @start_trig_output_term.deleter + def start_trig_output_term(self): + cfunc = lib_importer.windll.DAQmxResetExportedStartTrigOutputTerm + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def start_trig_pulse_polarity(self): + """ + :class:`nidaqmx.constants.Polarity`: Specifies the polarity of + the exported Start Trigger. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetExportedStartTrigPulsePolarity + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return Polarity(val.value) + + @start_trig_pulse_polarity.setter + def start_trig_pulse_polarity(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetExportedStartTrigPulsePolarity + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @start_trig_pulse_polarity.deleter + def start_trig_pulse_polarity(self): + cfunc = lib_importer.windll.DAQmxResetExportedStartTrigPulsePolarity + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def sync_pulse_event_output_term(self): + """ + str: Specifies the terminal to which to route the + Synchronization Pulse Event. + """ + cfunc = lib_importer.windll.DAQmxGetExportedSyncPulseEventOutputTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @sync_pulse_event_output_term.setter + def sync_pulse_event_output_term(self, val): + cfunc = lib_importer.windll.DAQmxSetExportedSyncPulseEventOutputTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @sync_pulse_event_output_term.deleter + def sync_pulse_event_output_term(self): + cfunc = lib_importer.windll.DAQmxResetExportedSyncPulseEventOutputTerm + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def watchdog_expired_event_output_term(self): + """ + str: Specifies the terminal to which to route the Watchdog + Timer Expired Event. + """ + cfunc = (lib_importer.windll. + DAQmxGetExportedWatchdogExpiredEventOutputTerm) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @watchdog_expired_event_output_term.setter + def watchdog_expired_event_output_term(self, val): + cfunc = (lib_importer.windll. + DAQmxSetExportedWatchdogExpiredEventOutputTerm) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @watchdog_expired_event_output_term.deleter + def watchdog_expired_event_output_term(self): + cfunc = (lib_importer.windll. + DAQmxResetExportedWatchdogExpiredEventOutputTerm) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + def export_signal(self, signal_id, output_terminal): + """ + Routes a control signal to the terminal you specify. The output + terminal can reside on the device that generates the control + signal or on a different device. You can use this function to + share clocks and triggers among multiple tasks and devices. The + routes this function creates are task-based routes. + + Args: + signal_id (nidaqmx.constants.Signal): Is the name of the + trigger, clock, or event to export. + output_terminal (str): Is the destination of the exported + signal. A DAQmx terminal constant lists all terminals on + installed devices. You can also specify a string + containing a comma-delimited list of terminal names. + """ + cfunc = lib_importer.windll.DAQmxExportSignal + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int, ctypes_byte_str] + + error_code = cfunc( + self._handle, signal_id.value, output_terminal) + check_for_error(error_code) + diff --git a/nidaqmx/_task_modules/in_stream.py b/nidaqmx/_task_modules/in_stream.py new file mode 100644 index 00000000..1c2bdfb8 --- /dev/null +++ b/nidaqmx/_task_modules/in_stream.py @@ -0,0 +1,1748 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import ctypes +import numpy + +from nidaqmx._lib import lib_importer, ctypes_byte_str +from nidaqmx._task_modules.read_functions import _read_raw +from nidaqmx.errors import check_for_error, is_string_buffer_too_small +from nidaqmx._task_modules.channels.channel import Channel +from nidaqmx.utils import unflatten_channel_string +from nidaqmx.constants import ( + AcquisitionType, LoggingMode, LoggingOperation, OverwriteMode, + READ_ALL_AVAILABLE, ReadRelativeTo, WaitMode) + + +class InStream(object): + """ + Exposes an input data stream on a DAQmx task. + + The input data stream be used to control reading behavior and can be + used in conjunction with reader classes to read samples from an + NI-DAQmx task. + """ + def __init__(self, task): + self._task = task + self._handle = task._handle + self._timeout = 10.0 + + super(InStream, self).__init__() + + def __eq__(self, other): + if isinstance(other, self.__class__): + return (self._handle == other._handle and + self._timeout == other._timeout) + return False + + def __hash__(self): + return hash((self._handle.value, self._timeout)) + + def __ne__(self, other): + return not self.__eq__(other) + + def __repr__(self): + return 'InStream(task={0})'.format(self._task.name) + + @property + def timeout(self): + """ + float: Specifies the amount of time in seconds to wait for + samples to become available. If the time elapses, the read + method returns an error and any samples read before the + timeout elapsed. The default timeout is 10 seconds. If you + set timeout to nidaqmx.WAIT_INFINITELY, the read method + waits indefinitely. If you set timeout to 0, the read method + tries once to read the requested samples and returns an error + if it is unable to. + """ + return self._timeout + + @timeout.setter + def timeout(self, val): + self._timeout = val + + @timeout.deleter + def timeout(self): + self._timeout = 10.0 + + @property + def accessory_insertion_or_removal_detected(self): + """ + bool: Indicates if any device(s) in the task detected the + insertion or removal of an accessory since the task started. + Reading this property clears the accessory change status for + all channels in the task. You must read this property before + you read **devs_with_inserted_or_removed_accessories**. + Otherwise, you will receive an error. + """ + val = ctypes.c_bool() + + cfunc = (lib_importer.windll. + DAQmxGetReadAccessoryInsertionOrRemovalDetected) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def auto_start(self): + """ + bool: Specifies if DAQmx Read automatically starts the task if + you did not start the task explicitly by using DAQmx Start. + The default value is True. When DAQmx Read starts a finite + acquisition task, it also stops the task after reading the + last sample. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetReadAutoStart + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @auto_start.setter + def auto_start(self, val): + cfunc = lib_importer.windll.DAQmxSetReadAutoStart + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_bool] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @auto_start.deleter + def auto_start(self): + cfunc = lib_importer.windll.DAQmxResetReadAutoStart + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def avail_samp_per_chan(self): + """ + int: Indicates the number of samples available to read per + channel. This value is the same for all channels in the + task. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetReadAvailSampPerChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def change_detect_overflowed(self): + """ + bool: Indicates if samples were missed because change detection + events occurred faster than the device could handle them. + Some devices detect overflows differently than others. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetReadChangeDetectHasOverflowed + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def channels_to_read(self): + """ + :class:`nidaqmx._task_modules.channels.channel.Channel`: + Specifies a subset of channels in the task from which to + read. + """ + cfunc = lib_importer.windll.DAQmxGetReadChannelsToRead + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return Channel._factory(self._handle, val.value.decode('ascii')) + + @channels_to_read.setter + def channels_to_read(self, val): + val = val.name + cfunc = lib_importer.windll.DAQmxSetReadChannelsToRead + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @channels_to_read.deleter + def channels_to_read(self): + cfunc = lib_importer.windll.DAQmxResetReadChannelsToRead + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def common_mode_range_error_chans(self): + """ + List[str]: Indicates a list of names of any virtual channels in + the task for which the device(s) detected a common mode + range violation. You must read + **common_mode_range_error_chans_exist** before you read this + property. Otherwise, you will receive an error. + """ + cfunc = lib_importer.windll.DAQmxGetReadCommonModeRangeErrorChans + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 2048 + val = ctypes.create_string_buffer(temp_size) + + error_code = cfunc( + self._handle, val, temp_size) + check_for_error(error_code) + + return unflatten_channel_string(val.value.decode('ascii')) + + @property + def common_mode_range_error_chans_exist(self): + """ + bool: Indicates if the device(s) detected a common mode range + violation for any virtual channel in the task. Common mode + range violation occurs when the voltage of either the + positive terminal or negative terminal to ground are out of + range. Reading this property clears the common mode range + violation status for all channels in the task. You must read + this property before you read + **common_mode_range_error_chans**. Otherwise, you will + receive an error. + """ + val = ctypes.c_bool() + + cfunc = (lib_importer.windll. + DAQmxGetReadCommonModeRangeErrorChansExist) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def curr_read_pos(self): + """ + float: Indicates in samples per channel the current position in + the buffer. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetReadCurrReadPos + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def devs_with_inserted_or_removed_accessories(self): + """ + List[str]: Indicates the names of any devices that detected the + insertion or removal of an accessory since the task started. + You must read **accessory_insertion_or_removal_detected** + before you read this property. Otherwise, you will receive + an error. + """ + cfunc = (lib_importer.windll. + DAQmxGetReadDevsWithInsertedOrRemovedAccessories) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return unflatten_channel_string(val.value.decode('ascii')) + + @property + def di_num_booleans_per_chan(self): + """ + int: Indicates the number of booleans per channel that NI-DAQmx + returns in a sample for line-based reads. If a channel has + fewer lines than this number, the extra booleans are False. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetReadDigitalLinesBytesPerChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def excit_fault_chans(self): + """ + List[str]: Indicates a list of names of any virtual channels in + the task for which the device(s) detected an excitation + fault condition. You must read **excit_fault_chans_exist** + before you read this property. Otherwise, you will receive + an error. + """ + cfunc = lib_importer.windll.DAQmxGetReadExcitFaultChans + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return unflatten_channel_string(val.value.decode('ascii')) + + @property + def excit_fault_chans_exist(self): + """ + bool: Indicates if the device(s) detected an excitation fault + condition for any virtual channel in the task. Reading this + property clears the excitation fault status for all channels + in the task. You must read this property before you read + **excit_fault_chans**. Otherwise, you will receive an error. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetReadExcitFaultChansExist + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def input_buf_size(self): + """ + int: Specifies the number of samples the input buffer can hold + for each channel in the task. Zero indicates to allocate no + buffer. Use a buffer size of 0 to perform a hardware-timed + operation without using a buffer. Setting this property + overrides the automatic input buffer allocation that NI- + DAQmx performs. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetBufInputBufSize + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @input_buf_size.setter + def input_buf_size(self, val): + cfunc = lib_importer.windll.DAQmxSetBufInputBufSize + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_uint] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @input_buf_size.deleter + def input_buf_size(self): + cfunc = lib_importer.windll.DAQmxResetBufInputBufSize + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def input_onbrd_buf_size(self): + """ + int: Indicates in samples per channel the size of the onboard + input buffer of the device. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetBufInputOnbrdBufSize + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def logging_file_path(self): + """ + str: Specifies the path to the TDMS file to which you want to + log data. If the file path is changed while the task is + running, this takes effect on the next sample interval (if + Logging.SampsPerFile has been set) or when DAQmx Start New + File is called. New file paths can be specified by ending + with "\" or "/". Files created after specifying a new file + path retain the same name and numbering sequence. + """ + cfunc = lib_importer.windll.DAQmxGetLoggingFilePath + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @logging_file_path.setter + def logging_file_path(self, val): + cfunc = lib_importer.windll.DAQmxSetLoggingFilePath + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @logging_file_path.deleter + def logging_file_path(self): + cfunc = lib_importer.windll.DAQmxResetLoggingFilePath + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def logging_file_preallocation_size(self): + """ + long: Specifies a size in samples to be used to pre-allocate + space on disk. Pre-allocation can improve file I/O + performance, especially in situations where multiple files + are being written to disk. For finite tasks, the default + behavior is to pre-allocate the file based on the number of + samples you configure the task to acquire. + """ + val = ctypes.c_ulonglong() + + cfunc = lib_importer.windll.DAQmxGetLoggingFilePreallocationSize + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_ulonglong)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @logging_file_preallocation_size.setter + def logging_file_preallocation_size(self, val): + cfunc = lib_importer.windll.DAQmxSetLoggingFilePreallocationSize + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_ulonglong] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @logging_file_preallocation_size.deleter + def logging_file_preallocation_size(self): + cfunc = lib_importer.windll.DAQmxResetLoggingFilePreallocationSize + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def logging_file_write_size(self): + """ + int: Specifies the size, in samples, in which data will be + written to disk. The size must be evenly divisible by the + volume sector size, in bytes. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetLoggingFileWriteSize + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @logging_file_write_size.setter + def logging_file_write_size(self, val): + cfunc = lib_importer.windll.DAQmxSetLoggingFileWriteSize + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_uint] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @logging_file_write_size.deleter + def logging_file_write_size(self): + cfunc = lib_importer.windll.DAQmxResetLoggingFileWriteSize + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def logging_mode(self): + """ + :class:`nidaqmx.constants.LoggingMode`: Specifies whether to + enable logging and whether to allow reading data while + logging. Log mode allows for the best performance. However, + you cannot read data while logging if you specify this mode. + If you want to read data while logging, specify Log and Read + mode. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetLoggingMode + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return LoggingMode(val.value) + + @logging_mode.setter + def logging_mode(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetLoggingMode + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @logging_mode.deleter + def logging_mode(self): + cfunc = lib_importer.windll.DAQmxResetLoggingMode + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def logging_pause(self): + """ + bool: Specifies whether logging is paused while a task is + executing. If **logging_mode** is set to Log and Read mode, + this value is taken into consideration on the next call to + DAQmx Read, where data is written to disk. If + **logging_mode** is set to Log Only mode, this value is + taken into consideration the next time that data is written + to disk. A new TDMS group is written when logging is resumed + from a paused state. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetLoggingPause + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @logging_pause.setter + def logging_pause(self, val): + cfunc = lib_importer.windll.DAQmxSetLoggingPause + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_bool] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @logging_pause.deleter + def logging_pause(self): + cfunc = lib_importer.windll.DAQmxResetLoggingPause + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def logging_samps_per_file(self): + """ + long: Specifies how many samples to write to each file. When the + file reaches the number of samples specified, a new file is + created with the naming convention of _####.tdms, + where #### starts at 0001 and increments automatically with + each new file. For example, if the file specified is + C:\data.tdms, the next file name used is C:\data_0001.tdms. + To disable file spanning behavior, set this attribute to 0. + If **logging_file_path** is changed while this attribute is + set, the new file path takes effect on the next file + created. + """ + val = ctypes.c_ulonglong() + + cfunc = lib_importer.windll.DAQmxGetLoggingSampsPerFile + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_ulonglong)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @logging_samps_per_file.setter + def logging_samps_per_file(self, val): + cfunc = lib_importer.windll.DAQmxSetLoggingSampsPerFile + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_ulonglong] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @logging_samps_per_file.deleter + def logging_samps_per_file(self): + cfunc = lib_importer.windll.DAQmxResetLoggingSampsPerFile + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def logging_tdms_group_name(self): + """ + str: Specifies the name of the group to create within the TDMS + file for data from this task. If you append data to an + existing file and the specified group already exists, NI- + DAQmx appends a number symbol and a number to the group + name, incrementing that number until finding a group name + that does not exist. For example, if you specify a group + name of Voltage Task, and that group already exists, NI- + DAQmx assigns the group name Voltage Task #1, then Voltage + Task #2. + """ + cfunc = lib_importer.windll.DAQmxGetLoggingTDMSGroupName + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @logging_tdms_group_name.setter + def logging_tdms_group_name(self, val): + cfunc = lib_importer.windll.DAQmxSetLoggingTDMSGroupName + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @logging_tdms_group_name.deleter + def logging_tdms_group_name(self): + cfunc = lib_importer.windll.DAQmxResetLoggingTDMSGroupName + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def logging_tdms_operation(self): + """ + :class:`nidaqmx.constants.LoggingOperation`: Specifies how to + open the TDMS file. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetLoggingTDMSOperation + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return LoggingOperation(val.value) + + @logging_tdms_operation.setter + def logging_tdms_operation(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetLoggingTDMSOperation + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @logging_tdms_operation.deleter + def logging_tdms_operation(self): + cfunc = lib_importer.windll.DAQmxResetLoggingTDMSOperation + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def num_chans(self): + """ + int: Indicates the number of channels that DAQmx Read reads from + the task. This value is the number of channels in the task + or the number of channels you specify with + **channels_to_read**. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetReadNumChans + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def offset(self): + """ + int: Specifies an offset in samples per channel at which to + begin a read operation. This offset is relative to the + location you specify with **relative_to**. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetReadOffset + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @offset.setter + def offset(self, val): + cfunc = lib_importer.windll.DAQmxSetReadOffset + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @offset.deleter + def offset(self): + cfunc = lib_importer.windll.DAQmxResetReadOffset + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def open_chans(self): + """ + List[str]: Indicates a list of names of any open virtual + channels. You must read **open_chans_exist** before you read + this property. Otherwise you will receive an error. + """ + cfunc = lib_importer.windll.DAQmxGetReadOpenChans + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return unflatten_channel_string(val.value.decode('ascii')) + + @property + def open_chans_details(self): + """ + List[str]: Indicates a list of details of any open virtual + channels. You must read **open_chans_exist** before you read + this property. Otherwise you will receive an error. + """ + cfunc = lib_importer.windll.DAQmxGetReadOpenChansDetails + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return unflatten_channel_string(val.value.decode('ascii')) + + @property + def open_chans_exist(self): + """ + bool: Indicates if the device or devices detected an open + channel condition in any virtual channel in the task. + Reading this property clears the open channel status for all + channels in this task. You must read this property before + you read **open_chans**. Otherwise, you will receive an + error. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetReadOpenChansExist + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def open_current_loop_chans(self): + """ + List[str]: Indicates a list of names of any virtual channels in + the task for which the device(s) detected an open current + loop. You must read **open_current_loop_chans_exist** before + you read this property. Otherwise, you will receive an + error. + """ + cfunc = lib_importer.windll.DAQmxGetReadOpenCurrentLoopChans + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return unflatten_channel_string(val.value.decode('ascii')) + + @property + def open_current_loop_chans_exist(self): + """ + bool: Indicates if the device(s) detected an open current loop + for any virtual channel in the task. Reading this property + clears the open current loop status for all channels in the + task. You must read this property before you read + **open_current_loop_chans**. Otherwise, you will receive an + error. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetReadOpenCurrentLoopChansExist + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def open_thrmcpl_chans(self): + """ + List[str]: Indicates a list of names of any virtual channels in + the task for which the device(s) detected an open + thermcouple. You must read **open_thrmcpl_chans_exist** + before you read this property. Otherwise, you will receive + an error. + """ + cfunc = lib_importer.windll.DAQmxGetReadOpenThrmcplChans + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return unflatten_channel_string(val.value.decode('ascii')) + + @property + def open_thrmcpl_chans_exist(self): + """ + bool: Indicates if the device(s) detected an open thermocouple + connected to any virtual channel in the task. Reading this + property clears the open thermocouple status for all + channels in the task. You must read this property before you + read **open_thrmcpl_chans**. Otherwise, you will receive an + error. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetReadOpenThrmcplChansExist + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def over_write(self): + """ + :class:`nidaqmx.constants.OverwriteMode`: Specifies whether to + overwrite samples in the buffer that you have not yet read. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetReadOverWrite + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return OverwriteMode(val.value) + + @over_write.setter + def over_write(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetReadOverWrite + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @over_write.deleter + def over_write(self): + cfunc = lib_importer.windll.DAQmxResetReadOverWrite + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def overcurrent_chans(self): + """ + List[str]: Indicates a list of names of any virtual channels in + the task for which the device(s) detected an overcurrent + condition. You must read **overcurrent_chans_exist** before + you read this property. Otherwise, you will receive an + error. On some devices, you must restart the task for all + overcurrent channels to recover. + """ + cfunc = lib_importer.windll.DAQmxGetReadOvercurrentChans + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return unflatten_channel_string(val.value.decode('ascii')) + + @property + def overcurrent_chans_exist(self): + """ + bool: Indicates if the device(s) detected an overcurrent + condition for any virtual channel in the task. Reading this + property clears the overcurrent status for all channels in + the task. You must read this property before you read + **overcurrent_chans**. Otherwise, you will receive an error. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetReadOvercurrentChansExist + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def overloaded_chans(self): + """ + List[str]: Indicates a list of names of any overloaded virtual + channels in the task. You must read + **overloaded_chans_exist** before you read this property. + Otherwise, you will receive an error. + """ + cfunc = lib_importer.windll.DAQmxGetReadOverloadedChans + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return unflatten_channel_string(val.value.decode('ascii')) + + @property + def overloaded_chans_exist(self): + """ + bool: Indicates if the device(s) detected an overload in any + virtual channel in the task. Reading this property clears + the overload status for all channels in the task. You must + read this property before you read **overloaded_chans**. + Otherwise, you will receive an error. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetReadOverloadedChansExist + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def overtemperature_chans(self): + """ + List[str]: Indicates a list of names of any overtemperature + virtual channels. You must read + **overtemperature_chans_exist** before you read this + property. Otherwise, you will receive an error. + """ + cfunc = lib_importer.windll.DAQmxGetReadOvertemperatureChans + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return unflatten_channel_string(val.value.decode('ascii')) + + @property + def overtemperature_chans_exist(self): + """ + bool: Indicates if the device(s) detected an overtemperature + condition in any virtual channel in the task. Reading this + property clears the overtemperature status for all channels + in the task. You must read this property before you read + **overtemperature_chans**. Otherwise, you will receive an + error. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetReadOvertemperatureChansExist + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def raw_data_width(self): + """ + int: Indicates in bytes the size of a raw sample from the task. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetReadRawDataWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def read_all_avail_samp(self): + """ + bool: Specifies whether subsequent read operations read all + samples currently available in the buffer or wait for the + buffer to become full before reading. NI-DAQmx uses this + setting for finite acquisitions and only when the number of + samples to read is -1. For continuous acquisitions when the + number of samples to read is -1, a read operation always + reads all samples currently available in the buffer. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetReadReadAllAvailSamp + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @read_all_avail_samp.setter + def read_all_avail_samp(self, val): + cfunc = lib_importer.windll.DAQmxSetReadReadAllAvailSamp + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_bool] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @read_all_avail_samp.deleter + def read_all_avail_samp(self): + cfunc = lib_importer.windll.DAQmxResetReadReadAllAvailSamp + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def relative_to(self): + """ + :class:`nidaqmx.constants.ReadRelativeTo`: Specifies the point + in the buffer at which to begin a read operation. If you + also specify an offset with **offset**, the read operation + begins at that offset relative to the point you select with + this property. The default value is + **ReadRelativeTo.CURRENT_READ_POSITION** unless you + configure a Reference Trigger for the task. If you configure + a Reference Trigger, the default value is + **ReadRelativeTo.FIRST_PRETRIGGER_SAMPLE**. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetReadRelativeTo + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return ReadRelativeTo(val.value) + + @relative_to.setter + def relative_to(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetReadRelativeTo + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @relative_to.deleter + def relative_to(self): + cfunc = lib_importer.windll.DAQmxResetReadRelativeTo + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def sleep_time(self): + """ + float: Specifies in seconds the amount of time to sleep after + checking for available samples if **wait_mode** is + **WaitMode.SLEEP**. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetReadSleepTime + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @sleep_time.setter + def sleep_time(self, val): + cfunc = lib_importer.windll.DAQmxSetReadSleepTime + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @sleep_time.deleter + def sleep_time(self): + cfunc = lib_importer.windll.DAQmxResetReadSleepTime + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def total_samp_per_chan_acquired(self): + """ + float: Indicates the total number of samples acquired by each + channel. NI-DAQmx returns a single value because this value + is the same for all channels. For retriggered acquisitions, + this value is the cumulative number of samples across all + retriggered acquisitions. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetReadTotalSampPerChanAcquired + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def wait_mode(self): + """ + :class:`nidaqmx.constants.WaitMode`: Specifies how DAQmx Read + waits for samples to become available. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetReadWaitMode + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return WaitMode(val.value) + + @wait_mode.setter + def wait_mode(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetReadWaitMode + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @wait_mode.deleter + def wait_mode(self): + cfunc = lib_importer.windll.DAQmxResetReadWaitMode + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + def _calculate_num_samps_per_chan(self, num_samps_per_chan): + if num_samps_per_chan == -1: + acq_type = self._task.timing.samp_quant_samp_mode + + if (acq_type == AcquisitionType.FINITE and + not self.read_all_avail_samp): + return self._task.timing.samp_quant_samp_per_chan + else: + return self.avail_samp_per_chan + else: + return num_samps_per_chan + + def configure_logging( + self, file_path, logging_mode=LoggingMode.LOG_AND_READ, + group_name="", operation=LoggingOperation.OPEN_OR_CREATE): + """ + Configures TDMS file logging for the task. + + Args: + file_path (str): Specifies the path to the TDMS file to + which you want to log data. + logging_mode (Optional[nidaqmx.constants.LoggingMode]): + Specifies whether to enable logging and whether to allow + reading data while logging. "log" mode allows for the + best performance. However, you cannot read data while + logging if you specify this mode. If you want to read + data while logging, specify "LOG_AND_READ" mode. + group_name (Optional[str]): Specifies the name of the group + to create within the TDMS file for data from this task. + If you append data to an existing file and the specified + group already exists, NI-DAQmx appends a number symbol + and a number to the group name, incrementing that number + until finding a group name that does not exist. For + example, if you specify a group name of Voltage Task, + and that group already exists, NI-DAQmx assigns the + group name Voltage Task #1, then Voltage Task #2. If you + do not specify a group name, NI-DAQmx uses the name of + the task. + operation (Optional[nidaqmx.constants.LoggingOperation]): + Specifies how to open the TDMS file. + """ + cfunc = lib_importer.windll.DAQmxConfigureLogging + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int, + ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, file_path, logging_mode.value, group_name, + operation.value) + check_for_error(error_code) + + def read(self, number_of_samples_per_channel=READ_ALL_AVAILABLE): + """ + Reads raw samples from the task or virtual channels you specify. + + Raw samples constitute the internal representation of samples in a + device, read directly from the device or buffer without scaling or + reordering. The native format of a device can be an 8-, 16-, or + 32-bit integer, signed or unsigned. + + NI-DAQmx does not separate raw data into channels. It returns data + in an interleaved or non-interleaved 1D array, depending on the + raw ordering of the device. Refer to your device documentation for + more information. + + This method determines a NumPy array of appropriate size and data + type to create and return based on your device specifications. + + Use the "timeout" property on the stream to specify the amount of + time in seconds to wait for samples to become available. If the + time elapses, the method returns an error and any samples read + before the timeout elapsed. The default timeout is 10 seconds. + If you set timeout to nidaqmx.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries once to + read the requested samples and returns an error if it is unable + to. + + Args: + number_of_samples_per_channel (int): Specifies the number of + samples to read. + + If you set this input to nidaqmx.READ_ALL_AVAILABLE, + NI-DAQmx determines how many samples to read based on if + the task acquires samples continuously or acquires a + finite number of samples. + + If the task acquires samples continuously and you set + this input to nidaqmx.READ_ALL_AVAILABLE, this method + reads all the samples currently available in the buffer. + + If the task acquires a finite number of samples and you + set this input to nidaqmx.READ_ALL_AVAILABLE, the method + waits for the task to acquire all requested samples, + then reads those samples. If you set the + "read_all_avail_samp" property to TRUE, the method reads + the samples currently available in the buffer and does + not wait for the task to acquire all requested samples. + Returns: + numpy.ndarray: + + The samples requested in the form of a 1D NumPy array. This + method determines a NumPy array of appropriate size and data + type to create and return based on your device specifications. + """ + channels_to_read = self.channels_to_read + number_of_channels = len(channels_to_read.channel_names) + + samp_size_in_bits = channels_to_read.ai_raw_samp_size + has_negative_range = channels_to_read.ai_rng_low < 0 + + if samp_size_in_bits == 32: + if has_negative_range: + dtype = numpy.int32 + else: + dtype = numpy.uint32 + elif samp_size_in_bits == 16: + if has_negative_range: + dtype = numpy.int16 + else: + dtype = numpy.uint16 + else: + if has_negative_range: + dtype = numpy.int8 + else: + dtype = numpy.uint8 + + num_samps_per_chan = self._calculate_num_samps_per_chan( + number_of_samples_per_channel) + + number_of_samples = number_of_channels * num_samps_per_chan + + numpy_array = numpy.zeros(number_of_samples, dtype=dtype) + + samples_read, number_of_bytes_per_sample = _read_raw( + self._handle, numpy_array, num_samps_per_chan, + self.timeout) + + if samples_read != number_of_samples: + return numpy_array[:samples_read] + return numpy_array + + def readall(self): + """ + Reads all available raw samples from the task or virtual channels + you specify. + + NI-DAQmx determines how many samples to read based on if the task + acquires samples continuously or acquires a finite number of + samples. + + If the task acquires samples continuously, this method reads all + the samples currently available in the buffer. + + If the task acquires a finite number of samples, the method + waits for the task to acquire all requested samples, then reads + those samples. If you set the "read_all_avail_samp" property to + TRUE, the method reads the samples currently available in the + buffer and does not wait for the task to acquire all requested + samples. + + Raw samples constitute the internal representation of samples in a + device, read directly from the device or buffer without scaling or + reordering. The native format of a device can be an 8-, 16-, or + 32-bit integer, signed or unsigned. + + NI-DAQmx does not separate raw data into channels. It returns data + in an interleaved or non-interleaved 1D array, depending on the + raw ordering of the device. Refer to your device documentation for + more information. + + This method determines a NumPy array of appropriate size and data + type to create and return based on your device specifications. + + Use the "timeout" property on the stream to specify the amount of + time in seconds to wait for samples to become available. If the + time elapses, the method returns an error and any samples read + before the timeout elapsed. The default timeout is 10 seconds. + If you set timeout to nidaqmx.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries once to + read the requested samples and returns an error if it is unable + to. + + Returns: + numpy.ndarray: + + The samples requested in the form of a 1D NumPy array. This + method determines a NumPy array of appropriate size and data + type to create and return based on your device specifications. + """ + return self.read(number_of_samples_per_channel=READ_ALL_AVAILABLE) + + def readinto(self, numpy_array): + """ + Reads raw samples from the task or virtual channels you specify + into numpy_array. + + The object numpy_array should be a pre-allocated, writable 1D + numpy array. + + The number of samples per channel to read is determined using + the following equation: + + number_of_samples_per_channel = math.floor( + numpy_array_size_in_bytes / ( + number_of_channels_to_read * raw_sample_size_in_bytes)) + + Raw samples constitute the internal representation of samples in a + device, read directly from the device or buffer without scaling or + reordering. The native format of a device can be an 8-, 16-, or + 32-bit integer, signed or unsigned. + + If you use a different integer size than the native format of the + device, one integer can contain multiple samples or one sample can + stretch across multiple integers. For example, if you use 32-bit + integers, but the device uses 8-bit samples, one integer contains + up to four samples. If you use 8-bit integers, but the device uses + 16-bit samples, a sample might require two integers. This behavior + varies from device to device. Refer to your device documentation + for more information. + + NI-DAQmx does not separate raw data into channels. It returns data + in an interleaved or non-interleaved 1D array, depending on the + raw ordering of the device. Refer to your device documentation for + more information. + + Use the "timeout" property on the stream to specify the amount of + time in seconds to wait for samples to become available. If the + time elapses, the method returns an error and any samples read + before the timeout elapsed. The default timeout is 10 seconds. + If you set timeout to -1, the method waits indefinitely. If you + set timeout to 0, the method tries once to read the requested + samples and returns an error if it is unable to. + + Args: + numpy_array: Specifies the 1D NumPy array object into which + the samples requested are read. + Returns: + int: Indicates the total number of samples read. + """ + channels_to_read = self.channels_to_read + number_of_channels = len(channels_to_read.channel_names) + + number_of_samples_per_channel, _ = divmod( + numpy_array.nbytes, ( + number_of_channels * channels_to_read.ai_raw_samp_size / 8)) + + samples_read, _ = _read_raw( + self._handle, numpy_array, number_of_samples_per_channel, + self.timeout) + + return samples_read + + def start_new_file(self, file_path): + """ + Starts a new TDMS file the next time data is written to disk. + + Args: + file_path (str): Specifies the path to the TDMS file to + which you want to log data. + """ + cfunc = lib_importer.windll.DAQmxStartNewFile + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, file_path) + check_for_error(error_code) diff --git a/nidaqmx/_task_modules/out_stream.py b/nidaqmx/_task_modules/out_stream.py new file mode 100644 index 00000000..4d754073 --- /dev/null +++ b/nidaqmx/_task_modules/out_stream.py @@ -0,0 +1,939 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import ctypes +import numpy + +from nidaqmx._lib import lib_importer, ctypes_byte_str +from nidaqmx._task_modules.write_functions import _write_raw +from nidaqmx.errors import check_for_error, is_string_buffer_too_small +from nidaqmx.utils import unflatten_channel_string +from nidaqmx.constants import ( + RegenerationMode, ResolutionType, WaitMode, WriteRelativeTo) + + +class OutStream(object): + """ + Exposes an output data stream on a DAQmx task. + + The output data stream be used to control writing behavior and can be + used in conjunction with writer classes to write samples to an + NI-DAQmx task. + """ + def __init__(self, task): + self._task = task + self._handle = task._handle + self._auto_start = False + self._timeout = 10.0 + + super(OutStream, self).__init__() + + def __eq__(self, other): + if isinstance(other, self.__class__): + return (self._handle == other._handle and + self._auto_start == other._auto_start and + self._timeout == other._timeout) + return False + + def __hash__(self): + return hash((self._handle.value, self._auto_start, self._timeout)) + + def __ne__(self, other): + return not self.__eq__(other) + + def __repr__(self): + return 'OutStream(task={0})'.format(self._task.name) + + @property + def auto_start(self): + """ + bool: Specifies if the "write" method automatically starts the + stream's owning task if you did not explicitly start it + with the DAQmx Start Task method. + """ + return self._auto_start + + @auto_start.setter + def auto_start(self, val): + self._auto_start = val + + @auto_start.deleter + def auto_start(self): + self._auto_start = False + + @property + def timeout(self): + """ + float: Specifies the amount of time in seconds to wait for + the write method to write all samples. NI-DAQmx performs a + timeout check only if the write method must wait before it + writes data. The write method returns an error if the time + elapses. The default timeout is 10 seconds. If you set + "timeout" to nidaqmx.WAIT_INFINITELY, the write method + waits indefinitely. If you set timeout to 0, the write + method tries once to write the submitted samples. If the + write method could not write all the submitted samples, it + returns an error and the number of samples successfully + written in the number of samples written per channel + output. + """ + return self._timeout + + @timeout.setter + def timeout(self, val): + self._timeout = val + + @timeout.deleter + def timeout(self): + self._timeout = 10.0 + + @property + def accessory_insertion_or_removal_detected(self): + """ + bool: Indicates if any devices in the task detected the + insertion or removal of an accessory since the task started. + Reading this property clears the accessory change status for + all channels in the task. You must read this property before + you read **devs_with_inserted_or_removed_accessories**. + Otherwise, you will receive an error. + """ + val = ctypes.c_bool() + + cfunc = (lib_importer.windll. + DAQmxGetWriteAccessoryInsertionOrRemovalDetected) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def curr_write_pos(self): + """ + float: Indicates the position in the buffer of the next sample + to generate. This value is identical for all channels in the + task. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetWriteCurrWritePos + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def devs_with_inserted_or_removed_accessories(self): + """ + List[str]: Indicates the names of any devices that detected the + insertion or removal of an accessory since the task started. + You must read **accessory_insertion_or_removal_detected** + before you read this property. Otherwise, you will receive + an error. + """ + cfunc = (lib_importer.windll. + DAQmxGetWriteDevsWithInsertedOrRemovedAccessories) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return unflatten_channel_string(val.value.decode('ascii')) + + @property + def do_num_booleans_per_chan(self): + """ + int: Indicates the number of Boolean values expected per channel + in a sample for line-based writes. This property is + determined by the channel in the task with the most digital + lines. If a channel has fewer lines than this number, NI- + DAQmx ignores the extra Boolean values. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetWriteDigitalLinesBytesPerChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def external_overvoltage_chans(self): + """ + List[str]: Indicates a list of names of any virtual channels in + the task for which an External Overvoltage condition has + been detected. You must read External OvervoltageChansExist + before you read this property. Otherwise, you will receive + an error. + """ + cfunc = lib_importer.windll.DAQmxGetWriteExternalOvervoltageChans + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return unflatten_channel_string(val.value.decode('ascii')) + + @property + def external_overvoltage_chans_exist(self): + """ + bool: Indicates if the device(s) detected an External + Overvoltage condition for any channel in the task. Reading + this property clears the External Overvoltage status for all + channels in the task. You must read this property before you + read External OvervoltageChans. Otherwise, you will receive + an error. + """ + val = ctypes.c_bool() + + cfunc = (lib_importer.windll. + DAQmxGetWriteExternalOvervoltageChansExist) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def num_chans(self): + """ + int: Indicates the number of channels that DAQmx Write writes to + the task. This value is the number of channels in the task. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetWriteNumChans + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def offset(self): + """ + int: Specifies in samples per channel an offset at which a write + operation begins. This offset is relative to the location + you specify with **relative_to**. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetWriteOffset + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @offset.setter + def offset(self, val): + cfunc = lib_importer.windll.DAQmxSetWriteOffset + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @offset.deleter + def offset(self): + cfunc = lib_importer.windll.DAQmxResetWriteOffset + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def open_current_loop_chans(self): + """ + List[str]: Indicates a list of names of any virtual channels in + the task for which the device(s) detected an open current + loop. You must read **open_current_loop_chans_exist** before + you read this property. Otherwise, you will receive an + error. + """ + cfunc = lib_importer.windll.DAQmxGetWriteOpenCurrentLoopChans + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return unflatten_channel_string(val.value.decode('ascii')) + + @property + def open_current_loop_chans_exist(self): + """ + bool: Indicates if the device(s) detected an open current loop + for any channel in the task. Reading this property clears + the open current loop status for all channels in the task. + You must read this property before you read + **open_current_loop_chans**. Otherwise, you will receive an + error. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetWriteOpenCurrentLoopChansExist + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def output_buf_size(self): + """ + int: Specifies the number of samples the output buffer can hold + for each channel in the task. Zero indicates to allocate no + buffer. Use a buffer size of 0 to perform a hardware-timed + operation without using a buffer. Setting this property + overrides the automatic output buffer allocation that NI- + DAQmx performs. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetBufOutputBufSize + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @output_buf_size.setter + def output_buf_size(self, val): + cfunc = lib_importer.windll.DAQmxSetBufOutputBufSize + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_uint] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @output_buf_size.deleter + def output_buf_size(self): + cfunc = lib_importer.windll.DAQmxResetBufOutputBufSize + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def output_onbrd_buf_size(self): + """ + int: Specifies in samples per channel the size of the onboard + output buffer of the device. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetBufOutputOnbrdBufSize + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @output_onbrd_buf_size.setter + def output_onbrd_buf_size(self, val): + cfunc = lib_importer.windll.DAQmxSetBufOutputOnbrdBufSize + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_uint] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @output_onbrd_buf_size.deleter + def output_onbrd_buf_size(self): + cfunc = lib_importer.windll.DAQmxResetBufOutputOnbrdBufSize + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def overcurrent_chans(self): + """ + List[str]: Indicates a list of names of any virtual channels in + the task for which an overcurrent condition has been + detected. You must read **overcurrent_chans_exist** before + you read this property. Otherwise, you will receive an + error. + """ + cfunc = lib_importer.windll.DAQmxGetWriteOvercurrentChans + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return unflatten_channel_string(val.value.decode('ascii')) + + @property + def overcurrent_chans_exist(self): + """ + bool: Indicates if the device(s) detected an overcurrent + condition for any channel in the task. Reading this property + clears the overcurrent status for all channels in the task. + You must read this property before you read + **overcurrent_chans**. Otherwise, you will receive an error. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetWriteOvercurrentChansExist + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def overloaded_chans(self): + """ + List[str]: Indicates a list of names of any overloaded virtual + channels in the task. You must read + **overloaded_chans_exist** before you read this property. + Otherwise, you will receive an error. + """ + cfunc = lib_importer.windll.DAQmxGetWriteOverloadedChans + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return unflatten_channel_string(val.value.decode('ascii')) + + @property + def overloaded_chans_exist(self): + """ + bool: Indicates if the device(s) detected an overload in any + virtual channel in the task. Reading this property clears + the overload status for all channels in the task. You must + read this property before you read **overloaded_chans**. + Otherwise, you will receive an error. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetWriteOverloadedChansExist + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def overtemperature_chans(self): + """ + List[str]: Indicates a list of names of any overtemperature + virtual channels. You must read + **overtemperature_chans_exist** before you read this + property. Otherwise, you will receive an error. The list of + names may be empty if the device cannot determine the source + of the overtemperature. + """ + cfunc = lib_importer.windll.DAQmxGetWriteOvertemperatureChans + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return unflatten_channel_string(val.value.decode('ascii')) + + @property + def overtemperature_chans_exist(self): + """ + bool: Indicates if the device(s) detected an overtemperature + condition in any virtual channel in the task. Reading this + property clears the overtemperature status for all channels + in the task. You must read this property before you read + **overtemperature_chans**. Otherwise, you will receive an + error. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetWriteOvertemperatureChansExist + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def power_supply_fault_chans(self): + """ + List[str]: Indicates a list of names of any virtual channels in + the task that have a power supply fault. You must read + **power_supply_fault_chans_exist** before you read this + property. Otherwise, you will receive an error. + """ + cfunc = lib_importer.windll.DAQmxGetWritePowerSupplyFaultChans + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return unflatten_channel_string(val.value.decode('ascii')) + + @property + def power_supply_fault_chans_exist(self): + """ + bool: Indicates if the device(s) detected a power supply fault + for any channel in the task. Reading this property clears + the power supply fault status for all channels in the task. + You must read this property before you read + **power_supply_fault_chans**. Otherwise, you will receive an + error. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetWritePowerSupplyFaultChansExist + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def raw_data_width(self): + """ + int: Indicates in bytes the required size of a raw sample to + write to the task. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetWriteRawDataWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def regen_mode(self): + """ + :class:`nidaqmx.constants.RegenerationMode`: Specifies whether + to allow NI-DAQmx to generate the same data multiple times. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetWriteRegenMode + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return RegenerationMode(val.value) + + @regen_mode.setter + def regen_mode(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetWriteRegenMode + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @regen_mode.deleter + def regen_mode(self): + cfunc = lib_importer.windll.DAQmxResetWriteRegenMode + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def relative_to(self): + """ + :class:`nidaqmx.constants.WriteRelativeTo`: Specifies the point + in the buffer at which to write data. If you also specify an + offset with **offset**, the write operation begins at that + offset relative to this point you select with this property. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetRelativeTo + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return WriteRelativeTo(val.value) + + @relative_to.setter + def relative_to(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetRelativeTo + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @relative_to.deleter + def relative_to(self): + cfunc = lib_importer.windll.DAQmxResetRelativeTo + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def sleep_time(self): + """ + float: Specifies in seconds the amount of time to sleep after + checking for available buffer space if **wait_mode** is + **WaitMode2.SLEEP**. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetWriteSleepTime + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @sleep_time.setter + def sleep_time(self, val): + cfunc = lib_importer.windll.DAQmxSetWriteSleepTime + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @sleep_time.deleter + def sleep_time(self): + cfunc = lib_importer.windll.DAQmxResetWriteSleepTime + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def space_avail(self): + """ + int: Indicates in samples per channel the amount of available + space in the buffer. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetWriteSpaceAvail + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def total_samp_per_chan_generated(self): + """ + float: Indicates the total number of samples generated by each + channel in the task. This value is identical for all + channels in the task. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetWriteTotalSampPerChanGenerated + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def wait_mode(self): + """ + :class:`nidaqmx.constants.WaitMode`: Specifies how DAQmx Write + waits for space to become available in the buffer. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetWriteWaitMode + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return WaitMode(val.value) + + @wait_mode.setter + def wait_mode(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetWriteWaitMode + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @wait_mode.deleter + def wait_mode(self): + cfunc = lib_importer.windll.DAQmxResetWriteWaitMode + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + def write(self, numpy_array): + """ + Writes raw samples to the task or virtual channels you specify. + + The number of samples per channel to write is determined using the + following equation: + + number_of_samples_per_channel = math.floor( + numpy_array_size_in_bytes / ( + number_of_channels_to_write * raw_sample_size_in_bytes)) + + Raw samples constitute the internal representation of samples in a + device, read directly from the device or buffer without scaling or + reordering. The native format of a device can be an 8-, 16-, or 32-bit + integer, signed or unsigned. + + If you use a different integer size than the native format of the + device, one integer can contain multiple samples or one sample can + stretch across multiple integers. For example, if you use 32-bit + integers, but the device uses 8-bit samples, one integer contains up to + four samples. If you use 8-bit integers, but the device uses 16-bit + samples, a sample might require two integers. This behavior varies from + device to device. Refer to your device documentation for more + information. + + NI-DAQmx does not separate raw data into channels. It accepts data in + an interleaved or non-interleaved 1D array, depending on the raw + ordering of the device. Refer to your device documentation for more + information. + + If the task uses on-demand timing, this method returns only after the + device generates all samples. On-demand is the default timing type if + you do not use the timing property on the task to configure a sample + timing type. If the task uses any timing type other than on-demand, + this method returns immediately and does not wait for the device to + generate all samples. Your application must determine if the task is + done to ensure that the device generated all samples. + + Use the "auto_start" property on the stream to specify if this method + automatically starts the stream's owning task if you did not explicitly + start it with the DAQmx Start Task method. + + Use the "timeout" property on the stream to specify the amount of + time in seconds to wait for the method to write all samples. NI-DAQmx + performs a timeout check only if the method must wait before it writes + data. This method returns an error if the time elapses. The default + timeout is 10 seconds. If you set timeout to nidaqmx.WAIT_INFINITELY, + the method waits indefinitely. If you set timeout to 0, the method + tries once to write the submitted samples. If the method could not + write all the submitted samples, it returns an error and the number of + samples successfully written. + + Args: + numpy_array (numpy.ndarray): Specifies a 1D NumPy array that + contains the raw samples to write to the task. + Returns: + int: + + Specifies the actual number of samples per channel successfully + written to the buffer. + """ + channels_to_write = self._task.channels + number_of_channels = len(channels_to_write.channel_names) + + channels_to_write.ao_resolution_units = ResolutionType.BITS + + number_of_samples_per_channel, _ = divmod( + numpy_array.nbytes, ( + number_of_channels * channels_to_write.ao_resolution / 8)) + + return _write_raw( + self._handle, number_of_samples_per_channel, self.auto_start, + self.timeout, numpy_array) diff --git a/nidaqmx/_task_modules/read_functions.py b/nidaqmx/_task_modules/read_functions.py new file mode 100644 index 00000000..aed5ced3 --- /dev/null +++ b/nidaqmx/_task_modules/read_functions.py @@ -0,0 +1,510 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function + +import collections +import ctypes +import numpy + +from nidaqmx._lib import lib_importer, wrapped_ndpointer, c_bool32 +from nidaqmx.constants import FillMode +from nidaqmx.errors import check_for_error +from nidaqmx.types import CtrFreq, CtrTick, CtrTime + + +def _read_analog_f_64( + task_handle, read_array, num_samps_per_chan, timeout, + fill_mode=FillMode.GROUP_BY_CHANNEL): + samps_per_chan_read = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxReadAnalogF64 + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int, ctypes.c_double, c_bool32, + wrapped_ndpointer(dtype=numpy.float64, flags=('C', 'W')), + ctypes.c_uint, ctypes.POINTER(ctypes.c_int), + ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, num_samps_per_chan, timeout, fill_mode.value, + read_array, numpy.prod(read_array.shape), + ctypes.byref(samps_per_chan_read), None) + check_for_error(error_code) + + return samps_per_chan_read.value + + +def _read_analog_scalar_f_64(task_handle, timeout): + value = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxReadAnalogScalarF64 + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double, + ctypes.POINTER(ctypes.c_double), + ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, timeout, ctypes.byref(value), None) + check_for_error(error_code) + + return value.value + + +def _read_binary_i_16( + task_handle, read_array, num_samps_per_chan, timeout, + fill_mode=FillMode.GROUP_BY_CHANNEL): + samps_per_chan_read = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxReadBinaryI16 + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int, ctypes.c_double, + ctypes.c_int, + wrapped_ndpointer(dtype=numpy.int16, flags=('C', 'W')), + ctypes.c_uint, ctypes.POINTER(ctypes.c_int), + ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, num_samps_per_chan, timeout, fill_mode.value, + read_array, numpy.prod(read_array.shape), + ctypes.byref(samps_per_chan_read), None) + check_for_error(error_code) + + return samps_per_chan_read.value + + +def _read_binary_u_16( + task_handle, read_array, num_samps_per_chan, timeout, + fill_mode=FillMode.GROUP_BY_CHANNEL): + samps_per_chan_read = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxReadBinaryU16 + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int, ctypes.c_double, + ctypes.c_int, + wrapped_ndpointer(dtype=numpy.uint16, flags=('C', 'W')), + ctypes.c_uint, ctypes.POINTER(ctypes.c_int), + ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, num_samps_per_chan, timeout, fill_mode.value, + read_array, numpy.prod(read_array.shape), + ctypes.byref(samps_per_chan_read), None) + check_for_error(error_code) + + return samps_per_chan_read.value + + +def _read_binary_i_32( + task_handle, read_array, num_samps_per_chan, timeout, + fill_mode=FillMode.GROUP_BY_CHANNEL): + samps_per_chan_read = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxReadBinaryI32 + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int, ctypes.c_double, + ctypes.c_int, + wrapped_ndpointer(dtype=numpy.int32, flags=('C', 'W')), + ctypes.c_uint, ctypes.POINTER(ctypes.c_int), + ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, num_samps_per_chan, timeout, fill_mode.value, + read_array, numpy.prod(read_array.shape), + ctypes.byref(samps_per_chan_read), None) + check_for_error(error_code) + + return samps_per_chan_read.value + + +def _read_binary_u_32( + task_handle, read_array, num_samps_per_chan, timeout, + fill_mode=FillMode.GROUP_BY_CHANNEL): + samps_per_chan_read = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxReadBinaryU32 + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int, ctypes.c_double, + ctypes.c_int, + wrapped_ndpointer(dtype=numpy.uint32, flags=('C', 'W')), + ctypes.c_uint, ctypes.POINTER(ctypes.c_int), + ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, num_samps_per_chan, timeout, fill_mode.value, + read_array, numpy.prod(read_array.shape), + ctypes.byref(samps_per_chan_read), None) + check_for_error(error_code) + + return samps_per_chan_read.value + + +def _read_digital_u_8( + task_handle, read_array, num_samps_per_chan, timeout, + fill_mode=FillMode.GROUP_BY_CHANNEL): + samps_per_chan_read = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxReadDigitalU8 + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int, ctypes.c_double, + ctypes.c_int, + wrapped_ndpointer(dtype=numpy.uint8, flags=('C', 'W')), + ctypes.c_uint, ctypes.POINTER(ctypes.c_int), + ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, num_samps_per_chan, timeout, fill_mode.value, + read_array, numpy.prod(read_array.shape), + ctypes.byref(samps_per_chan_read), None) + check_for_error(error_code) + + return samps_per_chan_read.value + + +def _read_digital_u_16( + task_handle, read_array, num_samps_per_chan, timeout, + fill_mode=FillMode.GROUP_BY_CHANNEL): + samps_per_chan_read = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxReadDigitalU16 + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int, ctypes.c_double, + ctypes.c_int, + wrapped_ndpointer(dtype=numpy.uint16, flags=('C', 'W')), + ctypes.c_uint, ctypes.POINTER(ctypes.c_int), + ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, num_samps_per_chan, timeout, fill_mode.value, + read_array, numpy.prod(read_array.shape), + ctypes.byref(samps_per_chan_read), None) + check_for_error(error_code) + + return samps_per_chan_read.value + + +def _read_digital_u_32( + task_handle, read_array, num_samps_per_chan, timeout, + fill_mode=FillMode.GROUP_BY_CHANNEL): + samps_per_chan_read = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxReadDigitalU32 + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int, ctypes.c_double, + ctypes.c_int, + wrapped_ndpointer(dtype=numpy.uint32, flags=('C', 'W')), + ctypes.c_uint, ctypes.POINTER(ctypes.c_int), + ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, num_samps_per_chan, timeout, fill_mode.value, + read_array, numpy.prod(read_array.shape), + ctypes.byref(samps_per_chan_read), None) + check_for_error(error_code) + + return samps_per_chan_read.value + + +def _read_digital_scalar_u_32(task_handle, timeout): + value = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxReadDigitalScalarU32 + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double, + ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, timeout, ctypes.byref(value), None) + check_for_error(error_code) + + return value.value + + +def _read_digital_lines( + task_handle, read_array, num_samps_per_chan, timeout, + fill_mode=FillMode.GROUP_BY_CHANNEL): + samps_per_chan_read = ctypes.c_int() + num_bytes_per_samp = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxReadDigitalLines + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int, ctypes.c_double, + ctypes.c_int, + wrapped_ndpointer(dtype=numpy.bool, flags=('C', 'W')), + ctypes.c_uint, ctypes.POINTER(ctypes.c_int), + ctypes.POINTER(ctypes.c_int), ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, num_samps_per_chan, timeout, fill_mode.value, + read_array, numpy.prod(read_array.shape), + ctypes.byref(samps_per_chan_read), + ctypes.byref(num_bytes_per_samp), None) + check_for_error(error_code) + + ReadDigitalLinesReturnData = ( + collections.namedtuple( + 'ReadDigitalLinesReturnData', + ['samps_per_chan_read', 'num_bytes_per_samp'])) + + return ReadDigitalLinesReturnData( + samps_per_chan_read.value, num_bytes_per_samp.value) + + +def _read_counter_f_64(task_handle, read_array, num_samps_per_chan, timeout): + samps_per_chan_read = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxReadCounterF64 + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int, ctypes.c_double, + wrapped_ndpointer(dtype=numpy.float64, flags=('C', 'W')), + ctypes.c_uint, ctypes.POINTER(ctypes.c_int), + ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, num_samps_per_chan, timeout, + read_array, numpy.prod(read_array.shape), + ctypes.byref(samps_per_chan_read), None) + check_for_error(error_code) + + return samps_per_chan_read.value + + +def _read_counter_u_32(task_handle, read_array, num_samps_per_chan, timeout): + samps_per_chan_read = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxReadCounterU32 + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int, ctypes.c_double, + wrapped_ndpointer(dtype=numpy.uint32, flags=('C', 'W')), + ctypes.c_uint, ctypes.POINTER(ctypes.c_int), + ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, num_samps_per_chan, timeout, + read_array, numpy.prod(read_array.shape), + ctypes.byref(samps_per_chan_read), None) + check_for_error(error_code) + + return samps_per_chan_read.value + + +def _read_counter_f_64_ex( + task_handle, read_array, num_samps_per_chan, timeout, + fill_mode=FillMode.GROUP_BY_CHANNEL): + samps_per_chan_read = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxReadCounterF64Ex + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int, ctypes.c_double, + ctypes.c_int, + wrapped_ndpointer(dtype=numpy.float64, flags=('C', 'W')), + ctypes.c_uint, ctypes.POINTER(ctypes.c_int), + ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, num_samps_per_chan, timeout, fill_mode.value, + read_array, numpy.prod(read_array.shape), + ctypes.byref(samps_per_chan_read), None) + check_for_error(error_code) + + return samps_per_chan_read.value + + +def _read_counter_u_32_ex( + task_handle, read_array, num_samps_per_chan, timeout, + fill_mode=FillMode.GROUP_BY_CHANNEL): + samps_per_chan_read = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxReadCounterU32Ex + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int, ctypes.c_double, + ctypes.c_int, + wrapped_ndpointer(dtype=numpy.uint32, flags=('C', 'W')), + ctypes.c_uint, ctypes.POINTER(ctypes.c_int), + ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, num_samps_per_chan, timeout, fill_mode.value, + read_array, numpy.prod(read_array.shape), + ctypes.byref(samps_per_chan_read), None) + check_for_error(error_code) + + return samps_per_chan_read.value + + +def _read_counter_scalar_f_64(task_handle, timeout): + value = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxReadCounterScalarF64 + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double, + ctypes.POINTER(ctypes.c_double), ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, timeout, ctypes.byref(value), None) + check_for_error(error_code) + + return value.value + + +def _read_counter_scalar_u_32(task_handle, timeout): + value = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxReadCounterScalarU32 + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double, + ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, timeout, ctypes.byref(value), None) + check_for_error(error_code) + + return value.value + + +def _read_ctr_freq( + task_handle, freq, duty_cycle, num_samps_per_chan, timeout, + interleaved=FillMode.GROUP_BY_CHANNEL): + samps_per_chan_read = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxReadCtrFreq + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int, ctypes.c_double, + ctypes.c_int, + wrapped_ndpointer(dtype=numpy.float64, flags=('C', 'W')), + wrapped_ndpointer(dtype=numpy.float64, flags=('C', 'W')), + ctypes.c_uint, ctypes.POINTER(ctypes.c_int), + ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, num_samps_per_chan, timeout, interleaved.value, + freq, duty_cycle, numpy.prod(freq.shape), + ctypes.byref(samps_per_chan_read), None) + check_for_error(error_code) + + return samps_per_chan_read.value + + +def _read_ctr_time( + task_handle, high_time, low_time, num_samps_per_chan, timeout, + interleaved=FillMode.GROUP_BY_CHANNEL): + samps_per_chan_read = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxReadCtrTime + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int, ctypes.c_double, + ctypes.c_int, + wrapped_ndpointer(dtype=numpy.float64, flags=('C', 'W')), + wrapped_ndpointer(dtype=numpy.float64, flags=('C', 'W')), + ctypes.c_uint, ctypes.POINTER(ctypes.c_int), + ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, num_samps_per_chan, timeout, interleaved.value, + high_time, low_time, numpy.prod(high_time.shape), + ctypes.byref(samps_per_chan_read), None) + check_for_error(error_code) + + return samps_per_chan_read.value + + +def _read_ctr_ticks( + task_handle, high_tick, low_tick, num_samps_per_chan, timeout, + interleaved=FillMode.GROUP_BY_CHANNEL): + samps_per_chan_read = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxReadCtrTicks + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int, ctypes.c_double, + ctypes.c_int, + wrapped_ndpointer(dtype=numpy.uint32, flags=('C', 'W')), + wrapped_ndpointer(dtype=numpy.uint32, flags=('C', 'W')), + ctypes.c_uint, ctypes.POINTER(ctypes.c_int), + ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, num_samps_per_chan, timeout, interleaved.value, + high_tick, low_tick, numpy.prod(high_tick.shape), + ctypes.byref(samps_per_chan_read), None) + check_for_error(error_code) + + return samps_per_chan_read.value + + +def _read_ctr_freq_scalar(task_handle, timeout): + freq = ctypes.c_double() + duty_cycle = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxReadCtrFreqScalar + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double, + ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), + ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, timeout, ctypes.byref(freq), + ctypes.byref(duty_cycle), None) + check_for_error(error_code) + + value = CtrFreq( + freq.value, duty_cycle.value) + + return value + + +def _read_ctr_time_scalar(task_handle, timeout): + high_time = ctypes.c_double() + low_time = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxReadCtrTimeScalar + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double, + ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), + ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, timeout, ctypes.byref(high_time), + ctypes.byref(low_time), None) + check_for_error(error_code) + + value = CtrTime( + high_time.value, low_time.value) + + return value + + +def _read_ctr_ticks_scalar(task_handle, timeout): + high_ticks = ctypes.c_uint() + low_ticks = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxReadCtrTicksScalar + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double, + ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(ctypes.c_uint), + ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, timeout, ctypes.byref(high_ticks), + ctypes.byref(low_ticks), None) + check_for_error(error_code) + + return CtrTick( + high_ticks.value, low_ticks.value) + + +def _read_raw(task_handle, read_array, num_samps_per_chan, timeout): + samples_read = ctypes.c_int() + number_of_bytes_per_sample = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxReadRaw + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int, ctypes.c_double, + wrapped_ndpointer(dtype=read_array.dtype, flags=('C', 'W')), + ctypes.c_uint, ctypes.POINTER(ctypes.c_int), + ctypes.POINTER(ctypes.c_int), ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, num_samps_per_chan, timeout, read_array, + read_array.nbytes, ctypes.byref(samples_read), + ctypes.byref(number_of_bytes_per_sample), None) + check_for_error(error_code) + + return samples_read.value, number_of_bytes_per_sample.value diff --git a/nidaqmx/_task_modules/timing.py b/nidaqmx/_task_modules/timing.py new file mode 100644 index 00000000..ac344daa --- /dev/null +++ b/nidaqmx/_task_modules/timing.py @@ -0,0 +1,2494 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import ctypes +import numpy + +from nidaqmx._lib import lib_importer, ctypes_byte_str +from nidaqmx.system.physical_channel import PhysicalChannel +from nidaqmx.errors import ( + check_for_error, is_string_buffer_too_small, is_array_buffer_too_small) +from nidaqmx.constants import ( + AcquisitionType, DigitalWidthUnits, Edge, HandshakeStartCondition, Level, + MIOAIConvertTimebaseSource, OverflowBehavior, Polarity, + SampleInputDataWhen, SampleTimingType, UnderflowBehavior) + + +class Timing(object): + """ + Represents the timing configurations for a DAQmx task. + """ + def __init__(self, task_handle): + self._handle = task_handle + + @property + def ai_conv_active_edge(self): + """ + :class:`nidaqmx.constants.Edge`: Specifies on which edge of the + clock pulse an analog-to-digital conversion takes place. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIConvActiveEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return Edge(val.value) + + @ai_conv_active_edge.setter + def ai_conv_active_edge(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIConvActiveEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @ai_conv_active_edge.deleter + def ai_conv_active_edge(self): + cfunc = lib_importer.windll.DAQmxResetAIConvActiveEdge + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def ai_conv_dig_fltr_enable(self): + """ + bool: Specifies whether to apply a digital filter to the AI + Convert Clock. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetAIConvDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_conv_dig_fltr_enable.setter + def ai_conv_dig_fltr_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetAIConvDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_bool] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @ai_conv_dig_fltr_enable.deleter + def ai_conv_dig_fltr_enable(self): + cfunc = lib_importer.windll.DAQmxResetAIConvDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def ai_conv_dig_fltr_min_pulse_width(self): + """ + float: Specifies in seconds the minimum pulse width the filter + recognizes. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIConvDigFltrMinPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_conv_dig_fltr_min_pulse_width.setter + def ai_conv_dig_fltr_min_pulse_width(self, val): + cfunc = lib_importer.windll.DAQmxSetAIConvDigFltrMinPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @ai_conv_dig_fltr_min_pulse_width.deleter + def ai_conv_dig_fltr_min_pulse_width(self): + cfunc = lib_importer.windll.DAQmxResetAIConvDigFltrMinPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def ai_conv_dig_fltr_timebase_rate(self): + """ + float: Specifies in hertz the rate of the digital filter + timebase. NI-DAQmx uses this value to compute settings for + the filter. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIConvDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_conv_dig_fltr_timebase_rate.setter + def ai_conv_dig_fltr_timebase_rate(self, val): + cfunc = lib_importer.windll.DAQmxSetAIConvDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @ai_conv_dig_fltr_timebase_rate.deleter + def ai_conv_dig_fltr_timebase_rate(self): + cfunc = lib_importer.windll.DAQmxResetAIConvDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def ai_conv_dig_fltr_timebase_src(self): + """ + str: Specifies the terminal of the signal to use as the timebase + of the digital filter. + """ + cfunc = lib_importer.windll.DAQmxGetAIConvDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ai_conv_dig_fltr_timebase_src.setter + def ai_conv_dig_fltr_timebase_src(self, val): + cfunc = lib_importer.windll.DAQmxSetAIConvDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @ai_conv_dig_fltr_timebase_src.deleter + def ai_conv_dig_fltr_timebase_src(self): + cfunc = lib_importer.windll.DAQmxResetAIConvDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def ai_conv_dig_sync_enable(self): + """ + bool: Specifies whether to synchronize recognition of + transitions in the signal to the internal timebase of the + device. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetAIConvDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_conv_dig_sync_enable.setter + def ai_conv_dig_sync_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetAIConvDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_bool] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @ai_conv_dig_sync_enable.deleter + def ai_conv_dig_sync_enable(self): + cfunc = lib_importer.windll.DAQmxResetAIConvDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def ai_conv_max_rate(self): + """ + float: Indicates the maximum convert rate supported by the task, + given the current devices and channel count. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIConvMaxRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def ai_conv_rate(self): + """ + float: Specifies in Hertz the rate at which to clock the analog- + to-digital converter. This clock is specific to the analog + input section of multiplexed devices. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAIConvRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_conv_rate.setter + def ai_conv_rate(self, val): + cfunc = lib_importer.windll.DAQmxSetAIConvRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @ai_conv_rate.deleter + def ai_conv_rate(self): + cfunc = lib_importer.windll.DAQmxResetAIConvRate + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def ai_conv_src(self): + """ + str: Specifies the terminal of the signal to use as the AI + Convert Clock. + """ + cfunc = lib_importer.windll.DAQmxGetAIConvSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ai_conv_src.setter + def ai_conv_src(self, val): + cfunc = lib_importer.windll.DAQmxSetAIConvSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @ai_conv_src.deleter + def ai_conv_src(self): + cfunc = lib_importer.windll.DAQmxResetAIConvSrc + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def ai_conv_timebase_div(self): + """ + int: Specifies the number of AI Convert Clock Timebase pulses + needed to produce a single AI Convert Clock pulse. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetAIConvTimebaseDiv + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ai_conv_timebase_div.setter + def ai_conv_timebase_div(self, val): + cfunc = lib_importer.windll.DAQmxSetAIConvTimebaseDiv + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_uint] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @ai_conv_timebase_div.deleter + def ai_conv_timebase_div(self): + cfunc = lib_importer.windll.DAQmxResetAIConvTimebaseDiv + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def ai_conv_timebase_src(self): + """ + :class:`nidaqmx.constants.MIOAIConvertTimebaseSource`: Specifies + the terminal of the signal to use as the AI Convert Clock + Timebase. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAIConvTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return MIOAIConvertTimebaseSource(val.value) + + @ai_conv_timebase_src.setter + def ai_conv_timebase_src(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAIConvTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @ai_conv_timebase_src.deleter + def ai_conv_timebase_src(self): + cfunc = lib_importer.windll.DAQmxResetAIConvTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def change_detect_di_falling_edge_physical_chans(self): + """ + :class:`nidaqmx.system.physical_channel.PhysicalChannel`: + Specifies the names of the digital lines or ports on which + to detect falling edges. The lines or ports must be used by + virtual channels in the task. You also can specify a string + that contains a list or range of digital lines or ports. + """ + cfunc = (lib_importer.windll. + DAQmxGetChangeDetectDIFallingEdgePhysicalChans) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return PhysicalChannel(val.value.decode('ascii')) + + @change_detect_di_falling_edge_physical_chans.setter + def change_detect_di_falling_edge_physical_chans(self, val): + val = val.name + cfunc = (lib_importer.windll. + DAQmxSetChangeDetectDIFallingEdgePhysicalChans) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @change_detect_di_falling_edge_physical_chans.deleter + def change_detect_di_falling_edge_physical_chans(self): + cfunc = (lib_importer.windll. + DAQmxResetChangeDetectDIFallingEdgePhysicalChans) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def change_detect_di_rising_edge_physical_chans(self): + """ + :class:`nidaqmx.system.physical_channel.PhysicalChannel`: + Specifies the names of the digital lines or ports on which + to detect rising edges. The lines or ports must be used by + virtual channels in the task. You also can specify a string + that contains a list or range of digital lines or ports. + """ + cfunc = (lib_importer.windll. + DAQmxGetChangeDetectDIRisingEdgePhysicalChans) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return PhysicalChannel(val.value.decode('ascii')) + + @change_detect_di_rising_edge_physical_chans.setter + def change_detect_di_rising_edge_physical_chans(self, val): + val = val.name + cfunc = (lib_importer.windll. + DAQmxSetChangeDetectDIRisingEdgePhysicalChans) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @change_detect_di_rising_edge_physical_chans.deleter + def change_detect_di_rising_edge_physical_chans(self): + cfunc = (lib_importer.windll. + DAQmxResetChangeDetectDIRisingEdgePhysicalChans) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def change_detect_di_tristate(self): + """ + bool: Specifies whether to tristate lines specified with + **change_detect_di_rising_edge_physical_chans** and + **change_detect_di_falling_edge_physical_chans** that are + not in a virtual channel in the task. If you set this + property to True, NI-DAQmx tristates rising/falling edge + lines that are not in a virtual channel in the task. If you + set this property to False, NI-DAQmx does not modify the + configuration of rising/falling edge lines that are not in a + virtual channel in the task, even if the lines were + previously tristated. Set this property to False to detect + changes on lines in other tasks or to detect changes on + output-only lines. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetChangeDetectDITristate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @change_detect_di_tristate.setter + def change_detect_di_tristate(self, val): + cfunc = lib_importer.windll.DAQmxSetChangeDetectDITristate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_bool] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @change_detect_di_tristate.deleter + def change_detect_di_tristate(self): + cfunc = lib_importer.windll.DAQmxResetChangeDetectDITristate + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def delay_from_samp_clk_delay(self): + """ + float: Specifies the amount of time to wait after receiving a + Sample Clock edge before beginning to acquire the sample. + This value is in the units you specify with + **delay_from_samp_clk_delay_units**. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetDelayFromSampClkDelay + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @delay_from_samp_clk_delay.setter + def delay_from_samp_clk_delay(self, val): + cfunc = lib_importer.windll.DAQmxSetDelayFromSampClkDelay + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @delay_from_samp_clk_delay.deleter + def delay_from_samp_clk_delay(self): + cfunc = lib_importer.windll.DAQmxResetDelayFromSampClkDelay + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def delay_from_samp_clk_delay_units(self): + """ + :class:`nidaqmx.constants.DigitalWidthUnits`: Specifies the + units of **delay_from_samp_clk_delay**. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetDelayFromSampClkDelayUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return DigitalWidthUnits(val.value) + + @delay_from_samp_clk_delay_units.setter + def delay_from_samp_clk_delay_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetDelayFromSampClkDelayUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @delay_from_samp_clk_delay_units.deleter + def delay_from_samp_clk_delay_units(self): + cfunc = lib_importer.windll.DAQmxResetDelayFromSampClkDelayUnits + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def hshk_delay_after_xfer(self): + """ + float: Specifies the number of seconds to wait after a handshake + cycle before starting a new handshake cycle. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetHshkDelayAfterXfer + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @hshk_delay_after_xfer.setter + def hshk_delay_after_xfer(self, val): + cfunc = lib_importer.windll.DAQmxSetHshkDelayAfterXfer + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @hshk_delay_after_xfer.deleter + def hshk_delay_after_xfer(self): + cfunc = lib_importer.windll.DAQmxResetHshkDelayAfterXfer + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def hshk_sample_input_data_when(self): + """ + :class:`nidaqmx.constants.SampleInputDataWhen`: Specifies on + which edge of the Handshake Trigger an input task latches + the data from the peripheral device. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetHshkSampleInputDataWhen + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return SampleInputDataWhen(val.value) + + @hshk_sample_input_data_when.setter + def hshk_sample_input_data_when(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetHshkSampleInputDataWhen + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @hshk_sample_input_data_when.deleter + def hshk_sample_input_data_when(self): + cfunc = lib_importer.windll.DAQmxResetHshkSampleInputDataWhen + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def hshk_start_cond(self): + """ + :class:`nidaqmx.constants.HandshakeStartCondition`: Specifies + the point in the handshake cycle that the device is in when + the task starts. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetHshkStartCond + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return HandshakeStartCondition(val.value) + + @hshk_start_cond.setter + def hshk_start_cond(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetHshkStartCond + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @hshk_start_cond.deleter + def hshk_start_cond(self): + cfunc = lib_importer.windll.DAQmxResetHshkStartCond + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def implicit_underflow_behavior(self): + """ + :class:`nidaqmx.constants.UnderflowBehavior`: Specifies the + action to take when the onboard memory of the device becomes + empty. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetImplicitUnderflowBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return UnderflowBehavior(val.value) + + @implicit_underflow_behavior.setter + def implicit_underflow_behavior(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetImplicitUnderflowBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @implicit_underflow_behavior.deleter + def implicit_underflow_behavior(self): + cfunc = lib_importer.windll.DAQmxResetImplicitUnderflowBehavior + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def master_timebase_rate(self): + """ + float: Specifies the rate of the Master Timebase. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetMasterTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @master_timebase_rate.setter + def master_timebase_rate(self, val): + cfunc = lib_importer.windll.DAQmxSetMasterTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @master_timebase_rate.deleter + def master_timebase_rate(self): + cfunc = lib_importer.windll.DAQmxResetMasterTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def master_timebase_src(self): + """ + str: Specifies the terminal of the signal to use as the Master + Timebase. On an E Series device, you can choose only between + the onboard 20MHz Timebase or the RTSI7 terminal. + """ + cfunc = lib_importer.windll.DAQmxGetMasterTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @master_timebase_src.setter + def master_timebase_src(self, val): + cfunc = lib_importer.windll.DAQmxSetMasterTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @master_timebase_src.deleter + def master_timebase_src(self): + cfunc = lib_importer.windll.DAQmxResetMasterTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def ref_clk_rate(self): + """ + float: Specifies the frequency of the Reference Clock. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetRefClkRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ref_clk_rate.setter + def ref_clk_rate(self, val): + cfunc = lib_importer.windll.DAQmxSetRefClkRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @ref_clk_rate.deleter + def ref_clk_rate(self): + cfunc = lib_importer.windll.DAQmxResetRefClkRate + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def ref_clk_src(self): + """ + str: Specifies the terminal of the signal to use as the + Reference Clock. + """ + cfunc = lib_importer.windll.DAQmxGetRefClkSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @ref_clk_src.setter + def ref_clk_src(self, val): + cfunc = lib_importer.windll.DAQmxSetRefClkSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @ref_clk_src.deleter + def ref_clk_src(self): + cfunc = lib_importer.windll.DAQmxResetRefClkSrc + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def samp_clk_active_edge(self): + """ + :class:`nidaqmx.constants.Edge`: Specifies on which edge of a + clock pulse sampling takes place. This property is useful + primarily when the signal you use as the Sample Clock is not + a periodic clock. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetSampClkActiveEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return Edge(val.value) + + @samp_clk_active_edge.setter + def samp_clk_active_edge(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetSampClkActiveEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @samp_clk_active_edge.deleter + def samp_clk_active_edge(self): + cfunc = lib_importer.windll.DAQmxResetSampClkActiveEdge + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def samp_clk_dig_fltr_enable(self): + """ + bool: Specifies whether to apply the pulse width filter to the + signal. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetSampClkDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @samp_clk_dig_fltr_enable.setter + def samp_clk_dig_fltr_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetSampClkDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_bool] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @samp_clk_dig_fltr_enable.deleter + def samp_clk_dig_fltr_enable(self): + cfunc = lib_importer.windll.DAQmxResetSampClkDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def samp_clk_dig_fltr_min_pulse_width(self): + """ + float: Specifies in seconds the minimum pulse width the filter + recognizes. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetSampClkDigFltrMinPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @samp_clk_dig_fltr_min_pulse_width.setter + def samp_clk_dig_fltr_min_pulse_width(self, val): + cfunc = lib_importer.windll.DAQmxSetSampClkDigFltrMinPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @samp_clk_dig_fltr_min_pulse_width.deleter + def samp_clk_dig_fltr_min_pulse_width(self): + cfunc = lib_importer.windll.DAQmxResetSampClkDigFltrMinPulseWidth + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def samp_clk_dig_fltr_timebase_rate(self): + """ + float: Specifies in hertz the rate of the pulse width filter + timebase. NI-DAQmx uses this value to compute settings for + the filter. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetSampClkDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @samp_clk_dig_fltr_timebase_rate.setter + def samp_clk_dig_fltr_timebase_rate(self, val): + cfunc = lib_importer.windll.DAQmxSetSampClkDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @samp_clk_dig_fltr_timebase_rate.deleter + def samp_clk_dig_fltr_timebase_rate(self): + cfunc = lib_importer.windll.DAQmxResetSampClkDigFltrTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def samp_clk_dig_fltr_timebase_src(self): + """ + str: Specifies the input terminal of the signal to use as the + timebase of the pulse width filter. + """ + cfunc = lib_importer.windll.DAQmxGetSampClkDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @samp_clk_dig_fltr_timebase_src.setter + def samp_clk_dig_fltr_timebase_src(self, val): + cfunc = lib_importer.windll.DAQmxSetSampClkDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @samp_clk_dig_fltr_timebase_src.deleter + def samp_clk_dig_fltr_timebase_src(self): + cfunc = lib_importer.windll.DAQmxResetSampClkDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def samp_clk_dig_sync_enable(self): + """ + bool: Specifies whether to synchronize recognition of + transitions in the signal to the internal timebase of the + device. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetSampClkDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @samp_clk_dig_sync_enable.setter + def samp_clk_dig_sync_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetSampClkDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_bool] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @samp_clk_dig_sync_enable.deleter + def samp_clk_dig_sync_enable(self): + cfunc = lib_importer.windll.DAQmxResetSampClkDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def samp_clk_max_rate(self): + """ + float: Indicates the maximum Sample Clock rate supported by the + task, based on other timing settings. For output tasks, the + maximum Sample Clock rate is the maximum rate of the DAC. + For input tasks, NI-DAQmx calculates the maximum sampling + rate differently for multiplexed devices than simultaneous + sampling devices. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetSampClkMaxRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def samp_clk_overrun_behavior(self): + """ + :class:`nidaqmx.constants.OverflowBehavior`: Specifies the + action to take if Sample Clock edges occur faster than the + device can handle them. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetSampClkOverrunBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return OverflowBehavior(val.value) + + @samp_clk_overrun_behavior.setter + def samp_clk_overrun_behavior(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetSampClkOverrunBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @samp_clk_overrun_behavior.deleter + def samp_clk_overrun_behavior(self): + cfunc = lib_importer.windll.DAQmxResetSampClkOverrunBehavior + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def samp_clk_rate(self): + """ + float: Specifies the sampling rate in samples per channel per + second. If you use an external source for the Sample Clock, + set this input to the maximum expected rate of that clock. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetSampClkRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @samp_clk_rate.setter + def samp_clk_rate(self, val): + cfunc = lib_importer.windll.DAQmxSetSampClkRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @samp_clk_rate.deleter + def samp_clk_rate(self): + cfunc = lib_importer.windll.DAQmxResetSampClkRate + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def samp_clk_src(self): + """ + str: Specifies the terminal of the signal to use as the Sample + Clock. + """ + cfunc = lib_importer.windll.DAQmxGetSampClkSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @samp_clk_src.setter + def samp_clk_src(self, val): + cfunc = lib_importer.windll.DAQmxSetSampClkSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @samp_clk_src.deleter + def samp_clk_src(self): + cfunc = lib_importer.windll.DAQmxResetSampClkSrc + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def samp_clk_term(self): + """ + str: Indicates the name of the internal Sample Clock terminal + for the task. This property does not return the name of the + Sample Clock source terminal specified with + **samp_clk_src**. + """ + cfunc = lib_importer.windll.DAQmxGetSampClkTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @property + def samp_clk_timebase_active_edge(self): + """ + :class:`nidaqmx.constants.Edge`: Specifies on which edge to + recognize a Sample Clock Timebase pulse. This property is + useful primarily when the signal you use as the Sample Clock + Timebase is not a periodic clock. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetSampClkTimebaseActiveEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return Edge(val.value) + + @samp_clk_timebase_active_edge.setter + def samp_clk_timebase_active_edge(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetSampClkTimebaseActiveEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @samp_clk_timebase_active_edge.deleter + def samp_clk_timebase_active_edge(self): + cfunc = lib_importer.windll.DAQmxResetSampClkTimebaseActiveEdge + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def samp_clk_timebase_div(self): + """ + int: Specifies the number of Sample Clock Timebase pulses needed + to produce a single Sample Clock pulse. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetSampClkTimebaseDiv + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @samp_clk_timebase_div.setter + def samp_clk_timebase_div(self, val): + cfunc = lib_importer.windll.DAQmxSetSampClkTimebaseDiv + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_uint] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @samp_clk_timebase_div.deleter + def samp_clk_timebase_div(self): + cfunc = lib_importer.windll.DAQmxResetSampClkTimebaseDiv + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def samp_clk_timebase_master_timebase_div(self): + """ + int: Specifies the number of pulses of the Master Timebase + needed to produce a single pulse of the Sample Clock + Timebase. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetSampClkTimebaseMasterTimebaseDiv + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @samp_clk_timebase_master_timebase_div.setter + def samp_clk_timebase_master_timebase_div(self, val): + cfunc = lib_importer.windll.DAQmxSetSampClkTimebaseMasterTimebaseDiv + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_uint] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @samp_clk_timebase_master_timebase_div.deleter + def samp_clk_timebase_master_timebase_div(self): + cfunc = lib_importer.windll.DAQmxResetSampClkTimebaseMasterTimebaseDiv + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def samp_clk_timebase_rate(self): + """ + float: Specifies the rate of the Sample Clock Timebase. Some + applications require that you specify a rate when you use + any signal other than the onboard Sample Clock Timebase. NI- + DAQmx requires this rate to calculate other timing + parameters. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetSampClkTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @samp_clk_timebase_rate.setter + def samp_clk_timebase_rate(self, val): + cfunc = lib_importer.windll.DAQmxSetSampClkTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @samp_clk_timebase_rate.deleter + def samp_clk_timebase_rate(self): + cfunc = lib_importer.windll.DAQmxResetSampClkTimebaseRate + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def samp_clk_timebase_src(self): + """ + str: Specifies the terminal of the signal to use as the Sample + Clock Timebase. + """ + cfunc = lib_importer.windll.DAQmxGetSampClkTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @samp_clk_timebase_src.setter + def samp_clk_timebase_src(self, val): + cfunc = lib_importer.windll.DAQmxSetSampClkTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @samp_clk_timebase_src.deleter + def samp_clk_timebase_src(self): + cfunc = lib_importer.windll.DAQmxResetSampClkTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def samp_clk_timebase_term(self): + """ + str: Indicates the name of the internal Sample Clock Timebase + terminal for the task. This property does not return the + name of the Sample Clock Timebase source terminal specified + with **samp_clk_timebase_src**. + """ + cfunc = lib_importer.windll.DAQmxGetSampClkTimebaseTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @property + def samp_clk_underflow_behavior(self): + """ + :class:`nidaqmx.constants.UnderflowBehavior`: Specifies the + action to take when the onboard memory of the device becomes + empty. In either case, the sample clock does not stop. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetSampClkUnderflowBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return UnderflowBehavior(val.value) + + @samp_clk_underflow_behavior.setter + def samp_clk_underflow_behavior(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetSampClkUnderflowBehavior + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @samp_clk_underflow_behavior.deleter + def samp_clk_underflow_behavior(self): + cfunc = lib_importer.windll.DAQmxResetSampClkUnderflowBehavior + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def samp_clk_write_wfm_use_initial_wfm_dt(self): + """ + bool: Specifies that the value of **samp_clk_rate** will be + determined by the dt component of the initial DAQmx Write + waveform input for Output tasks. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetSampClkWriteWfmUseInitialWfmDT + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @samp_clk_write_wfm_use_initial_wfm_dt.setter + def samp_clk_write_wfm_use_initial_wfm_dt(self, val): + cfunc = lib_importer.windll.DAQmxSetSampClkWriteWfmUseInitialWfmDT + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_bool] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @samp_clk_write_wfm_use_initial_wfm_dt.deleter + def samp_clk_write_wfm_use_initial_wfm_dt(self): + cfunc = lib_importer.windll.DAQmxResetSampClkWriteWfmUseInitialWfmDT + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def samp_quant_samp_mode(self): + """ + :class:`nidaqmx.constants.AcquisitionType`: Specifies if a task + acquires or generates a finite number of samples or if it + continuously acquires or generates samples. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetSampQuantSampMode + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return AcquisitionType(val.value) + + @samp_quant_samp_mode.setter + def samp_quant_samp_mode(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetSampQuantSampMode + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @samp_quant_samp_mode.deleter + def samp_quant_samp_mode(self): + cfunc = lib_importer.windll.DAQmxResetSampQuantSampMode + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def samp_quant_samp_per_chan(self): + """ + float: Specifies the number of samples to acquire or generate + for each channel if **samp_quant_samp_mode** is + **AcquisitionType.FINITE**. If **samp_quant_samp_mode** is + **AcquisitionType.CONTINUOUS**, NI-DAQmx uses this value to + determine the buffer size. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetSampQuantSampPerChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @samp_quant_samp_per_chan.setter + def samp_quant_samp_per_chan(self, val): + cfunc = lib_importer.windll.DAQmxSetSampQuantSampPerChan + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @samp_quant_samp_per_chan.deleter + def samp_quant_samp_per_chan(self): + cfunc = lib_importer.windll.DAQmxResetSampQuantSampPerChan + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def samp_timing_engine(self): + """ + int: Specifies which timing engine to use for the task. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetSampTimingEngine + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @samp_timing_engine.setter + def samp_timing_engine(self, val): + cfunc = lib_importer.windll.DAQmxSetSampTimingEngine + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_uint] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @samp_timing_engine.deleter + def samp_timing_engine(self): + cfunc = lib_importer.windll.DAQmxResetSampTimingEngine + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def samp_timing_type(self): + """ + :class:`nidaqmx.constants.SampleTimingType`: Specifies the type + of sample timing to use for the task. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetSampTimingType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return SampleTimingType(val.value) + + @samp_timing_type.setter + def samp_timing_type(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetSampTimingType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @samp_timing_type.deleter + def samp_timing_type(self): + cfunc = lib_importer.windll.DAQmxResetSampTimingType + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def simultaneous_ao_enable(self): + """ + bool: Specifies whether to update all channels in the task + simultaneously, rather than updating channels independently + when you write a sample to that channel. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetOnDemandSimultaneousAOEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @simultaneous_ao_enable.setter + def simultaneous_ao_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetOnDemandSimultaneousAOEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_bool] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @simultaneous_ao_enable.deleter + def simultaneous_ao_enable(self): + cfunc = lib_importer.windll.DAQmxResetOnDemandSimultaneousAOEnable + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def sync_clk_interval(self): + """ + int: Specifies the interval, in Sample Clock periods, between + each internal Synchronization Clock pulse. NI-DAQmx uses + this pulse for synchronization of triggers between multiple + devices at different rates. Refer to device documentation + for information about how to calculate this value. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetSyncClkInterval + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @sync_clk_interval.setter + def sync_clk_interval(self, val): + cfunc = lib_importer.windll.DAQmxSetSyncClkInterval + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_uint] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @sync_clk_interval.deleter + def sync_clk_interval(self): + cfunc = lib_importer.windll.DAQmxResetSyncClkInterval + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def sync_pulse_min_delay_to_start(self): + """ + float: Specifies in seconds the amount of time that elapses + after the master device issues the synchronization pulse + before the task starts. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetSyncPulseMinDelayToStart + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @sync_pulse_min_delay_to_start.setter + def sync_pulse_min_delay_to_start(self, val): + cfunc = lib_importer.windll.DAQmxSetSyncPulseMinDelayToStart + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @sync_pulse_min_delay_to_start.deleter + def sync_pulse_min_delay_to_start(self): + cfunc = lib_importer.windll.DAQmxResetSyncPulseMinDelayToStart + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def sync_pulse_reset_delay(self): + """ + float: Specifies in seconds the amount of time to wait after the + Synchronization Pulse before resetting the ADCs or DACs on + the device. When synchronizing devices, query + **sync_pulse_reset_time** on all devices and note the + largest reset time. Then, for each device, subtract the + reset time from the largest reset time and set this property + to the resulting value. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetSyncPulseResetDelay + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @sync_pulse_reset_delay.setter + def sync_pulse_reset_delay(self, val): + cfunc = lib_importer.windll.DAQmxSetSyncPulseResetDelay + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @sync_pulse_reset_delay.deleter + def sync_pulse_reset_delay(self): + cfunc = lib_importer.windll.DAQmxResetSyncPulseResetDelay + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def sync_pulse_reset_time(self): + """ + float: Indicates in seconds the amount of time required for the + ADCs or DACs on the device to reset. When synchronizing + devices, query this property on all devices and note the + largest reset time. Then, for each device, subtract the + value of this property from the largest reset time and set + **sync_pulse_reset_delay** to the resulting value. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetSyncPulseResetTime + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def sync_pulse_src(self): + """ + str: Specifies the terminal of the signal to use as the + synchronization pulse. The synchronization pulse resets the + clock dividers and the ADCs/DACs on the device. + """ + cfunc = lib_importer.windll.DAQmxGetSyncPulseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @sync_pulse_src.setter + def sync_pulse_src(self, val): + cfunc = lib_importer.windll.DAQmxSetSyncPulseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @sync_pulse_src.deleter + def sync_pulse_src(self): + cfunc = lib_importer.windll.DAQmxResetSyncPulseSrc + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def sync_pulse_sync_time(self): + """ + float: Indicates in seconds the delay required to reset the + ADCs/DACs after the device receives the synchronization + pulse. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetSyncPulseSyncTime + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def sync_pulse_term(self): + """ + str: Indicates the name of the internal Synchronization Pulse + terminal for the task. This property does not return the + name of the source terminal. + """ + cfunc = lib_importer.windll.DAQmxGetSyncPulseTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + def cfg_burst_handshaking_timing_export_clock( + self, sample_clk_rate, sample_clk_outp_term, + sample_mode=AcquisitionType.FINITE, samps_per_chan=1000, + sample_clk_pulse_polarity=Polarity.ACTIVE_HIGH, + pause_when=Level.HIGH, + ready_event_active_level=Polarity.ACTIVE_HIGH): + """ + Configures when the DAQ device transfers data to a peripheral + device, using the onboard Sample Clock of the DAQ device to + control burst handshake timing and exporting that clock for use + by the peripheral device. + + Args: + sample_clk_rate (float): Specifies in hertz the rate of the + Sample Clock. + sample_clk_outp_term (str): Specifies the terminal to which + to export the Sample Clock. + sample_mode (Optional[nidaqmx.constants.AcquisitionType]): + Specifies if the task acquires or generates samples + continuously or if it acquires or generates a finite + number of samples. + samps_per_chan (Optional[long]): Specifies the number of + samples to acquire or generate for each channel in the + task if **sample_mode** is **FINITE_SAMPLES**. If + **sample_mode** is **CONTINUOUS_SAMPLES**, NI-DAQmx uses + this value to determine the buffer size. This function + returns an error if the specified value is negative. + sample_clk_pulse_polarity (Optional[nidaqmx.constants.Polarity]): + Specifies the polarity of the exported Sample Clock. + pause_when (Optional[nidaqmx.constants.Level]): Specifies + whether the task pauses while the trigger signal is high + or low. + ready_event_active_level (Optional[nidaqmx.constants.Polarity]): + Specifies the polarity of the Ready for Transfer Event. + """ + cfunc = lib_importer.windll.DAQmxCfgBurstHandshakingTimingExportClock + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int, ctypes.c_ulonglong, + ctypes.c_double, ctypes_byte_str, ctypes.c_int, ctypes.c_int, + ctypes.c_int] + + error_code = cfunc( + self._handle, sample_mode.value, samps_per_chan, sample_clk_rate, + sample_clk_outp_term, sample_clk_pulse_polarity.value, + pause_when.value, ready_event_active_level.value) + check_for_error(error_code) + + def cfg_burst_handshaking_timing_import_clock( + self, sample_clk_rate, sample_clk_src, + sample_mode=AcquisitionType.FINITE, samps_per_chan=1000, + sample_clk_active_edge=Edge.RISING, pause_when=Level.HIGH, + ready_event_active_level=Polarity.ACTIVE_HIGH): + """ + Configures when the DAQ device transfers data to a peripheral + device, using an imported sample clock to control burst + handshake timing. + + Args: + sample_clk_rate (float): Specifies in hertz the rate of the + Sample Clock. + sample_clk_src (str): Specifies the source terminal of the + Sample Clock. Leave this input unspecified to use the + default onboard clock of the device. + sample_mode (Optional[nidaqmx.constants.AcquisitionType]): + Specifies if the task acquires or generates samples + continuously or if it acquires or generates a finite + number of samples. + samps_per_chan (Optional[long]): Specifies the number of + samples to acquire or generate for each channel in the + task if **sample_mode** is **FINITE_SAMPLES**. If + **sample_mode** is **CONTINUOUS_SAMPLES**, NI-DAQmx uses + this value to determine the buffer size. This function + returns an error if the specified value is negative. + sample_clk_active_edge (Optional[nidaqmx.constants.Edge]): + Specifies on which edges of Sample Clock pulses to + acquire or generate samples. + pause_when (Optional[nidaqmx.constants.Level]): Specifies + whether the task pauses while the trigger signal is high + or low. + ready_event_active_level (Optional[nidaqmx.constants.Polarity]): + Specifies the polarity of the Ready for Transfer Event. + """ + cfunc = lib_importer.windll.DAQmxCfgBurstHandshakingTimingImportClock + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int, ctypes.c_ulonglong, + ctypes.c_double, ctypes_byte_str, ctypes.c_int, ctypes.c_int, + ctypes.c_int] + + error_code = cfunc( + self._handle, sample_mode.value, samps_per_chan, sample_clk_rate, + sample_clk_src, sample_clk_active_edge.value, pause_when.value, + ready_event_active_level.value) + check_for_error(error_code) + + def cfg_change_detection_timing( + self, rising_edge_chan="", falling_edge_chan="", + sample_mode=AcquisitionType.FINITE, samps_per_chan=1000): + """ + Configures the task to acquire samples on the rising and/or + falling edges of the lines or ports you specify. To detect both + rising and falling edges on a line or port, specify the name of + that line or port to both **rising_edge_chan** and + **falling_edge_chan**. + + Args: + rising_edge_chan (Optional[str]): Specifies the names of the + digital lines or ports on which to detect rising edges. + The DAQmx physical channel constant lists all lines and + ports for devices installed in your system. + falling_edge_chan (Optional[str]): Specifies the names of + the digital lines or ports on which to detect falling + edges. The DAQmx physical channel constant lists all + lines and ports for devices installed in your system. + sample_mode (Optional[nidaqmx.constants.AcquisitionType]): + Specifies if the task acquires samples continuously or + if it acquires a finite number of samples. + samps_per_chan (Optional[long]): Specifies the number of + samples to acquire from each channel in the task if + **sample_mode** is **FINITE_SAMPLES**. This function + returns an error if the specified value is negative. + """ + cfunc = lib_importer.windll.DAQmxCfgChangeDetectionTiming + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_int, ctypes.c_ulonglong] + + error_code = cfunc( + self._handle, rising_edge_chan, falling_edge_chan, + sample_mode.value, samps_per_chan) + check_for_error(error_code) + + def cfg_handshaking_timing( + self, sample_mode=AcquisitionType.FINITE, samps_per_chan=1000): + """ + Determines the number of digital samples to acquire or generate + using digital handshaking between the device and a peripheral + device. + + Args: + sample_mode (Optional[nidaqmx.constants.AcquisitionType]): + Specifies if the task acquires or generates samples + continuously or if it acquires or generates a finite + number of samples. + samps_per_chan (Optional[long]): Specifies the number of + samples to acquire or generate for each channel in the + task if **sample_mode** is **FINITE_SAMPLES**. If + **sample_mode** is **CONTINUOUS_SAMPLES**, NI-DAQmx uses + this value to determine the buffer size. This function + returns an error if the specified value is negative. + """ + cfunc = lib_importer.windll.DAQmxCfgHandshakingTiming + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int, ctypes.c_ulonglong] + + error_code = cfunc( + self._handle, sample_mode.value, samps_per_chan) + check_for_error(error_code) + + def cfg_implicit_timing( + self, sample_mode=AcquisitionType.FINITE, samps_per_chan=1000): + """ + Sets only the number of samples to acquire or generate without + specifying timing. Typically, you should use this instance when + the task does not require sample timing, such as tasks that use + counters for buffered frequency measurement, buffered period + measurement, or pulse train generation. For finite counter + output tasks, **samps_per_chan** is the number of pulses to + generate. + + Args: + sample_mode (Optional[nidaqmx.constants.AcquisitionType]): + Specifies if the task acquires or generates samples + continuously or if it acquires or generates a finite + number of samples. + samps_per_chan (Optional[long]): Specifies the number of + samples to acquire or generate for each channel in the + task if **sample_mode** is **FINITE_SAMPLES**. If + **sample_mode** is **CONTINUOUS_SAMPLES**, NI-DAQmx uses + this value to determine the buffer size. This function + returns an error if the specified value is negative. + """ + cfunc = lib_importer.windll.DAQmxCfgImplicitTiming + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int, ctypes.c_ulonglong] + + error_code = cfunc( + self._handle, sample_mode.value, samps_per_chan) + check_for_error(error_code) + + def cfg_pipelined_samp_clk_timing( + self, rate, source="", active_edge=Edge.RISING, + sample_mode=AcquisitionType.FINITE, samps_per_chan=1000): + """ + "Sets the source of the Sample Clock, the rate of the Sample + Clock, and the number of samples to acquire or generate. The + device acquires or generates samples on each Sample Clock edge, + but it does not respond to certain triggers until a few Sample + Clock edges later. Pipelining allows higher data transfer rates + at the cost of increased trigger response latency. Refer to the + device documentation for information about which triggers + pipelining affects.\r\n\r\nThis timing type allows handshaking + using the Pause trigger and either the Ready for Transfer event + or the Data Active event. Refer to the device documentation for + more information.\r\n\r\nThis timing type is supported only by + the NI 6536 and NI 6537." + + Args: + rate (float): Specifies the sampling rate in samples per + channel per second. If you use an external source for + the Sample Clock, set this input to the maximum expected + rate of that clock. + source (Optional[str]): Specifies the source terminal of the + Sample Clock. Leave this input unspecified to use the + default onboard clock of the device. + active_edge (Optional[nidaqmx.constants.Edge]): Specifies on + which edges of Sample Clock pulses to acquire or + generate samples. + sample_mode (Optional[nidaqmx.constants.AcquisitionType]): + Specifies if the task acquires or generates samples + continuously or if it acquires or generates a finite + number of samples. + samps_per_chan (Optional[long]): Specifies the number of + samples to acquire or generate for each channel in the + task if **sample_mode** is **FINITE_SAMPLES**. If + **sample_mode** is **CONTINUOUS_SAMPLES**, NI-DAQmx uses + this value to determine the buffer size. This function + returns an error if the specified value is negative. + """ + cfunc = lib_importer.windll.DAQmxCfgPipelinedSampClkTiming + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double, + ctypes.c_int, ctypes.c_int, ctypes.c_ulonglong] + + error_code = cfunc( + self._handle, source, rate, active_edge.value, sample_mode.value, + samps_per_chan) + check_for_error(error_code) + + def cfg_samp_clk_timing( + self, rate, source="", active_edge=Edge.RISING, + sample_mode=AcquisitionType.FINITE, samps_per_chan=1000): + """ + Sets the source of the Sample Clock, the rate of the Sample + Clock, and the number of samples to acquire or generate. + + Args: + rate (float): Specifies the sampling rate in samples per + channel per second. If you use an external source for + the Sample Clock, set this input to the maximum expected + rate of that clock. + source (Optional[str]): Specifies the source terminal of the + Sample Clock. Leave this input unspecified to use the + default onboard clock of the device. + active_edge (Optional[nidaqmx.constants.Edge]): Specifies on + which edges of Sample Clock pulses to acquire or + generate samples. + sample_mode (Optional[nidaqmx.constants.AcquisitionType]): + Specifies if the task acquires or generates samples + continuously or if it acquires or generates a finite + number of samples. + samps_per_chan (Optional[long]): Specifies the number of + samples to acquire or generate for each channel in the + task if **sample_mode** is **FINITE_SAMPLES**. If + **sample_mode** is **CONTINUOUS_SAMPLES**, NI-DAQmx uses + this value to determine the buffer size. This function + returns an error if the specified value is negative. + """ + cfunc = lib_importer.windll.DAQmxCfgSampClkTiming + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double, + ctypes.c_int, ctypes.c_int, ctypes.c_ulonglong] + + error_code = cfunc( + self._handle, source, rate, active_edge.value, sample_mode.value, + samps_per_chan) + check_for_error(error_code) + diff --git a/nidaqmx/_task_modules/triggering/__init__.py b/nidaqmx/_task_modules/triggering/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/nidaqmx/_task_modules/triggering/arm_start_trigger.py b/nidaqmx/_task_modules/triggering/arm_start_trigger.py new file mode 100644 index 00000000..9c379459 --- /dev/null +++ b/nidaqmx/_task_modules/triggering/arm_start_trigger.py @@ -0,0 +1,398 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import ctypes +import numpy + +from nidaqmx._lib import lib_importer, wrapped_ndpointer, ctypes_byte_str +from nidaqmx.system.physical_channel import PhysicalChannel +from nidaqmx.errors import ( + check_for_error, is_string_buffer_too_small, is_array_buffer_too_small) +from nidaqmx.constants import ( + Edge, TriggerType) + + +class ArmStartTrigger(object): + """ + Represents the arm start trigger configurations for a DAQmx task. + """ + def __init__(self, task_handle): + self._handle = task_handle + + @property + def dig_edge_dig_fltr_enable(self): + """ + bool: Specifies whether to apply the pulse width filter to the + signal. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetDigEdgeArmStartTrigDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @dig_edge_dig_fltr_enable.setter + def dig_edge_dig_fltr_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetDigEdgeArmStartTrigDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_bool] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @dig_edge_dig_fltr_enable.deleter + def dig_edge_dig_fltr_enable(self): + cfunc = lib_importer.windll.DAQmxResetDigEdgeArmStartTrigDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def dig_edge_dig_fltr_min_pulse_width(self): + """ + float: Specifies in seconds the minimum pulse width the filter + recognizes. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetDigEdgeArmStartTrigDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @dig_edge_dig_fltr_min_pulse_width.setter + def dig_edge_dig_fltr_min_pulse_width(self, val): + cfunc = (lib_importer.windll. + DAQmxSetDigEdgeArmStartTrigDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @dig_edge_dig_fltr_min_pulse_width.deleter + def dig_edge_dig_fltr_min_pulse_width(self): + cfunc = (lib_importer.windll. + DAQmxResetDigEdgeArmStartTrigDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def dig_edge_dig_fltr_timebase_rate(self): + """ + float: Specifies in hertz the rate of the pulse width filter + timebase. NI-DAQmx uses this value to compute settings for + the filter. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetDigEdgeArmStartTrigDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @dig_edge_dig_fltr_timebase_rate.setter + def dig_edge_dig_fltr_timebase_rate(self, val): + cfunc = (lib_importer.windll. + DAQmxSetDigEdgeArmStartTrigDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @dig_edge_dig_fltr_timebase_rate.deleter + def dig_edge_dig_fltr_timebase_rate(self): + cfunc = (lib_importer.windll. + DAQmxResetDigEdgeArmStartTrigDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def dig_edge_dig_fltr_timebase_src(self): + """ + str: Specifies the input terminal of the signal to use as the + timebase of the pulse width filter. + """ + cfunc = (lib_importer.windll. + DAQmxGetDigEdgeArmStartTrigDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @dig_edge_dig_fltr_timebase_src.setter + def dig_edge_dig_fltr_timebase_src(self, val): + cfunc = (lib_importer.windll. + DAQmxSetDigEdgeArmStartTrigDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @dig_edge_dig_fltr_timebase_src.deleter + def dig_edge_dig_fltr_timebase_src(self): + cfunc = (lib_importer.windll. + DAQmxResetDigEdgeArmStartTrigDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def dig_edge_dig_sync_enable(self): + """ + bool: Specifies whether to synchronize recognition of + transitions in the signal to the internal timebase of the + device. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetDigEdgeArmStartTrigDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @dig_edge_dig_sync_enable.setter + def dig_edge_dig_sync_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetDigEdgeArmStartTrigDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_bool] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @dig_edge_dig_sync_enable.deleter + def dig_edge_dig_sync_enable(self): + cfunc = lib_importer.windll.DAQmxResetDigEdgeArmStartTrigDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def dig_edge_edge(self): + """ + :class:`nidaqmx.constants.Edge`: Specifies on which edge of a + digital signal to arm the task for a Start Trigger. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetDigEdgeArmStartTrigEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return Edge(val.value) + + @dig_edge_edge.setter + def dig_edge_edge(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetDigEdgeArmStartTrigEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @dig_edge_edge.deleter + def dig_edge_edge(self): + cfunc = lib_importer.windll.DAQmxResetDigEdgeArmStartTrigEdge + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def dig_edge_src(self): + """ + str: Specifies the name of a terminal where there is a digital + signal to use as the source of the Arm Start Trigger. + """ + cfunc = lib_importer.windll.DAQmxGetDigEdgeArmStartTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @dig_edge_src.setter + def dig_edge_src(self, val): + cfunc = lib_importer.windll.DAQmxSetDigEdgeArmStartTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @dig_edge_src.deleter + def dig_edge_src(self): + cfunc = lib_importer.windll.DAQmxResetDigEdgeArmStartTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def term(self): + """ + str: Indicates the name of the internal Arm Start Trigger + terminal for the task. This property does not return the + name of the trigger source terminal. + """ + cfunc = lib_importer.windll.DAQmxGetArmStartTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @property + def trig_type(self): + """ + :class:`nidaqmx.constants.TriggerType`: Specifies the type of + trigger to use to arm the task for a Start Trigger. If you + configure an Arm Start Trigger, the task does not respond to + a Start Trigger until the device receives the Arm Start + Trigger. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetArmStartTrigType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return TriggerType(val.value) + + @trig_type.setter + def trig_type(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetArmStartTrigType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @trig_type.deleter + def trig_type(self): + cfunc = lib_importer.windll.DAQmxResetArmStartTrigType + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + diff --git a/nidaqmx/_task_modules/triggering/handshake_trigger.py b/nidaqmx/_task_modules/triggering/handshake_trigger.py new file mode 100644 index 00000000..4147bb05 --- /dev/null +++ b/nidaqmx/_task_modules/triggering/handshake_trigger.py @@ -0,0 +1,150 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import ctypes +import numpy + +from nidaqmx._lib import lib_importer, wrapped_ndpointer, ctypes_byte_str +from nidaqmx.system.physical_channel import PhysicalChannel +from nidaqmx.errors import ( + check_for_error, is_string_buffer_too_small, is_array_buffer_too_small) +from nidaqmx.constants import ( + Level, TriggerType) + + +class HandshakeTrigger(object): + """ + Represents the handshake trigger configurations for a DAQmx task. + """ + def __init__(self, task_handle): + self._handle = task_handle + + @property + def interlocked_asserted_lvl(self): + """ + :class:`nidaqmx.constants.Level`: Specifies the asserted level + of the Handshake Trigger. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetInterlockedHshkTrigAssertedLvl + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return Level(val.value) + + @interlocked_asserted_lvl.setter + def interlocked_asserted_lvl(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetInterlockedHshkTrigAssertedLvl + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @interlocked_asserted_lvl.deleter + def interlocked_asserted_lvl(self): + cfunc = lib_importer.windll.DAQmxResetInterlockedHshkTrigAssertedLvl + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def interlocked_src(self): + """ + str: Specifies the source terminal of the Handshake Trigger. + """ + cfunc = lib_importer.windll.DAQmxGetInterlockedHshkTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @interlocked_src.setter + def interlocked_src(self, val): + cfunc = lib_importer.windll.DAQmxSetInterlockedHshkTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @interlocked_src.deleter + def interlocked_src(self): + cfunc = lib_importer.windll.DAQmxResetInterlockedHshkTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def trig_type(self): + """ + :class:`nidaqmx.constants.TriggerType`: Specifies the type of + Handshake Trigger to use. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetHshkTrigType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return TriggerType(val.value) + + @trig_type.setter + def trig_type(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetHshkTrigType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @trig_type.deleter + def trig_type(self): + cfunc = lib_importer.windll.DAQmxResetHshkTrigType + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + diff --git a/nidaqmx/_task_modules/triggering/pause_trigger.py b/nidaqmx/_task_modules/triggering/pause_trigger.py new file mode 100644 index 00000000..4a51914c --- /dev/null +++ b/nidaqmx/_task_modules/triggering/pause_trigger.py @@ -0,0 +1,1400 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import ctypes +import numpy + +from nidaqmx._lib import lib_importer, wrapped_ndpointer, ctypes_byte_str +from nidaqmx.system.physical_channel import PhysicalChannel +from nidaqmx.errors import ( + check_for_error, is_string_buffer_too_small, is_array_buffer_too_small) +from nidaqmx.constants import ( + ActiveLevel, Coupling, DigitalPatternCondition, Level, TriggerType, + WindowTriggerCondition2) + + +class PauseTrigger(object): + """ + Represents the pause trigger configurations for a DAQmx task. + """ + def __init__(self, task_handle): + self._handle = task_handle + + @property + def anlg_lvl_coupling(self): + """ + :class:`nidaqmx.constants.Coupling`: Specifies the coupling for + the source signal of the trigger if the source is a terminal + rather than a virtual channel. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAnlgLvlPauseTrigCoupling + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return Coupling(val.value) + + @anlg_lvl_coupling.setter + def anlg_lvl_coupling(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAnlgLvlPauseTrigCoupling + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_lvl_coupling.deleter + def anlg_lvl_coupling(self): + cfunc = lib_importer.windll.DAQmxResetAnlgLvlPauseTrigCoupling + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_lvl_dig_fltr_enable(self): + """ + bool: Specifies whether to apply a digital filter to the digital + output of the analog triggering circuitry (the Analog + Comparison Event). When enabled, the analog signal must stay + above or below the trigger level for the minimum pulse width + before being recognized. Use filtering for noisy trigger + signals that transition in and out of the hysteresis window + rapidly. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetAnlgLvlPauseTrigDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @anlg_lvl_dig_fltr_enable.setter + def anlg_lvl_dig_fltr_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetAnlgLvlPauseTrigDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_bool] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_lvl_dig_fltr_enable.deleter + def anlg_lvl_dig_fltr_enable(self): + cfunc = lib_importer.windll.DAQmxResetAnlgLvlPauseTrigDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_lvl_dig_fltr_min_pulse_width(self): + """ + float: Specifies in seconds the minimum pulse width the filter + recognizes. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetAnlgLvlPauseTrigDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @anlg_lvl_dig_fltr_min_pulse_width.setter + def anlg_lvl_dig_fltr_min_pulse_width(self, val): + cfunc = (lib_importer.windll. + DAQmxSetAnlgLvlPauseTrigDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_lvl_dig_fltr_min_pulse_width.deleter + def anlg_lvl_dig_fltr_min_pulse_width(self): + cfunc = (lib_importer.windll. + DAQmxResetAnlgLvlPauseTrigDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_lvl_dig_fltr_timebase_rate(self): + """ + float: Specifies in hertz the rate of the digital filter + timebase. NI-DAQmx uses this value to compute settings for + the filter. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetAnlgLvlPauseTrigDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @anlg_lvl_dig_fltr_timebase_rate.setter + def anlg_lvl_dig_fltr_timebase_rate(self, val): + cfunc = (lib_importer.windll. + DAQmxSetAnlgLvlPauseTrigDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_lvl_dig_fltr_timebase_rate.deleter + def anlg_lvl_dig_fltr_timebase_rate(self): + cfunc = (lib_importer.windll. + DAQmxResetAnlgLvlPauseTrigDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_lvl_dig_fltr_timebase_src(self): + """ + str: Specifies the terminal of the signal to use as the timebase + of the digital filter. + """ + cfunc = (lib_importer.windll. + DAQmxGetAnlgLvlPauseTrigDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @anlg_lvl_dig_fltr_timebase_src.setter + def anlg_lvl_dig_fltr_timebase_src(self, val): + cfunc = (lib_importer.windll. + DAQmxSetAnlgLvlPauseTrigDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_lvl_dig_fltr_timebase_src.deleter + def anlg_lvl_dig_fltr_timebase_src(self): + cfunc = (lib_importer.windll. + DAQmxResetAnlgLvlPauseTrigDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_lvl_dig_sync_enable(self): + """ + bool: Specifies whether to synchronize recognition of + transitions in the signal to the internal timebase of the + device. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetAnlgLvlPauseTrigDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @anlg_lvl_dig_sync_enable.setter + def anlg_lvl_dig_sync_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetAnlgLvlPauseTrigDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_bool] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_lvl_dig_sync_enable.deleter + def anlg_lvl_dig_sync_enable(self): + cfunc = lib_importer.windll.DAQmxResetAnlgLvlPauseTrigDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_lvl_hyst(self): + """ + float: Specifies a hysteresis level in the units of the + measurement or generation. If **anlg_lvl_when** is + **ActiveLevel.ABOVE**, the trigger does not deassert until + the source signal passes below **anlg_lvl_lvl** minus the + hysteresis. If **anlg_lvl_when** is **ActiveLevel.BELOW**, + the trigger does not deassert until the source signal passes + above **anlg_lvl_lvl** plus the hysteresis. Hysteresis is + always enabled. Set this property to a non-zero value to use + hysteresis. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAnlgLvlPauseTrigHyst + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @anlg_lvl_hyst.setter + def anlg_lvl_hyst(self, val): + cfunc = lib_importer.windll.DAQmxSetAnlgLvlPauseTrigHyst + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_lvl_hyst.deleter + def anlg_lvl_hyst(self): + cfunc = lib_importer.windll.DAQmxResetAnlgLvlPauseTrigHyst + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_lvl_lvl(self): + """ + float: Specifies the threshold at which to pause the task. + Specify this value in the units of the measurement or + generation. Use **anlg_lvl_when** to specify whether the + task pauses above or below this threshold. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAnlgLvlPauseTrigLvl + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @anlg_lvl_lvl.setter + def anlg_lvl_lvl(self, val): + cfunc = lib_importer.windll.DAQmxSetAnlgLvlPauseTrigLvl + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_lvl_lvl.deleter + def anlg_lvl_lvl(self): + cfunc = lib_importer.windll.DAQmxResetAnlgLvlPauseTrigLvl + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_lvl_src(self): + """ + str: Specifies the name of a virtual channel or terminal where + there is an analog signal to use as the source of the + trigger. + """ + cfunc = lib_importer.windll.DAQmxGetAnlgLvlPauseTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @anlg_lvl_src.setter + def anlg_lvl_src(self, val): + cfunc = lib_importer.windll.DAQmxSetAnlgLvlPauseTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_lvl_src.deleter + def anlg_lvl_src(self): + cfunc = lib_importer.windll.DAQmxResetAnlgLvlPauseTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_lvl_when(self): + """ + :class:`nidaqmx.constants.ActiveLevel`: Specifies whether the + task pauses above or below the threshold you specify with + **anlg_lvl_lvl**. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAnlgLvlPauseTrigWhen + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return ActiveLevel(val.value) + + @anlg_lvl_when.setter + def anlg_lvl_when(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAnlgLvlPauseTrigWhen + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_lvl_when.deleter + def anlg_lvl_when(self): + cfunc = lib_importer.windll.DAQmxResetAnlgLvlPauseTrigWhen + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_win_btm(self): + """ + float: Specifies the lower limit of the window. Specify this + value in the units of the measurement or generation. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAnlgWinPauseTrigBtm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @anlg_win_btm.setter + def anlg_win_btm(self, val): + cfunc = lib_importer.windll.DAQmxSetAnlgWinPauseTrigBtm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_win_btm.deleter + def anlg_win_btm(self): + cfunc = lib_importer.windll.DAQmxResetAnlgWinPauseTrigBtm + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_win_coupling(self): + """ + :class:`nidaqmx.constants.Coupling`: Specifies the coupling for + the source signal of the terminal if the source is a + terminal rather than a virtual channel. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAnlgWinPauseTrigCoupling + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return Coupling(val.value) + + @anlg_win_coupling.setter + def anlg_win_coupling(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAnlgWinPauseTrigCoupling + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_win_coupling.deleter + def anlg_win_coupling(self): + cfunc = lib_importer.windll.DAQmxResetAnlgWinPauseTrigCoupling + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_win_dig_fltr_enable(self): + """ + bool: Specifies whether to apply a digital filter to the digital + output of the analog triggering circuitry (the Analog + Comparison Event). When enabled, the analog signal must stay + within the trigger window for the minimum pulse width before + being recognized. Use filtering for noisy trigger signals + that transition in and out of the window rapidly. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetAnlgWinPauseTrigDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @anlg_win_dig_fltr_enable.setter + def anlg_win_dig_fltr_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetAnlgWinPauseTrigDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_bool] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_win_dig_fltr_enable.deleter + def anlg_win_dig_fltr_enable(self): + cfunc = lib_importer.windll.DAQmxResetAnlgWinPauseTrigDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_win_dig_fltr_min_pulse_width(self): + """ + float: Specifies in seconds the minimum pulse width the filter + recognizes. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetAnlgWinPauseTrigDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @anlg_win_dig_fltr_min_pulse_width.setter + def anlg_win_dig_fltr_min_pulse_width(self, val): + cfunc = (lib_importer.windll. + DAQmxSetAnlgWinPauseTrigDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_win_dig_fltr_min_pulse_width.deleter + def anlg_win_dig_fltr_min_pulse_width(self): + cfunc = (lib_importer.windll. + DAQmxResetAnlgWinPauseTrigDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_win_dig_fltr_timebase_rate(self): + """ + float: Specifies in hertz the rate of the digital filter + timebase. NI-DAQmx uses this value to compute settings for + the filter. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetAnlgWinPauseTrigDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @anlg_win_dig_fltr_timebase_rate.setter + def anlg_win_dig_fltr_timebase_rate(self, val): + cfunc = (lib_importer.windll. + DAQmxSetAnlgWinPauseTrigDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_win_dig_fltr_timebase_rate.deleter + def anlg_win_dig_fltr_timebase_rate(self): + cfunc = (lib_importer.windll. + DAQmxResetAnlgWinPauseTrigDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_win_dig_fltr_timebase_src(self): + """ + str: Specifies the terminal of the signal to use as the timebase + of the digital filter. + """ + cfunc = (lib_importer.windll. + DAQmxGetAnlgWinPauseTrigDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @anlg_win_dig_fltr_timebase_src.setter + def anlg_win_dig_fltr_timebase_src(self, val): + cfunc = (lib_importer.windll. + DAQmxSetAnlgWinPauseTrigDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_win_dig_fltr_timebase_src.deleter + def anlg_win_dig_fltr_timebase_src(self): + cfunc = (lib_importer.windll. + DAQmxResetAnlgWinPauseTrigDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_win_dig_sync_enable(self): + """ + bool: Specifies whether to synchronize recognition of + transitions in the signal to the internal timebase of the + device. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetAnlgWinPauseTrigDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @anlg_win_dig_sync_enable.setter + def anlg_win_dig_sync_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetAnlgWinPauseTrigDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_bool] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_win_dig_sync_enable.deleter + def anlg_win_dig_sync_enable(self): + cfunc = lib_importer.windll.DAQmxResetAnlgWinPauseTrigDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_win_src(self): + """ + str: Specifies the name of a virtual channel or terminal where + there is an analog signal to use as the source of the + trigger. + """ + cfunc = lib_importer.windll.DAQmxGetAnlgWinPauseTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @anlg_win_src.setter + def anlg_win_src(self, val): + cfunc = lib_importer.windll.DAQmxSetAnlgWinPauseTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_win_src.deleter + def anlg_win_src(self): + cfunc = lib_importer.windll.DAQmxResetAnlgWinPauseTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_win_top(self): + """ + float: Specifies the upper limit of the window. Specify this + value in the units of the measurement or generation. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAnlgWinPauseTrigTop + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @anlg_win_top.setter + def anlg_win_top(self, val): + cfunc = lib_importer.windll.DAQmxSetAnlgWinPauseTrigTop + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_win_top.deleter + def anlg_win_top(self): + cfunc = lib_importer.windll.DAQmxResetAnlgWinPauseTrigTop + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_win_when(self): + """ + :class:`nidaqmx.constants.WindowTriggerCondition2`: Specifies + whether the task pauses while the trigger signal is inside + or outside the window you specify with **anlg_win_btm** and + **anlg_win_top**. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAnlgWinPauseTrigWhen + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return WindowTriggerCondition2(val.value) + + @anlg_win_when.setter + def anlg_win_when(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAnlgWinPauseTrigWhen + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_win_when.deleter + def anlg_win_when(self): + cfunc = lib_importer.windll.DAQmxResetAnlgWinPauseTrigWhen + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def dig_lvl_dig_fltr_enable(self): + """ + bool: Specifies whether to apply a digital filter to the trigger + signal. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetDigLvlPauseTrigDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @dig_lvl_dig_fltr_enable.setter + def dig_lvl_dig_fltr_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetDigLvlPauseTrigDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_bool] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @dig_lvl_dig_fltr_enable.deleter + def dig_lvl_dig_fltr_enable(self): + cfunc = lib_importer.windll.DAQmxResetDigLvlPauseTrigDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def dig_lvl_dig_fltr_min_pulse_width(self): + """ + float: Specifies in seconds the minimum pulse width the filter + recognizes. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetDigLvlPauseTrigDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @dig_lvl_dig_fltr_min_pulse_width.setter + def dig_lvl_dig_fltr_min_pulse_width(self, val): + cfunc = (lib_importer.windll. + DAQmxSetDigLvlPauseTrigDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @dig_lvl_dig_fltr_min_pulse_width.deleter + def dig_lvl_dig_fltr_min_pulse_width(self): + cfunc = (lib_importer.windll. + DAQmxResetDigLvlPauseTrigDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def dig_lvl_dig_fltr_timebase_rate(self): + """ + float: Specifies in hertz the rate of the pulse width filter + timebase. NI-DAQmx uses this value to compute settings for + the filter. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetDigLvlPauseTrigDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @dig_lvl_dig_fltr_timebase_rate.setter + def dig_lvl_dig_fltr_timebase_rate(self, val): + cfunc = (lib_importer.windll. + DAQmxSetDigLvlPauseTrigDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @dig_lvl_dig_fltr_timebase_rate.deleter + def dig_lvl_dig_fltr_timebase_rate(self): + cfunc = (lib_importer.windll. + DAQmxResetDigLvlPauseTrigDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def dig_lvl_dig_fltr_timebase_src(self): + """ + str: Specifies the input terminal of the signal to use as the + timebase of the pulse width filter. + """ + cfunc = (lib_importer.windll. + DAQmxGetDigLvlPauseTrigDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @dig_lvl_dig_fltr_timebase_src.setter + def dig_lvl_dig_fltr_timebase_src(self, val): + cfunc = (lib_importer.windll. + DAQmxSetDigLvlPauseTrigDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @dig_lvl_dig_fltr_timebase_src.deleter + def dig_lvl_dig_fltr_timebase_src(self): + cfunc = (lib_importer.windll. + DAQmxResetDigLvlPauseTrigDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def dig_lvl_dig_sync_enable(self): + """ + bool: Specifies whether to synchronize recognition of + transitions in the signal to the internal timebase of the + device. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetDigLvlPauseTrigDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @dig_lvl_dig_sync_enable.setter + def dig_lvl_dig_sync_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetDigLvlPauseTrigDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_bool] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @dig_lvl_dig_sync_enable.deleter + def dig_lvl_dig_sync_enable(self): + cfunc = lib_importer.windll.DAQmxResetDigLvlPauseTrigDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def dig_lvl_src(self): + """ + str: Specifies the name of a terminal where there is a digital + signal to use as the source of the Pause Trigger. + """ + cfunc = lib_importer.windll.DAQmxGetDigLvlPauseTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @dig_lvl_src.setter + def dig_lvl_src(self, val): + cfunc = lib_importer.windll.DAQmxSetDigLvlPauseTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @dig_lvl_src.deleter + def dig_lvl_src(self): + cfunc = lib_importer.windll.DAQmxResetDigLvlPauseTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def dig_lvl_when(self): + """ + :class:`nidaqmx.constants.Level`: Specifies whether the task + pauses while the signal is high or low. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetDigLvlPauseTrigWhen + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return Level(val.value) + + @dig_lvl_when.setter + def dig_lvl_when(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetDigLvlPauseTrigWhen + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @dig_lvl_when.deleter + def dig_lvl_when(self): + cfunc = lib_importer.windll.DAQmxResetDigLvlPauseTrigWhen + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def dig_pattern_pattern(self): + """ + str: Specifies the digital pattern that must be met for the + Pause Trigger to occur. + """ + cfunc = lib_importer.windll.DAQmxGetDigPatternPauseTrigPattern + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @dig_pattern_pattern.setter + def dig_pattern_pattern(self, val): + cfunc = lib_importer.windll.DAQmxSetDigPatternPauseTrigPattern + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @dig_pattern_pattern.deleter + def dig_pattern_pattern(self): + cfunc = lib_importer.windll.DAQmxResetDigPatternPauseTrigPattern + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def dig_pattern_src(self): + """ + :class:`nidaqmx.system.physical_channel.PhysicalChannel`: + Specifies the physical channels to use for pattern matching. + The order of the physical channels determines the order of + the pattern. If a port is included, the lines within the + port are in ascending order. + """ + cfunc = lib_importer.windll.DAQmxGetDigPatternPauseTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return PhysicalChannel(val.value.decode('ascii')) + + @dig_pattern_src.setter + def dig_pattern_src(self, val): + val = val.name + cfunc = lib_importer.windll.DAQmxSetDigPatternPauseTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @dig_pattern_src.deleter + def dig_pattern_src(self): + cfunc = lib_importer.windll.DAQmxResetDigPatternPauseTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def dig_pattern_when(self): + """ + :class:`nidaqmx.constants.DigitalPatternCondition`: Specifies if + the Pause Trigger occurs when the physical channels + specified with **dig_pattern_src** match or differ from the + digital pattern specified with **dig_pattern_pattern**. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetDigPatternPauseTrigWhen + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return DigitalPatternCondition(val.value) + + @dig_pattern_when.setter + def dig_pattern_when(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetDigPatternPauseTrigWhen + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @dig_pattern_when.deleter + def dig_pattern_when(self): + cfunc = lib_importer.windll.DAQmxResetDigPatternPauseTrigWhen + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def term(self): + """ + str: Indicates the name of the internal Pause Trigger terminal + for the task. This property does not return the name of the + trigger source terminal. + """ + cfunc = lib_importer.windll.DAQmxGetPauseTrigTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @property + def trig_type(self): + """ + :class:`nidaqmx.constants.TriggerType`: Specifies the type of + trigger to use to pause a task. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetPauseTrigType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return TriggerType(val.value) + + @trig_type.setter + def trig_type(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetPauseTrigType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @trig_type.deleter + def trig_type(self): + cfunc = lib_importer.windll.DAQmxResetPauseTrigType + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + diff --git a/nidaqmx/_task_modules/triggering/reference_trigger.py b/nidaqmx/_task_modules/triggering/reference_trigger.py new file mode 100644 index 00000000..ebe18b33 --- /dev/null +++ b/nidaqmx/_task_modules/triggering/reference_trigger.py @@ -0,0 +1,1701 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import ctypes +import numpy + +from nidaqmx._lib import lib_importer, wrapped_ndpointer, ctypes_byte_str +from nidaqmx.system.physical_channel import PhysicalChannel +from nidaqmx.errors import ( + check_for_error, is_string_buffer_too_small, is_array_buffer_too_small) +from nidaqmx.constants import ( + Coupling, DigitalPatternCondition, Edge, Slope, TriggerType, + WindowTriggerCondition1) + + +class ReferenceTrigger(object): + """ + Represents the reference trigger configurations for a DAQmx task. + """ + def __init__(self, task_handle): + self._handle = task_handle + + @property + def anlg_edge_coupling(self): + """ + :class:`nidaqmx.constants.Coupling`: Specifies the coupling for + the source signal of the trigger if the source is a terminal + rather than a virtual channel. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAnlgEdgeRefTrigCoupling + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return Coupling(val.value) + + @anlg_edge_coupling.setter + def anlg_edge_coupling(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAnlgEdgeRefTrigCoupling + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_edge_coupling.deleter + def anlg_edge_coupling(self): + cfunc = lib_importer.windll.DAQmxResetAnlgEdgeRefTrigCoupling + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_edge_dig_fltr_enable(self): + """ + bool: Specifies whether to apply a digital filter to the digital + output of the analog triggering circuitry (the Analog + Comparison Event). When enabled, the analog signal must stay + above or below the trigger level for the minimum pulse width + before being recognized. Use filtering for noisy trigger + signals that transition in and out of the hysteresis window + rapidly. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetAnlgEdgeRefTrigDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @anlg_edge_dig_fltr_enable.setter + def anlg_edge_dig_fltr_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetAnlgEdgeRefTrigDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_bool] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_edge_dig_fltr_enable.deleter + def anlg_edge_dig_fltr_enable(self): + cfunc = lib_importer.windll.DAQmxResetAnlgEdgeRefTrigDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_edge_dig_fltr_min_pulse_width(self): + """ + float: Specifies in seconds the minimum pulse width thefilter + recognizes. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetAnlgEdgeRefTrigDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @anlg_edge_dig_fltr_min_pulse_width.setter + def anlg_edge_dig_fltr_min_pulse_width(self, val): + cfunc = (lib_importer.windll. + DAQmxSetAnlgEdgeRefTrigDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_edge_dig_fltr_min_pulse_width.deleter + def anlg_edge_dig_fltr_min_pulse_width(self): + cfunc = (lib_importer.windll. + DAQmxResetAnlgEdgeRefTrigDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_edge_dig_fltr_timebase_rate(self): + """ + float: Specifies in hertz the rate of the digital filter + timebase. NI-DAQmx uses this value to compute settings for + the filter. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetAnlgEdgeRefTrigDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @anlg_edge_dig_fltr_timebase_rate.setter + def anlg_edge_dig_fltr_timebase_rate(self, val): + cfunc = (lib_importer.windll. + DAQmxSetAnlgEdgeRefTrigDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_edge_dig_fltr_timebase_rate.deleter + def anlg_edge_dig_fltr_timebase_rate(self): + cfunc = (lib_importer.windll. + DAQmxResetAnlgEdgeRefTrigDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_edge_dig_fltr_timebase_src(self): + """ + str: Specifies the terminal of the signal to use as the timebase + of the digital filter. + """ + cfunc = (lib_importer.windll. + DAQmxGetAnlgEdgeRefTrigDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @anlg_edge_dig_fltr_timebase_src.setter + def anlg_edge_dig_fltr_timebase_src(self, val): + cfunc = (lib_importer.windll. + DAQmxSetAnlgEdgeRefTrigDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_edge_dig_fltr_timebase_src.deleter + def anlg_edge_dig_fltr_timebase_src(self): + cfunc = (lib_importer.windll. + DAQmxResetAnlgEdgeRefTrigDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_edge_dig_sync_enable(self): + """ + bool: Specifies whether to synchronize recognition of + transitions in the signal to the internal timebase of the + device. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetAnlgEdgeRefTrigDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @anlg_edge_dig_sync_enable.setter + def anlg_edge_dig_sync_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetAnlgEdgeRefTrigDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_bool] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_edge_dig_sync_enable.deleter + def anlg_edge_dig_sync_enable(self): + cfunc = lib_importer.windll.DAQmxResetAnlgEdgeRefTrigDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_edge_hyst(self): + """ + float: Specifies a hysteresis level in the units of the + measurement. If **anlg_edge_slope** is **Slope1.RISING**, + the trigger does not deassert until the source signal passes + below **anlg_edge_lvl** minus the hysteresis. If + **anlg_edge_slope** is **Slope1.FALLING**, the trigger does + not deassert until the source signal passes above + **anlg_edge_lvl** plus the hysteresis. Hysteresis is always + enabled. Set this property to a non-zero value to use + hysteresis. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAnlgEdgeRefTrigHyst + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @anlg_edge_hyst.setter + def anlg_edge_hyst(self, val): + cfunc = lib_importer.windll.DAQmxSetAnlgEdgeRefTrigHyst + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_edge_hyst.deleter + def anlg_edge_hyst(self): + cfunc = lib_importer.windll.DAQmxResetAnlgEdgeRefTrigHyst + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_edge_lvl(self): + """ + float: Specifies in the units of the measurement the threshold + at which the Reference Trigger occurs. Use + **anlg_edge_slope** to specify on which slope to trigger at + this threshold. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAnlgEdgeRefTrigLvl + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @anlg_edge_lvl.setter + def anlg_edge_lvl(self, val): + cfunc = lib_importer.windll.DAQmxSetAnlgEdgeRefTrigLvl + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_edge_lvl.deleter + def anlg_edge_lvl(self): + cfunc = lib_importer.windll.DAQmxResetAnlgEdgeRefTrigLvl + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_edge_slope(self): + """ + :class:`nidaqmx.constants.Slope`: Specifies on which slope of + the source signal the Reference Trigger occurs. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAnlgEdgeRefTrigSlope + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return Slope(val.value) + + @anlg_edge_slope.setter + def anlg_edge_slope(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAnlgEdgeRefTrigSlope + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_edge_slope.deleter + def anlg_edge_slope(self): + cfunc = lib_importer.windll.DAQmxResetAnlgEdgeRefTrigSlope + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_edge_src(self): + """ + str: Specifies the name of a virtual channel or terminal where + there is an analog signal to use as the source of the + Reference Trigger. + """ + cfunc = lib_importer.windll.DAQmxGetAnlgEdgeRefTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @anlg_edge_src.setter + def anlg_edge_src(self, val): + cfunc = lib_importer.windll.DAQmxSetAnlgEdgeRefTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_edge_src.deleter + def anlg_edge_src(self): + cfunc = lib_importer.windll.DAQmxResetAnlgEdgeRefTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_win_btm(self): + """ + float: Specifies the lower limit of the window. Specify this + value in the units of the measurement. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAnlgWinRefTrigBtm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @anlg_win_btm.setter + def anlg_win_btm(self, val): + cfunc = lib_importer.windll.DAQmxSetAnlgWinRefTrigBtm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_win_btm.deleter + def anlg_win_btm(self): + cfunc = lib_importer.windll.DAQmxResetAnlgWinRefTrigBtm + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_win_coupling(self): + """ + :class:`nidaqmx.constants.Coupling`: Specifies the coupling for + the source signal of the trigger if the source is a terminal + rather than a virtual channel. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAnlgWinRefTrigCoupling + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return Coupling(val.value) + + @anlg_win_coupling.setter + def anlg_win_coupling(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAnlgWinRefTrigCoupling + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_win_coupling.deleter + def anlg_win_coupling(self): + cfunc = lib_importer.windll.DAQmxResetAnlgWinRefTrigCoupling + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_win_dig_fltr_enable(self): + """ + bool: Specifies whether to apply a digital filter to the digital + output of the analog triggering circuitry (the Analog + Comparison Event). When enabled, the analog signal must stay + within the trigger window for the minimum pulse width before + being recognized. Use filtering for noisy trigger signals + that transition in and out of the window rapidly. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetAnlgWinRefTrigDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @anlg_win_dig_fltr_enable.setter + def anlg_win_dig_fltr_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetAnlgWinRefTrigDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_bool] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_win_dig_fltr_enable.deleter + def anlg_win_dig_fltr_enable(self): + cfunc = lib_importer.windll.DAQmxResetAnlgWinRefTrigDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_win_dig_fltr_min_pulse_width(self): + """ + float: Specifies in seconds the minimum pulse width the filter + recognizes. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetAnlgWinRefTrigDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @anlg_win_dig_fltr_min_pulse_width.setter + def anlg_win_dig_fltr_min_pulse_width(self, val): + cfunc = (lib_importer.windll. + DAQmxSetAnlgWinRefTrigDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_win_dig_fltr_min_pulse_width.deleter + def anlg_win_dig_fltr_min_pulse_width(self): + cfunc = (lib_importer.windll. + DAQmxResetAnlgWinRefTrigDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_win_dig_fltr_timebase_rate(self): + """ + float: Specifies in hertz the rate of the digital filter + timebase. NI-DAQmx uses this value to compute settings for + the filter. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetAnlgWinRefTrigDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @anlg_win_dig_fltr_timebase_rate.setter + def anlg_win_dig_fltr_timebase_rate(self, val): + cfunc = (lib_importer.windll. + DAQmxSetAnlgWinRefTrigDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_win_dig_fltr_timebase_rate.deleter + def anlg_win_dig_fltr_timebase_rate(self): + cfunc = (lib_importer.windll. + DAQmxResetAnlgWinRefTrigDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_win_dig_fltr_timebase_src(self): + """ + str: Specifies the terminal of the signal to use as the timebase + of the digital filter. + """ + cfunc = lib_importer.windll.DAQmxGetAnlgWinRefTrigDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @anlg_win_dig_fltr_timebase_src.setter + def anlg_win_dig_fltr_timebase_src(self, val): + cfunc = lib_importer.windll.DAQmxSetAnlgWinRefTrigDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_win_dig_fltr_timebase_src.deleter + def anlg_win_dig_fltr_timebase_src(self): + cfunc = lib_importer.windll.DAQmxResetAnlgWinRefTrigDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_win_dig_sync_enable(self): + """ + bool: Specifies whether to synchronize recognition of + transitions in the signal to the internal timebase of the + device. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetAnlgWinRefTrigDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @anlg_win_dig_sync_enable.setter + def anlg_win_dig_sync_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetAnlgWinRefTrigDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_bool] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_win_dig_sync_enable.deleter + def anlg_win_dig_sync_enable(self): + cfunc = lib_importer.windll.DAQmxResetAnlgWinRefTrigDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_win_src(self): + """ + str: Specifies the name of a virtual channel or terminal where + there is an analog signal to use as the source of the + Reference Trigger. + """ + cfunc = lib_importer.windll.DAQmxGetAnlgWinRefTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @anlg_win_src.setter + def anlg_win_src(self, val): + cfunc = lib_importer.windll.DAQmxSetAnlgWinRefTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_win_src.deleter + def anlg_win_src(self): + cfunc = lib_importer.windll.DAQmxResetAnlgWinRefTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_win_top(self): + """ + float: Specifies the upper limit of the window. Specify this + value in the units of the measurement. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAnlgWinRefTrigTop + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @anlg_win_top.setter + def anlg_win_top(self, val): + cfunc = lib_importer.windll.DAQmxSetAnlgWinRefTrigTop + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_win_top.deleter + def anlg_win_top(self): + cfunc = lib_importer.windll.DAQmxResetAnlgWinRefTrigTop + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_win_trig_when(self): + """ + :class:`nidaqmx.constants.WindowTriggerCondition1`: Specifies + whether the Reference Trigger occurs when the source signal + enters the window or when it leaves the window. Use + **anlg_win_btm** and **anlg_win_top** to specify the window. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAnlgWinRefTrigTrigWhen + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return WindowTriggerCondition1(val.value) + + @anlg_win_trig_when.setter + def anlg_win_trig_when(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAnlgWinRefTrigTrigWhen + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_win_trig_when.deleter + def anlg_win_trig_when(self): + cfunc = lib_importer.windll.DAQmxResetAnlgWinRefTrigTrigWhen + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def auto_trig_enable(self): + """ + bool: Specifies whether to send a software trigger to the device + when a hardware trigger is no longer active in order to + prevent a timeout. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetRefTrigAutoTrigEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @auto_trig_enable.setter + def auto_trig_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetRefTrigAutoTrigEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_bool] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @auto_trig_enable.deleter + def auto_trig_enable(self): + cfunc = lib_importer.windll.DAQmxResetRefTrigAutoTrigEnable + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def auto_triggered(self): + """ + bool: Indicates whether a completed acquisition was triggered by + the auto trigger. If an acquisition has not completed after + the task starts, this property returns False. This property + is only applicable when **auto_trig_enable** is True. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetRefTrigAutoTriggered + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def delay(self): + """ + float: Specifies in seconds the time to wait after the device + receives the Reference Trigger before switching from + pretrigger to posttrigger samples. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetRefTrigDelay + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @delay.setter + def delay(self, val): + cfunc = lib_importer.windll.DAQmxSetRefTrigDelay + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @delay.deleter + def delay(self): + cfunc = lib_importer.windll.DAQmxResetRefTrigDelay + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def dig_edge_dig_fltr_enable(self): + """ + bool: Specifies whether to apply a digital filter to the trigger + signal. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetDigEdgeRefTrigDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @dig_edge_dig_fltr_enable.setter + def dig_edge_dig_fltr_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetDigEdgeRefTrigDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_bool] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @dig_edge_dig_fltr_enable.deleter + def dig_edge_dig_fltr_enable(self): + cfunc = lib_importer.windll.DAQmxResetDigEdgeRefTrigDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def dig_edge_dig_fltr_min_pulse_width(self): + """ + float: Specifies in seconds the minimum pulse width the filter + recognizes. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetDigEdgeRefTrigDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @dig_edge_dig_fltr_min_pulse_width.setter + def dig_edge_dig_fltr_min_pulse_width(self, val): + cfunc = (lib_importer.windll. + DAQmxSetDigEdgeRefTrigDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @dig_edge_dig_fltr_min_pulse_width.deleter + def dig_edge_dig_fltr_min_pulse_width(self): + cfunc = (lib_importer.windll. + DAQmxResetDigEdgeRefTrigDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def dig_edge_dig_fltr_timebase_rate(self): + """ + float: Specifies in hertz the rate of the digital filter + timebase. NI-DAQmx uses this value to compute settings for + the filter. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetDigEdgeRefTrigDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @dig_edge_dig_fltr_timebase_rate.setter + def dig_edge_dig_fltr_timebase_rate(self, val): + cfunc = (lib_importer.windll. + DAQmxSetDigEdgeRefTrigDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @dig_edge_dig_fltr_timebase_rate.deleter + def dig_edge_dig_fltr_timebase_rate(self): + cfunc = (lib_importer.windll. + DAQmxResetDigEdgeRefTrigDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def dig_edge_dig_fltr_timebase_src(self): + """ + str: Specifies the terminal of the signal to use as the timebase + of the digital filter. + """ + cfunc = lib_importer.windll.DAQmxGetDigEdgeRefTrigDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @dig_edge_dig_fltr_timebase_src.setter + def dig_edge_dig_fltr_timebase_src(self, val): + cfunc = lib_importer.windll.DAQmxSetDigEdgeRefTrigDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @dig_edge_dig_fltr_timebase_src.deleter + def dig_edge_dig_fltr_timebase_src(self): + cfunc = lib_importer.windll.DAQmxResetDigEdgeRefTrigDigFltrTimebaseSrc + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def dig_edge_dig_sync_enable(self): + """ + bool: Specifies whether to synchronize recognition of + transitions in the signal to the internal timebase of the + device. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetDigEdgeRefTrigDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @dig_edge_dig_sync_enable.setter + def dig_edge_dig_sync_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetDigEdgeRefTrigDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_bool] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @dig_edge_dig_sync_enable.deleter + def dig_edge_dig_sync_enable(self): + cfunc = lib_importer.windll.DAQmxResetDigEdgeRefTrigDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def dig_edge_edge(self): + """ + :class:`nidaqmx.constants.Edge`: Specifies on what edge of a + digital pulse the Reference Trigger occurs. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetDigEdgeRefTrigEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return Edge(val.value) + + @dig_edge_edge.setter + def dig_edge_edge(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetDigEdgeRefTrigEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @dig_edge_edge.deleter + def dig_edge_edge(self): + cfunc = lib_importer.windll.DAQmxResetDigEdgeRefTrigEdge + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def dig_edge_src(self): + """ + str: Specifies the name of a terminal where there is a digital + signal to use as the source of the Reference Trigger. + """ + cfunc = lib_importer.windll.DAQmxGetDigEdgeRefTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @dig_edge_src.setter + def dig_edge_src(self, val): + cfunc = lib_importer.windll.DAQmxSetDigEdgeRefTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @dig_edge_src.deleter + def dig_edge_src(self): + cfunc = lib_importer.windll.DAQmxResetDigEdgeRefTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def dig_pattern_pattern(self): + """ + str: Specifies the digital pattern that must be met for the + Reference Trigger to occur. + """ + cfunc = lib_importer.windll.DAQmxGetDigPatternRefTrigPattern + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @dig_pattern_pattern.setter + def dig_pattern_pattern(self, val): + cfunc = lib_importer.windll.DAQmxSetDigPatternRefTrigPattern + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @dig_pattern_pattern.deleter + def dig_pattern_pattern(self): + cfunc = lib_importer.windll.DAQmxResetDigPatternRefTrigPattern + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def dig_pattern_src(self): + """ + :class:`nidaqmx.system.physical_channel.PhysicalChannel`: + Specifies the physical channels to use for pattern matching. + The order of the physical channels determines the order of + the pattern. If a port is included, the order of the + physical channels within the port is in ascending order. + """ + cfunc = lib_importer.windll.DAQmxGetDigPatternRefTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return PhysicalChannel(val.value.decode('ascii')) + + @dig_pattern_src.setter + def dig_pattern_src(self, val): + val = val.name + cfunc = lib_importer.windll.DAQmxSetDigPatternRefTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @dig_pattern_src.deleter + def dig_pattern_src(self): + cfunc = lib_importer.windll.DAQmxResetDigPatternRefTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def dig_pattern_trig_when(self): + """ + :class:`nidaqmx.constants.DigitalPatternCondition`: Specifies + whether the Reference Trigger occurs when the physical + channels specified with **dig_pattern_src** match or differ + from the digital pattern specified with + **dig_pattern_pattern**. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetDigPatternRefTrigTrigWhen + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return DigitalPatternCondition(val.value) + + @dig_pattern_trig_when.setter + def dig_pattern_trig_when(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetDigPatternRefTrigTrigWhen + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @dig_pattern_trig_when.deleter + def dig_pattern_trig_when(self): + cfunc = lib_importer.windll.DAQmxResetDigPatternRefTrigTrigWhen + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def pretrig_samples(self): + """ + int: Specifies the minimum number of pretrigger samples to + acquire from each channel before recognizing the reference + trigger. Post-trigger samples per channel are equal to + **samp_quant_samp_per_chan** minus the number of pretrigger + samples per channel. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetRefTrigPreTrigSamples + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @pretrig_samples.setter + def pretrig_samples(self, val): + cfunc = lib_importer.windll.DAQmxSetRefTrigPreTrigSamples + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_uint] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @pretrig_samples.deleter + def pretrig_samples(self): + cfunc = lib_importer.windll.DAQmxResetRefTrigPreTrigSamples + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def term(self): + """ + str: Indicates the name of the internal Reference Trigger + terminal for the task. This property does not return the + name of the trigger source terminal. + """ + cfunc = lib_importer.windll.DAQmxGetRefTrigTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @property + def trig_type(self): + """ + :class:`nidaqmx.constants.TriggerType`: Specifies the type of + trigger to use to mark a reference point for the + measurement. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetRefTrigType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return TriggerType(val.value) + + @trig_type.setter + def trig_type(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetRefTrigType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @trig_type.deleter + def trig_type(self): + cfunc = lib_importer.windll.DAQmxResetRefTrigType + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + def cfg_anlg_edge_ref_trig( + self, trigger_source, pretrigger_samples, + trigger_slope=Slope.RISING, trigger_level=0.0): + """ + Configures the task to stop the acquisition when the device + acquires all pretrigger samples; an analog signal reaches the + level you specify; and the device acquires all post-trigger + samples. When you use a Reference Trigger, the default for the + read RelativeTo property is **first_pretrigger_sample** with a + read Offset of 0. + + Args: + trigger_source (str): Is the name of a virtual channel or + terminal where there is an analog signal to use as the + source of the trigger. + pretrigger_samples (int): Specifies the minimum number of + samples to acquire per channel before recognizing the + Reference Trigger. The number of post-trigger samples + per channel is equal to **number of samples per + channel** in the DAQmx Timing function minus + **pretrigger_samples**. + trigger_slope (Optional[nidaqmx.constants.Slope]): Specifies + on which slope of the signal the Reference Trigger + occurs. + trigger_level (Optional[float]): Specifies at what threshold + to trigger. Specify this value in the units of the + measurement or generation. Use **trigger_slope** to + specify on which slope to trigger at this threshold. + """ + cfunc = lib_importer.windll.DAQmxCfgAnlgEdgeRefTrig + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int, + ctypes.c_double, ctypes.c_uint] + + error_code = cfunc( + self._handle, trigger_source, trigger_slope.value, trigger_level, + pretrigger_samples) + check_for_error(error_code) + + def cfg_anlg_window_ref_trig( + self, trigger_source, window_top, window_bottom, + pretrigger_samples, + trigger_when=WindowTriggerCondition1.ENTERING_WINDOW): + """ + Configures the task to stop the acquisition when the device + acquires all pretrigger samples; an analog signal enters or + leaves a range you specify; and the device acquires all post- + trigger samples. When you use a Reference Trigger, the default + for the read RelativeTo property is **first_pretrigger_sample** + with a read Offset of 0. + + Args: + trigger_source (str): Is the name of a virtual channel or + terminal where there is an analog signal to use as the + source of the trigger. + window_top (float): Is the upper limit of the window. + Specify this value in the units of the measurement or + generation. + window_bottom (float): Is the lower limit of the window. + Specify this value in the units of the measurement or + generation. + pretrigger_samples (int): Specifies the minimum number of + samples to acquire per channel before recognizing the + Reference Trigger. The number of post-trigger samples + per channel is equal to **number of samples per + channel** in the DAQmx Timing function minus + **pretrigger_samples**. + trigger_when (Optional[nidaqmx.constants.WindowTriggerCondition1]): + Specifies whether the Reference Trigger occurs when the + signal enters the window or when it leaves the window. + Use **window_bottom** and **window_top** to specify the + limits of the window. + """ + cfunc = lib_importer.windll.DAQmxCfgAnlgWindowRefTrig + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int, + ctypes.c_double, ctypes.c_double, ctypes.c_uint] + + error_code = cfunc( + self._handle, trigger_source, trigger_when.value, window_top, + window_bottom, pretrigger_samples) + check_for_error(error_code) + + def cfg_dig_edge_ref_trig( + self, trigger_source, pretrigger_samples, + trigger_edge=Edge.RISING): + """ + Configures the task to stop the acquisition when the device + acquires all pretrigger samples, detects a rising or falling + edge of a digital signal, and acquires all posttrigger samples. + When you use a Reference Trigger, the default for the read + RelativeTo property is **first_pretrigger_sample** with a read + Offset of 0. + + Args: + trigger_source (str): Specifies the name of a terminal where + there is a digital signal to use as the source of the + trigger. + pretrigger_samples (int): Specifies the minimum number of + samples to acquire per channel before recognizing the + Reference Trigger. The number of post-trigger samples + per channel is equal to **number of samples per + channel** in the DAQmx Timing function minus + **pretrigger_samples**. + trigger_edge (Optional[nidaqmx.constants.Edge]): Specifies + on which edge of the digital signal the Reference + Trigger occurs. + """ + cfunc = lib_importer.windll.DAQmxCfgDigEdgeRefTrig + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int, + ctypes.c_uint] + + error_code = cfunc( + self._handle, trigger_source, trigger_edge.value, + pretrigger_samples) + check_for_error(error_code) + + def cfg_dig_pattern_ref_trig( + self, trigger_source, trigger_pattern, pretrigger_samples, + trigger_when=DigitalPatternCondition.PATTERN_MATCHES): + """ + Configures the task to stop the acquisition when the device + acquires all pretrigger samples, matches a digital pattern, and + acquires all posttrigger samples. When you use a Reference + Trigger, the default for the read RelativeTo property is First + PretriggerSample with a read Offset of zero. + + Args: + trigger_source (str): Specifies the physical channels to use + for pattern matching. The order of the physical channels + determines the order of the pattern. If a port is + included, the order of the physical channels within the + port is in ascending order. + trigger_pattern (str): Specifies the digital pattern that + must be met for the trigger to occur. + pretrigger_samples (int): Specifies the minimum number of + samples to acquire per channel before recognizing the + Reference Trigger. The number of post-trigger samples + per channel is equal to **number of samples per + channel** in the DAQmx Timing function minus + **pretrigger_samples**. + trigger_when (Optional[nidaqmx.constants.DigitalPatternCondition]): + Specifies the condition under which the trigger occurs. + """ + cfunc = lib_importer.windll.DAQmxCfgDigPatternRefTrig + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_int, ctypes.c_uint] + + error_code = cfunc( + self._handle, trigger_source, trigger_pattern, trigger_when.value, + pretrigger_samples) + check_for_error(error_code) + + def disable_ref_trig(self): + """ + Disables reference triggering for the measurement. + """ + cfunc = lib_importer.windll.DAQmxDisableRefTrig + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + diff --git a/nidaqmx/_task_modules/triggering/start_trigger.py b/nidaqmx/_task_modules/triggering/start_trigger.py new file mode 100644 index 00000000..8d1444c8 --- /dev/null +++ b/nidaqmx/_task_modules/triggering/start_trigger.py @@ -0,0 +1,1647 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import ctypes +import numpy + +from nidaqmx._lib import lib_importer, wrapped_ndpointer, ctypes_byte_str +from nidaqmx.system.physical_channel import PhysicalChannel +from nidaqmx.errors import ( + check_for_error, is_string_buffer_too_small, is_array_buffer_too_small) +from nidaqmx.constants import ( + Coupling, DigitalPatternCondition, DigitalWidthUnits, Edge, Slope, + TriggerType, WindowTriggerCondition1) + + +class StartTrigger(object): + """ + Represents the start trigger configurations for a DAQmx task. + """ + def __init__(self, task_handle): + self._handle = task_handle + + @property + def anlg_edge_coupling(self): + """ + :class:`nidaqmx.constants.Coupling`: Specifies the coupling for + the source signal of the trigger if the source is a terminal + rather than a virtual channel. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAnlgEdgeStartTrigCoupling + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return Coupling(val.value) + + @anlg_edge_coupling.setter + def anlg_edge_coupling(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAnlgEdgeStartTrigCoupling + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_edge_coupling.deleter + def anlg_edge_coupling(self): + cfunc = lib_importer.windll.DAQmxResetAnlgEdgeStartTrigCoupling + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_edge_dig_fltr_enable(self): + """ + bool: Specifies whether to apply a digital filter to the digital + output of the analog triggering circuitry (the Analog + Comparison Event). When enabled, the analog signal must stay + above or below the trigger level for the minimum pulse width + before being recognized. Use filtering for noisy trigger + signals that transition in and out of the hysteresis window + rapidly. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetAnlgEdgeStartTrigDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @anlg_edge_dig_fltr_enable.setter + def anlg_edge_dig_fltr_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetAnlgEdgeStartTrigDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_bool] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_edge_dig_fltr_enable.deleter + def anlg_edge_dig_fltr_enable(self): + cfunc = lib_importer.windll.DAQmxResetAnlgEdgeStartTrigDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_edge_dig_fltr_min_pulse_width(self): + """ + float: Specifies in seconds the minimum pulse width the filter + recognizes. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetAnlgEdgeStartTrigDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @anlg_edge_dig_fltr_min_pulse_width.setter + def anlg_edge_dig_fltr_min_pulse_width(self, val): + cfunc = (lib_importer.windll. + DAQmxSetAnlgEdgeStartTrigDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_edge_dig_fltr_min_pulse_width.deleter + def anlg_edge_dig_fltr_min_pulse_width(self): + cfunc = (lib_importer.windll. + DAQmxResetAnlgEdgeStartTrigDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_edge_dig_fltr_timebase_rate(self): + """ + float: Specifies in hertz the rate of the digital filter + timebase. NI-DAQmx uses this value to compute settings for + the filter. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetAnlgEdgeStartTrigDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @anlg_edge_dig_fltr_timebase_rate.setter + def anlg_edge_dig_fltr_timebase_rate(self, val): + cfunc = (lib_importer.windll. + DAQmxSetAnlgEdgeStartTrigDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_edge_dig_fltr_timebase_rate.deleter + def anlg_edge_dig_fltr_timebase_rate(self): + cfunc = (lib_importer.windll. + DAQmxResetAnlgEdgeStartTrigDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_edge_dig_fltr_timebase_src(self): + """ + str: Specifies the terminal of the signal to use as the timebase + of the digital filter. + """ + cfunc = (lib_importer.windll. + DAQmxGetAnlgEdgeStartTrigDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @anlg_edge_dig_fltr_timebase_src.setter + def anlg_edge_dig_fltr_timebase_src(self, val): + cfunc = (lib_importer.windll. + DAQmxSetAnlgEdgeStartTrigDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_edge_dig_fltr_timebase_src.deleter + def anlg_edge_dig_fltr_timebase_src(self): + cfunc = (lib_importer.windll. + DAQmxResetAnlgEdgeStartTrigDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_edge_dig_sync_enable(self): + """ + bool: Specifies whether to synchronize recognition of + transitions in the signal to the internal timebase of the + device. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetAnlgEdgeStartTrigDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @anlg_edge_dig_sync_enable.setter + def anlg_edge_dig_sync_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetAnlgEdgeStartTrigDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_bool] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_edge_dig_sync_enable.deleter + def anlg_edge_dig_sync_enable(self): + cfunc = lib_importer.windll.DAQmxResetAnlgEdgeStartTrigDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_edge_hyst(self): + """ + float: Specifies a hysteresis level in the units of the + measurement or generation. If **anlg_edge_slope** is + **Slope1.RISING**, the trigger does not deassert until the + source signal passes below **anlg_edge_lvl** minus the + hysteresis. If **anlg_edge_slope** is **Slope1.FALLING**, + the trigger does not deassert until the source signal passes + above **anlg_edge_lvl** plus the hysteresis. Hysteresis is + always enabled. Set this property to a non-zero value to use + hysteresis. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAnlgEdgeStartTrigHyst + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @anlg_edge_hyst.setter + def anlg_edge_hyst(self, val): + cfunc = lib_importer.windll.DAQmxSetAnlgEdgeStartTrigHyst + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_edge_hyst.deleter + def anlg_edge_hyst(self): + cfunc = lib_importer.windll.DAQmxResetAnlgEdgeStartTrigHyst + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_edge_lvl(self): + """ + float: Specifies at what threshold in the units of the + measurement or generation to start acquiring or generating + samples. Use **anlg_edge_slope** to specify on which slope + to trigger on this threshold. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAnlgEdgeStartTrigLvl + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @anlg_edge_lvl.setter + def anlg_edge_lvl(self, val): + cfunc = lib_importer.windll.DAQmxSetAnlgEdgeStartTrigLvl + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_edge_lvl.deleter + def anlg_edge_lvl(self): + cfunc = lib_importer.windll.DAQmxResetAnlgEdgeStartTrigLvl + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_edge_slope(self): + """ + :class:`nidaqmx.constants.Slope`: Specifies on which slope of + the trigger signal to start acquiring or generating samples. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAnlgEdgeStartTrigSlope + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return Slope(val.value) + + @anlg_edge_slope.setter + def anlg_edge_slope(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAnlgEdgeStartTrigSlope + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_edge_slope.deleter + def anlg_edge_slope(self): + cfunc = lib_importer.windll.DAQmxResetAnlgEdgeStartTrigSlope + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_edge_src(self): + """ + str: Specifies the name of a virtual channel or terminal where + there is an analog signal to use as the source of the Start + Trigger. + """ + cfunc = lib_importer.windll.DAQmxGetAnlgEdgeStartTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @anlg_edge_src.setter + def anlg_edge_src(self, val): + cfunc = lib_importer.windll.DAQmxSetAnlgEdgeStartTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_edge_src.deleter + def anlg_edge_src(self): + cfunc = lib_importer.windll.DAQmxResetAnlgEdgeStartTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_win_btm(self): + """ + float: Specifies the lower limit of the window. Specify this + value in the units of the measurement or generation. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAnlgWinStartTrigBtm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @anlg_win_btm.setter + def anlg_win_btm(self, val): + cfunc = lib_importer.windll.DAQmxSetAnlgWinStartTrigBtm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_win_btm.deleter + def anlg_win_btm(self): + cfunc = lib_importer.windll.DAQmxResetAnlgWinStartTrigBtm + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_win_coupling(self): + """ + :class:`nidaqmx.constants.Coupling`: Specifies the coupling for + the source signal of the trigger if the source is a terminal + rather than a virtual channel. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAnlgWinStartTrigCoupling + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return Coupling(val.value) + + @anlg_win_coupling.setter + def anlg_win_coupling(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAnlgWinStartTrigCoupling + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_win_coupling.deleter + def anlg_win_coupling(self): + cfunc = lib_importer.windll.DAQmxResetAnlgWinStartTrigCoupling + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_win_dig_fltr_enable(self): + """ + bool: Specifies whether to apply a digital filter to the digital + output of the analog triggering circuitry (the Analog + Comparison Event). When enabled, the analog signal must stay + within the trigger window for the minimum pulse width before + being recognized. Use filtering for noisy trigger signals + that transition in and out of the window rapidly. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetAnlgWinStartTrigDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @anlg_win_dig_fltr_enable.setter + def anlg_win_dig_fltr_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetAnlgWinStartTrigDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_bool] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_win_dig_fltr_enable.deleter + def anlg_win_dig_fltr_enable(self): + cfunc = lib_importer.windll.DAQmxResetAnlgWinStartTrigDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_win_dig_fltr_min_pulse_width(self): + """ + float: Specifies in seconds the minimum pulse width the filter + recognizes. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetAnlgWinStartTrigDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @anlg_win_dig_fltr_min_pulse_width.setter + def anlg_win_dig_fltr_min_pulse_width(self, val): + cfunc = (lib_importer.windll. + DAQmxSetAnlgWinStartTrigDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_win_dig_fltr_min_pulse_width.deleter + def anlg_win_dig_fltr_min_pulse_width(self): + cfunc = (lib_importer.windll. + DAQmxResetAnlgWinStartTrigDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_win_dig_fltr_timebase_rate(self): + """ + float: Specifies in hertz the rate of the digital filter + timebase. NI-DAQmx uses this value to compute settings for + the filter. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetAnlgWinStartTrigDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @anlg_win_dig_fltr_timebase_rate.setter + def anlg_win_dig_fltr_timebase_rate(self, val): + cfunc = (lib_importer.windll. + DAQmxSetAnlgWinStartTrigDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_win_dig_fltr_timebase_rate.deleter + def anlg_win_dig_fltr_timebase_rate(self): + cfunc = (lib_importer.windll. + DAQmxResetAnlgWinStartTrigDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_win_dig_fltr_timebase_src(self): + """ + str: Specifies the terminal of the signal to use as the timebase + of the digital filter. + """ + cfunc = (lib_importer.windll. + DAQmxGetAnlgWinStartTrigDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @anlg_win_dig_fltr_timebase_src.setter + def anlg_win_dig_fltr_timebase_src(self, val): + cfunc = (lib_importer.windll. + DAQmxSetAnlgWinStartTrigDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_win_dig_fltr_timebase_src.deleter + def anlg_win_dig_fltr_timebase_src(self): + cfunc = (lib_importer.windll. + DAQmxResetAnlgWinStartTrigDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_win_dig_sync_enable(self): + """ + bool: Specifies whether to synchronize recognition of + transitions in the signal to the internal timebase of the + device. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetAnlgWinStartTrigDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @anlg_win_dig_sync_enable.setter + def anlg_win_dig_sync_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetAnlgWinStartTrigDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_bool] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_win_dig_sync_enable.deleter + def anlg_win_dig_sync_enable(self): + cfunc = lib_importer.windll.DAQmxResetAnlgWinStartTrigDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_win_src(self): + """ + str: Specifies the name of a virtual channel or terminal where + there is an analog signal to use as the source of the Start + Trigger. + """ + cfunc = lib_importer.windll.DAQmxGetAnlgWinStartTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @anlg_win_src.setter + def anlg_win_src(self, val): + cfunc = lib_importer.windll.DAQmxSetAnlgWinStartTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_win_src.deleter + def anlg_win_src(self): + cfunc = lib_importer.windll.DAQmxResetAnlgWinStartTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_win_top(self): + """ + float: Specifies the upper limit of the window. Specify this + value in the units of the measurement or generation. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAnlgWinStartTrigTop + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @anlg_win_top.setter + def anlg_win_top(self, val): + cfunc = lib_importer.windll.DAQmxSetAnlgWinStartTrigTop + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_win_top.deleter + def anlg_win_top(self): + cfunc = lib_importer.windll.DAQmxResetAnlgWinStartTrigTop + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def anlg_win_trig_when(self): + """ + :class:`nidaqmx.constants.WindowTriggerCondition1`: Specifies + whether the task starts acquiring or generating samples when + the signal enters or leaves the window you specify with + **anlg_win_btm** and **anlg_win_top**. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetAnlgWinStartTrigTrigWhen + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return WindowTriggerCondition1(val.value) + + @anlg_win_trig_when.setter + def anlg_win_trig_when(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetAnlgWinStartTrigTrigWhen + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @anlg_win_trig_when.deleter + def anlg_win_trig_when(self): + cfunc = lib_importer.windll.DAQmxResetAnlgWinStartTrigTrigWhen + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def delay(self): + """ + float: Specifies an amount of time to wait after the Start + Trigger is received before acquiring or generating the first + sample. This value is in the units you specify with + **delay_units**. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetStartTrigDelay + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @delay.setter + def delay(self, val): + cfunc = lib_importer.windll.DAQmxSetStartTrigDelay + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @delay.deleter + def delay(self): + cfunc = lib_importer.windll.DAQmxResetStartTrigDelay + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def delay_units(self): + """ + :class:`nidaqmx.constants.DigitalWidthUnits`: Specifies the + units of **delay**. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetStartTrigDelayUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return DigitalWidthUnits(val.value) + + @delay_units.setter + def delay_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetStartTrigDelayUnits + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @delay_units.deleter + def delay_units(self): + cfunc = lib_importer.windll.DAQmxResetStartTrigDelayUnits + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def dig_edge_dig_fltr_enable(self): + """ + bool: Specifies whether to apply a digital filter to the trigger + signal. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetDigEdgeStartTrigDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @dig_edge_dig_fltr_enable.setter + def dig_edge_dig_fltr_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetDigEdgeStartTrigDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_bool] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @dig_edge_dig_fltr_enable.deleter + def dig_edge_dig_fltr_enable(self): + cfunc = lib_importer.windll.DAQmxResetDigEdgeStartTrigDigFltrEnable + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def dig_edge_dig_fltr_min_pulse_width(self): + """ + float: Specifies in seconds the minimum pulse width the filter + recognizes. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetDigEdgeStartTrigDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @dig_edge_dig_fltr_min_pulse_width.setter + def dig_edge_dig_fltr_min_pulse_width(self, val): + cfunc = (lib_importer.windll. + DAQmxSetDigEdgeStartTrigDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @dig_edge_dig_fltr_min_pulse_width.deleter + def dig_edge_dig_fltr_min_pulse_width(self): + cfunc = (lib_importer.windll. + DAQmxResetDigEdgeStartTrigDigFltrMinPulseWidth) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def dig_edge_dig_fltr_timebase_rate(self): + """ + float: Specifies in hertz the rate of the pulse width filter + timebase. NI-DAQmx uses this value to compute settings for + the filter. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetDigEdgeStartTrigDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @dig_edge_dig_fltr_timebase_rate.setter + def dig_edge_dig_fltr_timebase_rate(self, val): + cfunc = (lib_importer.windll. + DAQmxSetDigEdgeStartTrigDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @dig_edge_dig_fltr_timebase_rate.deleter + def dig_edge_dig_fltr_timebase_rate(self): + cfunc = (lib_importer.windll. + DAQmxResetDigEdgeStartTrigDigFltrTimebaseRate) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def dig_edge_dig_fltr_timebase_src(self): + """ + str: Specifies the input terminal of the signal to use as the + timebase of the pulse width filter. + """ + cfunc = (lib_importer.windll. + DAQmxGetDigEdgeStartTrigDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @dig_edge_dig_fltr_timebase_src.setter + def dig_edge_dig_fltr_timebase_src(self, val): + cfunc = (lib_importer.windll. + DAQmxSetDigEdgeStartTrigDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @dig_edge_dig_fltr_timebase_src.deleter + def dig_edge_dig_fltr_timebase_src(self): + cfunc = (lib_importer.windll. + DAQmxResetDigEdgeStartTrigDigFltrTimebaseSrc) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def dig_edge_dig_sync_enable(self): + """ + bool: Specifies whether to synchronize recognition of + transitions in the signal to the internal timebase of the + device. If you set this property to True, the device does + not recognize and act upon the trigger until the next pulse + of the internal timebase. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetDigEdgeStartTrigDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @dig_edge_dig_sync_enable.setter + def dig_edge_dig_sync_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetDigEdgeStartTrigDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_bool] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @dig_edge_dig_sync_enable.deleter + def dig_edge_dig_sync_enable(self): + cfunc = lib_importer.windll.DAQmxResetDigEdgeStartTrigDigSyncEnable + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def dig_edge_edge(self): + """ + :class:`nidaqmx.constants.Edge`: Specifies on which edge of a + digital pulse to start acquiring or generating samples. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetDigEdgeStartTrigEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return Edge(val.value) + + @dig_edge_edge.setter + def dig_edge_edge(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetDigEdgeStartTrigEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @dig_edge_edge.deleter + def dig_edge_edge(self): + cfunc = lib_importer.windll.DAQmxResetDigEdgeStartTrigEdge + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def dig_edge_src(self): + """ + str: Specifies the name of a terminal where there is a digital + signal to use as the source of the Start Trigger. + """ + cfunc = lib_importer.windll.DAQmxGetDigEdgeStartTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @dig_edge_src.setter + def dig_edge_src(self, val): + cfunc = lib_importer.windll.DAQmxSetDigEdgeStartTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @dig_edge_src.deleter + def dig_edge_src(self): + cfunc = lib_importer.windll.DAQmxResetDigEdgeStartTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def dig_pattern_pattern(self): + """ + str: Specifies the digital pattern that must be met for the + Start Trigger to occur. + """ + cfunc = lib_importer.windll.DAQmxGetDigPatternStartTrigPattern + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @dig_pattern_pattern.setter + def dig_pattern_pattern(self, val): + cfunc = lib_importer.windll.DAQmxSetDigPatternStartTrigPattern + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @dig_pattern_pattern.deleter + def dig_pattern_pattern(self): + cfunc = lib_importer.windll.DAQmxResetDigPatternStartTrigPattern + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def dig_pattern_src(self): + """ + :class:`nidaqmx.system.physical_channel.PhysicalChannel`: + Specifies the physical channels to use for pattern matching. + The order of the physical channels determines the order of + the pattern. If a port is included, the order of the + physical channels within the port is in ascending order. + """ + cfunc = lib_importer.windll.DAQmxGetDigPatternStartTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return PhysicalChannel(val.value.decode('ascii')) + + @dig_pattern_src.setter + def dig_pattern_src(self, val): + val = val.name + cfunc = lib_importer.windll.DAQmxSetDigPatternStartTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @dig_pattern_src.deleter + def dig_pattern_src(self): + cfunc = lib_importer.windll.DAQmxResetDigPatternStartTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def dig_pattern_trig_when(self): + """ + :class:`nidaqmx.constants.DigitalPatternCondition`: Specifies + whether the Start Trigger occurs when the physical channels + specified with **dig_pattern_src** match or differ from the + digital pattern specified with **dig_pattern_pattern**. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetDigPatternStartTrigTrigWhen + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return DigitalPatternCondition(val.value) + + @dig_pattern_trig_when.setter + def dig_pattern_trig_when(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetDigPatternStartTrigTrigWhen + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @dig_pattern_trig_when.deleter + def dig_pattern_trig_when(self): + cfunc = lib_importer.windll.DAQmxResetDigPatternStartTrigTrigWhen + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def retriggerable(self): + """ + bool: Specifies whether a finite task resets and waits for + another Start Trigger after the task completes. When you set + this property to True, the device performs a finite + acquisition or generation each time the Start Trigger occurs + until the task stops. The device ignores a trigger if it is + in the process of acquiring or generating signals. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetStartTrigRetriggerable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @retriggerable.setter + def retriggerable(self, val): + cfunc = lib_importer.windll.DAQmxSetStartTrigRetriggerable + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_bool] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @retriggerable.deleter + def retriggerable(self): + cfunc = lib_importer.windll.DAQmxResetStartTrigRetriggerable + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def term(self): + """ + str: Indicates the name of the internal Start Trigger terminal + for the task. This property does not return the name of the + trigger source terminal. + """ + cfunc = lib_importer.windll.DAQmxGetStartTrigTerm + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @property + def trig_type(self): + """ + :class:`nidaqmx.constants.TriggerType`: Specifies the type of + trigger to use to start a task. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetStartTrigType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return TriggerType(val.value) + + @trig_type.setter + def trig_type(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetStartTrigType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @trig_type.deleter + def trig_type(self): + cfunc = lib_importer.windll.DAQmxResetStartTrigType + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + def cfg_anlg_edge_start_trig( + self, trigger_source="", trigger_slope=Slope.RISING, + trigger_level=0.0): + """ + Configures the task to start acquiring or generating samples + when an analog signal crosses the level you specify. + + Args: + trigger_source (Optional[str]): Is the name of a virtual + channel or terminal where there is an analog signal to + use as the source of the trigger. + trigger_slope (Optional[nidaqmx.constants.Slope]): Specifies + on which slope of the signal to start acquiring or + generating samples when the signal crosses + **trigger_level**. + trigger_level (Optional[float]): Specifies at what threshold + to start acquiring or generating samples. Specify this + value in the units of the measurement or generation. Use + **trigger_slope** to specify on which slope to trigger + at this threshold. + """ + cfunc = lib_importer.windll.DAQmxCfgAnlgEdgeStartTrig + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int, + ctypes.c_double] + + error_code = cfunc( + self._handle, trigger_source, trigger_slope.value, trigger_level) + check_for_error(error_code) + + def cfg_anlg_window_start_trig( + self, window_top, window_bottom, trigger_source="", + trigger_when=WindowTriggerCondition1.ENTERING_WINDOW): + """ + Configures the task to start acquiring or generating samples + when an analog signal enters or leaves a range you specify. + + Args: + window_top (float): Is the upper limit of the window. + Specify this value in the units of the measurement or + generation. + window_bottom (float): Is the lower limit of the window. + Specify this value in the units of the measurement or + generation. + trigger_source (Optional[str]): Is the name of a virtual + channel or terminal where there is an analog signal to + use as the source of the trigger. + trigger_when (Optional[nidaqmx.constants.WindowTriggerCondition1]): + Specifies whether the task starts measuring or + generating samples when the signal enters the window or + when it leaves the window. Use **window_bottom** and + **window_top** to specify the limits of the window. + """ + cfunc = lib_importer.windll.DAQmxCfgAnlgWindowStartTrig + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int, + ctypes.c_double, ctypes.c_double] + + error_code = cfunc( + self._handle, trigger_source, trigger_when.value, window_top, + window_bottom) + check_for_error(error_code) + + def cfg_dig_edge_start_trig( + self, trigger_source, trigger_edge=Edge.RISING): + """ + Configures the task to start acquiring or generating samples on + a rising or falling edge of a digital signal. + + Args: + trigger_source (str): Specifies the name of a terminal where + there is a digital signal to use as the source of the + trigger. + trigger_edge (Optional[nidaqmx.constants.Edge]): Specifies + on which edge of the digital signal to start acquiring + or generating samples. + """ + cfunc = lib_importer.windll.DAQmxCfgDigEdgeStartTrig + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, trigger_source, trigger_edge.value) + check_for_error(error_code) + + def cfg_dig_pattern_start_trig( + self, trigger_source, trigger_pattern, + trigger_when=DigitalPatternCondition.PATTERN_MATCHES): + """ + Configures a task to start acquiring or generating samples when + a digital pattern is matched. + + Args: + trigger_source (str): Specifies the physical channels to use + for pattern matching. The order of the physical channels + determines the order of the pattern. If a port is + included, the order of the physical channels within the + port is in ascending order. + trigger_pattern (str): Specifies the digital pattern that + must be met for the trigger to occur. + trigger_when (Optional[nidaqmx.constants.DigitalPatternCondition]): + Specifies the condition under which the trigger occurs. + """ + cfunc = lib_importer.windll.DAQmxCfgDigPatternStartTrig + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_int] + + error_code = cfunc( + self._handle, trigger_source, trigger_pattern, trigger_when.value) + check_for_error(error_code) + + def disable_start_trig(self): + """ + Configures the task to start acquiring or generating samples + immediately upon starting the task. + """ + cfunc = lib_importer.windll.DAQmxDisableStartTrig + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + diff --git a/nidaqmx/_task_modules/triggers.py b/nidaqmx/_task_modules/triggers.py new file mode 100644 index 00000000..d008791e --- /dev/null +++ b/nidaqmx/_task_modules/triggers.py @@ -0,0 +1,117 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import ctypes +import numpy + +from nidaqmx._lib import lib_importer, wrapped_ndpointer, ctypes_byte_str +from nidaqmx.system.physical_channel import PhysicalChannel +from nidaqmx.errors import ( + check_for_error, is_string_buffer_too_small, is_array_buffer_too_small) +from nidaqmx._task_modules.triggering.arm_start_trigger import ArmStartTrigger +from nidaqmx._task_modules.triggering.handshake_trigger import HandshakeTrigger +from nidaqmx._task_modules.triggering.pause_trigger import PauseTrigger +from nidaqmx._task_modules.triggering.reference_trigger import ReferenceTrigger +from nidaqmx._task_modules.triggering.start_trigger import StartTrigger +from nidaqmx.constants import ( + SyncType) + + +class Triggers(object): + """ + Represents the trigger configurations for a DAQmx task. + """ + def __init__(self, task_handle): + self._handle = task_handle + self._arm_start_trigger = ArmStartTrigger(self._handle) + self._handshake_trigger = HandshakeTrigger(self._handle) + self._pause_trigger = PauseTrigger(self._handle) + self._reference_trigger = ReferenceTrigger(self._handle) + self._start_trigger = StartTrigger(self._handle) + + @property + def arm_start_trigger(self): + """ + :class:`nidaqmx._task_modules.triggering.arm_start_trigger.ArmStartTrigger`: + Gets the arm start trigger configurations for the task. + """ + return self._arm_start_trigger + + @property + def handshake_trigger(self): + """ + :class:`nidaqmx._task_modules.triggering.handshake_trigger.HandshakeTrigger`: + Gets the handshake trigger configurations for the task. + """ + return self._handshake_trigger + + @property + def pause_trigger(self): + """ + :class:`nidaqmx._task_modules.triggering.pause_trigger.PauseTrigger`: + Gets the pause trigger configurations for the task. + """ + return self._pause_trigger + + @property + def reference_trigger(self): + """ + :class:`nidaqmx._task_modules.triggering.reference_trigger.ReferenceTrigger`: + Gets the reference trigger configurations for the task. + """ + return self._reference_trigger + + @property + def start_trigger(self): + """ + :class:`nidaqmx._task_modules.triggering.start_trigger.StartTrigger`: + Gets the start trigger configurations for the task. + """ + return self._start_trigger + + @property + def sync_type(self): + """ + :class:`nidaqmx.constants.SyncType`: Specifies the role of the + device in a synchronized system. Setting this value to + **SyncType.MASTER** or **SyncType.SLAVE** enables trigger + skew correction. If you enable trigger skew correction, set + this property to **SyncType.MASTER** on only one device, and + set this property to **SyncType.SLAVE** on the other + devices. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetTriggerSyncType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return SyncType(val.value) + + @sync_type.setter + def sync_type(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetTriggerSyncType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @sync_type.deleter + def sync_type(self): + cfunc = lib_importer.windll.DAQmxResetTriggerSyncType + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + diff --git a/nidaqmx/_task_modules/write_functions.py b/nidaqmx/_task_modules/write_functions.py new file mode 100644 index 00000000..bc3b0905 --- /dev/null +++ b/nidaqmx/_task_modules/write_functions.py @@ -0,0 +1,343 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function + +import ctypes +import numpy + +from nidaqmx._lib import lib_importer, wrapped_ndpointer, c_bool32 +from nidaqmx.constants import FillMode +from nidaqmx.errors import check_for_error + + +def _write_analog_f_64( + task_handle, write_array, num_samps_per_chan, auto_start, timeout, + data_layout=FillMode.GROUP_BY_CHANNEL): + samps_per_chan_written = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxWriteAnalogF64 + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int, c_bool32, + ctypes.c_double, ctypes.c_int, + wrapped_ndpointer(dtype=numpy.float64, flags=('C', 'W')), + ctypes.POINTER(ctypes.c_int), ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, num_samps_per_chan, auto_start, timeout, + data_layout.value, write_array, + ctypes.byref(samps_per_chan_written), None) + check_for_error(error_code) + + return samps_per_chan_written.value + + +def _write_analog_scalar_f_64(task_handle, value, auto_start, timeout): + cfunc = lib_importer.windll.DAQmxWriteAnalogScalarF64 + cfunc.argtypes = [ + lib_importer.task_handle, c_bool32, ctypes.c_double, + ctypes.c_double, ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, auto_start, timeout, value, None) + check_for_error(error_code) + + +def _write_binary_i_16( + task_handle, write_array, num_samps_per_chan, auto_start, timeout, + data_layout=FillMode.GROUP_BY_CHANNEL): + samps_per_chan_written = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxWriteBinaryI16 + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int, c_bool32, + ctypes.c_double, ctypes.c_int, + wrapped_ndpointer(dtype=numpy.int16, flags=('C', 'W')), + ctypes.POINTER(ctypes.c_int), ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, num_samps_per_chan, auto_start, timeout, + data_layout.value, write_array, + ctypes.byref(samps_per_chan_written), None) + check_for_error(error_code) + + return samps_per_chan_written.value + + +def _write_binary_u_16( + task_handle, write_array, num_samps_per_chan, auto_start, timeout, + data_layout=FillMode.GROUP_BY_CHANNEL): + samps_per_chan_written = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxWriteBinaryU16 + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int, c_bool32, + ctypes.c_double, ctypes.c_int, + wrapped_ndpointer(dtype=numpy.uint16, flags=('C', 'W')), + ctypes.POINTER(ctypes.c_int), ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, num_samps_per_chan, auto_start, timeout, + data_layout.value, write_array, + ctypes.byref(samps_per_chan_written), None) + check_for_error(error_code) + + return samps_per_chan_written.value + + +def _write_binary_i_32( + task_handle, write_array, num_samps_per_chan, auto_start, timeout, + data_layout=FillMode.GROUP_BY_CHANNEL): + samps_per_chan_written = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxWriteBinaryI32 + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int, c_bool32, + ctypes.c_double, ctypes.c_int, + wrapped_ndpointer(dtype=numpy.int32, flags=('C', 'W')), + ctypes.POINTER(ctypes.c_int), ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, num_samps_per_chan, auto_start, timeout, + data_layout.value, write_array, + ctypes.byref(samps_per_chan_written), None) + check_for_error(error_code) + + return samps_per_chan_written.value + + +def _write_binary_u_32( + task_handle, write_array, num_samps_per_chan, auto_start, timeout, + data_layout=FillMode.GROUP_BY_CHANNEL): + samps_per_chan_written = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxWriteBinaryU32 + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int, c_bool32, + ctypes.c_double, ctypes.c_int, + wrapped_ndpointer(dtype=numpy.uint32, flags=('C', 'W')), + ctypes.POINTER(ctypes.c_int), ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, num_samps_per_chan, auto_start, timeout, + data_layout.value, write_array, + ctypes.byref(samps_per_chan_written), None) + check_for_error(error_code) + + return samps_per_chan_written.value + + +def _write_digital_u_8( + task_handle, write_array, num_samps_per_chan, auto_start, timeout, + data_layout=FillMode.GROUP_BY_CHANNEL): + samps_per_chan_written = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxWriteDigitalU8 + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int, c_bool32, + ctypes.c_double, ctypes.c_int, + wrapped_ndpointer(dtype=numpy.uint8, flags=('C', 'W')), + ctypes.POINTER(ctypes.c_int), ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, num_samps_per_chan, auto_start, timeout, + data_layout.value, write_array, + ctypes.byref(samps_per_chan_written), None) + check_for_error(error_code) + + return samps_per_chan_written.value + + +def _write_digital_u_16( + task_handle, write_array, num_samps_per_chan, auto_start, timeout, + data_layout=FillMode.GROUP_BY_CHANNEL): + samps_per_chan_written = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxWriteDigitalU16 + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int, c_bool32, + ctypes.c_double, ctypes.c_int, + wrapped_ndpointer(dtype=numpy.uint16, flags=('C', 'W')), + ctypes.POINTER(ctypes.c_int), ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, num_samps_per_chan, auto_start, timeout, + data_layout.value, write_array, + ctypes.byref(samps_per_chan_written), None) + check_for_error(error_code) + + return samps_per_chan_written.value + + +def _write_digital_u_32( + task_handle, write_array, num_samps_per_chan, auto_start, timeout, + data_layout=FillMode.GROUP_BY_CHANNEL): + samps_per_chan_written = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxWriteDigitalU32 + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int, c_bool32, + ctypes.c_double, ctypes.c_int, + wrapped_ndpointer(dtype=numpy.uint32, flags=('C', 'W')), + ctypes.POINTER(ctypes.c_int), ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, num_samps_per_chan, auto_start, timeout, + data_layout.value, write_array, + ctypes.byref(samps_per_chan_written), None) + check_for_error(error_code) + + return samps_per_chan_written.value + + +def _write_digital_scalar_u_32(task_handle, value, auto_start, timeout): + cfunc = lib_importer.windll.DAQmxWriteDigitalScalarU32 + cfunc.argtypes = [ + lib_importer.task_handle, c_bool32, ctypes.c_double, + ctypes.c_uint, ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, auto_start, timeout, value, None) + check_for_error(error_code) + + +def _write_digital_lines( + task_handle, write_array, num_samps_per_chan, auto_start, timeout, + data_layout=FillMode.GROUP_BY_CHANNEL): + samps_per_chan_written = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxWriteDigitalLines + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int, c_bool32, + ctypes.c_double, ctypes.c_int, + wrapped_ndpointer(dtype=numpy.bool, flags=('C', 'W')), + ctypes.POINTER(ctypes.c_int), ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, num_samps_per_chan, auto_start, timeout, + data_layout.value, write_array, + ctypes.byref(samps_per_chan_written), None) + check_for_error(error_code) + + return samps_per_chan_written.value + + +def _write_ctr_freq( + task_handle, freq, duty_cycle, num_samps_per_chan, auto_start, timeout, + data_layout=FillMode.GROUP_BY_CHANNEL): + num_samps_per_chan_written = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxWriteCtrFreq + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int, c_bool32, + ctypes.c_double, ctypes.c_int, + wrapped_ndpointer(dtype=numpy.float64, flags=('C', 'W')), + wrapped_ndpointer(dtype=numpy.float64, flags=('C', 'W')), + ctypes.POINTER(ctypes.c_int), ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, num_samps_per_chan, auto_start, timeout, + data_layout.value, freq, duty_cycle, + ctypes.byref(num_samps_per_chan_written), None) + check_for_error(error_code) + + return num_samps_per_chan_written.value + + +def _write_ctr_freq_scalar(task_handle, freq, duty_cycle, auto_start, timeout): + cfunc = lib_importer.windll.DAQmxWriteCtrFreqScalar + cfunc.argtypes = [ + lib_importer.task_handle, c_bool32, ctypes.c_double, + ctypes.c_double, ctypes.c_double, ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, auto_start, timeout, freq, duty_cycle, None) + check_for_error(error_code) + + +def _write_ctr_time( + task_handle, high_time, low_time, num_samps_per_chan, auto_start, + timeout, data_layout=FillMode.GROUP_BY_CHANNEL): + num_samps_per_chan_written = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxWriteCtrTime + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int, c_bool32, + ctypes.c_double, ctypes.c_int, + wrapped_ndpointer(dtype=numpy.float64, flags=('C', 'W')), + wrapped_ndpointer(dtype=numpy.float64, flags=('C', 'W')), + ctypes.POINTER(ctypes.c_int), ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, num_samps_per_chan, auto_start, timeout, + data_layout.value, high_time, low_time, + ctypes.byref(num_samps_per_chan_written), None) + check_for_error(error_code) + + return num_samps_per_chan_written.value + + +def _write_ctr_time_scalar( + task_handle, high_time, low_time, auto_start, timeout): + cfunc = lib_importer.windll.DAQmxWriteCtrTimeScalar + cfunc.argtypes = [ + lib_importer.task_handle, c_bool32, ctypes.c_double, + ctypes.c_double, ctypes.c_double, + ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, auto_start, timeout, high_time, + low_time, None) + check_for_error(error_code) + + +def _write_ctr_ticks( + task_handle, high_tick, low_tick, num_samps_per_chan, auto_start, + timeout, data_layout=FillMode.GROUP_BY_CHANNEL): + num_samps_per_chan_written = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxWriteCtrTicks + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int, c_bool32, + ctypes.c_double, ctypes.c_int, + wrapped_ndpointer(dtype=numpy.uint32, flags=('C', 'W')), + wrapped_ndpointer(dtype=numpy.uint32, flags=('C', 'W')), + ctypes.POINTER(ctypes.c_int), ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, num_samps_per_chan, auto_start, timeout, + data_layout.value, high_tick, low_tick, + ctypes.byref(num_samps_per_chan_written), None) + check_for_error(error_code) + + return num_samps_per_chan_written.value + + +def _write_ctr_ticks_scalar( + task_handle, high_ticks, low_ticks, auto_start, timeout): + cfunc = lib_importer.windll.DAQmxWriteCtrTicksScalar + cfunc.argtypes = [ + lib_importer.task_handle, c_bool32, ctypes.c_double, + ctypes.c_uint, ctypes.c_uint, ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, auto_start, timeout, high_ticks, low_ticks, None) + check_for_error(error_code) + + +def _write_raw( + task_handle, num_samps_per_chan, numpy_array, auto_start, timeout): + samps_per_chan_written = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxWriteRaw + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int, c_bool32, + ctypes.c_double, + wrapped_ndpointer(dtype=numpy_array.dtype, flags=('C', 'W')), + ctypes.POINTER(ctypes.c_int), ctypes.POINTER(c_bool32)] + + error_code = cfunc( + task_handle, num_samps_per_chan, auto_start, timeout, numpy_array, + ctypes.byref(samps_per_chan_written), None) + check_for_error(error_code) + + return samps_per_chan_written.value diff --git a/nidaqmx/constants.py b/nidaqmx/constants.py new file mode 100644 index 00000000..87313fdb --- /dev/null +++ b/nidaqmx/constants.py @@ -0,0 +1,1048 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +from enum import Enum + +# Constants +AUTO = -1 +CFG_DEFAULT = -1 +DEFAULT = -1 +READ_ALL_AVAILABLE = -1 +WAIT_INFINITELY = -1.0 + + +# Enums +class ACExcitWireMode(Enum): + FOUR_WIRE = 4 #: 4-wire. + FIVE_WIRE = 5 #: 5-wire. + SIX_WIRE = 6 #: 6-wire. + + +class ADCTimingMode(Enum): + AUTOMATIC = 16097 #: Uses the most appropriate supported timing mode based on the Sample Clock Rate. + HIGH_RESOLUTION = 10195 #: Increases resolution and noise rejection while decreasing conversion rate. + HIGH_SPEED = 14712 #: Increases conversion rate while decreasing resolution. + BEST_50_HZ_REJECTION = 14713 #: Improves 50 Hz noise rejection while decreasing noise rejection at other frequencies. + BEST_60_HZ_REJECTION = 14714 #: Improves 60 Hz noise rejection while decreasing noise rejection at other frequencies. + CUSTOM = 10137 #: Use **aiadc_custom_timing_mode** to specify a custom value controlling the tradeoff between speed and resolution. + + +class AOIdleOutputBehavior(Enum): + ZERO_VOLTS = 12526 #: Generate 0 V. + HIGH_IMPEDANCE = 12527 #: Set the channel to high-impedance, effectively disconnecting the analog output circuitry from the I/O connector. + MAINTAIN_EXISTING_VALUE = 12528 #: Continue generating the current value. + + +class AOPowerUpOutputBehavior(Enum): + VOLTAGE = 10322 #: Voltage output. + CURRENT = 10134 #: Current output. + HIGH_IMPEDANCE = 12527 #: High-impedance state. + + +class AccelChargeSensitivityUnits(Enum): + PICO_COULOMBS_PER_G = 16099 #: PicoCoulombs per g. + PICO_COULOMBS_PER_METERS_PER_SECOND_SQUARED = 16100 #: PicoCoulombs per m/s^2. + PICO_COULOMBS_PER_INCHES_PER_SECOND_SQUARED = 16101 #: PicoCoulombs per in/s^2. + + +class AccelSensitivityUnits(Enum): + M_VOLTS_PER_G = 12509 #: mVolts/g. + VOLTS_PER_G = 12510 #: Volts/g. + + +class AccelUnits(Enum): + G = 10186 #: 1 g is approximately equal to 9.81 m/s/s. + METERS_PER_SECOND_SQUARED = 12470 #: Meters per second per second. + INCHES_PER_SECOND_SQUARED = 12471 #: Inches per second per second. + FROM_CUSTOM_SCALE = 10065 #: Units a custom scale specifies. If you select this value, you must specify a custom scale name. + + +class AcquisitionType(Enum): + FINITE = 10178 #: Acquire or generate a finite number of samples. + CONTINUOUS = 10123 #: Acquire or generate samples until you stop the task. + HW_TIMED_SINGLE_POINT = 12522 #: Acquire or generate samples continuously using hardware timing without a buffer. Hardware timed single point sample mode is supported only for the sample clock and change detection timing types. + + +class Action(Enum): + COMMIT = 0 #: Commit + CANCEL = 1 #: Cancel + + +class ActiveLevel(Enum): + ABOVE = 10093 #: Pause the measurement or generation while the signal is above the threshold. + BELOW = 10107 #: Pause the measurement or generation while the signal is below the threshold. + + +class ActiveOrInactiveEdgeSelection(Enum): + ACTIVE = 14617 #: Active edges. + INACTIVE = 14618 #: Inactive edges. + + +class AngleUnits(Enum): + DEGREES = 10146 #: Degrees. + RADIANS = 10273 #: Radians. + TICKS = 10304 #: Ticks. + FROM_CUSTOM_SCALE = 10065 #: Units a custom scale specifies. If you select this value, you must specify a custom scale name. + + +class AngularVelocityUnits(Enum): + RPM = 16080 #: Revolutions per minute. + RADIANS_PER_SECOND = 16081 #: Radians per second. + DEGREES_PER_SECOND = 16082 #: Degrees per second. + FROM_CUSTOM_SCALE = 10065 #: Units a custom scale specifies. If you select this value, you must specify a custom scale name. + + +class AutoZeroType(Enum): + NONE = 10230 #: Do not perform an autozero. + ONCE = 10244 #: Perform an auto zero at the beginning of the acquisition. This auto zero task might not run if you have used DAQmx Control Task previously in your task. + EVERY_SAMPLE = 10164 #: Perform an auto zero at every sample of the acquisition. + + +class BreakMode(Enum): + NO_ACTION = 10227 #: When advancing to the next entry in the scan list, leave all previous connections intact. + BREAK_BEFORE_MAKE = 10110 #: When advancing to the next entry in the scan list, disconnect all previous connections before making any new connections. + + +class BridgeConfiguration(Enum): + FULL_BRIDGE = 10182 #: Sensor is a full bridge. If you set **ai_excit_use_for_scaling** to True, NI-DAQmx divides the measurement by the excitation value. Many sensors scale data to native units using scaling of volts per excitation. + HALF_BRIDGE = 10187 #: Sensor is a half bridge. If you set **ai_excit_use_for_scaling** to True, NI-DAQmx divides the measurement by the excitation value. Many sensors scale data to native units using scaling of volts per excitation. + QUARTER_BRIDGE = 10270 #: Sensor is a quarter bridge. If you set **ai_excit_use_for_scaling** to True, NI-DAQmx divides the measurement by the excitation value. Many sensors scale data to native units using scaling of volts per excitation. + NO_BRIDGE = 10228 #: Sensor is not a Wheatstone bridge. + + +class BridgeElectricalUnits(Enum): + VOLTS_PER_VOLT = 15896 #: Volts per volt. + M_VOLTS_PER_VOLT = 15897 #: Millivolts per volt. + + +class BridgePhysicalUnits(Enum): + NEWTONS = 15875 #: Newtons. + POUNDS = 15876 #: Pounds. + KILOGRAM_FORCE = 15877 #: kilograms-force. + PASCALS = 10081 #: Pascals. + BAR = 15880 #: Bar. + POUNDS_PER_SQ_INCH = 15879 #: Pounds per square inch. + NEWTON_METERS = 15881 #: Newton metres. + INCH_OUNCES = 15882 #: Ounce-inches. + INCH_POUNDS = 15883 #: Pound-inches. + FOOT_POUNDS = 15884 #: Pound-feet. + + +class BridgeShuntCalSource(Enum): + BUILT_IN = 10200 #: Use the internal shunt. + USER_PROVIDED = 10167 #: Use an external shunt. + + +class BridgeUnits(Enum): + VOLTS_PER_VOLTS = 15896 #: Volts per volt. + M_VOLTS_PER_VOLT = 15897 #: Millivolts per volt. + FROM_CUSTOM_SCALE = 10065 #: Units a custom scale specifies. If you select this value, you must specify a custom scale name. + FROM_TEDS = 12516 #: Units defined by TEDS information associated with the channel. + + +class BusType(Enum): + PCI = 12582 #: PCI. + PCIE = 13612 #: PCI Express. + PXI = 12583 #: PXI. + PXIE = 14706 #: PXI Express. + SCXI = 12584 #: SCXI. + SCC = 14707 #: SCC. + PC_CARD = 12585 #: PC Card/PCMCIA. + USB = 12586 #: USB. + UNKNOWN = 12588 #: Unknown bus type. + COMPACT_DAQ = 14637 #: CompactDAQ. + TCPIP = 14828 #: TCP/IP. + SWITCH_BLOCK = 15870 #: SwitchBlock. + + +class CJCSource(Enum): + BUILT_IN = 10200 #: Use a cold-junction compensation channel built into the terminal block. + CONSTANT_USER_VALUE = 10116 #: You must specify the cold-junction temperature. + SCANNABLE_CHANNEL = 10113 #: Use a channel for cold-junction compensation. + + +class CalibrationMode2(Enum): + VOLTAGE = 10322 #: Voltage + CHARGE = 16105 #: Charge + + +class CalibrationTerminalConfig(Enum): + DIFF = 10106 #: Differential + PSEUDO_DIFF = 12529 #: Pseudodifferential + + +class ChannelType(Enum): + ANALOG_INPUT = 10100 #: Analog input channel. + ANALOG_OUTPUT = 10102 #: Analog output channel. + DIGITAL_INPUT = 10151 #: Digital input channel. + DIGITAL_OUTPUT = 10153 #: Digital output channel. + COUNTER_INPUT = 10131 #: Counter input channel. + COUNTER_OUTPUT = 10132 #: Counter output channel. + + +class ChargeUnits(Enum): + COULOMBS = 16102 #: Coulombs. + PICO_COULOMBS = 16103 #: PicoCoulombs. + FROM_CUSTOM_SCALE = 10065 #: Units a custom scale specifies. If you select this value, you must specify a custom scale name. + + +class ConstrainedGenMode(Enum): + UNCONSTRAINED = 14708 #: Counter has no restrictions on pulse generation. + FIXED_HIGH_FREQ = 14709 #: Pulse frequency must be above 7.63 Hz and cannot change while the task runs. In this mode, the duty cycle has 8 bits of resolution. + FIXED_LOW_FREQ = 14710 #: Pulse frequency must be below 366.21 Hz and cannot change while the task runs. In this mode, the duty cycle has 16 bits of resolution. + FIXED_50_PERCENT_DUTY_CYCLE = 14711 #: Pulse duty cycle must be 50 percent. The frequency can change while the task runs. + + +class CountDirection(Enum): + COUNT_UP = 10128 #: Increment counter. + COUNT_DOWN = 10124 #: Decrement counter. + EXTERNAL_SOURCE = 10326 #: The state of a digital line controls the count direction. Each counter has a default count direction terminal. + + +class CounterFrequencyMethod(Enum): + LOW_FREQUENCY_1_COUNTER = 10105 #: Use one counter that uses a constant timebase to measure the input signal. + HIGH_FREQUENCY_2_COUNTERS = 10157 #: Use two counters, one of which counts pulses of the signal to measure during the specified measurement time. + LARGE_RANGE_2_COUNTERS = 10205 #: Use one counter to divide the frequency of the input signal to create a lower-frequency signal that the second counter can more easily measure. + DYNAMIC_AVERAGING = 16065 #: Uses one counter and automatically configures the counter settings based on the range of frequencies to be measured. During the acquisition, the counter dynamically adjusts the number of periods that are averaged to balance measurement accuracy and latency. + + +class Coupling(Enum): + AC = 10045 #: Remove the DC offset from the signal. + DC = 10050 #: Allow NI-DAQmx to measure all of the signal. + GND = 10066 #: Remove the signal from the measurement and measure only ground. + + +class CurrentShuntResistorLocation(Enum): + LET_DRIVER_CHOOSE = -1 #: + INTERNAL = 10200 #: Use the built-in shunt resistor of the device. + EXTERNAL = 10167 #: Use a shunt resistor external to the device. You must specify the value of the shunt resistor by using **ai_current_shunt_resistance**. + + +class CurrentUnits(Enum): + AMPS = 10342 #: Amperes. + FROM_CUSTOM_SCALE = 10065 #: Units a custom scale specifies. If you select this value, you must specify a custom scale name. + FROM_TEDS = 12516 #: Units defined by TEDS information associated with the channel. + + +class DataJustification(Enum): + RIGHT = 10279 #: Samples occupy the lower bits of the integer. + LEFT = 10209 #: Samples occupy the higher bits of the integer. + + +class DataTransferActiveTransferMode(Enum): + DMA = 10054 #: Direct Memory Access. Data transfers take place independently from the application. + INTERRUPT = 10204 #: Data transfers take place independently from the application. Using interrupts increases CPU usage because the CPU must service interrupt requests. Typically, you should use interrupts if the device is out of DMA channels. + POLLED = 10264 #: Data transfers take place when you call DAQmx Read or DAQmx Write. + USB_BULK = 12590 #: Data transfers take place independently from the application using a USB bulk pipe. + + +class DeassertCondition(Enum): + ON_BOARD_MEMORY_MORE_THAN_HALF_FULL = 10237 #: Deassert the signal when more than half of the onboard memory of the device fills. + ON_BOARD_MEMORY_FULL = 10236 #: Deassert the signal when the onboard memory fills. + ONBOARD_MEMORY_CUSTOM_THRESHOLD = 12577 #: Deassert the signal when the amount of space available in the onboard memory is below the value specified with **rdy_for_xfer_event_deassert_cond_custom_threshold**. + + +class DigitalDriveType(Enum): + ACTIVE_DRIVE = 12573 #: Drive the output pin to approximately 0 V for logic low and +3.3 V or +5 V, depending on the device, for logic high. + OPEN_COLLECTOR = 12574 #: Drive the output pin to 0 V for logic low. For logic high, the output driver assumes a high-impedance state and does not drive a voltage. + + +class DigitalPatternCondition(Enum): + PATTERN_MATCHES = 10254 #: Trigger when the physical channels match the specified pattern. + PATTERN_DOES_NOT_MATCH = 10253 #: Trigger when the physical channels do not match the specified pattern. + + +class DigitalWidthUnits(Enum): + SAMPLE_CLOCK_PERIODS = 10286 #: Complete periods of the Sample Clock. + SECONDS = 10364 #: Seconds. + TICKS = 10304 #: Timebase ticks. + + +class EddyCurrentProxProbeSensitivityUnits(Enum): + MIL = 14836 #: mVolts/mil. + IL = 14837 #: Volts/mil. + MILLIMETER = 14838 #: mVolts/mMeter. + ILLIMETER = 14839 #: Volts/mMeter. + MICRON = 14840 #: mVolts/micron. + + +class Edge(Enum): + RISING = 10280 #: Rising edge(s). + FALLING = 10171 #: Falling edge(s). + + +class EncoderType(Enum): + X_1 = 10090 #: If signal A leads signal B, count the rising edges of signal A. If signal B leads signal A, count the falling edges of signal A. + X_2 = 10091 #: Count the rising and falling edges of signal A. + X_4 = 10092 #: Count the rising and falling edges of signal A and signal B. + TWO_PULSE_COUNTING = 10313 #: Two pulse counting. + + +class EncoderZIndexPhase(Enum): + AHIGH_BHIGH = 10040 #: Reset the measurement when signal A and signal B are high. + AHIGH_BLOW = 10041 #: Reset the measurement when signal A is high and signal B is low. + ALOW_BHIGH = 10042 #: Reset the measurement when signal A is low and signal B high. + ALOW_BLOW = 10043 #: Reset the measurement when signal A and signal B are low. + + +class EveryNSamplesEventType(Enum): + ACQUIRED_INTO_BUFFER = 1 #: Acquired Into Buffer + TRANSFERRED_FROM_BUFFER = 2 #: Transferred From Buffer + + +class ExcitationDCorAC(Enum): + USE_DC = 10050 #: DC excitation. + USE_AC = 10045 #: AC excitation. + + +class ExcitationIdleOutputBehavior(Enum): + ZERO_VOLTS_OR_AMPERES = 12526 #: Drive excitation output to zero. + MAINTAIN_EXISTING_VALUE = 12528 #: Continue generating the current value. + + +class ExcitationSource(Enum): + INTERNAL = 10200 #: Use the built-in excitation source of the device. If you select this value, you must specify the amount of excitation. + EXTERNAL = 10167 #: Use an excitation source other than the built-in excitation source of the device. If you select this value, you must specify the amount of excitation. + NONE = 10230 #: Supply no excitation to the channel. + + +class ExcitationVoltageOrCurrent(Enum): + USE_VOLTAGE = 10322 #: Voltage excitation. + USE_CURRENT = 10134 #: Current excitation. + + +class ExportAction(Enum): + PULSE = 10265 #: Send a pulse to the terminal. + TOGGLE = 10307 #: Toggle the state of the terminal from low to high or from high to low. + LEVEL = 10210 #: The exported Sample Clock goes high at the beginning of the sample and goes low when the last AI Convert begins. + INTERLOCKED = 12549 #: Handshake Event deasserts after the Handshake Trigger asserts, plus the amount of time specified with **hshk_event_interlocked_deassert_delay**. + + +class FillMode(Enum): + GROUP_BY_CHANNEL = 0 #: Group by Channel + GROUP_BY_SCAN_NUMBER = 1 #: Group by Scan Number + + +class FilterResponse(Enum): + CONSTANT_GROUP_DELAY = 16075 #: Constant group delay filter response. + BUTTERWORTH = 16076 #: Butterworth filter response. + ELLIPTICAL = 16077 #: Elliptical filter response. + HARDWARE_DEFINED = 10191 #: Use the hardware-defined filter response. + + +class FilterType(Enum): + LOWPASS = 16071 #: Lowpass filter. + HIGHPASS = 16072 #: Highpass filter. + BANDPASS = 16073 #: Bandpass filter. + NOTCH = 16074 #: Notch filter. + CUSTOM = 10137 #: Custom filter. + + +class ForceIEPESensorSensitivityUnits(Enum): + M_VOLTS_PER_POUND = 15892 #: Millivolts per pound. + M_VOLTS_PER_NEWTON = 15891 #: Millivolts per newton. + + +class ForceUnits(Enum): + NEWTONS = 15875 #: Newtons. + POUNDS = 15876 #: Pounds. + KILOGRAM_FORCE = 15877 #: Kilograms-force. + FROM_CUSTOM_SCALE = 10065 #: Units a custom scale specifies. If you select this value, you must specify a custom scale name. + + +class FrequencyUnits(Enum): + HZ = 10373 #: Hertz. + TICKS = 10304 #: Timebase ticks. + FROM_CUSTOM_SCALE = 10065 #: Units a custom scale specifies. If you select this value, you must specify a custom scale name. + + +class FuncGenType(Enum): + SINE = 14751 #: Sine wave. + TRIANGLE = 14752 #: Triangle wave. + SQUARE = 14753 #: Square wave. + SAWTOOTH = 14754 #: Sawtooth wave. + + +class GpsSignalType(Enum): + IRIGB = 10070 #: Use the IRIG-B synchronization method. The GPS receiver sends one synchronization pulse per second, as well as information about the number of days, hours, minutes, and seconds that elapsed since the beginning of the current year. + PPS = 10080 #: Use the PPS synchronization method. The GPS receiver sends one synchronization pulse per second, but does not send any timing information. The timestamp measurement returns the number of seconds that elapsed since the device powered up unless you set **ci_timestamp_initial_seconds**. + NONE = 10230 #: Do not synchronize the counter to a GPS receiver. The timestamp measurement returns the number of seconds that elapsed since the device powered up unless you set **ci_timestamp_initial_seconds**. + + +class HandshakeStartCondition(Enum): + IMMEDIATE = 10198 #: Device is waiting for space in the FIFO (for acquisition) or waiting for samples (for generation). + WAIT_FOR_HANDSHAKE_TRIGGER_ASSERT = 12550 #: Device is waiting for the Handshake Trigger to assert. + WAIT_FOR_HANDSHAKE_TRIGGER_DEASSERT = 12551 #: Device is waiting for the Handshake Trigger to deassert. + + +class Impedance1(Enum): + FIFTY_OHMS = 50 #: 50 Ohms. + SEVENTY_FIVE_OHMS = 75 #: 75 Ohms. + ONE_M_OHM = 1000000 #: 1 M Ohm. + TEN_G_OHMS = 10000000000 #: 10 G Ohm. + + +class InputCalSource(Enum): + LOOPBACK_0 = 0 #: Loopback 0 degree shift + LOOPBACK_180 = 1 #: Loopback 180 degree shift + GROUND = 2 #: Ground + + +class InputDataTransferCondition(Enum): + ON_BOARD_MEMORY_MORE_THAN_HALF_FULL = 10237 #: Transfer data from the device when more than half of the onboard memory of the device fills. + ON_BOARD_MEMORY_NOT_EMPTY = 10241 #: Transfer data from the device when there is data in the onboard memory. + ONBOARD_MEMORY_CUSTOM_THRESHOLD = 12577 #: Transfer data from the device when the number of samples specified with **ai_data_xfer_custom_threshold** are in the device FIFO. + WHEN_ACQUISITION_COMPLETE = 12546 #: Transfer data when the acquisition is complete. + + +class LVDTSensitivityUnits(Enum): + M_VOLTS_PER_VOLT_PER_MILLIMETER = 12506 #: mVolts/Volt/mMeter. + M_VOLTS_PER_VOLT_PER_MILLI_INCH = 12505 #: mVolts/Volt/0.001 Inch. + + +class Language(Enum): + RAW = -1 #: + ENG = 0 #: + FRA = 1 #: + DEU = 2 #: + JPN = 3 #: + KOR = 4 #: + CHS = 5 #: + + +class LengthUnits(Enum): + METERS = 10219 #: Meters. + INCHES = 10379 #: Inches. + TICKS = 10304 #: Ticks. + FROM_CUSTOM_SCALE = 10065 #: Units a custom scale specifies. If you select this value, you must specify a custom scale name. + + +class Level(Enum): + HIGH = 10192 #: Logic high. + LOW = 10214 #: Logic low. + NO_CHANGE = 10160 #: Do not change the state of the lines. On some devices, you can select this value only for entire ports. + TRISTATE = 10310 #: High-impedance state. You can select this state only on devices with bidirectional lines. You cannot select this state for dedicated digital output lines. On some devices, you can select this value only for entire ports. + + +class LineGrouping(Enum): + CHAN_PER_LINE = 0 #: One Channel For Each Line + CHAN_FOR_ALL_LINES = 1 #: One Channel For All Lines + + +class LoggingMode(Enum): + OFF = 10231 #: Disable logging for the task. + LOG = 15844 #: Enable logging for the task. You cannot read data using DAQmx Read when using this mode. If you require access to the data, read from the TDMS file. + LOG_AND_READ = 15842 #: Enable both logging and reading data for the task. You must use DAQmx Read to read samples for NI-DAQmx to stream them to disk. + + +class LoggingOperation(Enum): + OPEN = 10437 #: Open an existing TDMS file, and append data to that file. If the file does not exist, NI-DAQmx returns an error. + OPEN_OR_CREATE = 15846 #: Open an existing TDMS file, and append data to that file. If the file does not exist, NI-DAQmx creates a new TDMS file. + CREATE_OR_REPLACE = 15847 #: Create a new TDMS file, or replace an existing TDMS file. + CREATE = 15848 #: Create a new TDMS file. If the file already exists, NI-DAQmx returns an error. + + +class LogicFamily(Enum): + TWO_POINT_FIVE_V = 14620 #: Compatible with 2.5 V CMOS signals. + THREE_POINT_THREE_V = 14621 #: Compatible with LVTTL signals. + FIVE_V = 14619 #: Compatible with TTL and 5 V CMOS signals. + + +class LogicLvlBehavior(Enum): + PULL_UP = 16064 #: High logic. + NONE = 10230 #: Supply no excitation to the channel. + + +class MIOAIConvertTimebaseSource(Enum): + SAMPLE_TIMEBASE = 10284 #: Use the same source as Sample Clock timebase. + EIGHT_M_HZ_TIMEBASE = 16023 #: Use the onboard 8 MHz timebase. + ONE_HUNDRED_M_HZ_TIMEBASE = 15857 #: Use the onboard 100 MHz timebase. + MASTER_TIMEBASE = 10282 #: Use the same source as the Master Timebase. + TWENTY_M_HZ_TIMEBASE = 12537 #: Use the onboard 20 MHz timebase. + EIGHTY_M_HZ_TIMEBASE = 14636 #: Use the onboard 80 MHz timebase. + + +class ModulationType(Enum): + AM = 14756 #: Amplitude modulation. + FM = 14757 #: Frequency modulation. + NONE = 10230 #: No modulation. + + +class OutputDataTransferCondition(Enum): + ON_BOARD_MEMORY_EMPTY = 10235 #: Transfer data to the device only when there is no data in the onboard memory of the device. + ON_BOARD_MEMORY_HALF_FULL_OR_LESS = 10239 #: Transfer data to the device any time the onboard memory is less than half full. + ON_BOARD_MEMORY_LESS_THAN_FULL = 10242 #: Transfer data to the device any time the onboard memory of the device is not full. + + +class OverflowBehavior(Enum): + TOP_TASK_AND_ERROR = 15862 #: Stop task and return an error. + GNORE_OVERRUNS = 15863 #: NI-DAQmx ignores Sample Clock overruns, and the task continues to run. + + +class OverwriteMode(Enum): + OVERWRITE_UNREAD_SAMPLES = 10252 #: When an acquisition encounters unread data in the buffer, the acquisition continues and overwrites the unread samples with new ones. You can read the new samples by setting **relative_to** to **ReadRelativeTo.MOST_RECENT_SAMPLE** and setting **offset** to the appropriate number of samples. + DO_NOT_OVERWRITE_UNREAD_SAMPLES = 10159 #: The acquisition stops when it encounters a sample in the buffer that you have not read. + + +class PathCapability(Enum): + PATH_AVAILABLE = 10431 #: + PATH_ALREADY_EXISTS = 10432 #: + PATH_UNSUPPORTED = 10433 #: + CHANNEL_IN_USE = 10434 #: + CHANNEL_SOURCE_CONFLICT = 10435 #: + CHANNEL_RESERVED_FOR_ROUTING = 10436 #: + + +class Polarity(Enum): + ACTIVE_HIGH = 10095 #: High state is the active state. + ACTIVE_LOW = 10096 #: Low state is the active state. + + +class PowerUpChannelType(Enum): + CHANNEL_VOLTAGE = 0 #: Voltage Channel + CHANNEL_CURRENT = 1 #: Current Channel + CHANNEL_HIGH_IMPEDANCE = 2 #: High-Impedance Channel + + +class PowerUpStates(Enum): + HIGH = 10192 #: Logic high. + LOW = 10214 #: Logic low. + TRISTATE = 10310 #: High-impedance state. You can select this state only on devices with bidirectional lines. You cannot select this state for dedicated digital output lines. On some devices, you can select this value only for entire ports. + + +class PressureUnits(Enum): + PASCALS = 10081 #: Pascals. + POUNDS_PER_SQ_INCH = 15879 #: Pounds per square inch. + BAR = 15880 #: Bar. + FROM_CUSTOM_SCALE = 10065 #: Units a custom scale specifies. If you select this value, you must specify a custom scale name. + + +class ProductCategory(Enum): + M_SERIES_DAQ = 14643 #: M Series DAQ. + X_SERIES_DAQ = 15858 #: X Series DAQ. + E_SERIES_DAQ = 14642 #: E Series DAQ. + S_SERIES_DAQ = 14644 #: S Series DAQ. + B_SERIES_DAQ = 14662 #: B Series DAQ. + SC_SERIES_DAQ = 14645 #: SC Series DAQ. + USBDAQ = 14646 #: USB DAQ. + AO_SERIES = 14647 #: AO Series. + DIGITAL_IO = 14648 #: Digital I/O. + TIO_SERIES = 14661 #: TIO Series. + DSA = 14649 #: Dynamic Signal Acquisition. + SWITCHES = 14650 #: Switches. + COMPACT_DAQ_CHASSIS = 14658 #: CompactDAQ chassis. + C_SERIES_MODULE = 14659 #: C Series I/O module. + SCXI_MODULE = 14660 #: SCXI module. + SCC_CONNECTOR_BLOCK = 14704 #: SCC Connector Block. + SCC_MODULE = 14705 #: SCC Module. + NIELVIS = 14755 #: NI ELVIS. + NETWORK_DAQ = 14829 #: Network DAQ. + SC_EXPRESS = 15886 #: SC Express. + UNKNOWN = 12588 #: Unknown category. + + +class RTDType(Enum): + PT_3750 = 12481 #: Pt3750. + PT_3851 = 10071 #: Pt3851. + PT_3911 = 12482 #: Pt3911. + PT_3916 = 10069 #: Pt3916. + PT_3920 = 10053 #: Pt3920. + PT_3928 = 12483 #: Pt3928. + CUSTOM = 10137 #: You must use **ai_rtd_a**, **ai_rtd_b**, and **ai_rtd_c** to supply the coefficients for the Callendar-Van Dusen equation. + + +class RVDTSensitivityUnits(Enum): + M_VPER_VPER_DEGREE = 12507 #: mVolts/Volt/Degree. + M_VPER_VPER_RADIAN = 12508 #: mVolts/Volt/Radian. + + +class RawDataCompressionType(Enum): + NONE = 10230 #: Do not compress samples. + LOSSLESS_PACKING = 12555 #: Remove unused bits from samples. No resolution is lost. + LOSSY_LSB_REMOVAL = 12556 #: Remove unused bits from samples. Then, if necessary, remove bits from samples until the samples are the size specified with **ai_lossy_lsb_removal_compressed_samp_size**. This compression type limits resolution to the specified sample size. + + +class ReadRelativeTo(Enum): + FIRST_SAMPLE = 10424 #: Start reading samples relative to the first sample acquired. + CURRENT_READ_POSITION = 10425 #: Start reading samples relative to the last sample returned by the previous read. For the first read operation, this position is the first sample acquired or the first pretrigger sample if you configured a reference trigger for the task. + REFERENCE_TRIGGER = 10426 #: Start reading samples relative to the first sample after the reference trigger occurred. + FIRST_PRETRIGGER_SAMPLE = 10427 #: Start reading samples relative to the first pretrigger sample. You specify the number of pretrigger samples to acquire when you configure a reference trigger. + MOST_RECENT_SAMPLE = 10428 #: Start reading samples relative to the next sample acquired. For example, use this value and set **offset** to -1 to read the last sample acquired. + + +class RegenerationMode(Enum): + ALLOW_REGENERATION = 10097 #: Allow NI-DAQmx to regenerate samples that the device previously generated. When you choose this value, the write marker returns to the beginning of the buffer after the device generates all samples currently in the buffer. + DONT_ALLOW_REGENERATION = 10158 #: Do not allow NI-DAQmx to regenerate samples the device previously generated. When you choose this value, NI-DAQmx waits for you to write more samples to the buffer or until the timeout expires. + + +class RelayPosition(Enum): + OPEN = 10437 #: + CLOSED = 10438 #: + + +class ResistanceConfiguration(Enum): + TWO_WIRE = 2 #: 2-wire mode. + THREE_WIRE = 3 #: 3-wire mode. + FOUR_WIRE = 4 #: 4-wire mode. + + +class ResistanceUnits(Enum): + OHMS = 10384 #: Ohms. + FROM_CUSTOM_SCALE = 10065 #: Units a custom scale specifies. If you select this value, you must specify a custom scale name. + FROM_TEDS = 12516 #: Units defined by TEDS information associated with the channel. + + +class ResistorState(Enum): + PULL_UP = 15950 #: pull up state for pull up/pull down resistors + PULL_DOWN = 15951 #: pull down state for pull up pull down resistors + + +class ResolutionType(Enum): + BITS = 10109 #: Bits. + + +class SCXI1124Range(Enum): + ZERO_TO_ONE_V = 14629 #: + ZERO_TO_FIVE_V = 14630 #: + ZERO_TO_TEN_V = 14631 #: + NEG_1_TO_1_V = 14632 #: + NEG_5_TO_5_V = 14633 #: + NEG_10_TO_10_V = 14634 #: + ZERO_TO_TWENTY_M_A = 14635 #: + + +class SampClkOverrunBehavior(Enum): + REPEAT_LAST_SAMPLE = 16062 #: Repeat the last sample. + RETURN_SENTINEL_VALUE = 16063 #: Return the sentinel value. + + +class SampleInputDataWhen(Enum): + HANDSHAKE_TRIGGER_ASSERTS = 12552 #: Latch data when the Handshake Trigger asserts. + HANDSHAKE_TRIGGER_DEASSERTS = 12553 #: Latch data when the Handshake Trigger deasserts. + + +class SampleTimingType(Enum): + SAMPLE_CLOCK = 10388 #: Acquire or generate samples on the specified edge of the sample clock. + BURST_HANDSHAKE = 12548 #: Determine sample timing using burst handshaking between the device and a peripheral device. + HANDSHAKE = 10389 #: Determine sample timing by using digital handshaking between the device and a peripheral device. + IMPLICIT = 10451 #: Configure only the duration of the task. + ON_DEMAND = 10390 #: Acquire or generate a sample on each read or write operation. This timing type is also referred to as static or software-timed. + CHANGE_DETECTION = 12504 #: Acquire samples when a change occurs in the state of one or more digital input lines. The lines must be contained within a digital input channel. + PIPELINED_SAMPLE_CLOCK = 14668 #: Device acquires or generates samples on each sample clock edge, but does not respond to certain triggers until a few sample clock edges later. Pipelining allows higher data transfer rates at the cost of increased trigger response latency. Refer to the device documentation for information about which triggers pipelining affects. This timing type allows handshaking with some devices using the Pause trigger, the Ready for Transfer event, or the Data Active event. Refer to the device documentation for more information. + + +class ScaleType(Enum): + LINEAR = 10447 #: Scale values by using the equation y=mx+b, where x is a prescaled value and y is a scaled value. + MAP_RANGES = 10448 #: Scale values proportionally from a range of pre-scaled values to a range of scaled values. + POLYNOMIAL = 10449 #: Scale values by using an Nth order polynomial equation. + TABLE = 10450 #: Map a list of pre-scaled values to a list of corresponding scaled values, with all other values scaled proportionally. + NONE = 10230 #: Do not scale electrical values to physical units. + TWO_POINT_LINEAR = 15898 #: You provide two pairs of electrical values and their corresponding physical values. NI-DAQmx uses those values to calculate the slope and y-intercept of a linear equation and uses that equation to scale electrical values to physical values. + + +class ScanRepeatMode(Enum): + FINITE = 10172 #: The task advances through the scan list one time only. NI-DAQmx ignores any Advance Triggers after completing the scan list. + CONTINUOUS = 10117 #: The task returns to the beginning of the scan list when it reaches the end of the scan list. + + +class Sense(Enum): + LOCAL = 16095 #: Local. + REMOTE = 16096 #: Remote. + + +class ShuntCalSelect(Enum): + A = 12513 #: Switch A. + B = 12514 #: Switch B. + AAND_B = 12515 #: Switches A and B. + + +class ShuntElementLocation(Enum): + R_1 = 12465 #: + R_2 = 12466 #: + R_3 = 12467 #: + R_4 = 14813 #: + NONE = 10230 #: + + +class ShuntResistorSelect(Enum): + A = 12513 #: A + B = 12514 #: B + + +class Signal(Enum): + AI_CONVERT_CLOCK = 12484 #: + TEN_M_HZ_REF_CLOCK = 12536 #: + TWENTY_M_HZ_TIMEBASE_CLOCK = 12486 #: + SAMPLE_CLOCK = 12487 #: Timed Loop executes on each active edge of the Sample Clock. + ADVANCE_TRIGGER = 12488 #: + REFERENCE_TRIGGER = 12490 #: + START_TRIGGER = 12491 #: + ADV_CMPLT_EVENT = 12492 #: + AI_HOLD_CMPLT_EVENT = 12493 #: + COUNTER_OUTPUT_EVENT = 12494 #: Timed Loop executes each time the Counter Output Event occurs. + CHANGE_DETECTION_EVENT = 12511 #: Timed Loop executes each time the Change Detection Event occurs. + WATCHDOG_TIMER_EXPIRED_EVENT = 12512 #: + SAMPLE_COMPLETE = 12530 #: Timed Loop executes each time the Sample Complete Event occurs. + + +class SignalModifiers(Enum): + DO_NOT_INVERT_POLARITY = 0 #: Do not invert polarity + INVERT_POLARITY = 1 #: Invert polarity + + +class Slope(Enum): + RISING = 10280 #: Trigger on the rising slope of the signal. + FALLING = 10171 #: Trigger on the falling slope of the signal. + + +class SoftwareTrigger(Enum): + ADVANCE_TRIGGER = 12488 #: Place holder enum to make editting internal enum easier. + + +class SoundPressureUnits(Enum): + PA = 10081 #: Pascals. + FROM_CUSTOM_SCALE = 10065 #: Units a custom scale specifies. If you select this value, you must specify a custom scale name. + + +class SourceSelection(Enum): + INTERNAL = 10200 #: Internal to the device. + EXTERNAL = 10167 #: External to the device. + + +class StrainGageBridgeType(Enum): + FULL_BRIDGE_I = 10183 #: Four active gages with two pairs subjected to equal and opposite strains. + FULL_BRIDGE_II = 10184 #: Four active gages with two aligned with maximum principal strain and two Poisson gages in adjacent arms. + FULL_BRIDGE_III = 10185 #: Four active gages with two aligned with maximum principal strain and two Poisson gages in opposite arms. + HALF_BRIDGE_I = 10188 #: Two active gages with one aligned with maximum principal strain and one Poisson gage. + HALF_BRIDGE_II = 10189 #: Two active gages with equal and opposite strains. + QUARTER_BRIDGE_I = 10271 #: Single active gage. + QUARTER_BRIDGE_II = 10272 #: Single active gage and one dummy gage. + + +class StrainGageRosetteMeasurementType(Enum): + PRINCIPAL_STRAIN_1 = 15971 #: The maximum tensile strain coplanar to the surface of the material under stress. + PRINCIPAL_STRAIN_2 = 15972 #: The minimum tensile strain coplanar to the surface of the material under stress. + PRINCIPAL_STRAIN_ANGLE = 15973 #: The angle at which the principal strains of the rosette occur. + CARTESIAN_STRAIN_X = 15974 #: The tensile strain coplanar to the surface of the material under stress in the X coordinate direction. + CARTESIAN_STRAIN_Y = 15975 #: The tensile strain coplanar to the surface of the material under stress in the Y coordinate direction. + CARTESIAN_SHEAR_STRAIN_XY = 15976 #: The tensile strain coplanar to the surface of the material under stress in the XY coordinate direction. + MAX_SHEAR_STRAIN = 15977 #: The maximum strain coplanar to the cross section of the material under stress. + MAX_SHEAR_STRAIN_ANGLE = 15978 #: The angle at which the maximum shear strain of the rosette occurs. + + +class StrainGageRosetteType(Enum): + RECTANGULAR = 15968 #: A rectangular rosette consists of three strain gages, each separated by a 45 degree angle. + DELTA = 15969 #: A delta rosette consists of three strain gages, each separated by a 60 degree angle. + TEE = 15970 #: A tee rosette consists of two gages oriented at 90 degrees with respect to each other. + + +class StrainUnits(Enum): + STRAIN = 10299 #: Strain. + FROM_CUSTOM_SCALE = 10065 #: Units a custom scale specifies. If you select this value, you must specify a custom scale name. + + +class SwitchChannelUsage(Enum): + SOURCE_CHANNEL = 10439 #: You can use the channel only as an input for a signal. + LOAD_CHANNEL = 10440 #: You can use the channel only as the output for a signal passing through the switch. + RESERVED_FOR_ROUTING_CHANNEL = 10441 #: You can use the channel only to complete routes within a switch. + + +class SyncType(Enum): + NONE = 10230 #: Disables trigger skew correction. + MASTER = 15888 #: Device is the source for shared clocks and triggers. + SLAVE = 15889 #: Device uses clocks and triggers from the master device. + + +class TEDSUnits(Enum): + FROM_CUSTOM_SCALE = 10065 #: Units a custom scale specifies. If you select this value, you must specify a custom scale name. + FROM_TEDS = 12516 #: Units defined by TEDS information associated with the channel. + + +class TaskMode(Enum): + TASK_START = 0 #: Start + TASK_STOP = 1 #: Stop + TASK_VERIFY = 2 #: Verify + TASK_COMMIT = 3 #: Commit + TASK_RESERVE = 4 #: Reserve + TASK_UNRESERVE = 5 #: Unreserve + TASK_ABORT = 6 #: Abort + + +class TaskStringFormat(Enum): + INI = 0 #: + TAB_DELIMITED = 1 #: + JSON = 2 #: + + +class TemperatureUnits(Enum): + DEG_C = 10143 #: Degrees Celsius. + DEG_F = 10144 #: Degrees Fahrenheit. + K = 10325 #: Kelvins. + DEG_R = 10145 #: Degrees Rankine. + FROM_CUSTOM_SCALE = 10065 #: Units a custom scale specifies. If you select this value, you must specify a custom scale name. + + +class TerminalConfiguration(Enum): + DEFAULT = -1 #: Default. + RSE = 10083 #: Referenced Single-Ended. + NRSE = 10078 #: Non-Referenced Single-Ended. + DIFFERENTIAL = 10106 #: Differential. + PSEUDODIFFERENTIAL = 12529 #: Pseudodifferential. + + +class ThermocoupleType(Enum): + J = 10072 #: J-type thermocouple. + K = 10073 #: K-type thermocouple. + N = 10077 #: N-type thermocouple. + R = 10082 #: R-type thermocouple. + S = 10085 #: S-type thermocouple. + T = 10086 #: T-type thermocouple. + B = 10047 #: B-type thermocouple. + E = 10055 #: E-type thermocouple. + + +class TimeUnits(Enum): + SECONDS = 10364 #: Seconds. + TICKS = 10304 #: Timebase ticks. + FROM_CUSTOM_SCALE = 10065 #: Units a custom scale specifies. If you select this value, you must specify a custom scale name. + + +class TorqueUnits(Enum): + NEWTON_METERS = 15881 #: Newton meters. + FOOT_POUNDS = 15884 #: Pound-feet. + INCH_POUNDS = 15883 #: Pound-inches. + INCH_OUNCES = 15882 #: Ounce-inches. + FROM_CUSTOM_SCALE = 10065 #: Units a custom scale specifies. If you select this value, you must specify a custom scale name. + + +class TriggerType(Enum): + NONE = 10230 #: Disable reference triggering for the task. + ANALOG_LEVEL = 10101 #: Pause the measurement or generation while an analog signal is above or below a level. + ANALOG_WINDOW = 10103 #: Trigger when an analog signal enters or leaves a range of values. + DIGITAL_EDGE = 10150 #: Trigger on a rising or falling edge of a digital pulse. + DIGITAL_LEVEL = 10152 #: Pause the measurement or generation while a digital signal is at either a high or low state. + DIGITAL_PATTERN = 10398 #: Pause the measurement or generation while digital physical channels either match or do not match a digital pattern. + SOFTWARE = 10292 #: Advance to the next entry in a scan list when you call DAQmx Send Software Trigger. + ANALOG_EDGE = 10099 #: Trigger when an analog signal crosses a threshold. + INTERLOCKED = 12549 #: Use the Handshake Trigger as a control signal for asynchronous handshaking, such as 8255 handshaking. + + +class TriggerUsage(Enum): + ADVANCE = 12488 #: Advance trigger. + PAUSE = 12489 #: Pause trigger. + REFERENCE = 12490 #: Reference trigger. + START = 12491 #: Start trigger. + HANDSHAKE = 10389 #: Handshake trigger. + ARM_START = 14641 #: Arm Start trigger. + + +class UnderflowBehavior(Enum): + HALT_OUTPUT_AND_ERROR = 14615 #: Stop generating samples and return an error. + AUSE_UNTIL_DATA_AVAILABLE = 14616 #: Pause the task until samples are available in the FIFO. + + +class UnitsPreScaled(Enum): + VOLTS = 10348 #: Volts. + AMPS = 10342 #: Amperes. + DEG_F = 10144 #: Degrees Fahrenheit. + DEG_C = 10143 #: Degrees Celsius. + DEG_R = 10145 #: Degrees Rankine. + K = 10325 #: Kelvins. + STRAIN = 10299 #: Strain. + OHMS = 10384 #: Ohms. + HERTZ = 10373 #: Hertz. + SECONDS = 10364 #: Seconds. + METERS = 10219 #: Meters. + INCHES = 10379 #: Inches. + DEGREES = 10146 #: Degrees. + RADIANS = 10273 #: Radians. + TICKS = 10304 #: Ticks. + RPM = 16080 #: Revolutions per minute. + RADIANS_PER_SECOND = 16081 #: Radians per second. + DEGREES_PER_SECOND = 16082 #: Degrees per second. + G = 10186 #: 1 g is approximately equal to 9.81 m/s/s. + METERS_PER_SECOND_SQUARED = 12470 #: Meters per second per second. + INCHES_PER_SECOND_SQUARED = 12471 #: Inches per second per second. + METERS_PER_SECOND = 15959 #: Meters per second. + INCHES_PER_SECOND = 15960 #: Inches per second. + PA = 10081 #: Pascals. + NEWTONS = 15875 #: Newtons. + POUNDS = 15876 #: Pounds. + KILOGRAM_FORCE = 15877 #: Kilograms-force. + BAR = 15880 #: Bar. + POUNDS_PER_SQ_INCH = 15879 #: Pounds per square inch. + NEWTON_METERS = 15881 #: Newton meters. + INCH_OUNCES = 15882 #: Ounce-inches. + INCH_POUNDS = 15883 #: Pound-inches. + FOOT_POUNDS = 15884 #: Pound-feet. + VOLTS_PER_VOLT = 15896 #: Volts per volt. + M_VOLTS_PER_VOLT = 15897 #: Millivolts per volt. + COULOMBS = 16102 #: Coulombs. + PICO_COULOMBS = 16103 #: PicoCoulombs. + FROM_TEDS = 12516 #: Units defined by TEDS information associated with the channel. + + +class UsageTypeAI(Enum): + VOLTAGE = 10322 #: Voltage measurement. + VOLTAGE_ACRMS = 10350 #: Voltage RMS measurement. + VOLTAGE_CUSTOM_WITH_EXCITATION = 10323 #: Voltage measurement with an excitation source. You can use this measurement type for custom sensors that require excitation, but you must use a custom scale to scale the measured voltage. + CURRENT = 10134 #: Current measurement. + CURRENT_ACRMS = 10351 #: Current RMS measurement. + FREQUENCY_VOLTAGE = 10181 #: Frequency measurement using a frequency to voltage converter. + RESISTANCE = 10278 #: Resistance measurement. + TEMPERATURE_THERMOCOUPLE = 10303 #: Temperature measurement using a thermocouple. + TEMPERATURE_THERMISTOR = 10302 #: Temperature measurement using a thermistor. + TEMPERATURE_BUILT_IN_SENSOR = 10311 #: Temperature measurement using a built-in sensor on a terminal block or device. On SCXI modules, for example, this could be the CJC sensor. + TEMPERATURE_RTD = 10301 #: Temperature measurement using an RTD. + POSITION_LINEAR_LVDT = 10352 #: Position measurement using an LVDT. + POSITION_ANGULAR_RVDT = 10353 #: Position measurement using an RVDT. + POSITION_EDDY_CURRENT_PROX_PROBE = 14835 #: Position measurement using an eddy current proximity probe. + SOUND_PRESSURE_MICROPHONE = 10354 #: Sound pressure measurement using a microphone. + STRAIN_STRAIN_GAGE = 10300 #: Strain measurement. + ROSETTE_STRAIN_GAGE = 15980 #: Strain measurement using a rosette strain gage. + ACCELERATION_ACCELEROMETER_CURRENT_INPUT = 10356 #: Acceleration measurement using an accelerometer. + ACCELERATION_CHARGE = 16104 #: Acceleration measurement using a charge-based sensor. + ACCELERATION_4_WIRE_DC_VOLTAGE = 16106 #: Acceleration measurement using a 4 wire DC voltage based sensor. + VELOCITY_IEPE_SENSOR = 15966 #: Velocity measurement using an IEPE Sensor. + FORCE_IEPE_SENSOR = 15895 #: Force measurement using an IEPE Sensor. + FORCE_BRIDGE = 15899 #: Force measurement using a bridge-based sensor. + BRIDGE = 15908 #: Measure voltage ratios from a Wheatstone bridge. + TORQUE_BRIDGE = 15905 #: Torque measurement using a bridge-based sensor. + PRESSURE_BRIDGE = 15902 #: Pressure measurement using a bridge-based sensor. + TEDS = 12531 #: Measurement type defined by TEDS. + CHARGE = 16105 #: Charge measurement. + + +class UsageTypeAO(Enum): + VOLTAGE = 10322 #: Voltage generation. + CURRENT = 10134 #: Current generation. + FUNCTION_GENERATION = 14750 #: Function generation. + + +class UsageTypeCI(Enum): + FREQUENCY = 10179 #: Measure the frequency of a digital signal. + PERIOD = 10256 #: Measure the period of a digital signal. + PULSE_WIDTH_DIGITAL = 10359 #: Measure the width of a pulse of a digital signal. + PULSE_WIDTH_DIGITAL_TWO_EDGE_SEPARATION = 10267 #: Measure time between edges of two digital signals. + PULSE_WIDTH_DIGITAL_SEMI_PERIOD = 10289 #: Measure the time between state transitions of a digital signal. + PULSE_FREQ = 15864 #: Pulse measurement, returning the result as frequency and duty cycle. + PULSE_TIME = 15865 #: Pulse measurement, returning the result as high time and low time. + PULSE_TICKS = 15866 #: Pulse measurement, returning the result as high ticks and low ticks. + COUNT_EDGES = 10125 #: Count edges of a digital signal. + POSITION_ANGULAR_ENCODER = 10360 #: Angular position measurement using an angular encoder. + POSITION_LINEAR_ENCODER = 10361 #: Linear position measurement using a linear encoder. + TIME_GPS = 10362 #: Timestamp measurement, synchronizing the counter to a GPS receiver. + DUTY_CYCLE = 16070 #: Measure the duty cycle of a digital signal. + VELOCITY_ANGULAR_ENCODER = 16078 #: Angular velocity measurement using an angular encoder. + VELOCITY_LINEAR_ENCODER = 16079 #: Linear velocity measurement using a linear encoder. + + +class UsageTypeCO(Enum): + PULSE_TIME = 10269 #: Generate pulses defined by the time the pulse is at a low state and the time the pulse is at a high state. + PULSE_FREQUENCY = 10119 #: Generate digital pulses defined by frequency and duty cycle. + PULSE_TICKS = 10268 #: Generate digital pulses defined by the number of timebase ticks that the pulse is at a low state and the number of timebase ticks that the pulse is at a high state. + + +class VelocityIEPESensorSensitivityUnits(Enum): + M_VOLTS_PER_MILLIMETER_PER_SECOND = 15963 #: Millivolts per millimeter per second. + M_VOLTS_PER_INCH_PER_SECOND = 15964 #: Millivolts per inch per second. + + +class VelocityUnits(Enum): + METERS_PER_SECOND = 15959 #: Meters per second. + INCHES_PER_SECOND = 15960 #: Inches per second. + FROM_CUSTOM_SCALE = 10065 #: Units a custom scale specifies. If you select this value, you must specify a custom scale name. + + +class VoltageUnits(Enum): + VOLTS = 10348 #: Volts. + FROM_CUSTOM_SCALE = 10065 #: Units a custom scale specifies. If you select this value, you must specify a custom scale name. + FROM_TEDS = 12516 #: Units defined by TEDS information associated with the channel. + + +class WDTTaskAction(Enum): + RESET_TIMER = 0 #: Reset Timer + CLEAR_EXPIRATION = 1 #: Clear Expiration + + +class WaitMode(Enum): + WAIT_FOR_INTERRUPT = 12523 #: Check for available samples when the system receives an interrupt service request. This mode is the most CPU efficient, but results in lower possible sampling rates. + POLL = 12524 #: Repeatedly check for available samples as fast as possible. This mode allows for the highest sampling rates at the expense of CPU efficiency. + YIELD = 12525 #: Repeatedly check for available samples, but yield control to other threads after each check. This mode offers a balance between sampling rate and CPU efficiency. + SLEEP = 12547 #: Check for available samples once per the amount of time specified in **sleep_time**. + + +class WatchdogAOExpirState(Enum): + VOLTAGE = 10322 #: Voltage output. + CURRENT = 10134 #: Current output. + NO_CHANGE = 10160 #: Expiration does not affect the port. Do not change the state of any lines in the port, and do not lock the port. + + +class WatchdogCOExpirState(Enum): + LOW = 10214 #: Low logic. + HIGH = 10192 #: High logic. + NO_CHANGE = 10160 #: Expiration does not affect the state of the counter output. The channels retain their states at the time of the watchdog timer expiration, and no further counter generation runs. + + +class WaveformAttributes(Enum): + SAMPLES_ONLY = 10287 #: Return only samples. + SAMPLES_AND_TIMING = 10140 #: Return the samples and timing information. + SAMPLES_TIMING_AND_ATTRIBUTES = 10141 #: Return the samples, timing information, and other attributes, such as the name of the channel. + + +class WindowTriggerCondition1(Enum): + ENTERING_WINDOW = 10163 #: Trigger when the signal enters the window. + LEAVING_WINDOW = 10208 #: Trigger when the signal leaves the window. + + +class WindowTriggerCondition2(Enum): + INSIDE_WINDOW = 10199 #: Pause the measurement or generation while the trigger is inside the window. + OUTSIDE_WINDOW = 10251 #: Pause the measurement or generation while the signal is outside the window. + + +class WriteBasicTEDSOptions(Enum): + WRITE_TO_EEPROM = 12538 #: blah + WRITE_TO_PROM = 12539 #: blah + DO_NOT_WRITE = 12540 #: blah + + +class WriteRelativeTo(Enum): + FIRST_SAMPLE = 10424 #: Write samples relative to the first sample. + CURRENT_WRITE_POSITION = 10430 #: Write samples relative to the current position in the buffer. + + +class _Callback(Enum): + SYNCHRONOUS_EVENT_CALLBACKS = 1 #: Synchronous callbacks + + +class _CouplingTypes(Enum): + AC = 1 #: Device supports AC coupling + DC = 2 #: Device supports DC coupling + GND = 4 #: Device supports ground coupling + HF_REJECT = 8 #: Device supports High Frequency Reject coupling + LF_REJECT = 16 #: Device supports Low Frequency Reject coupling + NOISE_REJECT = 32 #: Device supports Noise Reject coupling + + +class _Save(Enum): + OVERWRITE = 1 #: + ALLOW_INTERACTIVE_EDITING = 2 #: + ALLOW_INTERACTIVE_DELETION = 4 #: + + +class _TermCfg(Enum): + RSE = 1 #: RSE terminal configuration + NRSE = 2 #: NRSE terminal configuration + DIFFERENTIAL = 4 #: Differential terminal configuration + PSEUDODIFFERENTIAL = 8 #: Pseudodifferential terminal configuration + + +class _TriggerUsageTypes(Enum): + ADVANCE = 1 #: Device supports advance triggers + PAUSE = 2 #: Device supports pause triggers + REFERENCE = 4 #: Device supports reference triggers + START = 8 #: Device supports start triggers + HANDSHAKE = 16 #: Device supports handshake triggers + ARM_START = 32 #: Device supports arm start triggers diff --git a/nidaqmx/error_codes.py b/nidaqmx/error_codes.py new file mode 100644 index 00000000..d4b5ec58 --- /dev/null +++ b/nidaqmx/error_codes.py @@ -0,0 +1,1944 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +from enum import Enum + +__all__ = ['DAQmxErrors', 'DAQmxWarnings'] + + +class DAQmxErrors(Enum): + TRIG_WIN_TIMEOUT_EXPIRED = -209832 + INVALID_TRIGGER_CFG_FOR_DEVICE = -209831 + INVALID_DATA_TRANSFER_MECHANISM_FOR_DEVICE = -209830 + INPUT_FIFO_OVERFLOW_3 = -209829 + TOO_MANY_DEVICES_FOR_ANALOG_MULTI_EDGE_TRIG_CDAQ = -209828 + TOO_MANY_TRIGGERS_TYPES_SPECIFIED_IN_TASK = -209827 + MISMATCHED_MULTI_TRIGGER_CONFIG_VALUES = -209826 + INCONSISTENT_AO_DAC_RANGE_ACROSS_TASKS = -209825 + INCONSISTENT_DT_TO_WRITE = -209824 + FUNCTION_OBSOLETE = -209823 + NEGATIVE_DURATION_NOT_SUPPORTED = -209822 + DURATION_TOO_SMALL = -209821 + DURATION_TOO_LONG = -209820 + DURATION_BASED_NOT_SUPPORTED_FOR_SPECIFIED_TIMING_MODE = -209819 + INVALID_LED_STATE = -209818 + WATCHDOG_STATES_NOT_UNIFORM = -209817 + SELF_TEST_FAILED_POWER_SUPPLY_OUT_OF_TOLERANCE = -209816 + HWTSP_MULTI_SAMPLE_WRITE = -209815 + ONBOARD_REGEN_EXCEEDS_CHANNEL_LIMIT = -209814 + WATCHDOG_CHANNEL_EXPIRATION_STATE_NOT_SPECIFIED = -209813 + INVALID_SHUNT_SOURCE_FOR_CALIBRATION = -209812 + INVALID_SHUNT_SELECT_FOR_CALIBRATION = -209811 + INVALID_SHUNT_CALIBRATION_CONFIGURATION = -209810 + BUFFERED_OPERATIONS_NOT_SUPPORTED_ON_CHANNEL_STANDALONE = -209809 + FEATURE_NOT_AVAILABLE_ON_ACCESSORY = -209808 + INCONSISTENT_THRESH_VOLTAGE_ACROSS_TERMINALS = -209807 + DA_QMX_IS_NOT_INSTALLED_ON_TARGET = -209806 + CO_CANNOT_KEEP_UP_IN_HW_TIMED_SINGLE_POINT = -209805 + WAIT_FOR_NEXT_SAMP_CLK_DETECTED_3_OR_MORE_SAMP_CLKS = -209803 + WAIT_FOR_NEXT_SAMP_CLK_DETECTED_MISSED_SAMP_CLK = -209802 + WRITE_NOT_COMPLETE_BEFORE_SAMP_CLK = -209801 + READ_NOT_COMPLETE_BEFORE_SAMP_CLK = -209800 + INCONSISTENT_DIGITAL_FILTERING_ACROSS_TERMINALS = -201510 + INCONSISTENT_PULL_UP_CFG_ACROSS_TERMINALS = -201509 + INCONSISTENT_TERM_CFG_ACROSS_TERMINALS = -201508 + VCXO_DCM_BECAME_UNLOCKED = -201507 + PLL_DAC_UPDATE_FAILED = -201506 + NO_CABLED_DEVICE = -201505 + LOST_REF_CLK = -201504 + CANT_USE_AI_TIMING_ENGINE_WITH_COUNTERS = -201503 + DAC_OFFSET_VAL_NOT_SET = -201502 + CAL_ADJUST_REF_VAL_OUT_OF_RANGE = -201501 + CHANS_FOR_CAL_ADJUST_MUST_PERFORM_SET_CONTEXT = -201500 + GET_CAL_DATA_INVALID_FOR_CAL_MODE = -201499 + NO_IEPE_WITH_AC_NOT_ALLOWED = -201498 + SETUP_CAL_NEEDED_BEFORE_GET_CAL_DATA_POINTS = -201497 + VOLTAGE_NOT_CALIBRATED = -201496 + MISSING_RANGE_FOR_CALIBRATION = -201495 + MULTIPLE_CHANS_NOT_SUPPORTED_DURING_CAL_ADJUST = -201494 + SHUNT_CAL_FAILED_OUT_OF_RANGE = -201493 + OPERATION_NOT_SUPPORTED_ON_SIMULATED_DEVICE = -201492 + FIRMWARE_VERSION_SAME_AS_INSTALLED_VERSION = -201491 + FIRMWARE_VERSION_OLDER_THAN_INSTALLED_VERSION = -201490 + FIRMWARE_UPDATE_INVALID_STATE = -201489 + FIRMWARE_UPDATE_INVALID_ID = -201488 + FIRMWARE_UPDATE_AUTOMATIC_MANAGEMENT_ENABLED = -201487 + SETUP_CALIBRATION_NOT_CALLED = -201486 + CAL_MEASURED_DATA_SIZE_VS_ACTUAL_DATA_SIZE_MISMATCH = -201485 + CDAQ_MISSING_DSA_MASTER_FOR_CHAN_EXPANSION = -201484 + CDAQ_MASTER_NOT_FOUND_FOR_CHAN_EXPANSION = -201483 + ALL_CHANS_SHOULD_BE_PROVIDED_FOR_CALIBRATION = -201482 + MUST_SPECIFY_EXPIRATION_STATE_FOR_ALL_LINES_IN_RANGE = -201481 + OPEN_SESSION_EXISTS = -201480 + CANNOT_QUERY_TERMINAL_FOR_SW_ARM_START = -201479 + CHASSIS_WATCHDOG_TIMER_EXPIRED = -201478 + CANT_RESERVE_WATCHDOG_TASK_WHILE_OTHER_TASKS_RESERVED = -201477 + CANT_RESERVE_TASK_WHILE_WATCHDOG_TASK_RESERVING = -201476 + AUX_POWER_SOURCE_REQUIRED = -201475 + DEVICE_NOT_SUPPORTED_ON_LOCAL_SYSTEM = -201474 + ONE_TIMESTAMP_CHANNEL_REQUIRED_FOR_COMBINED_NAVIGATION_READ = -201472 + MULT_DEVS_MULT_PHYS_CHANS = -201471 + INVALID_CAL_ADJUSTMENT_POINT_VALUES = -201470 + DIFFERENT_DIGITIZER_FROM_COMMUNICATOR = -201469 + CDAQ_SYNC_MASTER_CLOCK_NOT_PRESENT = -201468 + ASSOCIATED_CHANS_HAVE_CONFLICTING_PROPS = -201467 + AUTO_CONFIG_BETWEEN_MULTIPLE_DEVICE_STATES_INVALID = -201466 + AUTO_CONFIG_OF_OFFLINE_DEVICES_INVALID = -201465 + EXTERNAL_FIFO_FAULT = -201464 + CONNECTIONS_NOT_RECIPROCAL = -201463 + INVALID_OUTPUT_TO_INPUT_CDAQ_SYNC_CONNECTION = -201462 + REFERENCE_CLOCK_NOT_PRESENT = -201461 + BLANK_STRING_EXPANSION_FOUND_NO_SUPPORTED_CDAQ_SYNC_CONNECTION_DEVICES = -201460 + NO_DEVICES_SUPPORT_CDAQ_SYNC_CONNECTIONS = -201459 + INVALID_CDAQ_SYNC_TIMEOUT_VALUE = -201458 + CDAQ_SYNC_CONNECTION_TO_SAME_PORT = -201457 + DEVS_WITHOUT_COMMON_SYNC_CONNECTION_STRATEGY = -201456 + NO_CDAQ_SYNC_BETWEEN_PHYS_AND_SIMULATED_DEVS = -201455 + UNABLE_TO_CONTAIN_CARDS = -201454 + FIND_DISCONNECTED_BETWEEN_PHYS_AND_SIM_DEVICE_STATES_INVALID = -201453 + OPERATION_ABORTED = -201452 + TWO_PORTS_REQUIRED = -201451 + DEVICE_DOES_NOT_SUPPORT_CDAQ_SYNC_CONNECTIONS = -201450 + INVALIDC_DAQ_SYNC_PORT_CONNECTION_FORMAT = -201449 + ROSETTE_MEASUREMENTS_NOT_SPECIFIED = -201448 + INVALID_NUM_OF_PHYS_CHANS_FOR_DELTA_ROSETTE = -201447 + INVALID_NUM_OF_PHYS_CHANS_FOR_TEE_ROSETTE = -201446 + ROSETTE_STRAIN_CHAN_NAMES_NEEDED = -201445 + MULTIDEVICE_WITH_ON_DEMAND_TIMING = -201444 + FREQOUT_CANNOT_PRODUCE_DESIRED_FREQUENCY_3 = -201443 + TWO_EDGE_SEPARATION_SAME_TERMINAL_SAME_EDGE = -201442 + DONT_MIX_SYNC_PULSE_AND_SAMP_CLK_TIMEBASE_ON_449_X = -201441 + NEITHER_REF_CLK_NOR_SAMP_CLK_TIMEBASE_CONFIGURED_FOR_DSA_SYNC = -201440 + RETRIGGERING_FINITE_CO_NOT_ALLOWED = -201439 + DEVICE_REBOOTED_FROM_WDT_TIMEOUT = -201438 + TIMEOUT_VALUE_EXCEEDS_MAXIMUM = -201437 + SHARING_DIFFERENT_WIRE_MODES = -201436 + CANT_PRIME_WITH_EMPTY_BUFFER = -201435 + CONFIG_FAILED_BECAUSE_WATCHDOG_EXPIRED = -201434 + WRITE_FAILED_BECAUSE_WATCHDOG_CHANGED_LINE_DIRECTION = -201433 + MULTIPLE_SUBSYTEM_CALIBRATION = -201432 + INCORRECT_CHANNEL_FOR_OFFSET_ADJUSTMENT = -201431 + INVALID_NUM_REF_VOLTAGES_TO_WRITE = -201430 + START_TRIG_DELAY_WITH_DSA_MODULE = -201429 + MORE_THAN_ONE_SYNC_PULSE_DETECTED = -201428 + DEV_NOT_SUPPORTED_WITHIN_DA_QMX_API = -201427 + DEVS_WITHOUT_SYNC_STRATEGIES = -201426 + DEVS_WITHOUT_COMMON_SYNC_STRATEGY = -201425 + SYNC_STRATEGIES_CANNOT_SYNC = -201424 + CHASSIS_COMMUNICATION_INTERRUPTED = -201423 + UNKNOWN_CARD_POWER_PROFILE_IN_CARRIER = -201422 + ATTR_NOT_SUPPORTED_ON_ACCESSORY = -201421 + NETWORK_DEVICE_RESERVED_BY_ANOTHER_HOST = -201420 + INCORRECT_FIRMWARE_FILE_UPLOADED = -201419 + INVALID_FIRMWARE_FILE_UPLOADED = -201418 + IN_TIMER_TIMEOUT_ON_ARM = -201417 + CANT_EXCEED_SLOT_RELAY_DRIVE_LIMIT = -201416 + MODULE_UNSUPPORTED_FOR_9163 = -201415 + CONNECTIONS_NOT_SUPPORTED = -201414 + ACCESSORY_NOT_PRESENT = -201413 + SPECIFIED_ACCESSORY_CHANNELS_NOT_PRESENT_ON_DEVICE = -201412 + CONNECTIONS_NOT_SUPPORTED_ON_ACCESSORY = -201411 + RATE_TOO_FAST_FOR_HWTSP = -201410 + DELAY_FROM_SAMPLE_CLOCK_OUT_OF_RANGE_FOR_HWTSP = -201409 + AVERAGING_WHEN_NOT_INTERNAL_HWTSP = -201408 + ATTRIBUTE_NOT_SUPPORTED_UNLESS_HWTSP = -201407 + FIVE_VOLT_DETECT_FAILED = -201406 + ANALOG_BUS_STATE_INCONSISTENT = -201405 + CARD_DETECTED_DOES_NOT_MATCH_EXPECTED_CARD = -201404 + LOGGING_START_NEW_FILE_NOT_CALLED = -201403 + LOGGING_SAMPS_PER_FILE_NOT_DIVISIBLE = -201402 + RETRIEVING_NETWORK_DEVICE_PROPERTIES = -201401 + FILE_PREALLOCATION_FAILED = -201400 + MODULE_MISMATCH_IN_SAME_TIMED_TASK = -201399 + INVALID_ATTRIBUTE_VALUE_POSSIBLY_DUE_TO_OTHER_ATTRIBUTE_VALUES = -201398 + CHANGE_DETECTION_STOPPED_TO_PREVENT_DEVICE_HANG = -201397 + FILTER_DELAY_REMOVAL_NOT_POSSSIBLE_WITH_ANALOG_TRIGGER = -201396 + NONBUFFERED_OR_NO_CHANNELS = -201395 + TRISTATE_LOGIC_LEVEL_NOT_SPECD_FOR_ENTIRE_PORT = -201394 + TRISTATE_LOGIC_LEVEL_NOT_SUPPORTED_ON_DIG_OUT_CHAN = -201393 + TRISTATE_LOGIC_LEVEL_NOT_SUPPORTED = -201392 + INCOMPLETE_GAIN_AND_COUPLING_CAL_ADJUSTMENT = -201391 + NETWORK_STATUS_CONNECTION_LOST = -201390 + MODULE_CHANGE_DURING_CONNECTION_LOSS = -201389 + NETWORK_DEVICE_NOT_RESERVED_BY_HOST = -201388 + DUPLICATE_CALIBRATION_ADJUSTMENT_INPUT = -201387 + SELF_CAL_FAILED_CONTACT_TECH_SUPPORT = -201386 + SELF_CAL_FAILED_TO_CONVERGE = -201385 + UNSUPPORTED_SIMULATED_MODULE_FOR_SIMULATED_CHASSIS = -201384 + LOGGING_WRITE_SIZE_TOO_BIG = -201383 + LOGGING_WRITE_SIZE_NOT_DIVISIBLE = -201382 + MY_DAQ_POWER_RAIL_FAULT = -201381 + DEVICE_DOES_NOT_SUPPORT_THIS_OPERATION = -201380 + NETWORK_DEVICES_NOT_SUPPORTED_ON_THIS_PLATFORM = -201379 + UNKNOWN_FIRMWARE_VERSION = -201378 + FIRMWARE_IS_UPDATING = -201377 + ACCESSORY_EEPROM_IS_CORRUPT = -201376 + THRMCPL_LEAD_OFFSET_NULLING_CAL_NOT_SUPPORTED = -201375 + SELF_CAL_FAILED_TRY_EXT_CAL = -201374 + OUTPUT_P_2_P_NOT_SUPPORTED_WITH_MULTITHREADED_SCRIPTS = -201373 + THRMCPL_CALIBRATION_CHANNELS_OPEN = -201372 + MDNS_SERVICE_INSTANCE_ALREADY_IN_USE = -201371 + IP_ADDRESS_ALREADY_IN_USE = -201370 + HOSTNAME_ALREADY_IN_USE = -201369 + INVALID_NUMBER_OF_CAL_ADJUSTMENT_POINTS = -201368 + FILTER_OR_DIGITAL_SYNC_INTERNAL_SIGNAL = -201367 + BAD_DDS_SOURCE = -201366 + ONBOARD_REGEN_WITH_MORE_THAN_16_CHANNELS = -201365 + TRIGGER_TOO_FAST = -201364 + MIN_MAX_OUTSIDE_TABLE_RANGE = -201363 + CHANNEL_EXPANSION_WITH_INVALID_ANALOG_TRIGGER_DEVICE = -201362 + SYNC_PULSE_SRC_INVALID_FOR_TASK = -201361 + INVALID_CARRIER_SLOT_NUMBER_SPECD = -201360 + CARDS_MUST_BE_IN_SAME_CARRIER = -201359 + CARD_DEV_CARRIER_SIM_MUST_MATCH = -201358 + DEV_MUST_HAVE_AT_LEAST_ONE_CARD = -201357 + CARD_TOPOLOGY_ERROR = -201356 + EXCEEDED_CARRIER_POWER_LIMIT = -201355 + CARDS_INCOMPATIBLE = -201354 + ANALOG_BUS_NOT_VALID = -201353 + RESERVATION_CONFLICT = -201352 + MEM_MAPPED_ON_DEMAND_NOT_SUPPORTED = -201351 + SLAVE_WITH_NO_START_TRIGGER_CONFIGURED = -201350 + CHANNEL_EXPANSION_WITH_DIFFERENT_TRIGGER_DEVICES = -201349 + COUNTER_SYNC_AND_RETRIGGERED = -201348 + NO_EXTERNAL_SYNC_PULSE_DETECTED = -201347 + SLAVE_AND_NO_EXTERNAL_SYNC_PULSE = -201346 + CUSTOM_TIMING_REQUIRED_FOR_ATTRIBUTE = -201345 + CUSTOM_TIMING_MODE_NOT_SET = -201344 + ACCESSORY_POWER_TRIPPED = -201343 + UNSUPPORTED_ACCESSORY = -201342 + INVALID_ACCESSORY_CHANGE = -201341 + FIRMWARE_REQUIRES_UPGRADE = -201340 + FAST_EXTERNAL_TIMEBASE_NOT_SUPPORTED_FOR_DEVICE = -201339 + INVALID_SHUNT_LOCATION_FOR_CALIBRATION = -201338 + DEVICE_NAME_TOO_LONG = -201337 + BRIDGE_SCALES_UNSUPPORTED = -201336 + MISMATCHED_ELEC_PHYS_VALUES = -201335 + LINEAR_REQUIRES_UNIQUE_POINTS = -201334 + MISSING_REQUIRED_SCALING_PARAMETER = -201333 + LOGGING_NOT_SUPPORT_ON_OUTPUT_TASKS = -201332 + MEMORY_MAPPED_HARDWARE_TIMED_NON_BUFFERED_UNSUPPORTED = -201331 + CANNOT_UPDATE_PULSE_TRAIN_WITH_AUTO_INCREMENT_ENABLED = -201330 + HW_TIMED_SINGLE_POINT_AND_DATA_XFER_NOT_DMA = -201329 + SCC_SECOND_STAGE_EMPTY = -201328 + SCC_INVALID_DUAL_STAGE_COMBO = -201327 + SCC_INVALID_SECOND_STAGE = -201326 + SCC_INVALID_FIRST_STAGE = -201325 + COUNTER_MULTIPLE_SAMPLE_CLOCKED_CHANNELS = -201324 + TWO_COUNTER_MEASUREMENT_MODE_AND_SAMPLE_CLOCKED = -201323 + CANT_HAVE_BOTH_MEM_MAPPED_AND_NON_MEM_MAPPED_TASKS = -201322 + MEM_MAPPED_DATA_READ_BY_ANOTHER_PROCESS = -201321 + RETRIGGERING_INVALID_FOR_GIVEN_SETTINGS = -201320 + AI_OVERRUN = -201319 + CO_OVERRUN = -201318 + COUNTER_MULTIPLE_BUFFERED_CHANNELS = -201317 + INVALID_TIMEBASE_FOR_COHWTSP = -201316 + WRITE_BEFORE_EVENT = -201315 + CI_OVERRUN = -201314 + COUNTER_NON_RESPONSIVE_AND_RESET = -201313 + MEAS_TYPE_OR_CHANNEL_NOT_SUPPORTED_FOR_LOGGING = -201312 + FILE_ALREADY_OPENED_FOR_WRITE = -201311 + TDMS_NOT_FOUND = -201310 + GENERIC_FILE_IO = -201309 + FINITE_STC_COUNTER_NOT_SUPPORTED_FOR_LOGGING = -201308 + MEASUREMENT_TYPE_NOT_SUPPORTED_FOR_LOGGING = -201307 + FILE_ALREADY_OPENED = -201306 + DISK_FULL = -201305 + FILE_PATH_INVALID = -201304 + FILE_VERSION_MISMATCH = -201303 + FILE_WRITE_PROTECTED = -201302 + READ_NOT_SUPPORTED_FOR_LOGGING_MODE = -201301 + ATTRIBUTE_NOT_SUPPORTED_WHEN_LOGGING = -201300 + LOGGING_MODE_NOT_SUPPORTED_NON_BUFFERED = -201299 + PROPERTY_NOT_SUPPORTED_WITH_CONFLICTING_PROPERTY = -201298 + PARALLEL_SSH_ON_CONNECTOR_1 = -201297 + CO_ONLY_IMPLICIT_SAMPLE_TIMING_TYPE_SUPPORTED = -201296 + CALIBRATION_FAILED_AO_OUT_OF_RANGE = -201295 + CALIBRATION_FAILED_AI_OUT_OF_RANGE = -201294 + CAL_PWM_LINEARITY_FAILED = -201293 + OVERRUN_UNDERFLOW_CONFIGURATION_COMBO = -201292 + CANNOT_WRITE_TO_FINITE_CO_TASK = -201291 + NETWORK_DAQ_INVALID_WEP_KEY_LENGTH = -201290 + CAL_INPUTS_SHORTED_NOT_SUPPORTED = -201289 + CANNOT_SET_PROPERTY_WHEN_TASK_IS_RESERVED = -201288 + MINUS_12_V_FUSE_BLOWN = -201287 + PLUS_12_V_FUSE_BLOWN = -201286 + PLUS_5_V_FUSE_BLOWN = -201285 + PLUS_3_V_FUSE_BLOWN = -201284 + DEVICE_SERIAL_PORT_ERROR = -201283 + POWER_UP_STATE_MACHINE_NOT_DONE = -201282 + TOO_MANY_TRIGGERS_SPECIFIED_IN_TASK = -201281 + VERTICAL_OFFSET_NOT_SUPPORTED_ON_DEVICE = -201280 + INVALID_COUPLING_FOR_MEASUREMENT_TYPE = -201279 + DIGITAL_LINE_UPDATE_TOO_FAST_FOR_DEVICE = -201278 + CERTIFICATE_IS_TOO_BIG_TO_TRANSFER = -201277 + ONLY_PEM_OR_DER_CERTITICATES_ACCEPTED = -201276 + CAL_COUPLING_NOT_SUPPORTED = -201275 + DEVICE_NOT_SUPPORTED_IN_64_BIT = -201274 + NETWORK_DEVICE_IN_USE = -201273 + INVALID_IPV_4_ADDRESS_FORMAT = -201272 + NETWORK_PRODUCT_TYPE_MISMATCH = -201271 + ONLY_PEM_CERTIFICATES_ACCEPTED = -201270 + CALIBRATION_REQUIRES_PROTOTYPING_BOARD_ENABLED = -201269 + ALL_CURRENT_LIMITING_RESOURCES_ALREADY_TAKEN = -201268 + USER_DEF_INFO_STRING_BAD_LENGTH = -201267 + PROPERTY_NOT_FOUND = -201266 + OVER_VOLTAGE_PROTECTION_ACTIVATED = -201265 + SCALED_IQ_WAVEFORM_TOO_LARGE = -201264 + FIRMWARE_FAILED_TO_DOWNLOAD = -201263 + PROPERTY_NOT_SUPPORTED_FOR_BUS_TYPE = -201262 + CHANGE_RATE_WHILE_RUNNING_COULD_NOT_BE_COMPLETED = -201261 + CANNOT_QUERY_MANUAL_CONTROL_ATTRIBUTE = -201260 + INVALID_NETWORK_CONFIGURATION = -201259 + INVALID_WIRELESS_CONFIGURATION = -201258 + INVALID_WIRELESS_COUNTRY_CODE = -201257 + INVALID_WIRELESS_CHANNEL = -201256 + NETWORK_EEPROM_HAS_CHANGED = -201255 + NETWORK_SERIAL_NUMBER_MISMATCH = -201254 + NETWORK_STATUS_DOWN = -201253 + NETWORK_TARGET_UNREACHABLE = -201252 + NETWORK_TARGET_NOT_FOUND = -201251 + NETWORK_STATUS_TIMED_OUT = -201250 + INVALID_WIRELESS_SECURITY_SELECTION = -201249 + NETWORK_DEVICE_CONFIGURATION_LOCKED = -201248 + NETWORK_DAQ_DEVICE_NOT_SUPPORTED = -201247 + NETWORK_DAQ_CANNOT_CREATE_EMPTY_SLEEVE = -201246 + USER_DEF_INFO_STRING_TOO_LONG = -201245 + MODULE_TYPE_DOES_NOT_MATCH_MODULE_TYPE_IN_DESTINATION = -201244 + INVALID_TEDS_INTERFACE_ADDRESS = -201243 + DEV_DOES_NOT_SUPPORT_SCXI_COMM = -201242 + SCXI_COMM_DEV_CONNECTOR_0_MUST_BE_CABLED_TO_MODULE = -201241 + SCXI_MODULE_DOES_NOT_SUPPORT_DIGITIZATION_MODE = -201240 + DEV_DOES_NOT_SUPPORT_MULTIPLEXED_SCXI_DIGITIZATION_MODE = -201239 + DEV_OR_DEV_PHYS_CHAN_DOES_NOT_SUPPORT_SCXI_DIGITIZATION = -201238 + INVALID_PHYS_CHAN_NAME = -201237 + SCXI_CHASSIS_COMM_MODE_INVALID = -201236 + REQUIRED_DEPENDENCY_NOT_FOUND = -201235 + INVALID_STORAGE = -201234 + INVALID_OBJECT = -201233 + STORAGE_ALTERED_PRIOR_TO_SAVE = -201232 + TASK_DOES_NOT_REFERENCE_LOCAL_CHANNEL = -201231 + REFERENCED_DEV_SIM_MUST_MATCH_TARGET = -201230 + PROGRAMMED_IO_FAILS_BECAUSE_OF_WATCHDOG_TIMER = -201229 + WATCHDOG_TIMER_FAILS_BECAUSE_OF_PROGRAMMED_IO = -201228 + CANT_USE_THIS_TIMING_ENGINE_WITH_A_PORT = -201227 + PROGRAMMED_IO_CONFLICT = -201226 + CHANGE_DETECTION_INCOMPATIBLE_WITH_PROGRAMMED_IO = -201225 + TRISTATE_NOT_ENOUGH_LINES = -201224 + TRISTATE_CONFLICT = -201223 + GENERATE_OR_FINITE_WAIT_EXPECTED_BEFORE_BREAK_BLOCK = -201222 + BREAK_BLOCK_NOT_ALLOWED_IN_LOOP = -201221 + CLEAR_TRIGGER_NOT_ALLOWED_IN_BREAK_BLOCK = -201220 + NESTING_NOT_ALLOWED_IN_BREAK_BLOCK = -201219 + IF_ELSE_BLOCK_NOT_ALLOWED_IN_BREAK_BLOCK = -201218 + REPEAT_UNTIL_TRIGGER_LOOP_NOT_ALLOWED_IN_BREAK_BLOCK = -201217 + WAIT_UNTIL_TRIGGER_NOT_ALLOWED_IN_BREAK_BLOCK = -201216 + MARKER_POS_INVALID_IN_BREAK_BLOCK = -201215 + INVALID_WAIT_DURATION_IN_BREAK_BLOCK = -201214 + INVALID_SUBSET_LENGTH_IN_BREAK_BLOCK = -201213 + INVALID_WAVEFORM_LENGTH_IN_BREAK_BLOCK = -201212 + INVALID_WAIT_DURATION_BEFORE_BREAK_BLOCK = -201211 + INVALID_SUBSET_LENGTH_BEFORE_BREAK_BLOCK = -201210 + INVALID_WAVEFORM_LENGTH_BEFORE_BREAK_BLOCK = -201209 + SAMPLE_RATE_TOO_HIGH_FOR_ADC_TIMING_MODE = -201208 + ACTIVE_DEV_NOT_SUPPORTED_WITH_MULTI_DEV_TASK = -201207 + REAL_DEV_AND_SIM_DEV_NOT_SUPPORTED_IN_SAME_TASK = -201206 + RTSI_SIM_MUST_MATCH_DEV_SIM = -201205 + BRIDGE_SHUNT_CA_NOT_SUPPORTED = -201204 + STRAIN_SHUNT_CA_NOT_SUPPORTED = -201203 + GAIN_TOO_LARGE_FOR_GAIN_CAL_CONST = -201202 + OFFSET_TOO_LARGE_FOR_OFFSET_CAL_CONST = -201201 + ELVIS_PROTOTYPING_BOARD_REMOVED = -201200 + ELVIS_2_POWER_RAIL_FAULT = -201199 + ELVIS_2_PHYSICAL_CHANS_FAULT = -201198 + ELVIS_2_PHYSICAL_CHANS_THERMAL_EVENT = -201197 + RX_BIT_ERROR_RATE_LIMIT_EXCEEDED = -201196 + PHY_BIT_ERROR_RATE_LIMIT_EXCEEDED = -201195 + TWO_PART_ATTRIBUTE_CALLED_OUT_OF_ORDER = -201194 + INVALID_SCXI_CHASSIS_ADDRESS = -201193 + COULD_NOT_CONNECT_TO_REMOTE_MXS = -201192 + EXCITATION_STATE_REQUIRED_FOR_ATTRIBUTES = -201191 + DEVICE_NOT_USABLE_UNTIL_USB_REPLUG = -201190 + INPUT_FIFO_OVERFLOW_DURING_CALIBRATION_ON_FULL_SPEED_USB = -201189 + INPUT_FIFO_OVERFLOW_DURING_CALIBRATION = -201188 + CJC_CHAN_CONFLICTS_WITH_NON_THERMOCOUPLE_CHAN = -201187 + COMM_DEVICE_FOR_PXI_BACKPLANE_NOT_IN_RIGHTMOST_SLOT = -201186 + COMM_DEVICE_FOR_PXI_BACKPLANE_NOT_IN_SAME_CHASSIS = -201185 + COMM_DEVICE_FOR_PXI_BACKPLANE_NOT_PXI = -201184 + INVALID_CAL_EXCIT_FREQUENCY = -201183 + INVALID_CAL_EXCIT_VOLTAGE = -201182 + INVALID_AI_INPUT_SRC = -201181 + INVALID_CAL_INPUT_REF = -201180 + D_B_REFERENCE_VALUE_NOT_GREATER_THAN_ZERO = -201179 + SAMPLE_CLOCK_RATE_IS_TOO_FAST_FOR_SAMPLE_CLOCK_TIMING = -201178 + DEVICE_NOT_USABLE_UNTIL_COLD_START = -201177 + SAMPLE_CLOCK_RATE_IS_TOO_FAST_FOR_BURST_TIMING = -201176 + DEV_IMPORT_FAILED_ASSOCIATED_RESOURCE_IDS_NOT_SUPPORTED = -201175 + SCXI_1600_IMPORT_NOT_SUPPORTED = -201174 + POWER_SUPPLY_CONFIGURATION_FAILED = -201173 + IEPE_WITH_DC_NOT_ALLOWED = -201172 + MIN_TEMP_FOR_THERMOCOUPLE_TYPE_OUTSIDE_ACCURACY_FOR_POLY_SCALING = -201171 + DEV_IMPORT_FAILED_NO_DEVICE_TO_OVERWRITE_AND_SIMULATION_NOT_SUPPORTED = -201170 + DEV_IMPORT_FAILED_DEVICE_NOT_SUPPORTED_ON_DESTINATION = -201169 + FIRMWARE_IS_TOO_OLD = -201168 + FIRMWARE_COULDNT_UPDATE = -201167 + FIRMWARE_IS_CORRUPT = -201166 + FIRMWARE_TOO_NEW = -201165 + SAMP_CLOCK_CANNOT_BE_EXPORTED_FROM_EXTERNAL_SAMP_CLOCK_SRC = -201164 + PHYS_CHAN_RESERVED_FOR_INPUT_WHEN_DESIRED_FOR_OUTPUT = -201163 + PHYS_CHAN_RESERVED_FOR_OUTPUT_WHEN_DESIRED_FOR_INPUT = -201162 + SPECIFIED_CDAQ_SLOT_NOT_EMPTY = -201161 + DEVICE_DOES_NOT_SUPPORT_SIMULATION = -201160 + INVALID_CDAQ_SLOT_NUMBER_SPECD = -201159 + C_SERIES_MOD_SIM_MUST_MATCH_CDAQ_CHASSIS_SIM = -201158 + SCC_CABLED_DEV_MUST_NOT_BE_SIM_WHEN_SCC_CARRIER_IS_NOT_SIM = -201157 + SCC_MOD_SIM_MUST_MATCH_SCC_CARRIER_SIM = -201156 + SCXI_MODULE_DOES_NOT_SUPPORT_SIMULATION = -201155 + SCXI_CABLE_DEV_MUST_NOT_BE_SIM_WHEN_MOD_IS_NOT_SIM = -201154 + SCXI_DIGITIZER_SIM_MUST_NOT_BE_SIM_WHEN_MOD_IS_NOT_SIM = -201153 + SCXI_MOD_SIM_MUST_MATCH_SCXI_CHASSIS_SIM = -201152 + SIM_PXI_DEV_REQ_SLOT_AND_CHASSIS_SPECD = -201151 + SIM_DEV_CONFLICT_WITH_REAL_DEV = -201150 + INSUFFICIENT_DATA_FOR_CALIBRATION = -201149 + TRIGGER_CHANNEL_MUST_BE_ENABLED = -201148 + CALIBRATION_DATA_CONFLICT_COULD_NOT_BE_RESOLVED = -201147 + SOFTWARE_TOO_NEW_FOR_SELF_CALIBRATION_DATA = -201146 + SOFTWARE_TOO_NEW_FOR_EXT_CALIBRATION_DATA = -201145 + SELF_CALIBRATION_DATA_TOO_NEW_FOR_SOFTWARE = -201144 + EXT_CALIBRATION_DATA_TOO_NEW_FOR_SOFTWARE = -201143 + SOFTWARE_TOO_NEW_FOR_EEPROM = -201142 + EEPROM_TOO_NEW_FOR_SOFTWARE = -201141 + SOFTWARE_TOO_NEW_FOR_HARDWARE = -201140 + HARDWARE_TOO_NEW_FOR_SOFTWARE = -201139 + TASK_CANNOT_RESTART_FIRST_SAMP_NOT_AVAIL_TO_GENERATE = -201138 + ONLY_USE_START_TRIG_SRC_PRPTY_WITH_DEV_DATA_LINES = -201137 + ONLY_USE_PAUSE_TRIG_SRC_PRPTY_WITH_DEV_DATA_LINES = -201136 + ONLY_USE_REF_TRIG_SRC_PRPTY_WITH_DEV_DATA_LINES = -201135 + PAUSE_TRIG_DIG_PATTERN_SIZE_DOES_NOT_MATCH_SRC_SIZE = -201134 + LINE_CONFLICT_CDAQ = -201133 + CANNOT_WRITE_BEYOND_FINAL_FINITE_SAMPLE = -201132 + REF_AND_START_TRIGGER_SRC_CANT_BE_SAME = -201131 + MEM_MAPPING_INCOMPATIBLE_WITH_PHYS_CHANS_IN_TASK = -201130 + OUTPUT_DRIVE_TYPE_MEM_MAPPING_CONFLICT = -201129 + CAPI_DEVICE_INDEX_INVALID = -201128 + RATIOMETRIC_DEVICES_MUST_USE_EXCITATION_FOR_SCALING = -201127 + PROPERTY_REQUIRES_PER_DEVICE_CFG = -201126 + AI_COUPLING_AND_AI_INPUT_SOURCE_CONFLICT = -201125 + ONLY_ONE_TASK_CAN_PERFORM_DO_MEMORY_MAPPING_AT_A_TIME = -201124 + TOO_MANY_CHANS_FOR_ANALOG_REF_TRIG_CDAQ = -201123 + SPECD_PROPERTY_VALUE_IS_INCOMPATIBLE_WITH_SAMPLE_TIMING_TYPE = -201122 + CPU_NOT_SUPPORTED_REQUIRE_SSE = -201121 + SPECD_PROPERTY_VALUE_IS_INCOMPATIBLE_WITH_SAMPLE_TIMING_RESPONSE_MODE = -201120 + CONFLICTING_NEXT_WRITE_IS_LAST_AND_REGEN_MODE_PROPERTIES = -201119 + M_STUDIO_OPERATION_DOES_NOT_SUPPORT_DEVICE_CONTEXT = -201118 + PROPERTY_VALUE_IN_CHANNEL_EXPANSION_CONTEXT_INVALID = -201117 + HW_TIMED_NON_BUFFERED_AO_NOT_SUPPORTED = -201116 + WAVEFORM_LENGTH_NOT_MULT_OF_QUANTUM = -201115 + DSA_EXPANSION_MIXED_BOARDS_WRONG_ORDER_IN_PXI_CHASSIS = -201114 + POWER_LEVEL_TOO_LOW_FOR_OOK = -201113 + DEVICE_COMPONENT_TEST_FAILURE = -201112 + USER_DEFINED_WFM_WITH_OOK_UNSUPPORTED = -201111 + INVALID_DIGITAL_MODULATION_USER_DEFINED_WAVEFORM = -201110 + BOTH_REF_IN_AND_REF_OUT_ENABLED = -201109 + BOTH_ANALOG_AND_DIGITAL_MODULATION_ENABLED = -201108 + BUFFERED_OPS_NOT_SUPPORTED_IN_SPECD_SLOT_FOR_CDAQ = -201107 + PHYS_CHAN_NOT_SUPPORTED_IN_SPECD_SLOT_FOR_CDAQ = -201106 + RESOURCE_RESERVED_WITH_CONFLICTING_SETTINGS = -201105 + INCONSISTENT_ANALOG_TRIG_SETTINGS_CDAQ = -201104 + TOO_MANY_CHANS_FOR_ANALOG_PAUSE_TRIG_CDAQ = -201103 + ANALOG_TRIG_NOT_FIRST_IN_SCAN_LIST_CDAQ = -201102 + TOO_MANY_CHANS_GIVEN_TIMING_TYPE = -201101 + SAMP_CLK_TIMEBASE_DIV_WITH_EXT_SAMP_CLK = -201100 + CANT_SAVE_TASK_WITH_PER_DEVICE_TIMING_PROPERTIES = -201099 + CONFLICTING_AUTO_ZERO_MODE = -201098 + SAMP_CLK_RATE_NOT_SUPPORTED_WITH_EAR_ENABLED = -201097 + SAMP_CLK_TIMEBASE_RATE_NOT_SPECD = -201096 + SESSION_CORRUPTED_BY_DLL_RELOAD = -201095 + ACTIVE_DEV_NOT_SUPPORTED_WITH_CHAN_EXPANSION = -201094 + SAMP_CLK_RATE_INVALID = -201093 + EXT_SYNC_PULSE_SRC_CANNOT_BE_EXPORTED = -201092 + SYNC_PULSE_MIN_DELAY_TO_START_NEEDED_FOR_EXT_SYNC_PULSE_SRC = -201091 + SYNC_PULSE_SRC_INVALID = -201090 + SAMP_CLK_TIMEBASE_RATE_INVALID = -201089 + SAMP_CLK_TIMEBASE_SRC_INVALID = -201088 + SAMP_CLK_RATE_MUST_BE_SPECD = -201087 + INVALID_ATTRIBUTE_NAME = -201086 + CJC_CHAN_NAME_MUST_BE_SET_WHEN_CJC_SRC_IS_SCANNABLE_CHAN = -201085 + HIDDEN_CHAN_MISSING_IN_CHANS_PROPERTY_IN_CFG_FILE = -201084 + CHAN_NAMES_NOT_SPECD_IN_CFG_FILE = -201083 + DUPLICATE_HIDDEN_CHAN_NAMES_IN_CFG_FILE = -201082 + DUPLICATE_CHAN_NAME_IN_CFG_FILE = -201081 + INVALID_SCC_MODULE_FOR_SLOT_SPECD = -201080 + INVALID_SCC_SLOT_NUMBER_SPECD = -201079 + INVALID_SECTION_IDENTIFIER = -201078 + INVALID_SECTION_NAME = -201077 + DA_QMX_VERSION_NOT_SUPPORTED = -201076 + SW_OBJECTS_FOUND_IN_FILE = -201075 + HW_OBJECTS_FOUND_IN_FILE = -201074 + LOCAL_CHANNEL_SPECD_WITH_NO_PARENT_TASK = -201073 + TASK_REFERENCES_MISSING_LOCAL_CHANNEL = -201072 + TASK_REFERENCES_LOCAL_CHANNEL_FROM_OTHER_TASK = -201071 + TASK_MISSING_CHANNEL_PROPERTY = -201070 + INVALID_LOCAL_CHAN_NAME = -201069 + INVALID_ESCAPE_CHARACTER_IN_STRING = -201068 + INVALID_TABLE_IDENTIFIER = -201067 + VALUE_FOUND_IN_INVALID_COLUMN = -201066 + MISSING_START_OF_TABLE = -201065 + FILE_MISSING_REQUIRED_DA_QMX_HEADER = -201064 + DEVICE_ID_DOES_NOT_MATCH = -201063 + BUFFERED_OPERATIONS_NOT_SUPPORTED_ON_SELECTED_LINES = -201062 + PROPERTY_CONFLICTS_WITH_SCALE = -201061 + INVALID_INI_FILE_SYNTAX = -201060 + DEVICE_INFO_FAILED_PXI_CHASSIS_NOT_IDENTIFIED = -201059 + INVALID_HW_PRODUCT_NUMBER = -201058 + INVALID_HW_PRODUCT_TYPE = -201057 + INVALID_NUMERIC_FORMAT_SPECD = -201056 + DUPLICATE_PROPERTY_IN_OBJECT = -201055 + INVALID_ENUM_VALUE_SPECD = -201054 + TEDS_SENSOR_PHYSICAL_CHANNEL_CONFLICT = -201053 + TOO_MANY_PHYSICAL_CHANS_FOR_TEDS_INTERFACE_SPECD = -201052 + INCAPABLE_TEDS_INTERFACE_CONTROLLING_DEVICE_SPECD = -201051 + SCC_CARRIER_SPECD_IS_MISSING = -201050 + INCAPABLE_SCC_DIGITIZING_DEVICE_SPECD = -201049 + ACCESSORY_SETTING_NOT_APPLICABLE = -201048 + DEVICE_AND_CONNECTOR_SPECD_ALREADY_OCCUPIED = -201047 + ILLEGAL_ACCESSORY_TYPE_FOR_DEVICE_SPECD = -201046 + INVALID_DEVICE_CONNECTOR_NUMBER_SPECD = -201045 + INVALID_ACCESSORY_NAME = -201044 + MORE_THAN_ONE_MATCH_FOR_SPECD_DEVICE = -201043 + NO_MATCH_FOR_SPECD_DEVICE = -201042 + PRODUCT_TYPE_AND_PRODUCT_NUMBER_CONFLICT = -201041 + EXTRA_PROPERTY_DETECTED_IN_SPECD_OBJECT = -201040 + REQUIRED_PROPERTY_MISSING = -201039 + CANT_SET_AUTHOR_FOR_LOCAL_CHAN = -201038 + INVALID_TIME_VALUE = -201037 + INVALID_TIME_FORMAT = -201036 + DIG_DEV_CHANS_SPECD_IN_MODE_OTHER_THAN_PARALLEL = -201035 + CASCADE_DIGITIZATION_MODE_NOT_SUPPORTED = -201034 + SPECD_SLOT_ALREADY_OCCUPIED = -201033 + INVALID_SCXI_SLOT_NUMBER_SPECD = -201032 + ADDRESS_ALREADY_IN_USE = -201031 + SPECD_DEVICE_DOES_NOT_SUPPORT_RTSI = -201030 + SPECD_DEVICE_IS_ALREADY_ON_RTSI_BUS = -201029 + IDENTIFIER_IN_USE = -201028 + WAIT_FOR_NEXT_SAMPLE_CLOCK_OR_READ_DETECTED_3_OR_MORE_MISSED_SAMP_CLKS = -201027 + HW_TIMED_AND_DATA_XFER_PIO = -201026 + NON_BUFFERED_AND_HW_TIMED = -201025 + CTR_OUT_SAMP_CLK_PERIOD_SHORTER_THAN_GEN_PULSE_TRAIN_PERIOD_POLLED = -201024 + CTR_OUT_SAMP_CLK_PERIOD_SHORTER_THAN_GEN_PULSE_TRAIN_PERIOD_2 = -201023 + CO_CANNOT_KEEP_UP_IN_HW_TIMED_SINGLE_POINT_POLLED = -201022 + WRITE_RECOVERY_CANNOT_KEEP_UP_IN_HW_TIMED_SINGLE_POINT = -201021 + NO_CHANGE_DETECTION_ON_SELECTED_LINE_FOR_DEVICE = -201020 + SMIO_PAUSE_TRIGGERS_NOT_SUPPORTED_WITH_CHANNEL_EXPANSION = -201019 + CLOCK_MASTER_FOR_EXTERNAL_CLOCK_NOT_LONGEST_PIPELINE = -201018 + UNSUPPORTED_UNICODE_BYTE_ORDER_MARKER = -201017 + TOO_MANY_INSTRUCTIONS_IN_LOOP_IN_SCRIPT = -201016 + PLL_NOT_LOCKED = -201015 + IF_ELSE_BLOCK_NOT_ALLOWED_IN_FINITE_REPEAT_LOOP_IN_SCRIPT = -201014 + IF_ELSE_BLOCK_NOT_ALLOWED_IN_CONDITIONAL_REPEAT_LOOP_IN_SCRIPT = -201013 + CLEAR_IS_LAST_INSTRUCTION_IN_IF_ELSE_BLOCK_IN_SCRIPT = -201012 + INVALID_WAIT_DURATION_BEFORE_IF_ELSE_BLOCK_IN_SCRIPT = -201011 + MARKER_POS_INVALID_BEFORE_IF_ELSE_BLOCK_IN_SCRIPT = -201010 + INVALID_SUBSET_LENGTH_BEFORE_IF_ELSE_BLOCK_IN_SCRIPT = -201009 + INVALID_WAVEFORM_LENGTH_BEFORE_IF_ELSE_BLOCK_IN_SCRIPT = -201008 + GENERATE_OR_FINITE_WAIT_INSTRUCTION_EXPECTED_BEFORE_IF_ELSE_BLOCK_IN_SCRIPT = -201007 + CAL_PASSWORD_NOT_SUPPORTED = -201006 + SETUP_CAL_NEEDED_BEFORE_ADJUST_CAL = -201005 + MULTIPLE_CHANS_NOT_SUPPORTED_DURING_CAL_SETUP = -201004 + DEV_CANNOT_BE_ACCESSED = -201003 + SAMP_CLK_RATE_DOESNT_MATCH_SAMP_CLK_SRC = -201002 + SAMP_CLK_RATE_NOT_SUPPORTED_WITH_EAR_DISABLED = -201001 + LAB_VIEW_VERSION_DOESNT_SUPPORT_DA_QMX_EVENTS = -201000 + CO_READY_FOR_NEW_VAL_NOT_SUPPORTED_WITH_ON_DEMAND = -200999 + CIHW_TIMED_SINGLE_POINT_NOT_SUPPORTED_FOR_MEAS_TYPE = -200998 + ON_DEMAND_NOT_SUPPORTED_WITH_HW_TIMED_SINGLE_POINT = -200997 + HW_TIMED_SINGLE_POINT_AND_DATA_XFER_NOT_PROG_IO = -200996 + MEM_MAP_AND_HW_TIMED_SINGLE_POINT = -200995 + CANNOT_SET_PROPERTY_WHEN_HW_TIMED_SINGLE_POINT_TASK_IS_RUNNING = -200994 + CTR_OUT_SAMP_CLK_PERIOD_SHORTER_THAN_GEN_PULSE_TRAIN_PERIOD = -200993 + TOO_MANY_EVENTS_GENERATED = -200992 + M_STUDIO_CPP_REMOVE_EVENTS_BEFORE_STOP = -200991 + CAPI_CANNOT_REGISTER_SYNC_EVENTS_FROM_MULTIPLE_THREADS = -200990 + READ_WAIT_NEXT_SAMP_CLK_WAIT_MISMATCH_TWO = -200989 + READ_WAIT_NEXT_SAMP_CLK_WAIT_MISMATCH_ONE = -200988 + DA_QMX_SIGNAL_EVENT_TYPE_NOT_SUPPORTED_BY_CHAN_TYPES_OR_DEVICES_IN_TASK = -200987 + CANNOT_UNREGISTER_DA_QMX_SOFTWARE_EVENT_WHILE_TASK_IS_RUNNING = -200986 + AUTO_START_WRITE_NOT_ALLOWED_EVENT_REGISTERED = -200985 + AUTO_START_READ_NOT_ALLOWED_EVENT_REGISTERED = -200984 + CANNOT_GET_PROPERTY_WHEN_TASK_NOT_RESERVED_COMMITTED_OR_RUNNING = -200983 + SIGNAL_EVENTS_NOT_SUPPORTED_BY_DEVICE = -200982 + EVERY_N_SAMPLES_ACQ_INTO_BUFFER_EVENT_NOT_SUPPORTED_BY_DEVICE = -200981 + EVERY_N_SAMPS_TRANSFERRED_FROM_BUFFER_EVENT_NOT_SUPPORTED_BY_DEVICE = -200980 + CAPI_SYNC_EVENTS_TASK_STATE_CHANGE_NOT_ALLOWED_FROM_DIFFERENT_THREAD = -200979 + DA_QMX_SW_EVENTS_WITH_DIFFERENT_CALL_MECHANISMS = -200978 + CANT_SAVE_CHAN_WITH_POLY_CAL_SCALE_AND_ALLOW_INTERACTIVE_EDIT = -200977 + CHAN_DOES_NOT_SUPPORT_CJC = -200976 + CO_READY_FOR_NEW_VAL_NOT_SUPPORTED_WITH_HW_TIMED_SINGLE_POINT = -200975 + DAC_ALLOW_CONN_TO_GND_NOT_SUPPORTED_BY_DEV_WHEN_REF_SRC_EXT = -200974 + CANT_GET_PROPERTY_TASK_NOT_RUNNING = -200973 + CANT_SET_PROPERTY_TASK_NOT_RUNNING = -200972 + CANT_SET_PROPERTY_TASK_NOT_RUNNING_COMMITTED = -200971 + AI_EVERY_N_SAMPS_EVENT_INTERVAL_NOT_MULTIPLE_OF_2 = -200970 + INVALID_TEDS_PHYS_CHAN_NOT_AI = -200969 + CAPI_CANNOT_PERFORM_TASK_OPERATION_IN_ASYNC_CALLBACK = -200968 + EVERY_N_SAMPS_TRANSFERRED_FROM_BUFFER_EVENT_ALREADY_REGISTERED = -200967 + EVERY_N_SAMPS_ACQ_INTO_BUFFER_EVENT_ALREADY_REGISTERED = -200966 + EVERY_N_SAMPS_TRANSFERRED_FROM_BUFFER_NOT_FOR_INPUT = -200965 + EVERY_N_SAMPS_ACQ_INTO_BUFFER_NOT_FOR_OUTPUT = -200964 + AO_SAMP_TIMING_TYPE_DIFFERENT_IN_2_TASKS = -200963 + COULD_NOT_DOWNLOAD_FIRMWARE_HW_DAMAGED = -200962 + COULD_NOT_DOWNLOAD_FIRMWARE_FILE_MISSING_OR_DAMAGED = -200961 + CANNOT_REGISTER_DA_QMX_SOFTWARE_EVENT_WHILE_TASK_IS_RUNNING = -200960 + DIFFERENT_RAW_DATA_COMPRESSION = -200959 + CONFIGURED_TEDS_INTERFACE_DEV_NOT_DETECTED = -200958 + COMPRESSED_SAMP_SIZE_EXCEEDS_RESOLUTION = -200957 + CHAN_DOES_NOT_SUPPORT_COMPRESSION = -200956 + DIFFERENT_RAW_DATA_FORMATS = -200955 + SAMP_CLK_OUTPUT_TERM_INCLUDES_START_TRIG_SRC = -200954 + START_TRIG_SRC_EQUAL_TO_SAMP_CLK_SRC = -200953 + EVENT_OUTPUT_TERM_INCLUDES_TRIG_SRC = -200952 + CO_MULTIPLE_WRITES_BETWEEN_SAMP_CLKS = -200951 + DONE_EVENT_ALREADY_REGISTERED = -200950 + SIGNAL_EVENT_ALREADY_REGISTERED = -200949 + CANNOT_HAVE_TIMED_LOOP_AND_DA_QMX_SIGNAL_EVENTS_IN_SAME_TASK = -200948 + NEED_LAB_VIEW_711_PATCH_TO_USE_DA_QMX_EVENTS = -200947 + START_FAILED_DUE_TO_WRITE_FAILURE = -200946 + DATA_XFER_CUSTOM_THRESHOLD_NOT_DMA_XFER_METHOD_SPECIFIED_FOR_DEV = -200945 + DATA_XFER_REQUEST_CONDITION_NOT_SPECIFIED_FOR_CUSTOM_THRESHOLD = -200944 + DATA_XFER_CUSTOM_THRESHOLD_NOT_SPECIFIED = -200943 + CAPI_SYNC_CALLBACK_NOT_SUPPORTED_ON_THIS_PLATFORM = -200942 + CAL_CHAN_REVERSE_POLY_COEF_NOT_SPECD = -200941 + CAL_CHAN_FORWARD_POLY_COEF_NOT_SPECD = -200940 + CHAN_CAL_REPEATED_NUMBER_IN_PRE_SCALED_VALS = -200939 + CHAN_CAL_TABLE_NUM_SCALED_NOT_EQUAL_NUM_PRESCALED_VALS = -200938 + CHAN_CAL_TABLE_SCALED_VALS_NOT_SPECD = -200937 + CHAN_CAL_TABLE_PRE_SCALED_VALS_NOT_SPECD = -200936 + CHAN_CAL_SCALE_TYPE_NOT_SET = -200935 + CHAN_CAL_EXPIRED = -200934 + CHAN_CAL_EXPIRATION_DATE_NOT_SET = -200933 + THREE_OUTPUT_PORT_COMBINATION_GIVEN_SAMP_TIMING_TYPE_653_X = -200932 + THREE_INPUT_PORT_COMBINATION_GIVEN_SAMP_TIMING_TYPE_653_X = -200931 + TWO_OUTPUT_PORT_COMBINATION_GIVEN_SAMP_TIMING_TYPE_653_X = -200930 + TWO_INPUT_PORT_COMBINATION_GIVEN_SAMP_TIMING_TYPE_653_X = -200929 + PATTERN_MATCHER_MAY_BE_USED_BY_ONE_TRIG_ONLY = -200928 + NO_CHANS_SPECD_FOR_PATTERN_SOURCE = -200927 + CHANGE_DETECTION_CHAN_NOT_IN_TASK = -200926 + CHANGE_DETECTION_CHAN_NOT_TRISTATED = -200925 + WAIT_MODE_VALUE_NOT_SUPPORTED_NON_BUFFERED = -200924 + WAIT_MODE_PROPERTY_NOT_SUPPORTED_NON_BUFFERED = -200923 + CANT_SAVE_PER_LINE_CONFIG_DIG_CHAN_SO_INTERACTIVE_EDITS_ALLOWED = -200922 + CANT_SAVE_NON_PORT_MULTI_LINE_DIG_CHAN_SO_INTERACTIVE_EDITS_ALLOWED = -200921 + BUFFER_SIZE_NOT_MULTIPLE_OF_EVERY_N_SAMPS_EVENT_INTERVAL_NO_IRQ_ON_DEV = -200920 + GLOBAL_TASK_NAME_ALREADY_CHAN_NAME = -200919 + GLOBAL_CHAN_NAME_ALREADY_TASK_NAME = -200918 + AO_EVERY_N_SAMPS_EVENT_INTERVAL_NOT_MULTIPLE_OF_2 = -200917 + SAMPLE_TIMEBASE_DIVISOR_NOT_SUPPORTED_GIVEN_TIMING_TYPE = -200916 + HANDSHAKE_EVENT_OUTPUT_TERM_NOT_SUPPORTED_GIVEN_TIMING_TYPE = -200915 + CHANGE_DETECTION_OUTPUT_TERM_NOT_SUPPORTED_GIVEN_TIMING_TYPE = -200914 + READY_FOR_TRANSFER_OUTPUT_TERM_NOT_SUPPORTED_GIVEN_TIMING_TYPE = -200913 + REF_TRIG_OUTPUT_TERM_NOT_SUPPORTED_GIVEN_TIMING_TYPE = -200912 + START_TRIG_OUTPUT_TERM_NOT_SUPPORTED_GIVEN_TIMING_TYPE = -200911 + SAMP_CLOCK_OUTPUT_TERM_NOT_SUPPORTED_GIVEN_TIMING_TYPE = -200910 + TWENTY_MHZ_TIMEBASE_NOT_SUPPORTED_GIVEN_TIMING_TYPE = -200909 + SAMP_CLOCK_SOURCE_NOT_SUPPORTED_GIVEN_TIMING_TYPE = -200908 + REF_TRIG_TYPE_NOT_SUPPORTED_GIVEN_TIMING_TYPE = -200907 + PAUSE_TRIG_TYPE_NOT_SUPPORTED_GIVEN_TIMING_TYPE = -200906 + HANDSHAKE_TRIG_TYPE_NOT_SUPPORTED_GIVEN_TIMING_TYPE = -200905 + START_TRIG_TYPE_NOT_SUPPORTED_GIVEN_TIMING_TYPE = -200904 + REF_CLK_SRC_NOT_SUPPORTED = -200903 + DATA_VOLTAGE_LOW_AND_HIGH_INCOMPATIBLE = -200902 + INVALID_CHAR_IN_DIG_PATTERN_STRING = -200901 + CANT_USE_PORT_3_ALONE_GIVEN_SAMP_TIMING_TYPE_ON_653_X = -200900 + CANT_USE_PORT_1_ALONE_GIVEN_SAMP_TIMING_TYPE_ON_653_X = -200899 + PARTIAL_USE_OF_PHYSICAL_LINES_WITHIN_PORT_NOT_SUPPORTED_653_X = -200898 + PHYSICAL_CHAN_NOT_SUPPORTED_GIVEN_SAMP_TIMING_TYPE_653_X = -200897 + CAN_EXPORT_ONLY_DIG_EDGE_TRIGS = -200896 + REF_TRIG_DIG_PATTERN_SIZE_DOES_NOT_MATCH_SOURCE_SIZE = -200895 + START_TRIG_DIG_PATTERN_SIZE_DOES_NOT_MATCH_SOURCE_SIZE = -200894 + CHANGE_DETECTION_RISING_AND_FALLING_EDGE_CHAN_DONT_MATCH = -200893 + PHYSICAL_CHANS_FOR_CHANGE_DETECTION_AND_PATTERN_MATCH_653_X = -200892 + CAN_EXPORT_ONLY_ONBOARD_SAMP_CLK = -200891 + INTERNAL_SAMP_CLK_NOT_RISING_EDGE = -200890 + REF_TRIG_DIG_PATTERN_CHAN_NOT_IN_TASK = -200889 + REF_TRIG_DIG_PATTERN_CHAN_NOT_TRISTATED = -200888 + START_TRIG_DIG_PATTERN_CHAN_NOT_IN_TASK = -200887 + START_TRIG_DIG_PATTERN_CHAN_NOT_TRISTATED = -200886 + PXI_STAR_AND_CLOCK_10_SYNC = -200885 + GLOBAL_CHAN_CANNOT_BE_SAVED_SO_INTERACTIVE_EDITS_ALLOWED = -200884 + TASK_CANNOT_BE_SAVED_SO_INTERACTIVE_EDITS_ALLOWED = -200883 + INVALID_GLOBAL_CHAN = -200882 + EVERY_N_SAMPS_EVENT_ALREADY_REGISTERED = -200881 + EVERY_N_SAMPS_EVENT_INTERVAL_ZERO_NOT_SUPPORTED = -200880 + CHAN_SIZE_TOO_BIG_FOR_U_16_PORT_WRITE = -200879 + CHAN_SIZE_TOO_BIG_FOR_U_16_PORT_READ = -200878 + BUFFER_SIZE_NOT_MULTIPLE_OF_EVERY_N_SAMPS_EVENT_INTERVAL_WHEN_DMA = -200877 + WRITE_WHEN_TASK_NOT_RUNNING_CO_TICKS = -200876 + WRITE_WHEN_TASK_NOT_RUNNING_CO_FREQ = -200875 + WRITE_WHEN_TASK_NOT_RUNNING_CO_TIME = -200874 + AO_MIN_MAX_NOT_SUPPORTED_DAC_RANGE_TOO_SMALL = -200873 + AO_MIN_MAX_NOT_SUPPORTED_GIVEN_DAC_RANGE = -200872 + AO_MIN_MAX_NOT_SUPPORTED_GIVEN_DAC_RANGE_AND_OFFSET_VAL = -200871 + AO_MIN_MAX_NOT_SUPPORTED_DAC_OFFSET_VAL_INAPPROPRIATE = -200870 + AO_MIN_MAX_NOT_SUPPORTED_GIVEN_DAC_OFFSET_VAL = -200869 + AO_MIN_MAX_NOT_SUPPORTED_DAC_REF_VAL_TOO_SMALL = -200868 + AO_MIN_MAX_NOT_SUPPORTED_GIVEN_DAC_REF_VAL = -200867 + AO_MIN_MAX_NOT_SUPPORTED_GIVEN_DAC_REF_AND_OFFSET_VAL = -200866 + WHEN_ACQ_COMP_AND_NUM_SAMPS_PER_CHAN_EXCEEDS_ON_BRD_BUF_SIZE = -200865 + WHEN_ACQ_COMP_AND_NO_REF_TRIG = -200864 + WAIT_FOR_NEXT_SAMP_CLK_NOT_SUPPORTED = -200863 + DEV_IN_UNIDENTIFIED_PXI_CHASSIS = -200862 + MAX_SOUND_PRESSURE_MIC_SENSITIVIT_RELATED_AI_PROPERTIES_NOT_SUPPORTED_BY_DEV = -200861 + MAX_SOUND_PRESSURE_AND_MIC_SENSITIVITY_NOT_SUPPORTED_BY_DEV = -200860 + AO_BUFFER_SIZE_ZERO_FOR_SAMP_CLK_TIMING_TYPE = -200859 + AO_CALL_WRITE_BEFORE_START_FOR_SAMP_CLK_TIMING_TYPE = -200858 + INVALID_CAL_LOW_PASS_CUTOFF_FREQ = -200857 + SIMULATION_CANNOT_BE_DISABLED_FOR_DEV_CREATED_AS_SIMULATED_DEV = -200856 + CANNOT_ADD_NEW_DEVS_AFTER_TASK_CONFIGURATION = -200855 + DIFFT_SYNC_PULSE_SRC_AND_SAMP_CLK_TIMEBASE_SRC_DEV_MULTI_DEV_TASK = -200854 + TERM_WITHOUT_DEV_IN_MULTI_DEV_TASK = -200853 + SYNC_NO_DEV_SAMP_CLK_TIMEBASE_OR_SYNC_PULSE_IN_PXI_SLOT_2 = -200852 + PHYSICAL_CHAN_NOT_ON_THIS_CONNECTOR = -200851 + NUM_SAMPS_TO_WAIT_NOT_GREATER_THAN_ZERO_IN_SCRIPT = -200850 + NUM_SAMPS_TO_WAIT_NOT_MULTIPLE_OF_ALIGNMENT_QUANTUM_IN_SCRIPT = -200849 + EVERY_N_SAMPLES_EVENT_NOT_SUPPORTED_FOR_NON_BUFFERED_TASKS = -200848 + BUFFERED_AND_DATA_XFER_PIO = -200847 + CANNOT_WRITE_WHEN_AUTO_START_FALSE_AND_TASK_NOT_RUNNING = -200846 + NON_BUFFERED_AND_DATA_XFER_INTERRUPTS = -200845 + WRITE_FAILED_MULTIPLE_CTRS_WITH_FREQOUT = -200844 + READ_NOT_COMPLETE_BEFORE_3_SAMP_CLK_EDGES = -200843 + CTR_HW_TIMED_SINGLE_POINT_AND_DATA_XFER_NOT_PROG_IO = -200842 + PRESCALER_NOT_1_FOR_INPUT_TERMINAL = -200841 + PRESCALER_NOT_1_FOR_TIMEBASE_SRC = -200840 + SAMP_CLK_TIMING_TYPE_WHEN_TRISTATE_IS_FALSE = -200839 + OUTPUT_BUFFER_SIZE_NOT_MULT_OF_XFER_SIZE = -200838 + SAMP_PER_CHAN_NOT_MULT_OF_XFER_SIZE = -200837 + WRITE_TO_TEDS_FAILED = -200836 + SCXI_DEV_NOT_USABLE_POWER_TURNED_OFF = -200835 + CANNOT_READ_WHEN_AUTO_START_FALSE_BUF_SIZE_ZERO_AND_TASK_NOT_RUNNING = -200834 + CANNOT_READ_WHEN_AUTO_START_FALSE_HW_TIMED_SINGLE_PT_AND_TASK_NOT_RUNNING = -200833 + CANNOT_READ_WHEN_AUTO_START_FALSE_ON_DEMAND_AND_TASK_NOT_RUNNING = -200832 + SIMULTANEOUS_AO_WHEN_NOT_ON_DEMAND_TIMING = -200831 + MEM_MAP_AND_SIMULTANEOUS_AO = -200830 + WRITE_FAILED_MULTIPLE_CO_OUTPUT_TYPES = -200829 + WRITE_TO_TEDS_NOT_SUPPORTED_ON_RT = -200828 + VIRTUAL_TEDS_DATA_FILE_ERROR = -200827 + TEDS_SENSOR_DATA_ERROR = -200826 + DATA_SIZE_MORE_THAN_SIZE_OF_EEPROM_ON_TEDS = -200825 + PROM_ON_TEDS_CONTAINS_BASIC_TEDS_DATA = -200824 + PROM_ON_TEDS_ALREADY_WRITTEN = -200823 + TEDS_DOES_NOT_CONTAIN_PROM = -200822 + HW_TIMED_SINGLE_POINT_NOT_SUPPORTED_AI = -200821 + HW_TIMED_SINGLE_POINT_ODD_NUM_CHANS_IN_AI_TASK = -200820 + CANT_USE_ONLY_ON_BOARD_MEM_WITH_PROGRAMMED_IO = -200819 + SWITCH_DEV_SHUT_DOWN_DUE_TO_HIGH_TEMP = -200818 + EXCITATION_NOT_SUPPORTED_WHEN_TERM_CFG_DIFF = -200817 + TEDS_MIN_ELEC_VAL_GE_MAX_ELEC_VAL = -200816 + TEDS_MIN_PHYS_VAL_GE_MAX_PHYS_VAL = -200815 + CI_ONBOARD_CLOCK_NOT_SUPPORTED_AS_INPUT_TERM = -200814 + INVALID_SAMP_MODE_FOR_POSITION_MEAS = -200813 + TRIG_WHEN_AOHW_TIMED_SINGLE_PT_SAMP_MODE = -200812 + DA_QMX_CANT_USE_STRING_DUE_TO_UNKNOWN_CHAR = -200811 + DA_QMX_CANT_RETRIEVE_STRING_DUE_TO_UNKNOWN_CHAR = -200810 + CLEAR_TEDS_NOT_SUPPORTED_ON_RT = -200809 + CFG_TEDS_NOT_SUPPORTED_ON_RT = -200808 + PROG_FILTER_CLK_CFGD_TO_DIFFERENT_MIN_PULSE_WIDTH_BY_SAME_TASK_1_PER_DEV = -200807 + PROG_FILTER_CLK_CFGD_TO_DIFFERENT_MIN_PULSE_WIDTH_BY_ANOTHER_TASK_1_PER_DEV = -200806 + NO_LAST_EXT_CAL_DATE_TIME_LAST_EXT_CAL_NOT_DA_QMX = -200804 + CANNOT_WRITE_NOT_STARTED_AUTO_START_FALSE_NOT_ON_DEMAND_HW_TIMED_SGL_PT = -200803 + CANNOT_WRITE_NOT_STARTED_AUTO_START_FALSE_NOT_ON_DEMAND_BUF_SIZE_ZERO = -200802 + CO_INVALID_TIMING_SRC_DUE_TO_SIGNAL = -200801 + CI_INVALID_TIMING_SRC_FOR_SAMP_CLK_DUE_TO_SAMP_TIMING_TYPE = -200800 + CI_INVALID_TIMING_SRC_FOR_EVENT_CNT_DUE_TO_SAMP_MODE = -200799 + NO_CHANGE_DETECT_ON_NON_INPUT_DIG_LINE_FOR_DEV = -200798 + EMPTY_STRING_TERM_NAME_NOT_SUPPORTED = -200797 + MEM_MAP_ENABLED_FOR_HW_TIMED_NON_BUFFERED_AO = -200796 + DEV_ONBOARD_MEM_OVERFLOW_DURING_HW_TIMED_NON_BUFFERED_GEN = -200795 + CODA_QMX_WRITE_MULTIPLE_CHANS = -200794 + CANT_MAINTAIN_EXISTING_VALUE_AO_SYNC = -200793 + M_STUDIO_MULTIPLE_PHYS_CHANS_NOT_SUPPORTED = -200792 + CANT_CONFIGURE_TEDS_FOR_CHAN = -200791 + WRITE_DATA_TYPE_TOO_SMALL = -200790 + READ_DATA_TYPE_TOO_SMALL = -200789 + MEASURED_BRIDGE_OFFSET_TOO_HIGH = -200788 + START_TRIG_CONFLICT_WITH_COHW_TIMED_SINGLE_PT = -200787 + SAMP_CLK_RATE_EXT_SAMP_CLK_TIMEBASE_RATE_MISMATCH = -200786 + INVALID_TIMING_SRC_DUE_TO_SAMP_TIMING_TYPE = -200785 + VIRTUAL_TEDS_FILE_NOT_FOUND = -200784 + M_STUDIO_NO_FORWARD_POLY_SCALE_COEFFS = -200783 + M_STUDIO_NO_REVERSE_POLY_SCALE_COEFFS = -200782 + M_STUDIO_NO_POLY_SCALE_COEFFS_USE_CALC = -200781 + M_STUDIO_NO_FORWARD_POLY_SCALE_COEFFS_USE_CALC = -200780 + M_STUDIO_NO_REVERSE_POLY_SCALE_COEFFS_USE_CALC = -200779 + CO_SAMP_MODE_SAMP_TIMING_TYPE_SAMP_CLK_CONFLICT = -200778 + DEV_CANNOT_PRODUCE_MIN_PULSE_WIDTH = -200777 + CANNOT_PRODUCE_MIN_PULSE_WIDTH_GIVEN_PROPERTY_VALUES = -200776 + TERM_CFGD_TO_DIFFERENT_MIN_PULSE_WIDTH_BY_ANOTHER_TASK = -200775 + TERM_CFGD_TO_DIFFERENT_MIN_PULSE_WIDTH_BY_ANOTHER_PROPERTY = -200774 + DIG_SYNC_NOT_AVAILABLE_ON_TERM = -200773 + DIG_FILTER_NOT_AVAILABLE_ON_TERM = -200772 + DIG_FILTER_ENABLED_MIN_PULSE_WIDTH_NOT_CFG = -200771 + DIG_FILTER_AND_SYNC_BOTH_ENABLED = -200770 + HW_TIMED_SINGLE_POINT_AO_AND_DATA_XFER_NOT_PROG_IO = -200769 + NON_BUFFERED_AO_AND_DATA_XFER_NOT_PROG_IO = -200768 + PROG_IO_DATA_XFER_FOR_BUFFERED_AO = -200767 + TEDS_LEGACY_TEMPLATE_ID_INVALID_OR_UNSUPPORTED = -200766 + TEDS_MAPPING_METHOD_INVALID_OR_UNSUPPORTED = -200765 + TEDS_LINEAR_MAPPING_SLOPE_ZERO = -200764 + AI_INPUT_BUFFER_SIZE_NOT_MULT_OF_XFER_SIZE = -200763 + NO_SYNC_PULSE_EXT_SAMP_CLK_TIMEBASE = -200762 + NO_SYNC_PULSE_ANOTHER_TASK_RUNNING = -200761 + AO_MIN_MAX_NOT_IN_GAIN_RANGE = -200760 + AO_MIN_MAX_NOT_IN_DAC_RANGE = -200759 + DEV_ONLY_SUPPORTS_SAMP_CLK_TIMING_AO = -200758 + DEV_ONLY_SUPPORTS_SAMP_CLK_TIMING_AI = -200757 + TEDS_INCOMPATIBLE_SENSOR_AND_MEAS_TYPE = -200756 + TEDS_MULTIPLE_CAL_TEMPLATES_NOT_SUPPORTED = -200755 + TEDS_TEMPLATE_PARAMETERS_NOT_SUPPORTED = -200754 + PARSING_TEDS_DATA = -200753 + MULTIPLE_ACTIVE_PHYS_CHANS_NOT_SUPPORTED = -200752 + NO_CHANS_SPECD_FOR_CHANGE_DETECT = -200751 + INVALID_CAL_VOLTAGE_FOR_GIVEN_GAIN = -200750 + INVALID_CAL_GAIN = -200749 + MULTIPLE_WRITES_BETWEEN_SAMP_CLKS = -200748 + INVALID_ACQ_TYPE_FOR_FREQOUT = -200747 + SUITABLE_TIMEBASE_NOT_FOUND_TIME_COMBO_2 = -200746 + SUITABLE_TIMEBASE_NOT_FOUND_FREQUENCY_COMBO_2 = -200745 + REF_CLK_RATE_REF_CLK_SRC_MISMATCH = -200744 + NO_TEDS_TERMINAL_BLOCK = -200743 + CORRUPTED_TEDS_MEMORY = -200742 + TEDS_NOT_SUPPORTED = -200741 + TIMING_SRC_TASK_STARTED_BEFORE_TIMED_LOOP = -200740 + PROPERTY_NOT_SUPPORTED_FOR_TIMING_SRC = -200739 + TIMING_SRC_DOES_NOT_EXIST = -200738 + INPUT_BUFFER_SIZE_NOT_EQUAL_SAMPS_PER_CHAN_FOR_FINITE_SAMP_MODE = -200737 + FREQOUT_CANNOT_PRODUCE_DESIRED_FREQUENCY_2 = -200736 + EXT_REF_CLK_RATE_NOT_SPECIFIED = -200735 + DEVICE_DOES_NOT_SUPPORT_DMA_DATA_XFER_FOR_NON_BUFFERED_ACQ = -200734 + DIG_FILTER_MIN_PULSE_WIDTH_SET_WHEN_TRISTATE_IS_FALSE = -200733 + DIG_FILTER_ENABLE_SET_WHEN_TRISTATE_IS_FALSE = -200732 + NO_HW_TIMING_WITH_ON_DEMAND = -200731 + CANNOT_DETECT_CHANGES_WHEN_TRISTATE_IS_FALSE = -200730 + CANNOT_HANDSHAKE_WHEN_TRISTATE_IS_FALSE = -200729 + LINES_USED_FOR_STATIC_INPUT_NOT_FOR_HANDSHAKING_CONTROL = -200728 + LINES_USED_FOR_HANDSHAKING_CONTROL_NOT_FOR_STATIC_INPUT = -200727 + LINES_USED_FOR_STATIC_INPUT_NOT_FOR_HANDSHAKING_INPUT = -200726 + LINES_USED_FOR_HANDSHAKING_INPUT_NOT_FOR_STATIC_INPUT = -200725 + DIFFERENT_DI_TRISTATE_VALS_FOR_CHANS_IN_TASK = -200724 + TIMEBASE_CAL_FREQ_VARIANCE_TOO_LARGE = -200723 + TIMEBASE_CAL_FAILED_TO_CONVERGE = -200722 + INADEQUATE_RESOLUTION_FOR_TIMEBASE_CAL = -200721 + INVALID_AO_GAIN_CAL_CONST = -200720 + INVALID_AO_OFFSET_CAL_CONST = -200719 + INVALID_AI_GAIN_CAL_CONST = -200718 + INVALID_AI_OFFSET_CAL_CONST = -200717 + DIG_OUTPUT_OVERRUN = -200716 + DIG_INPUT_OVERRUN = -200715 + ACQ_STOPPED_DRIVER_CANT_XFER_DATA_FAST_ENOUGH = -200714 + CHANS_CANT_APPEAR_IN_SAME_TASK = -200713 + INPUT_CFG_FAILED_BECAUSE_WATCHDOG_EXPIRED = -200712 + ANALOG_TRIG_CHAN_NOT_EXTERNAL = -200711 + TOO_MANY_CHANS_FOR_INTERNAL_AI_INPUT_SRC = -200710 + TEDS_SENSOR_NOT_DETECTED = -200709 + PRPTY_GET_SPECD_ACTIVE_ITEM_FAILED_DUE_TO_DIFFT_VALUES = -200708 + ROUTING_DEST_TERM_PXI_CLK_10_IN_NOT_IN_SLOT_2 = -200706 + ROUTING_DEST_TERM_PXI_STAR_X_NOT_IN_SLOT_2 = -200705 + ROUTING_SRC_TERM_PXI_STAR_X_NOT_IN_SLOT_2 = -200704 + ROUTING_SRC_TERM_PXI_STAR_IN_SLOT_16_AND_ABOVE = -200703 + ROUTING_DEST_TERM_PXI_STAR_IN_SLOT_16_AND_ABOVE = -200702 + ROUTING_DEST_TERM_PXI_STAR_IN_SLOT_2 = -200701 + ROUTING_SRC_TERM_PXI_STAR_IN_SLOT_2 = -200700 + ROUTING_DEST_TERM_PXI_CHASSIS_NOT_IDENTIFIED = -200699 + ROUTING_SRC_TERM_PXI_CHASSIS_NOT_IDENTIFIED = -200698 + FAILED_TO_ACQUIRE_CAL_DATA = -200697 + BRIDGE_OFFSET_NULLING_CAL_NOT_SUPPORTED = -200696 + AI_MAX_NOT_SPECIFIED = -200695 + AI_MIN_NOT_SPECIFIED = -200694 + ODD_TOTAL_BUFFER_SIZE_TO_WRITE = -200693 + ODD_TOTAL_NUM_SAMPS_TO_WRITE = -200692 + BUFFER_WITH_WAIT_MODE = -200691 + BUFFER_WITH_HW_TIMED_SINGLE_POINT_SAMP_MODE = -200690 + CO_WRITE_PULSE_LOW_TICKS_NOT_SUPPORTED = -200689 + CO_WRITE_PULSE_HIGH_TICKS_NOT_SUPPORTED = -200688 + CO_WRITE_PULSE_LOW_TIME_OUT_OF_RANGE = -200687 + CO_WRITE_PULSE_HIGH_TIME_OUT_OF_RANGE = -200686 + CO_WRITE_FREQ_OUT_OF_RANGE = -200685 + CO_WRITE_DUTY_CYCLE_OUT_OF_RANGE = -200684 + INVALID_INSTALLATION = -200683 + REF_TRIG_MASTER_SESSION_UNAVAILABLE = -200682 + ROUTE_FAILED_BECAUSE_WATCHDOG_EXPIRED = -200681 + DEVICE_SHUT_DOWN_DUE_TO_HIGH_TEMP = -200680 + NO_MEM_MAP_WHEN_HW_TIMED_SINGLE_POINT = -200679 + WRITE_FAILED_BECAUSE_WATCHDOG_EXPIRED = -200678 + DIFFT_INTERNAL_AI_INPUT_SRCS = -200677 + DIFFT_AI_INPUT_SRC_IN_ONE_CHAN_GROUP = -200676 + INTERNAL_AI_INPUT_SRC_IN_MULT_CHAN_GROUPS = -200675 + SWITCH_OP_FAILED_DUE_TO_PREV_ERROR = -200674 + WROTE_MULTI_SAMPS_USING_SINGLE_SAMP_WRITE = -200673 + MISMATCHED_INPUT_ARRAY_SIZES = -200672 + CANT_EXCEED_RELAY_DRIVE_LIMIT = -200671 + DAC_RNG_LOW_NOT_EQUAL_TO_MINUS_REF_VAL = -200670 + CANT_ALLOW_CONNECT_DAC_TO_GND = -200669 + WATCHDOG_TIMEOUT_OUT_OF_RANGE_AND_NOT_SPECIAL_VAL = -200668 + NO_WATCHDOG_OUTPUT_ON_PORT_RESERVED_FOR_INPUT = -200667 + NO_INPUT_ON_PORT_CFGD_FOR_WATCHDOG_OUTPUT = -200666 + WATCHDOG_EXPIRATION_STATE_NOT_EQUAL_FOR_LINES_IN_PORT = -200665 + CANNOT_PERFORM_OP_WHEN_TASK_NOT_RESERVED = -200664 + POWERUP_STATE_NOT_SUPPORTED = -200663 + WATCHDOG_TIMER_NOT_SUPPORTED = -200662 + OP_NOT_SUPPORTED_WHEN_REF_CLK_SRC_NONE = -200661 + SAMP_CLK_RATE_UNAVAILABLE = -200660 + PRPTY_GET_SPECD_SINGLE_ACTIVE_CHAN_FAILED_DUE_TO_DIFFT_VALS = -200659 + PRPTY_GET_IMPLIED_ACTIVE_CHAN_FAILED_DUE_TO_DIFFT_VALS = -200658 + PRPTY_GET_SPECD_ACTIVE_CHAN_FAILED_DUE_TO_DIFFT_VALS = -200657 + NO_REGEN_WHEN_USING_BRD_MEM = -200656 + NONBUFFERED_READ_MORE_THAN_SAMPS_PER_CHAN = -200655 + WATCHDOG_EXPIRATION_TRISTATE_NOT_SPECD_FOR_ENTIRE_PORT = -200654 + POWERUP_TRISTATE_NOT_SPECD_FOR_ENTIRE_PORT = -200653 + POWERUP_STATE_NOT_SPECD_FOR_ENTIRE_PORT = -200652 + CANT_SET_WATCHDOG_EXPIRATION_ON_DIG_IN_CHAN = -200651 + CANT_SET_POWERUP_STATE_ON_DIG_IN_CHAN = -200650 + PHYS_CHAN_NOT_IN_TASK = -200649 + PHYS_CHAN_DEV_NOT_IN_TASK = -200648 + DIG_INPUT_NOT_SUPPORTED = -200647 + DIG_FILTER_INTERVAL_NOT_EQUAL_FOR_LINES = -200646 + DIG_FILTER_INTERVAL_ALREADY_CFGD = -200645 + CANT_RESET_EXPIRED_WATCHDOG = -200644 + ACTIVE_CHAN_TOO_MANY_LINES_SPECD_WHEN_GETTING_PRPTY = -200643 + ACTIVE_CHAN_NOT_SPECD_WHEN_GETTING_1_LINE_PRPTY = -200642 + DIG_PRPTY_CANNOT_BE_SET_PER_LINE = -200641 + SEND_ADV_CMPLT_AFTER_WAIT_FOR_TRIG_IN_SCANLIST = -200640 + DISCONNECTION_REQUIRED_IN_SCANLIST = -200639 + TWO_WAIT_FOR_TRIGS_AFTER_CONNECTION_IN_SCANLIST = -200638 + ACTION_SEPARATOR_REQUIRED_AFTER_BREAKING_CONNECTION_IN_SCANLIST = -200637 + CONNECTION_IN_SCANLIST_MUST_WAIT_FOR_TRIG = -200636 + ACTION_NOT_SUPPORTED_TASK_NOT_WATCHDOG = -200635 + WFM_NAME_SAME_AS_SCRIPT_NAME = -200634 + SCRIPT_NAME_SAME_AS_WFM_NAME = -200633 + DSF_STOP_CLOCK = -200632 + DSF_READY_FOR_START_CLOCK = -200631 + WRITE_OFFSET_NOT_MULT_OF_INCR = -200630 + DIFFERENT_PRPTY_VALS_NOT_SUPPORTED_ON_DEV = -200629 + REF_AND_PAUSE_TRIG_CONFIGURED = -200628 + FAILED_TO_ENABLE_HIGH_SPEED_INPUT_CLOCK = -200627 + EMPTY_PHYS_CHAN_IN_POWER_UP_STATES_ARRAY = -200626 + ACTIVE_PHYS_CHAN_TOO_MANY_LINES_SPECD_WHEN_GETTING_PRPTY = -200625 + ACTIVE_PHYS_CHAN_NOT_SPECD_WHEN_GETTING_1_LINE_PRPTY = -200624 + PXI_DEV_TEMP_CAUSED_SHUT_DOWN = -200623 + INVALID_NUM_SAMPS_TO_WRITE = -200622 + OUTPUT_FIFO_UNDERFLOW_2 = -200621 + REPEATED_AI_PHYSICAL_CHAN = -200620 + MULT_SCAN_OPS_IN_ONE_CHASSIS = -200619 + INVALID_AI_CHAN_ORDER = -200618 + REVERSE_POWER_PROTECTION_ACTIVATED = -200617 + INVALID_ASYN_OP_HANDLE = -200616 + FAILED_TO_ENABLE_HIGH_SPEED_OUTPUT = -200615 + CANNOT_READ_PAST_END_OF_RECORD = -200614 + ACQ_STOPPED_TO_PREVENT_INPUT_BUFFER_OVERWRITE_ONE_DATA_XFER_MECH = -200613 + ZERO_BASED_CHAN_INDEX_INVALID = -200612 + NO_CHANS_OF_GIVEN_TYPE_IN_TASK = -200611 + SAMP_CLK_SRC_INVALID_FOR_OUTPUT_VALID_FOR_INPUT = -200610 + OUTPUT_BUF_SIZE_TOO_SMALL_TO_START_GEN = -200609 + INPUT_BUF_SIZE_TOO_SMALL_TO_START_ACQ = -200608 + EXPORT_TWO_SIGNALS_ON_SAME_TERMINAL = -200607 + CHAN_INDEX_INVALID = -200606 + RANGE_SYNTAX_NUMBER_TOO_BIG = -200605 + NULL_PTR = -200604 + SCALED_MIN_EQUAL_MAX = -200603 + PRE_SCALED_MIN_EQUAL_MAX = -200602 + PROPERTY_NOT_SUPPORTED_FOR_SCALE_TYPE = -200601 + CHANNEL_NAME_GENERATION_NUMBER_TOO_BIG = -200600 + REPEATED_NUMBER_IN_SCALED_VALUES = -200599 + REPEATED_NUMBER_IN_PRE_SCALED_VALUES = -200598 + LINES_ALREADY_RESERVED_FOR_OUTPUT = -200597 + SWITCH_OPERATION_CHANS_SPAN_MULTIPLE_DEVS_IN_LIST = -200596 + INVALID_ID_IN_LIST_AT_BEGINNING_OF_SWITCH_OPERATION = -200595 + M_STUDIO_INVALID_POLY_DIRECTION = -200594 + M_STUDIO_PROPERTY_GET_WHILE_TASK_NOT_VERIFIED = -200593 + RANGE_WITH_TOO_MANY_OBJECTS = -200592 + CPP_DOT_NET_API_NEGATIVE_BUFFER_SIZE = -200591 + CPP_CANT_REMOVE_INVALID_EVENT_HANDLER = -200590 + CPP_CANT_REMOVE_EVENT_HANDLER_TWICE = -200589 + CPP_CANT_REMOVE_OTHER_OBJECTS_EVENT_HANDLER = -200588 + DIG_LINES_RESERVED_OR_UNAVAILABLE = -200587 + DSF_FAILED_TO_RESET_STREAM = -200586 + DSF_READY_FOR_OUTPUT_NOT_ASSERTED = -200585 + SAMP_TO_WRITE_PER_CHAN_NOT_MULTIPLE_OF_INCR = -200584 + AO_PROPERTIES_CAUSE_VOLTAGE_BELOW_MIN = -200583 + AO_PROPERTIES_CAUSE_VOLTAGE_OVER_MAX = -200582 + PROPERTY_NOT_SUPPORTED_WHEN_REF_CLK_SRC_NONE = -200581 + AI_MAX_TOO_SMALL = -200580 + AI_MAX_TOO_LARGE = -200579 + AI_MIN_TOO_SMALL = -200578 + AI_MIN_TOO_LARGE = -200577 + BUILT_IN_CJC_SRC_NOT_SUPPORTED = -200576 + TOO_MANY_POST_TRIG_SAMPS_PER_CHAN = -200575 + TRIG_LINE_NOT_FOUND_SINGLE_DEV_ROUTE = -200574 + DIFFERENT_INTERNAL_AI_INPUT_SOURCES = -200573 + DIFFERENT_AI_INPUT_SRC_IN_ONE_CHAN_GROUP = -200572 + INTERNAL_AI_INPUT_SRC_IN_MULTIPLE_CHAN_GROUPS = -200571 + CAPI_CHAN_INDEX_INVALID = -200570 + COLLECTION_DOES_NOT_MATCH_CHAN_TYPE = -200569 + OUTPUT_CANT_START_CHANGED_REGENERATION_MODE = -200568 + OUTPUT_CANT_START_CHANGED_BUFFER_SIZE = -200567 + CHAN_SIZE_TOO_BIG_FOR_U_32_PORT_WRITE = -200566 + CHAN_SIZE_TOO_BIG_FOR_U_8_PORT_WRITE = -200565 + CHAN_SIZE_TOO_BIG_FOR_U_32_PORT_READ = -200564 + CHAN_SIZE_TOO_BIG_FOR_U_8_PORT_READ = -200563 + INVALID_DIG_DATA_WRITE = -200562 + INVALID_AO_DATA_WRITE = -200561 + WAIT_UNTIL_DONE_DOES_NOT_INDICATE_DONE = -200560 + MULTI_CHAN_TYPES_IN_TASK = -200559 + MULTI_DEVS_IN_TASK = -200558 + CANNOT_SET_PROPERTY_WHEN_TASK_RUNNING = -200557 + CANNOT_GET_PROPERTY_WHEN_TASK_NOT_COMMITTED_OR_RUNNING = -200556 + LEADING_UNDERSCORE_IN_STRING = -200555 + TRAILING_SPACE_IN_STRING = -200554 + LEADING_SPACE_IN_STRING = -200553 + INVALID_CHAR_IN_STRING = -200552 + DLL_BECAME_UNLOCKED = -200551 + DLL_LOCK = -200550 + SELF_CAL_CONSTS_INVALID = -200549 + INVALID_TRIG_COUPLING_EXCEPT_FOR_EXT_TRIG_CHAN = -200548 + WRITE_FAILS_BUFFER_SIZE_AUTO_CONFIGURED = -200547 + EXT_CAL_ADJUST_EXT_REF_VOLTAGE_FAILED = -200546 + SELF_CAL_FAILED_EXT_NOISE_OR_REF_VOLTAGE_OUT_OF_CAL = -200545 + EXT_CAL_TEMPERATURE_NOT_DA_QMX = -200544 + EXT_CAL_DATE_TIME_NOT_DA_QMX = -200543 + SELF_CAL_TEMPERATURE_NOT_DA_QMX = -200542 + SELF_CAL_DATE_TIME_NOT_DA_QMX = -200541 + DAC_REF_VAL_NOT_SET = -200540 + ANALOG_MULTI_SAMP_WRITE_NOT_SUPPORTED = -200539 + INVALID_ACTION_IN_CONTROL_TASK = -200538 + POLY_COEFFS_INCONSISTENT = -200537 + SENSOR_VAL_TOO_LOW = -200536 + SENSOR_VAL_TOO_HIGH = -200535 + WAVEFORM_NAME_TOO_LONG = -200534 + IDENTIFIER_TOO_LONG_IN_SCRIPT = -200533 + UNEXPECTED_ID_FOLLOWING_SWITCH_CHAN_NAME = -200532 + RELAY_NAME_NOT_SPECIFIED_IN_LIST = -200531 + UNEXPECTED_ID_FOLLOWING_RELAY_NAME_IN_LIST = -200530 + UNEXPECTED_ID_FOLLOWING_SWITCH_OP_IN_LIST = -200529 + INVALID_LINE_GROUPING = -200528 + CTR_MIN_MAX = -200527 + WRITE_CHAN_TYPE_MISMATCH = -200526 + READ_CHAN_TYPE_MISMATCH = -200525 + WRITE_NUM_CHANS_MISMATCH = -200524 + ONE_CHAN_READ_FOR_MULTI_CHAN_TASK = -200523 + CANNOT_SELF_CAL_DURING_EXT_CAL = -200522 + MEAS_CAL_ADJUST_OSCILLATOR_PHASE_DAC = -200521 + INVALID_CAL_CONST_CAL_ADC_ADJUSTMENT = -200520 + INVALID_CAL_CONST_OSCILLATOR_FREQ_DAC_VALUE = -200519 + INVALID_CAL_CONST_OSCILLATOR_PHASE_DAC_VALUE = -200518 + INVALID_CAL_CONST_OFFSET_DAC_VALUE = -200517 + INVALID_CAL_CONST_GAIN_DAC_VALUE = -200516 + INVALID_NUM_CAL_ADC_READS_TO_AVERAGE = -200515 + INVALID_CFG_CAL_ADJUST_DIRECT_PATH_OUTPUT_IMPEDANCE = -200514 + INVALID_CFG_CAL_ADJUST_MAIN_PATH_OUTPUT_IMPEDANCE = -200513 + INVALID_CFG_CAL_ADJUST_MAIN_PATH_POST_AMP_GAIN_AND_OFFSET = -200512 + INVALID_CFG_CAL_ADJUST_MAIN_PATH_PRE_AMP_GAIN = -200511 + INVALID_CFG_CAL_ADJUST_MAIN_PRE_AMP_OFFSET = -200510 + MEAS_CAL_ADJUST_CAL_ADC = -200509 + MEAS_CAL_ADJUST_OSCILLATOR_FREQUENCY = -200508 + MEAS_CAL_ADJUST_DIRECT_PATH_OUTPUT_IMPEDANCE = -200507 + MEAS_CAL_ADJUST_MAIN_PATH_OUTPUT_IMPEDANCE = -200506 + MEAS_CAL_ADJUST_DIRECT_PATH_GAIN = -200505 + MEAS_CAL_ADJUST_MAIN_PATH_POST_AMP_GAIN_AND_OFFSET = -200504 + MEAS_CAL_ADJUST_MAIN_PATH_PRE_AMP_GAIN = -200503 + MEAS_CAL_ADJUST_MAIN_PATH_PRE_AMP_OFFSET = -200502 + INVALID_DATE_TIME_IN_EEPROM = -200501 + UNABLE_TO_LOCATE_ERROR_RESOURCES = -200500 + DOT_NET_API_NOT_UNSIGNED_32_BIT_NUMBER = -200499 + INVALID_RANGE_OF_OBJECTS_SYNTAX_IN_STRING = -200498 + ATTEMPT_TO_ENABLE_LINE_NOT_PREVIOUSLY_DISABLED = -200497 + INVALID_CHAR_IN_PATTERN = -200496 + INTERMEDIATE_BUFFER_FULL = -200495 + LOAD_TASK_FAILS_BECAUSE_NO_TIMING_ON_DEV = -200494 + CAPI_RESERVED_PARAM_NOT_NULL_NOR_EMPTY = -200493 + CAPI_RESERVED_PARAM_NOT_NULL = -200492 + CAPI_RESERVED_PARAM_NOT_ZERO = -200491 + SAMPLE_VALUE_OUT_OF_RANGE = -200490 + CHAN_ALREADY_IN_TASK = -200489 + VIRTUAL_CHAN_DOES_NOT_EXIST = -200488 + CHAN_NOT_IN_TASK = -200486 + TASK_NOT_IN_DATA_NEIGHBORHOOD = -200485 + CANT_SAVE_TASK_WITHOUT_REPLACE = -200484 + CANT_SAVE_CHAN_WITHOUT_REPLACE = -200483 + DEV_NOT_IN_TASK = -200482 + DEV_ALREADY_IN_TASK = -200481 + CAN_NOT_PERFORM_OP_WHILE_TASK_RUNNING = -200479 + CAN_NOT_PERFORM_OP_WHEN_NO_CHANS_IN_TASK = -200478 + CAN_NOT_PERFORM_OP_WHEN_NO_DEV_IN_TASK = -200477 + CANNOT_PERFORM_OP_WHEN_TASK_NOT_RUNNING = -200475 + OPERATION_TIMED_OUT = -200474 + CANNOT_READ_WHEN_AUTO_START_FALSE_AND_TASK_NOT_RUNNING_OR_COMMITTED = -200473 + CANNOT_WRITE_WHEN_AUTO_START_FALSE_AND_TASK_NOT_RUNNING_OR_COMMITTED = -200472 + TASK_VERSION_NEW = -200470 + CHAN_VERSION_NEW = -200469 + EMPTY_STRING = -200467 + CHANNEL_SIZE_TOO_BIG_FOR_PORT_READ_TYPE = -200466 + CHANNEL_SIZE_TOO_BIG_FOR_PORT_WRITE_TYPE = -200465 + EXPECTED_NUMBER_OF_CHANNELS_VERIFICATION_FAILED = -200464 + NUM_LINES_MISMATCH_IN_READ_OR_WRITE = -200463 + OUTPUT_BUFFER_EMPTY = -200462 + INVALID_CHAN_NAME = -200461 + READ_NO_INPUT_CHANS_IN_TASK = -200460 + WRITE_NO_OUTPUT_CHANS_IN_TASK = -200459 + PROPERTY_NOT_SUPPORTED_NOT_INPUT_TASK = -200457 + PROPERTY_NOT_SUPPORTED_NOT_OUTPUT_TASK = -200456 + GET_PROPERTY_NOT_INPUT_BUFFERED_TASK = -200455 + GET_PROPERTY_NOT_OUTPUT_BUFFERED_TASK = -200454 + INVALID_TIMEOUT_VAL = -200453 + ATTRIBUTE_NOT_SUPPORTED_IN_TASK_CONTEXT = -200452 + ATTRIBUTE_NOT_QUERYABLE_UNLESS_TASK_IS_COMMITTED = -200451 + ATTRIBUTE_NOT_SETTABLE_WHEN_TASK_IS_RUNNING = -200450 + DAC_RNG_LOW_NOT_MINUS_REF_VAL_NOR_ZERO = -200449 + DAC_RNG_HIGH_NOT_EQUAL_REF_VAL = -200448 + UNITS_NOT_FROM_CUSTOM_SCALE = -200447 + INVALID_VOLTAGE_READING_DURING_EXT_CAL = -200446 + CAL_FUNCTION_NOT_SUPPORTED = -200445 + INVALID_PHYSICAL_CHAN_FOR_CAL = -200444 + EXT_CAL_NOT_COMPLETE = -200443 + CANT_SYNC_TO_EXT_STIMULUS_FREQ_DURING_CAL = -200442 + UNABLE_TO_DETECT_EXT_STIMULUS_FREQ_DURING_CAL = -200441 + INVALID_CLOSE_ACTION = -200440 + EXT_CAL_FUNCTION_OUTSIDE_EXT_CAL_SESSION = -200439 + INVALID_CAL_AREA = -200438 + EXT_CAL_CONSTS_INVALID = -200437 + START_TRIG_DELAY_WITH_EXT_SAMP_CLK = -200436 + DELAY_FROM_SAMP_CLK_WITH_EXT_CONV = -200435 + FEWER_THAN_2_PRE_SCALED_VALS = -200434 + FEWER_THAN_2_SCALED_VALUES = -200433 + PHYS_CHAN_OUTPUT_TYPE = -200432 + PHYS_CHAN_MEAS_TYPE = -200431 + INVALID_PHYS_CHAN_TYPE = -200430 + LAB_VIEW_EMPTY_TASK_OR_CHANS = -200429 + LAB_VIEW_INVALID_TASK_OR_CHANS = -200428 + INVALID_REF_CLK_RATE = -200427 + INVALID_EXT_TRIG_IMPEDANCE = -200426 + HYST_TRIG_LEVEL_AI_MAX = -200425 + LINE_NUM_INCOMPATIBLE_WITH_VIDEO_SIGNAL_FORMAT = -200424 + TRIG_WINDOW_AI_MIN_AI_MAX_COMBO = -200423 + TRIG_AI_MIN_AI_MAX = -200422 + HYST_TRIG_LEVEL_AI_MIN = -200421 + INVALID_SAMP_RATE_CONSIDER_RIS = -200420 + INVALID_READ_POS_DURING_RIS = -200419 + IMMED_TRIG_DURING_RIS_MODE = -200418 + TDC_NOT_ENABLED_DURING_RIS_MODE = -200417 + MULTI_REC_WITH_RIS = -200416 + INVALID_REF_CLK_SRC = -200415 + INVALID_SAMP_CLK_SRC = -200414 + INSUFFICIENT_ON_BOARD_MEM_FOR_NUM_RECS_AND_SAMPS = -200413 + INVALID_AI_ATTENUATION = -200412 + AC_COUPLING_NOT_ALLOWED_WITH_50_OHM_IMPEDANCE = -200411 + INVALID_RECORD_NUM = -200410 + ZERO_SLOPE_LINEAR_SCALE = -200409 + ZERO_REVERSE_POLY_SCALE_COEFFS = -200408 + ZERO_FORWARD_POLY_SCALE_COEFFS = -200407 + NO_REVERSE_POLY_SCALE_COEFFS = -200406 + NO_FORWARD_POLY_SCALE_COEFFS = -200405 + NO_POLY_SCALE_COEFFS = -200404 + REVERSE_POLY_ORDER_LESS_THAN_NUM_PTS_TO_COMPUTE = -200403 + REVERSE_POLY_ORDER_NOT_POSITIVE = -200402 + NUM_PTS_TO_COMPUTE_NOT_POSITIVE = -200401 + WAVEFORM_LENGTH_NOT_MULTIPLE_OF_INCR = -200400 + CAPI_NO_EXTENDED_ERROR_INFO_AVAILABLE = -200399 + CVI_FUNCTION_NOT_FOUND_IN_DA_QMX_DLL = -200398 + CVI_FAILED_TO_LOAD_DA_QMX_DLL = -200397 + NO_COMMON_TRIG_LINE_FOR_IMMED_ROUTE = -200396 + NO_COMMON_TRIG_LINE_FOR_TASK_ROUTE = -200395 + F_64_PRPTY_VAL_NOT_UNSIGNED_INT = -200394 + REGISTER_NOT_WRITABLE = -200393 + INVALID_OUTPUT_VOLTAGE_AT_SAMP_CLK_RATE = -200392 + STROBE_PHASE_SHIFT_DCM_BECAME_UNLOCKED = -200391 + DRIVE_PHASE_SHIFT_DCM_BECAME_UNLOCKED = -200390 + CLK_OUT_PHASE_SHIFT_DCM_BECAME_UNLOCKED = -200389 + OUTPUT_BOARD_CLK_DCM_BECAME_UNLOCKED = -200388 + INPUT_BOARD_CLK_DCM_BECAME_UNLOCKED = -200387 + INTERNAL_CLK_DCM_BECAME_UNLOCKED = -200386 + DCM_LOCK = -200385 + DATA_LINE_RESERVED_FOR_DYNAMIC_OUTPUT = -200384 + INVALID_REF_CLK_SRC_GIVEN_SAMP_CLK_SRC = -200383 + NO_PATTERN_MATCHER_AVAILABLE = -200382 + INVALID_DELAY_SAMP_RATE_BELOW_PHASE_SHIFT_DCM_THRESH = -200381 + STRAIN_GAGE_CALIBRATION = -200380 + INVALID_EXT_CLOCK_FREQ_AND_DIV_COMBO = -200379 + CUSTOM_SCALE_DOES_NOT_EXIST = -200378 + ONLY_FRONT_END_CHAN_OPS_DURING_SCAN = -200377 + INVALID_OPTION_FOR_DIGITAL_PORT_CHANNEL = -200376 + UNSUPPORTED_SIGNAL_TYPE_EXPORT_SIGNAL = -200375 + INVALID_SIGNAL_TYPE_EXPORT_SIGNAL = -200374 + UNSUPPORTED_TRIG_TYPE_SENDS_SW_TRIG = -200373 + INVALID_TRIG_TYPE_SENDS_SW_TRIG = -200372 + REPEATED_PHYSICAL_CHAN = -200371 + RESOURCES_IN_USE_FOR_ROUTE_IN_TASK = -200370 + RESOURCES_IN_USE_FOR_ROUTE = -200369 + ROUTE_NOT_SUPPORTED_BY_HW = -200368 + RESOURCES_IN_USE_FOR_EXPORT_SIGNAL_POLARITY = -200367 + RESOURCES_IN_USE_FOR_INVERSION_IN_TASK = -200366 + RESOURCES_IN_USE_FOR_INVERSION = -200365 + EXPORT_SIGNAL_POLARITY_NOT_SUPPORTED_BY_HW = -200364 + INVERSION_NOT_SUPPORTED_BY_HW = -200363 + OVERLOADED_CHANS_EXIST_NOT_READ = -200362 + INPUT_FIFO_OVERFLOW_2 = -200361 + CJC_CHAN_NOT_SPECD = -200360 + CTR_EXPORT_SIGNAL_NOT_POSSIBLE = -200359 + REF_TRIG_WHEN_CONTINUOUS = -200358 + INCOMPATIBLE_SENSOR_OUTPUT_AND_DEVICE_INPUT_RANGES = -200357 + CUSTOM_SCALE_NAME_USED = -200356 + PROPERTY_VAL_NOT_SUPPORTED_BY_HW = -200355 + PROPERTY_VAL_NOT_VALID_TERM_NAME = -200354 + RESOURCES_IN_USE_FOR_PROPERTY = -200353 + CJC_CHAN_ALREADY_USED = -200352 + FORWARD_POLYNOMIAL_COEF_NOT_SPECD = -200351 + TABLE_SCALE_NUM_PRE_SCALED_AND_SCALED_VALS_NOT_EQUAL = -200350 + TABLE_SCALE_PRE_SCALED_VALS_NOT_SPECD = -200349 + TABLE_SCALE_SCALED_VALS_NOT_SPECD = -200348 + INTERMEDIATE_BUFFER_SIZE_NOT_MULTIPLE_OF_INCR = -200347 + EVENT_PULSE_WIDTH_OUT_OF_RANGE = -200346 + EVENT_DELAY_OUT_OF_RANGE = -200345 + SAMP_PER_CHAN_NOT_MULTIPLE_OF_INCR = -200344 + CANNOT_CALCULATE_NUM_SAMPS_TASK_NOT_STARTED = -200343 + SCRIPT_NOT_IN_MEM = -200342 + ONBOARD_MEM_TOO_SMALL = -200341 + READ_ALL_AVAILABLE_DATA_WITHOUT_BUFFER = -200340 + PULSE_ACTIVE_AT_START = -200339 + CAL_TEMP_NOT_SUPPORTED = -200338 + DELAY_FROM_SAMP_CLK_TOO_LONG = -200337 + DELAY_FROM_SAMP_CLK_TOO_SHORT = -200336 + AI_CONV_RATE_TOO_HIGH = -200335 + DELAY_FROM_START_TRIG_TOO_LONG = -200334 + DELAY_FROM_START_TRIG_TOO_SHORT = -200333 + SAMP_RATE_TOO_HIGH = -200332 + SAMP_RATE_TOO_LOW = -200331 + PFI_0_USED_FOR_ANALOG_AND_DIGITAL_SRC = -200330 + PRIMING_CFG_FIFO = -200329 + CANNOT_OPEN_TOPOLOGY_CFG_FILE = -200328 + INVALID_DT_INSIDE_WFM_DATA_TYPE = -200327 + ROUTE_SRC_AND_DEST_SAME = -200326 + REVERSE_POLYNOMIAL_COEF_NOT_SPECD = -200325 + DEV_ABSENT_OR_UNAVAILABLE = -200324 + NO_ADV_TRIG_FOR_MULTI_DEV_SCAN = -200323 + INTERRUPTS_INSUFFICIENT_DATA_XFER_MECH = -200322 + INVALID_ATTENTUATION_BASED_ON_MIN_MAX = -200321 + CABLED_MODULE_CANNOT_ROUTE_SSH = -200320 + CABLED_MODULE_CANNOT_ROUTE_CONV_CLK = -200319 + INVALID_EXCIT_VAL_FOR_SCALING = -200318 + NO_DEV_MEM_FOR_SCRIPT = -200317 + SCRIPT_DATA_UNDERFLOW = -200316 + NO_DEV_MEM_FOR_WAVEFORM = -200315 + STREAM_DCM_BECAME_UNLOCKED = -200314 + STREAM_DCM_LOCK = -200313 + WAVEFORM_NOT_IN_MEM = -200312 + WAVEFORM_WRITE_OUT_OF_BOUNDS = -200311 + WAVEFORM_PREVIOUSLY_ALLOCATED = -200310 + SAMP_CLK_TB_MASTER_TB_DIV_NOT_APPROPRIATE_FOR_SAMP_TB_SRC = -200309 + SAMP_TB_RATE_SAMP_TB_SRC_MISMATCH = -200308 + MASTER_TB_RATE_MASTER_TB_SRC_MISMATCH = -200307 + SAMPS_PER_CHAN_TOO_BIG = -200306 + FINITE_PULSE_TRAIN_NOT_POSSIBLE = -200305 + EXT_MASTER_TIMEBASE_RATE_NOT_SPECIFIED = -200304 + EXT_SAMP_CLK_SRC_NOT_SPECIFIED = -200303 + INPUT_SIGNAL_SLOWER_THAN_MEAS_TIME = -200302 + CANNOT_UPDATE_PULSE_GEN_PROPERTY = -200301 + INVALID_TIMING_TYPE = -200300 + PROPERTY_UNAVAIL_WHEN_USING_ONBOARD_MEMORY = -200297 + CANNOT_WRITE_AFTER_START_WITH_ONBOARD_MEMORY = -200295 + NOT_ENOUGH_SAMPS_WRITTEN_FOR_INITIAL_XFER_RQST_CONDITION = -200294 + NO_MORE_SPACE = -200293 + SAMPLES_CAN_NOT_YET_BE_WRITTEN = -200292 + GEN_STOPPED_TO_PREVENT_INTERMEDIATE_BUFFER_REGEN_OF_OLD_SAMPLES = -200291 + GEN_STOPPED_TO_PREVENT_REGEN_OF_OLD_SAMPLES = -200290 + SAMPLES_NO_LONGER_WRITEABLE = -200289 + SAMPLES_WILL_NEVER_BE_GENERATED = -200288 + NEGATIVE_WRITE_SAMPLE_NUMBER = -200287 + NO_ACQ_STARTED = -200286 + SAMPLES_NOT_YET_AVAILABLE = -200284 + ACQ_STOPPED_TO_PREVENT_INTERMEDIATE_BUFFER_OVERFLOW = -200283 + NO_REF_TRIG_CONFIGURED = -200282 + CANNOT_READ_RELATIVE_TO_REF_TRIG_UNTIL_DONE = -200281 + SAMPLES_NO_LONGER_AVAILABLE = -200279 + SAMPLES_WILL_NEVER_BE_AVAILABLE = -200278 + NEGATIVE_READ_SAMPLE_NUMBER = -200277 + EXTERNAL_SAMP_CLK_AND_REF_CLK_THRU_SAME_TERM = -200276 + EXT_SAMP_CLK_RATE_TOO_LOW_FOR_CLK_IN = -200275 + EXT_SAMP_CLK_RATE_TOO_HIGH_FOR_BACKPLANE = -200274 + SAMP_CLK_RATE_AND_DIV_COMBO = -200273 + SAMP_CLK_RATE_TOO_LOW_FOR_DIV_DOWN = -200272 + PRODUCT_OF_AO_MIN_AND_GAIN_TOO_SMALL = -200271 + INTERPOLATION_RATE_NOT_POSSIBLE = -200270 + OFFSET_TOO_LARGE = -200269 + OFFSET_TOO_SMALL = -200268 + PRODUCT_OF_AO_MAX_AND_GAIN_TOO_LARGE = -200267 + MIN_AND_MAX_NOT_SYMMETRIC = -200266 + INVALID_ANALOG_TRIG_SRC = -200265 + TOO_MANY_CHANS_FOR_ANALOG_REF_TRIG = -200264 + TOO_MANY_CHANS_FOR_ANALOG_PAUSE_TRIG = -200263 + TRIG_WHEN_ON_DEMAND_SAMP_TIMING = -200262 + INCONSISTENT_ANALOG_TRIG_SETTINGS = -200261 + MEM_MAP_DATA_XFER_MODE_SAMP_TIMING_COMBO = -200260 + INVALID_JUMPERED_ATTR = -200259 + INVALID_GAIN_BASED_ON_MIN_MAX = -200258 + INCONSISTENT_EXCIT = -200257 + TOPOLOGY_NOT_SUPPORTED_BY_CFG_TERM_BLOCK = -200256 + BUILT_IN_TEMP_SENSOR_NOT_SUPPORTED = -200255 + INVALID_TERM = -200254 + CANNOT_TRISTATE_TERM = -200253 + CANNOT_TRISTATE_BUSY_TERM = -200252 + NO_DMA_CHANS_AVAILABLE = -200251 + INVALID_WAVEFORM_LENGTH_WITHIN_LOOP_IN_SCRIPT = -200250 + INVALID_SUBSET_LENGTH_WITHIN_LOOP_IN_SCRIPT = -200249 + MARKER_POS_INVALID_FOR_LOOP_IN_SCRIPT = -200248 + INTEGER_EXPECTED_IN_SCRIPT = -200247 + PLL_BECAME_UNLOCKED = -200246 + PLL_LOCK = -200245 + DDC_CLK_OUT_DCM_BECAME_UNLOCKED = -200244 + DDC_CLK_OUT_DCM_LOCK = -200243 + CLK_DOUBLER_DCM_BECAME_UNLOCKED = -200242 + CLK_DOUBLER_DCM_LOCK = -200241 + SAMP_CLK_DCM_BECAME_UNLOCKED = -200240 + SAMP_CLK_DCM_LOCK = -200239 + SAMP_CLK_TIMEBASE_DCM_BECAME_UNLOCKED = -200238 + SAMP_CLK_TIMEBASE_DCM_LOCK = -200237 + ATTR_CANNOT_BE_RESET = -200236 + EXPLANATION_NOT_FOUND = -200235 + WRITE_BUFFER_TOO_SMALL = -200234 + SPECIFIED_ATTR_NOT_VALID = -200233 + ATTR_CANNOT_BE_READ = -200232 + ATTR_CANNOT_BE_SET = -200231 + NULL_PTR_FOR_C_API = -200230 + READ_BUFFER_TOO_SMALL = -200229 + BUFFER_TOO_SMALL_FOR_STRING = -200228 + NO_AVAIL_TRIG_LINES_ON_DEVICE = -200227 + TRIG_BUS_LINE_NOT_AVAIL = -200226 + COULD_NOT_RESERVE_REQUESTED_TRIG_LINE = -200225 + TRIG_LINE_NOT_FOUND = -200224 + SCXI_1126_THRESH_HYST_COMBINATION = -200223 + ACQ_STOPPED_TO_PREVENT_INPUT_BUFFER_OVERWRITE = -200222 + TIMEOUT_EXCEEDED = -200221 + INVALID_DEVICE_ID = -200220 + INVALID_AO_CHAN_ORDER = -200219 + SAMPLE_TIMING_TYPE_AND_DATA_XFER_MODE = -200218 + BUFFER_WITH_ON_DEMAND_SAMP_TIMING = -200217 + BUFFER_AND_DATA_XFER_MODE = -200216 + MEM_MAP_AND_BUFFER = -200215 + NO_ANALOG_TRIG_HW = -200214 + TOO_MANY_PRETRIG_PLUS_MIN_POST_TRIG_SAMPS = -200213 + INCONSISTENT_UNITS_SPECIFIED = -200212 + MULTIPLE_RELAYS_FOR_SINGLE_RELAY_OP = -200211 + MULTIPLE_DEV_IDS_PER_CHASSIS_SPECIFIED_IN_LIST = -200210 + DUPLICATE_DEV_ID_IN_LIST = -200209 + INVALID_RANGE_STATEMENT_CHAR_IN_LIST = -200208 + INVALID_DEVICE_ID_IN_LIST = -200207 + TRIGGER_POLARITY_CONFLICT = -200206 + CANNOT_SCAN_WITH_CURRENT_TOPOLOGY = -200205 + UNEXPECTED_IDENTIFIER_IN_FULLY_SPECIFIED_PATH_IN_LIST = -200204 + SWITCH_CANNOT_DRIVE_MULTIPLE_TRIG_LINES = -200203 + INVALID_RELAY_NAME = -200202 + SWITCH_SCANLIST_TOO_BIG = -200201 + SWITCH_CHAN_IN_USE = -200200 + SWITCH_NOT_RESET_BEFORE_SCAN = -200199 + INVALID_TOPOLOGY = -200198 + ATTR_NOT_SUPPORTED = -200197 + UNEXPECTED_END_OF_ACTIONS_IN_LIST = -200196 + POWER_LIMIT_EXCEEDED = -200195 + HW_UNEXPECTEDLY_POWERED_OFF_AND_ON = -200194 + SWITCH_OPERATION_NOT_SUPPORTED = -200193 + ONLY_CONTINUOUS_SCAN_SUPPORTED = -200192 + SWITCH_DIFFERENT_TOPOLOGY_WHEN_SCANNING = -200191 + DISCONNECT_PATH_NOT_SAME_AS_EXISTING_PATH = -200190 + CONNECTION_NOT_PERMITTED_ON_CHAN_RESERVED_FOR_ROUTING = -200189 + CANNOT_CONNECT_SRC_CHANS = -200188 + CANNOT_CONNECT_CHANNEL_TO_ITSELF = -200187 + CHANNEL_NOT_RESERVED_FOR_ROUTING = -200186 + CANNOT_CONNECT_CHANS_DIRECTLY = -200185 + CHANS_ALREADY_CONNECTED = -200184 + CHAN_DUPLICATED_IN_PATH = -200183 + NO_PATH_TO_DISCONNECT = -200182 + INVALID_SWITCH_CHAN = -200181 + NO_PATH_AVAILABLE_BETWEEN_2_SWITCH_CHANS = -200180 + EXPLICIT_CONNECTION_EXISTS = -200179 + SWITCH_DIFFERENT_SETTLING_TIME_WHEN_SCANNING = -200178 + OPERATION_ONLY_PERMITTED_WHILE_SCANNING = -200177 + OPERATION_NOT_PERMITTED_WHILE_SCANNING = -200176 + HARDWARE_NOT_RESPONDING = -200175 + INVALID_SAMP_AND_MASTER_TIMEBASE_RATE_COMBO = -200173 + NON_ZERO_BUFFER_SIZE_IN_PROG_IO_XFER = -200172 + VIRTUAL_CHAN_NAME_USED = -200171 + PHYSICAL_CHAN_DOES_NOT_EXIST = -200170 + MEM_MAP_ONLY_FOR_PROG_IO_XFER = -200169 + TOO_MANY_CHANS = -200168 + CANNOT_HAVE_CJ_TEMP_WITH_OTHER_CHANS = -200167 + OUTPUT_BUFFER_UNDERWRITE = -200166 + SENSOR_INVALID_COMPLETION_RESISTANCE = -200163 + VOLTAGE_EXCIT_INCOMPATIBLE_WITH_2_WIRE_CFG = -200162 + INT_EXCIT_SRC_NOT_AVAILABLE = -200161 + CANNOT_CREATE_CHANNEL_AFTER_TASK_VERIFIED = -200160 + LINES_RESERVED_FOR_SCXI_CONTROL = -200159 + COULD_NOT_RESERVE_LINES_FOR_SCXI_CONTROL = -200158 + CALIBRATION_FAILED = -200157 + REFERENCE_FREQUENCY_INVALID = -200156 + REFERENCE_RESISTANCE_INVALID = -200155 + REFERENCE_CURRENT_INVALID = -200154 + REFERENCE_VOLTAGE_INVALID = -200153 + EEPROM_DATA_INVALID = -200152 + CABLED_MODULE_NOT_CAPABLE_OF_ROUTING_AI = -200151 + CHANNEL_NOT_AVAILABLE_IN_PARALLEL_MODE = -200150 + EXTERNAL_TIMEBASE_RATE_NOT_KNOWN_FOR_DELAY = -200149 + FREQOUT_CANNOT_PRODUCE_DESIRED_FREQUENCY = -200148 + MULTIPLE_COUNTER_INPUT_TASK = -200147 + COUNTER_START_PAUSE_TRIGGER_CONFLICT = -200146 + COUNTER_INPUT_PAUSE_TRIGGER_AND_SAMPLE_CLOCK_INVALID = -200145 + COUNTER_OUTPUT_PAUSE_TRIGGER_INVALID = -200144 + COUNTER_TIMEBASE_RATE_NOT_SPECIFIED = -200143 + COUNTER_TIMEBASE_RATE_NOT_FOUND = -200142 + COUNTER_OVERFLOW = -200141 + COUNTER_NO_TIMEBASE_EDGES_BETWEEN_GATES = -200140 + COUNTER_MAX_MIN_RANGE_FREQ = -200139 + COUNTER_MAX_MIN_RANGE_TIME = -200138 + SUITABLE_TIMEBASE_NOT_FOUND_TIME_COMBO = -200137 + SUITABLE_TIMEBASE_NOT_FOUND_FREQUENCY_COMBO = -200136 + INTERNAL_TIMEBASE_SOURCE_DIVISOR_COMBO = -200135 + INTERNAL_TIMEBASE_SOURCE_RATE_COMBO = -200134 + INTERNAL_TIMEBASE_RATE_DIVISOR_SOURCE_COMBO = -200133 + EXTERNAL_TIMEBASE_RATE_NOTKNOWN_FOR_RATE = -200132 + ANALOG_TRIG_CHAN_NOT_FIRST_IN_SCAN_LIST = -200131 + NO_DIVISOR_FOR_EXTERNAL_SIGNAL = -200130 + ATTRIBUTE_INCONSISTENT_ACROSS_REPEATED_PHYSICAL_CHANNELS = -200128 + CANNOT_HANDSHAKE_WITH_PORT_0 = -200127 + CONTROL_LINE_CONFLICT_ON_PORT_C = -200126 + LINES_4_TO_7_CONFIGURED_FOR_OUTPUT = -200125 + LINES_4_TO_7_CONFIGURED_FOR_INPUT = -200124 + LINES_0_TO_3_CONFIGURED_FOR_OUTPUT = -200123 + LINES_0_TO_3_CONFIGURED_FOR_INPUT = -200122 + PORT_CONFIGURED_FOR_OUTPUT = -200121 + PORT_CONFIGURED_FOR_INPUT = -200120 + PORT_CONFIGURED_FOR_STATIC_DIGITAL_OPS = -200119 + PORT_RESERVED_FOR_HANDSHAKING = -200118 + PORT_DOES_NOT_SUPPORT_HANDSHAKING_DATA_IO = -200117 + CANNOT_TRISTATE_8255_OUTPUT_LINES = -200116 + TEMPERATURE_OUT_OF_RANGE_FOR_CALIBRATION = -200113 + CALIBRATION_HANDLE_INVALID = -200112 + PASSWORD_REQUIRED = -200111 + INCORRECT_PASSWORD = -200110 + PASSWORD_TOO_LONG = -200109 + CALIBRATION_SESSION_ALREADY_OPEN = -200108 + SCXI_MODULE_INCORRECT = -200107 + ATTRIBUTE_INCONSISTENT_ACROSS_CHANNELS_ON_DEVICE = -200106 + SCXI_1122_RESISTANCE_CHAN_NOT_SUPPORTED_FOR_CFG = -200105 + BRACKET_PAIRING_MISMATCH_IN_LIST = -200104 + INCONSISTENT_NUM_SAMPLES_TO_WRITE = -200103 + INCORRECT_DIGITAL_PATTERN = -200102 + INCORRECT_NUM_CHANNELS_TO_WRITE = -200101 + INCORRECT_READ_FUNCTION = -200100 + PHYSICAL_CHANNEL_NOT_SPECIFIED = -200099 + MORE_THAN_ONE_TERMINAL = -200098 + MORE_THAN_ONE_ACTIVE_CHANNEL_SPECIFIED = -200097 + INVALID_NUMBER_SAMPLES_TO_READ = -200096 + ANALOG_WAVEFORM_EXPECTED = -200095 + DIGITAL_WAVEFORM_EXPECTED = -200094 + ACTIVE_CHANNEL_NOT_SPECIFIED = -200093 + FUNCTION_NOT_SUPPORTED_FOR_DEVICE_TASKS = -200092 + FUNCTION_NOT_IN_LIBRARY = -200091 + LIBRARY_NOT_PRESENT = -200090 + DUPLICATE_TASK = -200089 + INVALID_TASK = -200088 + INVALID_CHANNEL = -200087 + INVALID_SYNTAX_FOR_PHYSICAL_CHANNEL_RANGE = -200086 + MIN_NOT_LESS_THAN_MAX = -200082 + SAMPLE_RATE_NUM_CHANS_CONVERT_PERIOD_COMBO = -200081 + AO_DURING_COUNTER_1_DMA_CONFLICT = -200079 + AI_DURING_COUNTER_0_DMA_CONFLICT = -200078 + INVALID_ATTRIBUTE_VALUE = -200077 + SUPPLIED_CURRENT_DATA_OUTSIDE_SPECIFIED_RANGE = -200076 + SUPPLIED_VOLTAGE_DATA_OUTSIDE_SPECIFIED_RANGE = -200075 + CANNOT_STORE_CAL_CONST = -200074 + SCXI_MODULE_NOT_FOUND = -200073 + DUPLICATE_PHYSICAL_CHANS_NOT_SUPPORTED = -200072 + TOO_MANY_PHYSICAL_CHANS_IN_LIST = -200071 + INVALID_ADVANCE_EVENT_TRIGGER_TYPE = -200070 + DEVICE_IS_NOT_A_VALID_SWITCH = -200069 + DEVICE_DOES_NOT_SUPPORT_SCANNING = -200068 + SCAN_LIST_CANNOT_BE_TIMED = -200067 + CONNECT_OPERATOR_INVALID_AT_POINT_IN_LIST = -200066 + UNEXPECTED_SWITCH_ACTION_IN_LIST = -200065 + UNEXPECTED_SEPARATOR_IN_LIST = -200064 + EXPECTED_TERMINATOR_IN_LIST = -200063 + EXPECTED_CONNECT_OPERATOR_IN_LIST = -200062 + EXPECTED_SEPARATOR_IN_LIST = -200061 + FULLY_SPECIFIED_PATH_IN_LIST_CONTAINS_RANGE = -200060 + CONNECTION_SEPARATOR_AT_END_OF_LIST = -200059 + IDENTIFIER_IN_LIST_TOO_LONG = -200058 + DUPLICATE_DEVICE_ID_IN_LIST_WHEN_SETTLING = -200057 + CHANNEL_NAME_NOT_SPECIFIED_IN_LIST = -200056 + DEVICE_ID_NOT_SPECIFIED_IN_LIST = -200055 + SEMICOLON_DOES_NOT_FOLLOW_RANGE_IN_LIST = -200054 + SWITCH_ACTION_IN_LIST_SPANS_MULTIPLE_DEVICES = -200053 + RANGE_WITHOUT_A_CONNECT_ACTION_IN_LIST = -200052 + INVALID_IDENTIFIER_FOLLOWING_SEPARATOR_IN_LIST = -200051 + INVALID_CHANNEL_NAME_IN_LIST = -200050 + INVALID_NUMBER_IN_REPEAT_STATEMENT_IN_LIST = -200049 + INVALID_TRIGGER_LINE_IN_LIST = -200048 + INVALID_IDENTIFIER_IN_LIST_FOLLOWING_DEVICE_ID = -200047 + INVALID_IDENTIFIER_IN_LIST_AT_END_OF_SWITCH_ACTION = -200046 + DEVICE_REMOVED = -200045 + ROUTING_PATH_NOT_AVAILABLE = -200044 + ROUTING_HARDWARE_BUSY = -200043 + REQUESTED_SIGNAL_INVERSION_FOR_ROUTING_NOT_POSSIBLE = -200042 + INVALID_ROUTING_DESTINATION_TERMINAL_NAME = -200041 + INVALID_ROUTING_SOURCE_TERMINAL_NAME = -200040 + ROUTING_NOT_SUPPORTED_FOR_DEVICE = -200039 + WAIT_IS_LAST_INSTRUCTION_OF_LOOP_IN_SCRIPT = -200038 + CLEAR_IS_LAST_INSTRUCTION_OF_LOOP_IN_SCRIPT = -200037 + INVALID_LOOP_ITERATIONS_IN_SCRIPT = -200036 + REPEAT_LOOP_NESTING_TOO_DEEP_IN_SCRIPT = -200035 + MARKER_POSITION_OUTSIDE_SUBSET_IN_SCRIPT = -200034 + SUBSET_START_OFFSET_NOT_ALIGNED_IN_SCRIPT = -200033 + INVALID_SUBSET_LENGTH_IN_SCRIPT = -200032 + MARKER_POSITION_NOT_ALIGNED_IN_SCRIPT = -200031 + SUBSET_OUTSIDE_WAVEFORM_IN_SCRIPT = -200030 + MARKER_OUTSIDE_WAVEFORM_IN_SCRIPT = -200029 + WAVEFORM_IN_SCRIPT_NOT_IN_MEM = -200028 + KEYWORD_EXPECTED_IN_SCRIPT = -200027 + BUFFER_NAME_EXPECTED_IN_SCRIPT = -200026 + PROCEDURE_NAME_EXPECTED_IN_SCRIPT = -200025 + SCRIPT_HAS_INVALID_IDENTIFIER = -200024 + SCRIPT_HAS_INVALID_CHARACTER = -200023 + RESOURCE_ALREADY_RESERVED = -200022 + SELF_TEST_FAILED = -200020 + ADC_OVERRUN = -200019 + DAC_UNDERFLOW = -200018 + INPUT_FIFO_UNDERFLOW = -200017 + OUTPUT_FIFO_UNDERFLOW = -200016 + SCXI_SERIAL_COMMUNICATION = -200015 + DIGITAL_TERMINAL_SPECIFIED_MORE_THAN_ONCE = -200014 + DIGITAL_OUTPUT_NOT_SUPPORTED = -200012 + INCONSISTENT_CHANNEL_DIRECTIONS = -200011 + INPUT_FIFO_OVERFLOW = -200010 + TIME_STAMP_OVERWRITTEN = -200009 + STOP_TRIGGER_HAS_NOT_OCCURRED = -200008 + RECORD_NOT_AVAILABLE = -200007 + RECORD_OVERWRITTEN = -200006 + DATA_NOT_AVAILABLE = -200005 + DATA_OVERWRITTEN_IN_DEVICE_MEMORY = -200004 + DUPLICATED_CHANNEL = -200003 + ROUTING_DEST_TERM_PXI_DSTAR_X_NOT_IN_SYSTEM_TIMING_SLOT_ROUTING = -89167 + ROUTING_SRC_TERM_PXI_DSTAR_X_NOT_IN_SYSTEM_TIMING_SLOT_ROUTING = -89166 + ROUTING_SRC_TERM_PXI_DSTAR_IN_NON_D_STAR_TRIGGER_SLOT_ROUTING = -89165 + ROUTING_DEST_TERM_PXI_DSTAR_IN_NON_D_STAR_TRIGGER_SLOT_ROUTING = -89164 + ROUTING_DEST_TERM_PXI_CLK_10_IN_NOT_IN_STAR_TRIGGER_SLOT_ROUTING = -89162 + ROUTING_DEST_TERM_PXI_CLK_10_IN_NOT_IN_SYSTEM_TIMING_SLOT_ROUTING = -89161 + ROUTING_DEST_TERM_PXI_STAR_X_NOT_IN_STAR_TRIGGER_SLOT_ROUTING = -89160 + ROUTING_DEST_TERM_PXI_STAR_X_NOT_IN_SYSTEM_TIMING_SLOT_ROUTING = -89159 + ROUTING_SRC_TERM_PXI_STAR_X_NOT_IN_STAR_TRIGGER_SLOT_ROUTING = -89158 + ROUTING_SRC_TERM_PXI_STAR_X_NOT_IN_SYSTEM_TIMING_SLOT_ROUTING = -89157 + ROUTING_SRC_TERM_PXI_STAR_IN_NON_STAR_TRIGGER_SLOT_ROUTING = -89156 + ROUTING_DEST_TERM_PXI_STAR_IN_NON_STAR_TRIGGER_SLOT_ROUTING = -89155 + ROUTING_DEST_TERM_PXI_STAR_IN_STAR_TRIGGER_SLOT_ROUTING = -89154 + ROUTING_DEST_TERM_PXI_STAR_IN_SYSTEM_TIMING_SLOT_ROUTING = -89153 + ROUTING_SRC_TERM_PXI_STAR_IN_STAR_TRIGGER_SLOT_ROUTING = -89152 + ROUTING_SRC_TERM_PXI_STAR_IN_SYSTEM_TIMING_SLOT_ROUTING = -89151 + INVALID_SIGNAL_MODIFIER_ROUTING = -89150 + ROUTING_DEST_TERM_PXI_CLK_10_IN_NOT_IN_SLOT_2_ROUTING = -89149 + ROUTING_DEST_TERM_PXI_STAR_X_NOT_IN_SLOT_2_ROUTING = -89148 + ROUTING_SRC_TERM_PXI_STAR_X_NOT_IN_SLOT_2_ROUTING = -89147 + ROUTING_SRC_TERM_PXI_STAR_IN_SLOT_16_AND_ABOVE_ROUTING = -89146 + ROUTING_DEST_TERM_PXI_STAR_IN_SLOT_16_AND_ABOVE_ROUTING = -89145 + ROUTING_DEST_TERM_PXI_STAR_IN_SLOT_2_ROUTING = -89144 + ROUTING_SRC_TERM_PXI_STAR_IN_SLOT_2_ROUTING = -89143 + ROUTING_DEST_TERM_PXI_CHASSIS_NOT_IDENTIFIED_ROUTING = -89142 + ROUTING_SRC_TERM_PXI_CHASSIS_NOT_IDENTIFIED_ROUTING = -89141 + TRIG_LINE_NOT_FOUND_SINGLE_DEV_ROUTE_ROUTING = -89140 + NO_COMMON_TRIG_LINE_FOR_ROUTE_ROUTING = -89139 + RESOURCES_IN_USE_FOR_ROUTE_IN_TASK_ROUTING = -89138 + RESOURCES_IN_USE_FOR_ROUTE_ROUTING = -89137 + ROUTE_NOT_SUPPORTED_BY_HW_ROUTING = -89136 + RESOURCES_IN_USE_FOR_INVERSION_IN_TASK_ROUTING = -89135 + RESOURCES_IN_USE_FOR_INVERSION_ROUTING = -89134 + INVERSION_NOT_SUPPORTED_BY_HW_ROUTING = -89133 + RESOURCES_IN_USE_FOR_PROPERTY_ROUTING = -89132 + ROUTE_SRC_AND_DEST_SAME_ROUTING = -89131 + DEV_ABSENT_OR_UNAVAILABLE_ROUTING = -89130 + INVALID_TERM_ROUTING = -89129 + CANNOT_TRISTATE_TERM_ROUTING = -89128 + CANNOT_TRISTATE_BUSY_TERM_ROUTING = -89127 + COULD_NOT_RESERVE_REQUESTED_TRIG_LINE_ROUTING = -89126 + TRIG_LINE_NOT_FOUND_ROUTING = -89125 + ROUTING_PATH_NOT_AVAILABLE_ROUTING = -89124 + ROUTING_HARDWARE_BUSY_ROUTING = -89123 + REQUESTED_SIGNAL_INVERSION_FOR_ROUTING_NOT_POSSIBLE_ROUTING = -89122 + INVALID_ROUTING_DESTINATION_TERMINAL_NAME_ROUTING = -89121 + INVALID_ROUTING_SOURCE_TERMINAL_NAME_ROUTING = -89120 + SERVICE_LOCATOR_NOT_AVAILABLE_ROUTING = -88907 + COULD_NOT_CONNECT_TO_SERVER_ROUTING = -88900 + DEVICE_NAME_CONTAINS_SPACES_OR_PUNCTUATION_ROUTING = -88720 + DEVICE_NAME_CONTAINS_NONPRINTABLE_CHARACTERS_ROUTING = -88719 + DEVICE_NAME_IS_EMPTY_ROUTING = -88718 + DEVICE_NAME_NOT_FOUND_ROUTING = -88717 + LOCAL_REMOTE_DRIVER_VERSION_MISMATCH_ROUTING = -88716 + DUPLICATE_DEVICE_NAME_ROUTING = -88715 + RUNTIME_ABORTING_ROUTING = -88710 + RUNTIME_ABORTED_ROUTING = -88709 + RESOURCE_NOT_IN_POOL_ROUTING = -88708 + DRIVER_DEVICE_GUID_NOT_FOUND_ROUTING = -88705 + PAL_USB_TRANSACTION_ERROR = -50808 + PAL_ISOC_STREAM_BUFFER_ERROR = -50807 + PAL_INVALID_ADDRESS_COMPONENT = -50806 + PAL_SHARING_VIOLATION = -50805 + PAL_INVALID_DEVICE_STATE = -50804 + PAL_CONNECTION_RESET = -50803 + PAL_CONNECTION_ABORTED = -50802 + PAL_CONNECTION_REFUSED = -50801 + PAL_BUS_RESET_OCCURRED = -50800 + PAL_WAIT_INTERRUPTED = -50700 + PAL_MESSAGE_UNDERFLOW = -50651 + PAL_MESSAGE_OVERFLOW = -50650 + PAL_THREAD_ALREADY_DEAD = -50604 + PAL_THREAD_STACK_SIZE_NOT_SUPPORTED = -50603 + PAL_THREAD_CONTROLLER_IS_NOT_THREAD_CREATOR = -50602 + PAL_THREAD_HAS_NO_THREAD_OBJECT = -50601 + PAL_THREAD_COULD_NOT_RUN = -50600 + PAL_SYNC_ABANDONED = -50551 + PAL_SYNC_TIMED_OUT = -50550 + PAL_RECEIVER_SOCKET_INVALID = -50503 + PAL_SOCKET_LISTENER_INVALID = -50502 + PAL_SOCKET_LISTENER_ALREADY_REGISTERED = -50501 + PAL_DISPATCHER_ALREADY_EXPORTED = -50500 + PAL_DMA_LINK_EVENT_MISSED = -50450 + PAL_BUS_ERROR = -50413 + PAL_RETRY_LIMIT_EXCEEDED = -50412 + PAL_TRANSFER_OVERREAD = -50411 + PAL_TRANSFER_OVERWRITTEN = -50410 + PAL_PHYSICAL_BUFFER_FULL = -50409 + PAL_PHYSICAL_BUFFER_EMPTY = -50408 + PAL_LOGICAL_BUFFER_FULL = -50407 + PAL_LOGICAL_BUFFER_EMPTY = -50406 + PAL_TRANSFER_ABORTED = -50405 + PAL_TRANSFER_STOPPED = -50404 + PAL_TRANSFER_IN_PROGRESS = -50403 + PAL_TRANSFER_NOT_IN_PROGRESS = -50402 + PAL_COMMUNICATIONS_FAULT = -50401 + PAL_TRANSFER_TIMED_OUT = -50400 + PAL_MEMORY_HEAP_NOT_EMPTY = -50355 + PAL_MEMORY_BLOCK_CHECK_FAILED = -50354 + PAL_MEMORY_PAGE_LOCK_FAILED = -50353 + PAL_MEMORY_FULL = -50352 + PAL_MEMORY_ALIGNMENT_FAULT = -50351 + PAL_MEMORY_CONFIGURATION_FAULT = -50350 + PAL_DEVICE_INITIALIZATION_FAULT = -50303 + PAL_DEVICE_NOT_SUPPORTED = -50302 + PAL_DEVICE_UNKNOWN = -50301 + PAL_DEVICE_NOT_FOUND = -50300 + PAL_FEATURE_DISABLED = -50265 + PAL_COMPONENT_BUSY = -50264 + PAL_COMPONENT_ALREADY_INSTALLED = -50263 + PAL_COMPONENT_NOT_UNLOADABLE = -50262 + PAL_COMPONENT_NEVER_LOADED = -50261 + PAL_COMPONENT_ALREADY_LOADED = -50260 + PAL_COMPONENT_CIRCULAR_DEPENDENCY = -50259 + PAL_COMPONENT_INITIALIZATION_FAULT = -50258 + PAL_COMPONENT_IMAGE_CORRUPT = -50257 + PAL_FEATURE_NOT_SUPPORTED = -50256 + PAL_FUNCTION_NOT_FOUND = -50255 + PAL_FUNCTION_OBSOLETE = -50254 + PAL_COMPONENT_TOO_NEW = -50253 + PAL_COMPONENT_TOO_OLD = -50252 + PAL_COMPONENT_NOT_FOUND = -50251 + PAL_VERSION_MISMATCH = -50250 + PAL_FILE_FAULT = -50209 + PAL_FILE_WRITE_FAULT = -50208 + PAL_FILE_READ_FAULT = -50207 + PAL_FILE_SEEK_FAULT = -50206 + PAL_FILE_CLOSE_FAULT = -50205 + PAL_FILE_OPEN_FAULT = -50204 + PAL_DISK_FULL = -50203 + PAL_OS_FAULT = -50202 + PAL_OS_INITIALIZATION_FAULT = -50201 + PAL_OS_UNSUPPORTED = -50200 + PAL_CALCULATION_OVERFLOW = -50175 + PAL_HARDWARE_FAULT = -50152 + PAL_FIRMWARE_FAULT = -50151 + PAL_SOFTWARE_FAULT = -50150 + PAL_MESSAGE_QUEUE_FULL = -50108 + PAL_RESOURCE_AMBIGUOUS = -50107 + PAL_RESOURCE_BUSY = -50106 + PAL_RESOURCE_INITIALIZED = -50105 + PAL_RESOURCE_NOT_INITIALIZED = -50104 + PAL_RESOURCE_RESERVED = -50103 + PAL_RESOURCE_NOT_RESERVED = -50102 + PAL_RESOURCE_NOT_AVAILABLE = -50101 + PAL_RESOURCE_OWNED_BY_SYSTEM = -50100 + PAL_BAD_TOKEN = -50020 + PAL_BAD_THREAD_MULTITASK = -50019 + PAL_BAD_LIBRARY_SPECIFIER = -50018 + PAL_BAD_ADDRESS_SPACE = -50017 + PAL_BAD_WINDOW_TYPE = -50016 + PAL_BAD_ADDRESS_CLASS = -50015 + PAL_BAD_WRITE_COUNT = -50014 + PAL_BAD_WRITE_OFFSET = -50013 + PAL_BAD_WRITE_MODE = -50012 + PAL_BAD_READ_COUNT = -50011 + PAL_BAD_READ_OFFSET = -50010 + PAL_BAD_READ_MODE = -50009 + PAL_BAD_COUNT = -50008 + PAL_BAD_OFFSET = -50007 + PAL_BAD_MODE = -50006 + PAL_BAD_DATA_SIZE = -50005 + PAL_BAD_POINTER = -50004 + PAL_BAD_SELECTOR = -50003 + PAL_BAD_DEVICE = -50002 + PAL_IRRELEVANT_ATTRIBUTE = -50001 + PAL_VALUE_CONFLICT = -50000 + RETRY_CALL = -26853 + FILE_DOES_NOT_EXIST = -26852 + GENERATION_DISABLED = -26851 + ALREADY_INITIALIZED = -26850 + PXI_SYSTEM_DESCRIPTION_PARSE_ERROR = -26809 + PXI_SA_CONFIGURATION_LOCKED = -26808 + NOT_ACTIVE_RESOURCE_MANAGER = -26807 + INVALID_ATTRIBUTE = -26806 + INVALID_HANDLE = -26805 + SERVICE_NOT_RUNNING = -26804 + RECURSIVE_CALL = -26803 + TIMEOUT = -26802 + UNSPECIFIED_ERROR = -26801 + HANDLER_NOT_FOUND = -26657 + INCORRECT_DATA_TYPE = -26656 + INCONSISTENT_FILE_FAULT = -26655 + CHILD_NOT_FOUND = -26654 + ATTRIBUTE_NOT_FOUND = -26653 + IO_ERROR = -26652 + PXI_RESMAN_MXS_PXI_SYSTEM_NOT_FOUND = -26600 + PXI_RESMAN_PCI_DESCRIPTION_STRING_PARSE_ERROR = -26550 + PXI_RESMAN_MODULE_PARSE_ERROR = -26500 + PXI_RESMAN_SYSTEM_DESCRIPTION_SPEC_LIMITATION = -26403 + PXI_RESMAN_SYSTEM_DESCRIPTION_WRITE_ERROR = -26402 + PXI_RESMAN_SYSTEM_DESCRIPTION_PARSE_ERROR = -26401 + PXI_RESMAN_SYSTEM_DESCRIPTION_FILE_NOT_FOUND = -26400 + PXI_RESMAN_CONTROLLER_PARSE_ERROR = -26302 + PXI_RESMAN_CONTROLLER_TYPE_INVALID = -26301 + PXI_RESMAN_CONTROLLER_FILE_NOT_FOUND = -26300 + PXI_RESMAN_CHASSIS_TRIGGER_PARSE_ERROR = -26206 + PXI_RESMAN_CHASSIS_BRIDGE_PARSE_ERROR = -26205 + PXI_RESMAN_CHASSIS_SLOT_PARSE_ERROR = -26204 + PXI_RESMAN_CHASSIS_SEGMENT_PARSE_ERROR = -26203 + PXI_RESMAN_CHASSIS_PARSE_ERROR = -26202 + PXI_RESMAN_CHASSIS_BRIDGE_NOT_FOUND = -26201 + PXI_RESMAN_CHASSIS_FILE_NOT_FOUND = -26200 + INSUFFICIENT_BUFFER = -26113 + DIR_CREATE_FAULT = -26112 + ACCESS_DENIED = -26111 + PATH_NOT_FOUND = -26110 + FILE_EXISTS = -26109 + FILE_DELETE_FAULT = -26107 + FILE_COPY_FAULT = -26106 + FILE_CLOSE_FAULT = -26105 + FILE_NOT_FOUND = -26103 + PXI_RESMAN_SYSTEM_NOT_INITIALIZED = -26102 + PXI_RESMAN_INVALID_CONFIGURATION = -26101 + PXI_RESMAN_ALLOCATION_ERROR = -26100 + TRIGMAN_DISCONNECTED = -26010 + TRIGMAN_INVALID_CLIENT = -26009 + TRIGMAN_CONFLICTING_ROUTE = -26008 + TRIGMAN_CONFLICTING_ROUTE_NO_UNRESERVE = -26007 + TRIGMAN_CONFLICTING_ROUTE_GENERIC = -26006 + TRIGMAN_LINE_ALREADY_RESERVED = -26005 + TRIGMAN_LINE_NOT_RESERVED_UNROUTABLE = -26004 + TRIGMAN_LINE_NOT_RESERVED = -26003 + TRIGMAN_INVALID_PARAMETER = -26002 + TRIGMAN_UNSUPPORTED_OPER = -26001 + TRIGMAN_UNKNOWN_ERROR = -26000 + UNKNOWN = -1 + + +class DAQmxWarnings(Enum): + UNKNOWN = -1 + TIMESTAMP_COUNTER_ROLLED_OVER = 200003 + INPUT_TERMINATION_OVERLOADED = 200004 + ADC_OVERLOADED = 200005 + PLL_UNLOCKED = 200007 + COUNTER_0_DMA_DURING_AI_CONFLICT = 200008 + COUNTER_1_DMA_DURING_AO_CONFLICT = 200009 + STOPPED_BEFORE_DONE = 200010 + RATE_VIOLATES_SETTLING_TIME = 200011 + RATE_VIOLATES_MAX_ADC_RATE = 200012 + USER_DEF_INFO_STRING_TOO_LONG = 200013 + TOO_MANY_INTERRUPTS_PER_SECOND = 200014 + POTENTIAL_GLITCH_DURING_WRITE = 200015 + DEV_NOT_SELF_CALIBRATED_WITH_DA_QMX = 200016 + AI_SAMP_RATE_TOO_LOW = 200017 + AI_CONV_RATE_TOO_LOW = 200018 + READ_OFFSET_COERCION = 200019 + PRETRIG_COERCION = 200020 + SAMP_VAL_COERCED_TO_MAX = 200021 + SAMP_VAL_COERCED_TO_MIN = 200022 + PROPERTY_VERSION_NEW = 200024 + USER_DEFINED_INFO_TOO_LONG = 200025 + CAPI_STRING_TRUNCATED_TO_FIT_BUFFER = 200026 + SAMP_CLK_RATE_TOO_LOW = 200027 + POSSIBLY_INVALID_CTR_SAMPS_IN_FINITE_DMA_ACQ = 200028 + RIS_ACQ_COMPLETED_SOME_BINS_NOT_FILLED = 200029 + PXI_DEV_TEMP_EXCEEDS_MAX_OP_TEMP = 200030 + OUTPUT_GAIN_TOO_LOW_FOR_RF_FREQ = 200031 + OUTPUT_GAIN_TOO_HIGH_FOR_RF_FREQ = 200032 + MULTIPLE_WRITES_BETWEEN_SAMP_CLKS = 200033 + DEVICE_MAY_SHUT_DOWN_DUE_TO_HIGH_TEMP = 200034 + RATE_VIOLATES_MIN_ADC_RATE = 200035 + SAMP_CLK_RATE_ABOVE_DEV_SPECS = 200036 + CO_PREV_DA_QMX_WRITE_SETTINGS_OVERWRITTEN_FOR_HW_TIMED_SINGLE_POINT = 200037 + LOWPASS_FILTER_SETTLING_TIME_EXCEEDS_USER_TIME_BETWEEN_2_ADC_CONVERSIONS = 200038 + LOWPASS_FILTER_SETTLING_TIME_EXCEEDS_DRIVER_TIME_BETWEEN_2_ADC_CONVERSIONS = 200039 + SAMP_CLK_RATE_VIOLATES_SETTLING_TIME_FOR_GEN = 200040 + INVALID_CAL_CONST_VALUE_FOR_AI = 200041 + INVALID_CAL_CONST_VALUE_FOR_AO = 200042 + CHAN_CAL_EXPIRED = 200043 + UNRECOGNIZED_ENUM_VALUE_ENCOUNTERED_IN_STORAGE = 200044 + TABLE_CRC_NOT_CORRECT = 200045 + EXTERNAL_CRC_NOT_CORRECT = 200046 + SELF_CAL_CRC_NOT_CORRECT = 200047 + DEVICE_SPEC_EXCEEDED = 200048 + ONLY_GAIN_CALIBRATED = 200049 + REVERSE_POWER_PROTECTION_ACTIVATED = 200050 + OVER_VOLTAGE_PROTECTION_ACTIVATED = 200051 + BUFFER_SIZE_NOT_MULTIPLE_OF_SECTOR_SIZE = 200052 + SAMPLE_RATE_MAY_CAUSE_ACQ_TO_FAIL = 200053 + USER_AREA_CRC_NOT_CORRECT = 200054 + POWER_UP_INFO_CRC_NOT_CORRECT = 200055 + CONNECTION_COUNT_HAS_EXCEEDED_RECOMMENDED_LIMIT = 200056 + NETWORK_DEVICE_ALREADY_ADDED = 200057 + ACCESSORY_CONNECTION_COUNT_IS_INVALID = 200058 + UNABLE_TO_DISCONNECT_PORTS = 200059 + READ_REPEATED_DATA = 200060 + PXI_5600_NOT_CONFIGURED = 200061 + PXI_5661_INCORRECTLY_CONFIGURED = 200062 + PXIE_5601_NOT_CONFIGURED = 200063 + PXIE_5663_INCORRECTLY_CONFIGURED = 200064 + PXIE_5663_E_INCORRECTLY_CONFIGURED = 200065 + PXIE_5603_NOT_CONFIGURED = 200066 + PXIE_5665_5603_INCORRECTLY_CONFIGURED = 200067 + PXIE_5667_5603_INCORRECTLY_CONFIGURED = 200068 + PXIE_5605_NOT_CONFIGURED = 200069 + PXIE_5665_5605_INCORRECTLY_CONFIGURED = 200070 + PXIE_5667_5605_INCORRECTLY_CONFIGURED = 200071 + PXIE_5606_NOT_CONFIGURED = 200072 + PXIE_5665_5606_INCORRECTLY_CONFIGURED = 200073 + PXI_5610_NOT_CONFIGURED = 200074 + PXI_5610_INCORRECTLY_CONFIGURED = 200075 + PXIE_5611_NOT_CONFIGURED = 200076 + PXIE_5611_INCORRECTLY_CONFIGURED = 200077 + USB_HOTFIX_FOR_DAQ = 200078 + NO_CHANGE_SUPERSEDED_BY_IDLE_BEHAVIOR = 200079 + READ_NOT_COMPLETE_BEFORE_SAMP_CLK = 209800 + WRITE_NOT_COMPLETE_BEFORE_SAMP_CLK = 209801 + WAIT_FOR_NEXT_SAMP_CLK_DETECTED_MISSED_SAMP_CLK = 209802 + OUTPUT_DATA_TRANSFER_CONDITION_NOT_SUPPORTED = 209803 + TRIGMAN_UNKNOWN_ERROR = 26000 + TRIGMAN_UNSUPPORTED_OPER = 26001 + TRIGMAN_INVALID_PARAMETER = 26002 + TRIGMAN_LINE_NOT_RESERVED = 26003 + TRIGMAN_LINE_NOT_RESERVED_UNROUTABLE = 26004 + TRIGMAN_LINE_ALREADY_RESERVED = 26005 + TRIGMAN_CONFLICTING_ROUTE_GENERIC = 26006 + TRIGMAN_CONFLICTING_ROUTE_NO_UNRESERVE = 26007 + TRIGMAN_CONFLICTING_ROUTE = 26008 + TRIGMAN_INVALID_CLIENT = 26009 + TRIGMAN_DISCONNECTED = 26010 + PXI_RESMAN_ALLOCATION_ERROR = 26100 + PXI_RESMAN_INVALID_CONFIGURATION = 26101 + PXI_RESMAN_SYSTEM_NOT_INITIALIZED = 26102 + FILE_NOT_FOUND = 26103 + FILE_CLOSE_FAULT = 26105 + FILE_COPY_FAULT = 26106 + FILE_DELETE_FAULT = 26107 + FILE_EXISTS = 26109 + PATH_NOT_FOUND = 26110 + ACCESS_DENIED = 26111 + DIR_CREATE_FAULT = 26112 + INSUFFICIENT_BUFFER = 26113 + PXI_RESMAN_CHASSIS_FILE_NOT_FOUND = 26200 + PXI_RESMAN_CHASSIS_BRIDGE_NOT_FOUND = 26201 + PXI_RESMAN_CHASSIS_PARSE_ERROR = 26202 + PXI_RESMAN_CHASSIS_SEGMENT_PARSE_ERROR = 26203 + PXI_RESMAN_CHASSIS_SLOT_PARSE_ERROR = 26204 + PXI_RESMAN_CHASSIS_BRIDGE_PARSE_ERROR = 26205 + PXI_RESMAN_CHASSIS_TRIGGER_PARSE_ERROR = 26206 + PXI_RESMAN_CONTROLLER_FILE_NOT_FOUND = 26300 + PXI_RESMAN_CONTROLLER_TYPE_INVALID = 26301 + PXI_RESMAN_CONTROLLER_PARSE_ERROR = 26302 + PXI_RESMAN_SYSTEM_DESCRIPTION_FILE_NOT_FOUND = 26400 + PXI_RESMAN_SYSTEM_DESCRIPTION_PARSE_ERROR = 26401 + PXI_RESMAN_SYSTEM_DESCRIPTION_WRITE_ERROR = 26402 + PXI_RESMAN_SYSTEM_DESCRIPTION_SPEC_LIMITATION = 26403 + PXI_RESMAN_MODULE_PARSE_ERROR = 26500 + PXI_RESMAN_PCI_DESCRIPTION_STRING_PARSE_ERROR = 26550 + PXI_RESMAN_MXS_PXI_SYSTEM_NOT_FOUND = 26600 + IO_ERROR = 26652 + ATTRIBUTE_NOT_FOUND = 26653 + CHILD_NOT_FOUND = 26654 + INCONSISTENT_FILE_FAULT = 26655 + INCORRECT_DATA_TYPE = 26656 + HANDLER_NOT_FOUND = 26657 + UNSPECIFIED_ERROR = 26801 + TIMEOUT = 26802 + RECURSIVE_CALL = 26803 + SERVICE_NOT_RUNNING = 26804 + INVALID_HANDLE = 26805 + INVALID_ATTRIBUTE = 26806 + NOT_ACTIVE_RESOURCE_MANAGER = 26807 + PXI_SA_CONFIGURATION_LOCKED = 26808 + PXI_SYSTEM_DESCRIPTION_PARSE_ERROR = 26809 + ALREADY_INITIALIZED = 26850 + GENERATION_DISABLED = 26851 + FILE_DOES_NOT_EXIST = 26852 + RETRY_CALL = 26853 + PAL_VALUE_CONFLICT = 50000 + PAL_IRRELEVANT_ATTRIBUTE = 50001 + PAL_BAD_DEVICE = 50002 + PAL_BAD_SELECTOR = 50003 + PAL_BAD_POINTER = 50004 + PAL_BAD_DATA_SIZE = 50005 + PAL_BAD_MODE = 50006 + PAL_BAD_OFFSET = 50007 + PAL_BAD_COUNT = 50008 + PAL_BAD_READ_MODE = 50009 + PAL_BAD_READ_OFFSET = 50010 + PAL_BAD_READ_COUNT = 50011 + PAL_BAD_WRITE_MODE = 50012 + PAL_BAD_WRITE_OFFSET = 50013 + PAL_BAD_WRITE_COUNT = 50014 + PAL_BAD_ADDRESS_CLASS = 50015 + PAL_BAD_WINDOW_TYPE = 50016 + PAL_BAD_THREAD_MULTITASK = 50019 + PAL_RESOURCE_OWNED_BY_SYSTEM = 50100 + PAL_RESOURCE_NOT_AVAILABLE = 50101 + PAL_RESOURCE_NOT_RESERVED = 50102 + PAL_RESOURCE_RESERVED = 50103 + PAL_RESOURCE_NOT_INITIALIZED = 50104 + PAL_RESOURCE_INITIALIZED = 50105 + PAL_RESOURCE_BUSY = 50106 + PAL_RESOURCE_AMBIGUOUS = 50107 + PAL_FIRMWARE_FAULT = 50151 + PAL_HARDWARE_FAULT = 50152 + PAL_OS_UNSUPPORTED = 50200 + PAL_OS_FAULT = 50202 + PAL_FUNCTION_OBSOLETE = 50254 + PAL_FUNCTION_NOT_FOUND = 50255 + PAL_FEATURE_NOT_SUPPORTED = 50256 + PAL_COMPONENT_INITIALIZATION_FAULT = 50258 + PAL_COMPONENT_ALREADY_LOADED = 50260 + PAL_COMPONENT_NOT_UNLOADABLE = 50262 + PAL_MEMORY_ALIGNMENT_FAULT = 50351 + PAL_MEMORY_HEAP_NOT_EMPTY = 50355 + PAL_TRANSFER_NOT_IN_PROGRESS = 50402 + PAL_TRANSFER_IN_PROGRESS = 50403 + PAL_TRANSFER_STOPPED = 50404 + PAL_TRANSFER_ABORTED = 50405 + PAL_LOGICAL_BUFFER_EMPTY = 50406 + PAL_LOGICAL_BUFFER_FULL = 50407 + PAL_PHYSICAL_BUFFER_EMPTY = 50408 + PAL_PHYSICAL_BUFFER_FULL = 50409 + PAL_TRANSFER_OVERWRITTEN = 50410 + PAL_TRANSFER_OVERREAD = 50411 + PAL_DISPATCHER_ALREADY_EXPORTED = 50500 + PAL_SYNC_ABANDONED = 50551 diff --git a/nidaqmx/errors.py b/nidaqmx/errors.py new file mode 100644 index 00000000..7004721b --- /dev/null +++ b/nidaqmx/errors.py @@ -0,0 +1,143 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import ctypes +import warnings + +from nidaqmx._lib import lib_importer, ctypes_byte_str +from nidaqmx.error_codes import DAQmxErrors, DAQmxWarnings + +__all__ = ['DaqError', 'DaqWarning', 'DaqResourceWarning'] + + +class Error(Exception): + """ + Base error class for module. + """ + pass + + +class DaqError(Error): + """ + Error raised by any DAQmx method. + """ + def __init__(self, message, error_code, task_name=''): + """ + Args: + message (string): Specifies the error message. + error_code (int): Specifies the NI-DAQmx error code. + """ + if task_name: + message = '{0}\n\nTask Name: {1}'.format(message, task_name) + + super(DaqError, self).__init__(message) + + self._error_code = error_code + + try: + self._error_type = DAQmxErrors(self._error_code) + except ValueError: + self._error_type = DAQmxErrors.UNKNOWN + + @property + def error_code(self): + """ + int: Specifies the NI-DAQmx error code. + """ + return self._error_code + + @property + def error_type(self): + """ + :class:`nidaqmx.error_codes.DAQmxErrors`: Specifies the NI-DAQmx + error type. + """ + return self._error_type + + +class DaqWarning(Warning): + """ + Warning raised by any NI-DAQmx method. + """ + def __init__(self, message, error_code): + """ + Args: + message (string): Specifies the warning message. + error_code (int): Specifies the NI-DAQmx error code. + """ + super(DaqWarning, self).__init__( + '\nWarning {0} occurred.\n\n{1}'.format(error_code, message)) + + self._error_code = error_code + + try: + self._error_type = DAQmxWarnings(self._error_code) + except ValueError: + self._error_type = DAQmxWarnings.UNKNOWN + + @property + def error_code(self): + """ + int: Specifies the NI-DAQmx error code. + """ + return self._error_code + + @property + def error_type(self): + """ + :class:`nidaqmx.error_codes.DAQmxWarnings`: Specifies the NI-DAQmx + error type. + """ + return self._error_type + + +class _ResourceWarning(Warning): + """ + Resource warning raised by any NI-DAQmx method. + + Used in place of built-in ResourceWarning to allow Python 2.7 support. + """ + pass + + +# If ResourceWarning is in exceptions, it is also in the built-in namespace. +try: + DaqResourceWarning = ResourceWarning +except NameError: + DaqResourceWarning = _ResourceWarning + +warnings.filterwarnings("always", category=DaqWarning) +warnings.filterwarnings("always", category=DaqResourceWarning) + + +def check_for_error(error_code): + if error_code < 0: + error_buffer = ctypes.create_string_buffer(2048) + + cfunc = lib_importer.windll.DAQmxGetExtendedErrorInfo + cfunc.argtypes = [ctypes.c_char_p, ctypes.c_uint] + cfunc(error_buffer, 2048) + + raise DaqError(error_buffer.value.decode("utf-8"), error_code) + + elif error_code > 0: + error_buffer = ctypes.create_string_buffer(2048) + + cfunc = lib_importer.windll.DAQmxGetErrorString + cfunc.argtypes = [ctypes.c_int, ctypes.c_char_p, ctypes.c_uint] + cfunc(error_code, error_buffer, 2048) + + warnings.warn(DaqWarning( + error_buffer.value.decode("utf-8"), error_code)) + + +def is_string_buffer_too_small(error_code): + return ( + error_code == DAQmxErrors.BUFFER_TOO_SMALL_FOR_STRING.value or + error_code == DAQmxWarnings.CAPI_STRING_TRUNCATED_TO_FIT_BUFFER.value) + + +def is_array_buffer_too_small(error_code): + return error_code == DAQmxErrors.WRITE_BUFFER_TOO_SMALL.value diff --git a/nidaqmx/scale.py b/nidaqmx/scale.py new file mode 100644 index 00000000..07420a4d --- /dev/null +++ b/nidaqmx/scale.py @@ -0,0 +1,840 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import ctypes +import numpy + +from nidaqmx._lib import lib_importer, wrapped_ndpointer, ctypes_byte_str +from nidaqmx.errors import ( + check_for_error, is_string_buffer_too_small, is_array_buffer_too_small) +from nidaqmx.constants import ( + ScaleType, UnitsPreScaled, _Save) + +__all__ = ['Scale'] + + +class Scale(object): + """ + Represents a DAQmx scale. + """ + __slots__ = ['_name', '__weakref__'] + + def __init__(self, name): + """ + Args: + name (str): Specifies the name of the scale to create. + """ + self._name = name + + def __eq__(self, other): + if isinstance(other, self.__class__): + return self._name == other._name + return False + + def __hash__(self): + return hash(self._name) + + def __ne__(self, other): + return not self.__eq__(other) + + def __repr__(self): + return 'Scale(name={0})'.format(self._name) + + @property + def name(self): + """ + str: Specifies the name of this scale. + """ + return self._name + + @property + def description(self): + """ + str: Specifies a description for the scale. + """ + cfunc = lib_importer.windll.DAQmxGetScaleDescr + cfunc.argtypes = [ + ctypes_byte_str, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @description.setter + def description(self, val): + cfunc = lib_importer.windll.DAQmxSetScaleDescr + cfunc.argtypes = [ + ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._name, val) + check_for_error(error_code) + + @property + def lin_slope(self): + """ + float: Specifies the slope, m, in the equation y=mx+b. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetScaleLinSlope + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @lin_slope.setter + def lin_slope(self, val): + cfunc = lib_importer.windll.DAQmxSetScaleLinSlope + cfunc.argtypes = [ + ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._name, val) + check_for_error(error_code) + + @property + def lin_y_intercept(self): + """ + float: Specifies the y-intercept, b, in the equation y=mx+b. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetScaleLinYIntercept + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @lin_y_intercept.setter + def lin_y_intercept(self, val): + cfunc = lib_importer.windll.DAQmxSetScaleLinYIntercept + cfunc.argtypes = [ + ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._name, val) + check_for_error(error_code) + + @property + def map_pre_scaled_max(self): + """ + float: Specifies the largest value in the range of pre-scaled + values. NI-DAQmx maps this value to **map_scaled_max**. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetScaleMapPreScaledMax + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @map_pre_scaled_max.setter + def map_pre_scaled_max(self, val): + cfunc = lib_importer.windll.DAQmxSetScaleMapPreScaledMax + cfunc.argtypes = [ + ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._name, val) + check_for_error(error_code) + + @property + def map_pre_scaled_min(self): + """ + float: Specifies the smallest value in the range of pre-scaled + values. NI-DAQmx maps this value to **map_scaled_min**. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetScaleMapPreScaledMin + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @map_pre_scaled_min.setter + def map_pre_scaled_min(self, val): + cfunc = lib_importer.windll.DAQmxSetScaleMapPreScaledMin + cfunc.argtypes = [ + ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._name, val) + check_for_error(error_code) + + @property + def map_scaled_max(self): + """ + float: Specifies the largest value in the range of scaled + values. NI-DAQmx maps this value to **map_pre_scaled_max**. + Reads coerce samples that are larger than this value to + match this value. Writes generate errors for samples that + are larger than this value. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetScaleMapScaledMax + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @map_scaled_max.setter + def map_scaled_max(self, val): + cfunc = lib_importer.windll.DAQmxSetScaleMapScaledMax + cfunc.argtypes = [ + ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._name, val) + check_for_error(error_code) + + @property + def map_scaled_min(self): + """ + float: Specifies the smallest value in the range of scaled + values. NI-DAQmx maps this value to **map_pre_scaled_min**. + Reads coerce samples that are smaller than this value to + match this value. Writes generate errors for samples that + are smaller than this value. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetScaleMapScaledMin + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @map_scaled_min.setter + def map_scaled_min(self, val): + cfunc = lib_importer.windll.DAQmxSetScaleMapScaledMin + cfunc.argtypes = [ + ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._name, val) + check_for_error(error_code) + + @property + def poly_forward_coeff(self): + """ + List[float]: Specifies a list of coefficients for the polynomial + that converts pre-scaled values to scaled values. Each + element of the list corresponds to a term of the equation. + For example, if index three of the list is 9, the fourth + term of the equation is 9x^3. + """ + cfunc = lib_importer.windll.DAQmxGetScalePolyForwardCoeff + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.float64, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.float64) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.tolist() + + @poly_forward_coeff.setter + def poly_forward_coeff(self, val): + val = numpy.float64(val) + cfunc = lib_importer.windll.DAQmxSetScalePolyForwardCoeff + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.float64, + flags=('C','W')), ctypes.c_uint] + + error_code = cfunc( + self._name, val, len(val)) + check_for_error(error_code) + + @property + def poly_reverse_coeff(self): + """ + List[float]: Specifies a list of coefficients for the polynomial + that converts scaled values to pre-scaled values. Each + element of the list corresponds to a term of the equation. + For example, if index three of the list is 9, the fourth + term of the equation is 9y^3. + """ + cfunc = lib_importer.windll.DAQmxGetScalePolyReverseCoeff + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.float64, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.float64) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.tolist() + + @poly_reverse_coeff.setter + def poly_reverse_coeff(self, val): + val = numpy.float64(val) + cfunc = lib_importer.windll.DAQmxSetScalePolyReverseCoeff + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.float64, + flags=('C','W')), ctypes.c_uint] + + error_code = cfunc( + self._name, val, len(val)) + check_for_error(error_code) + + @property + def pre_scaled_units(self): + """ + :class:`nidaqmx.constants.UnitsPreScaled`: Specifies the units + of the values that you want to scale. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetScalePreScaledUnits + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return UnitsPreScaled(val.value) + + @pre_scaled_units.setter + def pre_scaled_units(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetScalePreScaledUnits + cfunc.argtypes = [ + ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._name, val) + check_for_error(error_code) + + @property + def scale_type(self): + """ + :class:`nidaqmx.constants.ScaleType`: Indicates the method or + equation form that the custom scale uses. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetScaleType + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return ScaleType(val.value) + + @property + def scaled_units(self): + """ + str: Specifies the units to use for scaled values. You can use + an arbitrary string. + """ + cfunc = lib_importer.windll.DAQmxGetScaleScaledUnits + cfunc.argtypes = [ + ctypes_byte_str, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @scaled_units.setter + def scaled_units(self, val): + cfunc = lib_importer.windll.DAQmxSetScaleScaledUnits + cfunc.argtypes = [ + ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._name, val) + check_for_error(error_code) + + @property + def table_pre_scaled_vals(self): + """ + List[float]: Specifies a list of pre-scaled values. These values + map directly to the values in **table_scaled_vals**. + """ + cfunc = lib_importer.windll.DAQmxGetScaleTablePreScaledVals + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.float64, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.float64) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.tolist() + + @table_pre_scaled_vals.setter + def table_pre_scaled_vals(self, val): + val = numpy.float64(val) + cfunc = lib_importer.windll.DAQmxSetScaleTablePreScaledVals + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.float64, + flags=('C','W')), ctypes.c_uint] + + error_code = cfunc( + self._name, val, len(val)) + check_for_error(error_code) + + @property + def table_scaled_vals(self): + """ + List[float]: Specifies a list of scaled values. These values map + directly to the values in **table_pre_scaled_vals**. + """ + cfunc = lib_importer.windll.DAQmxGetScaleTableScaledVals + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.float64, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.float64) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.tolist() + + @table_scaled_vals.setter + def table_scaled_vals(self, val): + val = numpy.float64(val) + cfunc = lib_importer.windll.DAQmxSetScaleTableScaledVals + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.float64, + flags=('C','W')), ctypes.c_uint] + + error_code = cfunc( + self._name, val, len(val)) + check_for_error(error_code) + + @staticmethod + def calculate_reverse_poly_coeff( + forward_coeffs, min_val_x=-5.0, max_val_x=5.0, + num_points_to_compute=1000, reverse_poly_order=-1): + """ + Computes a set of coefficients for a polynomial that + approximates the inverse of the polynomial with the coefficients + you specify with the "forward_coeffs" input. This function + generates a table of x versus y values over the range of x. This + function then finds a polynomial fit, using the least squares + method to compute a polynomial that computes x when given a + value for y. + + Args: + forward_coeffs (List[float]): Is the list of coefficients + for the polynomial that computes y given a value of x. + Each element of the list corresponds to a term of the + equation. + min_val_x (Optional[float]): Is the minimum value of x for + which you use the polynomial. This is the smallest value + of x for which the function generates a y value in the + table. + max_val_x (Optional[float]): Is the maximum value of x for + which you use the polynomial. This is the largest value + of x for which the function generates a y value in the + table. + num_points_to_compute (Optional[int]): Is the number of + points in the table of x versus y values. The function + spaces the values evenly between "min_val_x" and + "max_val_x". + reverse_poly_order (Optional[int]): Is the order of the + reverse polynomial to compute. For example, an input of + 3 indicates a 3rd order polynomial. A value of -1 + indicates a reverse polynomial of the same order as the + forward polynomial. + Returns: + List[float]: + + Specifies the list of coefficients for the reverse + polynomial. Each element of the list corresponds to a term + of the equation. For example, if index three of the list is + 9, the fourth term of the equation is 9y^3. + """ + forward_coeffs = numpy.float64(forward_coeffs) + + if reverse_poly_order == -1: + size = len(forward_coeffs) + else: + size = reverse_poly_order + 1 + + reverse_coeffs = numpy.zeros(size, dtype=numpy.float64) + + cfunc = lib_importer.windll.DAQmxCalculateReversePolyCoeff + cfunc.argtypes = [ + numpy.ctypeslib.ndpointer(dtype=numpy.float64, flags=('C', 'W')), + ctypes.c_uint, ctypes.c_double, ctypes.c_double, ctypes.c_int, + ctypes.c_int, + numpy.ctypeslib.ndpointer(dtype=numpy.float64, flags=('C', 'W'))] + + error_code = cfunc( + forward_coeffs, len(forward_coeffs), min_val_x, max_val_x, + num_points_to_compute, reverse_poly_order, reverse_coeffs) + check_for_error(error_code) + + return reverse_coeffs.tolist() + + @staticmethod + def create_lin_scale( + scale_name, slope, y_intercept=0.0, + pre_scaled_units=UnitsPreScaled.VOLTS, scaled_units=None): + """ + Creates a custom scale that uses the equation y=mx+b, where x is + a pre-scaled value, and y is a scaled value. The equation is + identical for input and output. If the equation is in the form + x=my+b, you must first solve for y in terms of x. + + Args: + scale_name (str): Specifies the name of the scale to create. + slope (float): Is the slope, m, in the equation. + y_intercept (Optional[float]): Is the y-intercept, b, in the + equation. + pre_scaled_units (Optional[nidaqmx.constants.UnitsPreScaled]): + Is the units of the values to scale. + scaled_units (Optional[str]): Is the units to use for the + scaled value. You can use an arbitrary string. NI-DAQmx + uses the units to label a graph or chart. + Returns: + nidaqmx.scale.Scale: + + Indicates an object that represents the created custom scale. + """ + scale = Scale(scale_name) + + cfunc = lib_importer.windll.DAQmxCreateLinScale + cfunc.argtypes = [ + ctypes_byte_str, ctypes.c_double, ctypes.c_double, ctypes.c_int, + ctypes_byte_str] + + error_code = cfunc( + scale_name, slope, y_intercept, pre_scaled_units.value, + scaled_units) + check_for_error(error_code) + + return scale + + @staticmethod + def create_map_scale( + scale_name, prescaled_min, prescaled_max, scaled_min, scaled_max, + pre_scaled_units=UnitsPreScaled.VOLTS, scaled_units=None): + """ + Creates a custom scale that scales values proportionally from a + range of pre-scaled values to a range of scaled values. + + Args: + scale_name (str): Specifies the name of the scale to create. + prescaled_min (float): Is the smallest value in the range of + pre-scaled values. NI-DAQmx maps this value to + "scaled_min". + prescaled_max (float): Is the largest value in the range of + pre-scaled values. NI-DAQmx maps this value to + "scaled_max". + scaled_min (float): Is the smallest value in the range of + scaled values. NI-DAQmx maps this value to + "prescaled_min". Read operations clip samples that are + smaller than this value. Write operations generate + errors for samples that are smaller than this value. + scaled_max (float): Is the largest value in the range of + scaled values. NI-DAQmx maps this value to + "prescaled_max". Read operations clip samples that are + larger than this value. Write operations generate errors + for samples that are larger than this value. + pre_scaled_units (Optional[nidaqmx.constants.UnitsPreScaled]): + Is the units of the values to scale. + scaled_units (Optional[str]): Is the units to use for the + scaled value. You can use an arbitrary string. NI-DAQmx + uses the units to label a graph or chart. + Returns: + nidaqmx.scale.Scale: + + Indicates an object that represents the created custom scale. + """ + scale = Scale(scale_name) + + cfunc = lib_importer.windll.DAQmxCreateMapScale + cfunc.argtypes = [ + ctypes_byte_str, ctypes.c_double, ctypes.c_double, + ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes_byte_str] + + error_code = cfunc( + scale_name, prescaled_min, prescaled_max, scaled_min, scaled_max, + pre_scaled_units.value, scaled_units) + check_for_error(error_code) + + return scale + + @staticmethod + def create_polynomial_scale( + scale_name, forward_coeffs, reverse_coeffs, + pre_scaled_units=UnitsPreScaled.VOLTS, scaled_units=None): + """ + Creates a custom scale that uses an nth order polynomial + equation. NI-DAQmx requires both a polynomial to convert pre- + scaled values to scaled values (forward) and a polynomial to + convert scaled values to pre-scaled values (reverse). If you + only know one set of coefficients, use the DAQmx Compute Reverse + Polynomial Coefficients function to generate the other set. + + Args: + scale_name (str): Specifies the name of the scale to create. + forward_coeffs (List[float]): Is an list of coefficients for + the polynomial that converts pre-scaled values to scaled + values. Each element of the list corresponds to a term + of the equation. + reverse_coeffs (List[float]): Is an list of coefficients for + the polynomial that converts scaled values to pre-scaled + values. Each element of the list corresponds to a term + of the equation. + pre_scaled_units (Optional[nidaqmx.constants.UnitsPreScaled]): + Is the units of the values to scale. + scaled_units (Optional[str]): Is the units to use for the + scaled value. You can use an arbitrary string. NI-DAQmx + uses the units to label a graph or chart. + Returns: + nidaqmx.scale.Scale: + + Indicates an object that represents the created custom scale. + """ + scale = Scale(scale_name) + + if forward_coeffs is None: + forward_coeffs = [] + + if reverse_coeffs is None: + reverse_coeffs = [] + + forward_coeffs = numpy.float64(forward_coeffs) + reverse_coeffs = numpy.float64(reverse_coeffs) + + cfunc = lib_importer.windll.DAQmxCreatePolynomialScale + cfunc.argtypes = [ + ctypes_byte_str, + wrapped_ndpointer(dtype=numpy.float64, flags=('C', 'W')), + ctypes.c_uint, + wrapped_ndpointer(dtype=numpy.float64, flags=('C', 'W')), + ctypes.c_uint, ctypes.c_int, ctypes_byte_str] + + error_code = cfunc( + scale_name, forward_coeffs, len(forward_coeffs), reverse_coeffs, + len(reverse_coeffs), pre_scaled_units.value, scaled_units) + check_for_error(error_code) + + return scale + + @staticmethod + def create_table_scale( + scale_name, prescaled_vals, scaled_vals, + pre_scaled_units=UnitsPreScaled.VOLTS, scaled_units=None): + """ + Creates a custom scale that maps an list of pre-scaled values to + an list of corresponding scaled values. NI-DAQmx applies linear + interpolation to values that fall between the values in the + table. Read operations clip scaled samples that are outside the + maximum and minimum scaled values found in the table. Write + operations generate errors for samples that are outside the + minimum and maximum scaled values found in the table. + + Args: + scale_name (str): Specifies the name of the scale to create. + prescaled_vals (List[float]): Is the list of pre-scaled + values that map to the values in "scaled_vals". + scaled_vals (List[float]): Is the list of scaled values that + map to the values in "prescaled_vals". + pre_scaled_units (Optional[nidaqmx.constants.UnitsPreScaled]): + Is the units of the values to scale. + scaled_units (Optional[str]): Is the units to use for the + scaled value. You can use an arbitrary string. NI-DAQmx + uses the units to label a graph or chart. + Returns: + nidaqmx.scale.Scale: + + Indicates an object that represents the created custom scale. + """ + scale = Scale(scale_name) + + if prescaled_vals is None: + prescaled_vals = [] + + if scaled_vals is None: + scaled_vals = [] + + prescaled_vals = numpy.float64(prescaled_vals) + scaled_vals = numpy.float64(scaled_vals) + + cfunc = lib_importer.windll.DAQmxCreateTableScale + cfunc.argtypes = [ + ctypes_byte_str, + wrapped_ndpointer(dtype=numpy.float64, flags=('C', 'W')), + ctypes.c_uint, + wrapped_ndpointer(dtype=numpy.float64, flags=('C', 'W')), + ctypes.c_uint, ctypes.c_int, ctypes_byte_str] + + error_code = cfunc( + scale_name, prescaled_vals, len(prescaled_vals), scaled_vals, + len(scaled_vals), pre_scaled_units.value, scaled_units) + check_for_error(error_code) + + return scale + + def save(self, save_as="", author="", overwrite_existing_scale=False, + allow_interactive_editing=True, allow_interactive_deletion=True): + """ + Saves this custom scale to MAX. + + Args: + save_as (Optional[str]): Is the name to save the task, + global channel, or custom scale as. If you do not + specify a value for this input, NI-DAQmx uses the name + currently assigned to the task, global channel, or + custom scale. + author (Optional[str]): Is a name to store with the task, + global channel, or custom scale. + options (Optional[int]): Specifies whether to allow the + task, global channel, or custom scale to be deleted + through MAX. + overwrite_existing_scale (Optional[bool]): Specifies whether to + overwrite a custom scale of the same name if one is already + saved in MAX. If this input is False and a custom scale of + the same name is already saved in MAX, this function returns + an error. + allow_interactive_editing (Optional[bool]): Specifies whether to + allow the task, global channel, or custom scale to be edited + in the DAQ Assistant. If allow_interactive_editing is True, + the DAQ Assistant must support all task or global channel + settings. + allow_interactive_deletion (Optional[bool]): Specifies whether + to allow the task, global channel, or custom scale to be + deleted through MAX. + """ + options = 0 + if overwrite_existing_scale: + options |= _Save.OVERWRITE.value + if allow_interactive_editing: + options |= _Save.ALLOW_INTERACTIVE_EDITING.value + if allow_interactive_deletion: + options |= _Save.ALLOW_INTERACTIVE_DELETION.value + + cfunc = lib_importer.windll.DAQmxSaveScale + cfunc.argtypes = [ + ctypes_byte_str, ctypes_byte_str, ctypes_byte_str, ctypes.c_uint] + + error_code = cfunc( + self._name, save_as, author, options) + check_for_error(error_code) diff --git a/nidaqmx/stream_readers.py b/nidaqmx/stream_readers.py new file mode 100644 index 00000000..5c913bff --- /dev/null +++ b/nidaqmx/stream_readers.py @@ -0,0 +1,2029 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import numpy +from nidaqmx import DaqError + +from nidaqmx.constants import READ_ALL_AVAILABLE +from nidaqmx._task_modules.read_functions import ( + _read_analog_f_64, _read_analog_scalar_f_64, _read_binary_i_16, + _read_binary_i_32, _read_binary_u_16, _read_binary_u_32, + _read_digital_lines, _read_digital_u_8, _read_digital_u_16, + _read_digital_scalar_u_32, _read_digital_u_32, _read_counter_scalar_f_64, + _read_counter_scalar_u_32, _read_counter_f_64_ex, _read_counter_u_32_ex, + _read_ctr_freq_scalar, _read_ctr_ticks_scalar, _read_ctr_time_scalar, + _read_ctr_freq, _read_ctr_ticks, _read_ctr_time) +from nidaqmx.error_codes import DAQmxErrors + +__all__ = ['AnalogSingleChannelReader', 'AnalogMultiChannelReader', + 'AnalogUnscaledReader', 'CounterReader', + 'DigitalSingleChannelReader', 'DigitalMultiChannelReader'] + + +class ChannelReaderBase(object): + """ + Defines base class for all NI-DAQmx stream readers. + """ + + def __init__(self, task_in_stream): + """ + Args: + task_in_stream: Specifies the input stream associated with + an NI-DAQmx task from which to read samples. + """ + self._in_stream = task_in_stream + self._task = task_in_stream._task + self._handle = task_in_stream._task._handle + + self._verify_array_shape = True + + @property + def verify_array_shape(self): + """ + bool: Indicates whether the size and shape of the user-defined + NumPy arrays passed to read methods are verified. Defaults + to True when this object is instantiated. + + Setting this property to True may marginally adversely + impact the performance of read methods. + """ + return self._verify_array_shape + + @verify_array_shape.setter + def verify_array_shape(self, val): + self._verify_array_shape = val + + def _verify_array(self, data, number_of_samples_per_channel, + is_many_chan, is_many_samp): + """ + Verifies that the shape of the specified NumPy array can be used + to read multiple samples from the current task which contains + one or more channels, if the "verify_array_shape" property is + set to True. + + Args: + data (numpy.ndarray): Specifies the NumPy array to verify. + number_of_samples_per_channel (int): Specifies the number of + samples per channel requested. + is_many_chan (bool): Specifies if the read method is a many + channel version. + is_many_samp (bool): Specifies if the read method is a many + samples version. + """ + if not self._verify_array_shape: + return + + channels_to_read = self._in_stream.channels_to_read + number_of_channels = len(channels_to_read.channel_names) + + array_shape = None + if is_many_chan: + if is_many_samp: + array_shape = (number_of_channels, + number_of_samples_per_channel) + else: + array_shape = (number_of_channels,) + else: + if is_many_samp: + array_shape = (number_of_samples_per_channel,) + + if array_shape is not None and data.shape != array_shape: + raise DaqError( + 'Read cannot be performed because the NumPy array passed into ' + 'this function is not shaped correctly. You must pass in a ' + 'NumPy array of the correct shape based on the number of ' + 'channels in task and the number of samples per channel ' + 'requested.\n\n' + 'Shape of NumPy Array provided: {0}\n' + 'Shape of NumPy Array required: {1}' + .format(data.shape, array_shape), + DAQmxErrors.UNKNOWN.value, task_name=self._task.name) + + def _verify_array_digital_lines( + self, data, is_many_chan, is_many_line): + """ + Verifies that the shape of the specified NumPy array can be used + to read samples from the current task which contains one or more + channels that have one or more digital lines per channel, if the + "verify_array_shape" property is set to True. + + Args: + data (numpy.ndarray): Specifies the NumPy array to verify. + is_many_chan (bool): Specifies if the read method is a + many channel version. + is_many_line (bool): Specifies if the read method is a + many line version. + """ + if not self._verify_array_shape: + return + + channels_to_read = self._in_stream.channels_to_read + number_of_channels = len(channels_to_read.channel_names) + number_of_lines = self._in_stream.di_num_booleans_per_chan + + array_shape = None + if is_many_chan: + if is_many_line: + array_shape = (number_of_channels, number_of_lines) + else: + array_shape = (number_of_channels,) + else: + if is_many_line: + array_shape = (number_of_lines,) + + if array_shape is not None and data.shape != array_shape: + raise DaqError( + 'Read cannot be performed because the NumPy array passed into ' + 'this function is not shaped correctly. You must pass in a ' + 'NumPy array of the correct shape based on the number of ' + 'channels in task and the number of digital lines per ' + 'channel.\n\n' + 'Shape of NumPy Array provided: {0}\n' + 'Shape of NumPy Array required: {1}' + .format(data.shape, array_shape), + DAQmxErrors.UNKNOWN.value, task_name=self._task.name) + + +class AnalogSingleChannelReader(ChannelReaderBase): + """ + Reads samples from an analog input channel in an NI-DAQmx task. + """ + + def read_many_sample( + self, data, number_of_samples_per_channel=READ_ALL_AVAILABLE, + timeout=10.0): + """ + Reads one or more floating-point samples from a single analog + input channel in a task. + + This read method accepts a preallocated NumPy array to hold the + samples requested, which can be advantageous for performance and + interoperability with NumPy and SciPy. + + Passing in a preallocated array is valuable in continuous + acquisition scenarios, where the same array can be used + repeatedly in each call to the method. + + Args: + data (numpy.ndarray): Specifies a preallocated 1D NumPy + array of floating-point values to hold the samples + requested. + + Each element in the array corresponds to a sample from + the channel. The size of the array must be large enough + to hold all requested samples from the channel in the + task; otherwise, an error is thrown. + number_of_samples_per_channel (Optional[int]): Specifies the + number of samples to read. + + If you set this input to nidaqmx.constants. + READ_ALL_AVAILABLE, NI-DAQmx determines how many samples + to read based on if the task acquires samples + continuously or acquires a finite number of samples. + + If the task acquires samples continuously and you set + this input to nidaqmx.constants.READ_ALL_AVAILABLE, this + method reads all the samples currently available in the + buffer. + + If the task acquires a finite number of samples and you + set this input to nidaqmx.constants.READ_ALL_AVAILABLE, + the method waits for the task to acquire all requested + samples, then reads those samples. If you set the + "read_all_avail_samp" property to True, the method reads + the samples currently available in the buffer and does + not wait for the task to acquire all requested samples. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for samples to become available. If the + time elapses, the method returns an error and any + samples read before the timeout elapsed. The default + timeout is 10 seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to read the requested samples and returns an error + if it is unable to. + Returns: + int: + + Indicates the number of samples acquired by each channel. + NI-DAQmx returns a single value because this value is the + same for all channels. + """ + number_of_samples_per_channel = ( + self._task._calculate_num_samps_per_chan( + number_of_samples_per_channel)) + + self._verify_array(data, number_of_samples_per_channel, False, True) + + return _read_analog_f_64( + self._handle, data, number_of_samples_per_channel, + timeout) + + def read_one_sample(self, timeout=10): + """ + Reads a single floating-point sample from a single analog input + channel in a task. + + Args: + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for samples to become available. If the + time elapses, the method returns an error and any + samples read before the timeout elapsed. The default + timeout is 10 seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to read the requested samples and returns an error + if it is unable to. + Returns: + float: + + Indicates a single floating-point sample from the task. + """ + return _read_analog_scalar_f_64(self._handle, timeout) + + +class AnalogMultiChannelReader(ChannelReaderBase): + """ + Reads samples from one or more analog input channels in an NI-DAQmx + task. + """ + + def read_many_sample( + self, data, number_of_samples_per_channel=READ_ALL_AVAILABLE, + timeout=10.0): + """ + Reads one or more floating-point samples from one or more analog + input channels in a task. + + This read method accepts a preallocated NumPy array to hold the + samples requested, which can be advantageous for performance and + interoperability with NumPy and SciPy. + + Passing in a preallocated array is valuable in continuous + acquisition scenarios, where the same array can be used + repeatedly in each call to the method. + + Args: + data (numpy.ndarray): Specifies a preallocated 2D NumPy + array of floating-point values to hold the samples + requested. The size of the array must be large enough to + hold all requested samples from all channels in the + task; otherwise, an error is thrown. + + Each row corresponds to a channel in the task. Each + column corresponds to a sample from each channel. The + order of the channels in the array corresponds to the + order in which you add the channels to the task or to + the order of the channels you specify with the + "channels_to_read" property. + + If the size of the array is too large or the array is + shaped incorrectly, the previous statement may not hold + true as the samples read may not be separated into rows + and columns properly. Set the "verify_array_shape" + property on this channel reader object to True to + validate that the NumPy array object is shaped properly. + Setting this property to True may marginally adversely + impact the performance of the method. + number_of_samples_per_channel (Optional[int]): Specifies the + number of samples to read. + + If you set this input to nidaqmx.constants. + READ_ALL_AVAILABLE, NI-DAQmx determines how many samples + to read based on if the task acquires samples + continuously or acquires a finite number of samples. + + If the task acquires samples continuously and you set + this input to nidaqmx.constants.READ_ALL_AVAILABLE, this + method reads all the samples currently available in the + buffer. + + If the task acquires a finite number of samples and you + set this input to nidaqmx.constants.READ_ALL_AVAILABLE, + the method waits for the task to acquire all requested + samples, then reads those samples. If you set the + "read_all_avail_samp" property to True, the method reads + the samples currently available in the buffer and does + not wait for the task to acquire all requested samples. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for samples to become available. If the + time elapses, the method returns an error and any + samples read before the timeout elapsed. The default + timeout is 10 seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to read the requested samples and returns an error + if it is unable to. + Returns: + int: + + Indicates the number of samples acquired by each channel. + NI-DAQmx returns a single value because this value is the + same for all channels. + """ + number_of_samples_per_channel = ( + self._task._calculate_num_samps_per_chan( + number_of_samples_per_channel)) + + self._verify_array(data, number_of_samples_per_channel, True, True) + + return _read_analog_f_64( + self._handle, data, number_of_samples_per_channel, + timeout) + + def read_one_sample(self, data, timeout=10): + """ + Reads a single floating-point sample from one or more analog + input channels in a task. + + This read method accepts a preallocated NumPy array to hold the + samples requested, which can be advantageous for performance and + interoperability with NumPy and SciPy. + + Passing in a preallocated array is valuable in continuous + acquisition scenarios, where the same array can be used + repeatedly in each call to the method. + + Args: + data (numpy.ndarray): Specifies a preallocated 1D NumPy + array of floating-point values to hold the samples + requested. + + Each element in the array corresponds to a sample from + each channel. The size of the array must be large enough + to hold all requested samples from the channel in the + task; otherwise, an error is thrown. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for samples to become available. If the + time elapses, the method returns an error and any + samples read before the timeout elapsed. The default + timeout is 10 seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to read the requested samples and returns an error + if it is unable to. + """ + self._verify_array(data, 1, True, False) + + _read_analog_f_64(self._handle, data, 1, timeout) + + +class AnalogUnscaledReader(ChannelReaderBase): + """ + Reads unscaled samples from one or more analog input channels in an + NI-DAQmx task. + """ + + def read_int16( + self, data, number_of_samples_per_channel=READ_ALL_AVAILABLE, + timeout=10.0): + """ + Reads one or more unscaled 16-bit integer samples from one or + more analog input channels in a task. + + This read method accepts a preallocated NumPy array to hold the + samples requested, which can be advantageous for performance and + interoperability with NumPy and SciPy. + + Passing in a preallocated array is valuable in continuous + acquisition scenarios, where the same array can be used + repeatedly in each call to the method. + + Args: + data (numpy.ndarray): Specifies a preallocated 2D NumPy + array of unscaled 16-bit integer values to hold the + samples requested. The size of the array must be large + enough to hold all requested samples from all channels + in the task; otherwise, an error is thrown. + + Each row corresponds to a channel in the task. Each + column corresponds to a sample from each channel. The + order of the channels in the array corresponds to the + order in which you add the channels to the task or to + the order of the channels you specify with the + "channels_to_read" property. + + If the size of the array is too large or the array is + shaped incorrectly, the previous statement may not hold + true as the samples read may not be separated into rows + and columns properly. Set the "verify_array_shape" + property on this channel reader object to True to + validate that the NumPy array object is shaped properly. + Setting this property may marginally adversely impact + the performance of the method. + number_of_samples_per_channel (Optional[int]): Specifies the + number of samples to read. + + If you set this input to nidaqmx.constants. + READ_ALL_AVAILABLE, NI-DAQmx determines how many samples + to read based on if the task acquires samples + continuously or acquires a finite number of samples. + + If the task acquires samples continuously and you set + this input to nidaqmx.constants.READ_ALL_AVAILABLE, this + method reads all the samples currently available in the + buffer. + + If the task acquires a finite number of samples and you + set this input to nidaqmx.constants.READ_ALL_AVAILABLE, + the method waits for the task to acquire all requested + samples, then reads those samples. If you set the + "read_all_avail_samp" property to True, the method reads + the samples currently available in the buffer and does + not wait for the task to acquire all requested samples. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for samples to become available. If the + time elapses, the method returns an error and any + samples read before the timeout elapsed. The default + timeout is 10 seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to read the requested samples and returns an error + if it is unable to. + Returns: + int: + + Indicates the number of samples acquired by each channel. + NI-DAQmx returns a single value because this value is the + same for all channels. + """ + number_of_samples_per_channel = ( + self._task._calculate_num_samps_per_chan( + number_of_samples_per_channel)) + + self._verify_array(data, number_of_samples_per_channel, True, True) + + return _read_binary_i_16( + self._handle, data, number_of_samples_per_channel, + timeout) + + def read_int32( + self, data, number_of_samples_per_channel=READ_ALL_AVAILABLE, + timeout=10.0): + """ + Reads one or more unscaled 32-bit integer samples from one or + more analog input channels in a task. + + This read method accepts a preallocated NumPy array to hold the + samples requested, which can be advantageous for performance and + interoperability with NumPy and SciPy. + + Passing in a preallocated array is valuable in continuous + acquisition scenarios, where the same array can be used + repeatedly in each call to the method. + + Args: + data (numpy.ndarray): Specifies a preallocated 2D NumPy + array of unscaled 32-bit integer values to hold the + samples requested. The size of the array must be large + enough to hold all requested samples from all channels + in the task; otherwise, an error is thrown. + + Each row corresponds to a channel in the task. Each + column corresponds to a sample from each channel. The + order of the channels in the array corresponds to the + order in which you add the channels to the task or to + the order of the channels you specify with the + "channels_to_read" property. + + If the size of the array is too large or the array is + shaped incorrectly, the previous statement may not hold + true as the samples read may not be separated into rows + and columns properly. Set the "verify_array_shape" + property on this channel reader object to True to + validate that the NumPy array object is shaped properly. + Setting this property may marginally adversely impact + the performance of the method. + number_of_samples_per_channel (Optional[int]): Specifies the + number of samples to read. + + If you set this input to nidaqmx.constants. + READ_ALL_AVAILABLE, NI-DAQmx determines how many samples + to read based on if the task acquires samples + continuously or acquires a finite number of samples. + + If the task acquires samples continuously and you set + this input to nidaqmx.constants.READ_ALL_AVAILABLE, this + method reads all the samples currently available in the + buffer. + + If the task acquires a finite number of samples and you + set this input to nidaqmx.constants.READ_ALL_AVAILABLE, + the method waits for the task to acquire all requested + samples, then reads those samples. If you set the + "read_all_avail_samp" property to True, the method reads + the samples currently available in the buffer and does + not wait for the task to acquire all requested samples. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for samples to become available. If the + time elapses, the method returns an error and any + samples read before the timeout elapsed. The default + timeout is 10 seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to read the requested samples and returns an error + if it is unable to. + Returns: + int: + + Indicates the number of samples acquired by each channel. + NI-DAQmx returns a single value because this value is the + same for all channels. + """ + number_of_samples_per_channel = ( + self._task._calculate_num_samps_per_chan( + number_of_samples_per_channel)) + + self._verify_array(data, number_of_samples_per_channel, True, True) + + return _read_binary_i_32( + self._handle, data, number_of_samples_per_channel, + timeout) + + def read_uint16( + self, data, number_of_samples_per_channel=READ_ALL_AVAILABLE, + timeout=10.0): + """ + Reads one or more unscaled 16-bit unsigned integer samples from + one or more analog input channels in a task. + + This read method accepts a preallocated NumPy array to hold the + samples requested, which can be advantageous for performance and + interoperability with NumPy and SciPy. + + Passing in a preallocated array is valuable in continuous + acquisition scenarios, where the same array can be used + repeatedly in each call to the method. + + Args: + data (numpy.ndarray): Specifies a preallocated 2D NumPy + array of unscaled 16-bit unsigned integer values to + hold the samples requested. The size of the array must + be large enough to hold all requested samples from all + channels in the task; otherwise, an error is thrown. + + Each row corresponds to a channel in the task. Each + column corresponds to a sample from each channel. The + order of the channels in the array corresponds to the + order in which you add the channels to the task or to + the order of the channels you specify with the + "channels_to_read" property. + + If the size of the array is too large or the array is + shaped incorrectly, the previous statement may not hold + true as the samples read may not be separated into rows + and columns properly. Set the "verify_array_shape" + property on this channel reader object to True to + validate that the NumPy array object is shaped properly. + Setting this property may marginally adversely impact + the performance of the method. + number_of_samples_per_channel (Optional[int]): Specifies the + number of samples to read. + + If you set this input to nidaqmx.constants. + READ_ALL_AVAILABLE, NI-DAQmx determines how many samples + to read based on if the task acquires samples + continuously or acquires a finite number of samples. + + If the task acquires samples continuously and you set + this input to nidaqmx.constants.READ_ALL_AVAILABLE, this + method reads all the samples currently available in the + buffer. + + If the task acquires a finite number of samples and you + set this input to nidaqmx.constants.READ_ALL_AVAILABLE, + the method waits for the task to acquire all requested + samples, then reads those samples. If you set the + "read_all_avail_samp" property to True, the method reads + the samples currently available in the buffer and does + not wait for the task to acquire all requested samples. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for samples to become available. If the + time elapses, the method returns an error and any + samples read before the timeout elapsed. The default + timeout is 10 seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to read the requested samples and returns an error + if it is unable to. + Returns: + int: + + Indicates the number of samples acquired by each channel. + NI-DAQmx returns a single value because this value is the + same for all channels. + """ + number_of_samples_per_channel = ( + self._task._calculate_num_samps_per_chan( + number_of_samples_per_channel)) + + self._verify_array(data, number_of_samples_per_channel, True, True) + + return _read_binary_u_16( + self._handle, data, number_of_samples_per_channel, + timeout) + + def read_uint32( + self, data, number_of_samples_per_channel=READ_ALL_AVAILABLE, + timeout=10.0): + """ + Reads one or more unscaled unsigned 32-bit integer samples from + one or more analog input channels in a task. + + This read method accepts a preallocated NumPy array to hold the + samples requested, which can be advantageous for performance and + interoperability with NumPy and SciPy. + + Passing in a preallocated array is valuable in continuous + acquisition scenarios, where the same array can be used + repeatedly in each call to the method. + + Args: + data (numpy.ndarray): Specifies a preallocated 2D NumPy + array of unscaled 32-bit unsigned integer values to + hold the samples requested. The size of the array must + be large enough to hold all requested samples from all + channels in the task; otherwise, an error is thrown. + + Each row corresponds to a channel in the task. Each + column corresponds to a sample from each channel. The + order of the channels in the array corresponds to the + order in which you add the channels to the task or to + the order of the channels you specify with the + "channels_to_read" property. + + If the size of the array is too large or the array is + shaped incorrectly, the previous statement may not hold + true as the samples read may not be separated into rows + and columns properly. Set the "verify_array_shape" + property on this channel reader object to True to + validate that the NumPy array object is shaped properly. + Setting this property may marginally adversely impact + the performance of the method. + number_of_samples_per_channel (Optional[int]): Specifies the + number of samples to read. + + If you set this input to nidaqmx.constants. + READ_ALL_AVAILABLE, NI-DAQmx determines how many samples + to read based on if the task acquires samples + continuously or acquires a finite number of samples. + + If the task acquires samples continuously and you set + this input to nidaqmx.constants.READ_ALL_AVAILABLE, this + method reads all the samples currently available in the + buffer. + + If the task acquires a finite number of samples and you + set this input to nidaqmx.constants.READ_ALL_AVAILABLE, + the method waits for the task to acquire all requested + samples, then reads those samples. If you set the + "read_all_avail_samp" property to True, the method reads + the samples currently available in the buffer and does + not wait for the task to acquire all requested samples. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for samples to become available. If the + time elapses, the method returns an error and any + samples read before the timeout elapsed. The default + timeout is 10 seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to read the requested samples and returns an error + if it is unable to. + Returns: + int: + + Indicates the number of samples acquired by each channel. + NI-DAQmx returns a single value because this value is the + same for all channels. + """ + number_of_samples_per_channel = ( + self._task._calculate_num_samps_per_chan( + number_of_samples_per_channel)) + + self._verify_array(data, number_of_samples_per_channel, True, True) + + return _read_binary_u_32( + self._handle, data, number_of_samples_per_channel, + timeout) + + +class CounterReader(ChannelReaderBase): + """ + Reads samples from a counter input channel in an NI-DAQmx task. + """ + + def read_many_sample_double( + self, data, number_of_samples_per_channel=READ_ALL_AVAILABLE, + timeout=10.0): + """ + Reads one or more floating-point samples from a single counter + input channel in a task. + + This read method accepts a preallocated NumPy array to hold the + samples requested, which can be advantageous for performance and + interoperability with NumPy and SciPy. + + Passing in a preallocated array is valuable in continuous + acquisition scenarios, where the same array can be used + repeatedly in each call to the method. + + Args: + data (numpy.ndarray): Specifies a preallocated 1D NumPy + array of floating-point values to hold the samples + requested. + + Each element in the array corresponds to a sample from + the channel. The size of the array must be large enough + to hold all requested samples from the channel in the + task; otherwise, an error is thrown. + number_of_samples_per_channel (Optional[int]): Specifies the + number of samples to read. + + If you set this input to nidaqmx.constants. + READ_ALL_AVAILABLE, NI-DAQmx determines how many samples + to read based on if the task acquires samples + continuously or acquires a finite number of samples. + + If the task acquires samples continuously and you set + this input to nidaqmx.constants.READ_ALL_AVAILABLE, this + method reads all the samples currently available in the + buffer. + + If the task acquires a finite number of samples and you + set this input to nidaqmx.constants.READ_ALL_AVAILABLE, + the method waits for the task to acquire all requested + samples, then reads those samples. If you set the + "read_all_avail_samp" property to True, the method reads + the samples currently available in the buffer and does + not wait for the task to acquire all requested samples. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for samples to become available. If the + time elapses, the method returns an error and any + samples read before the timeout elapsed. The default + timeout is 10 seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to read the requested samples and returns an error + if it is unable to. + Returns: + int: + + Indicates the number of samples acquired by each channel. + NI-DAQmx returns a single value because this value is the + same for all channels. + """ + number_of_samples_per_channel = ( + self._task._calculate_num_samps_per_chan( + number_of_samples_per_channel)) + + self._verify_array(data, number_of_samples_per_channel, False, True) + + return _read_counter_f_64_ex( + self._handle, data, number_of_samples_per_channel, + timeout) + + def read_many_sample_pulse_frequency( + self, frequencies, duty_cycles, + number_of_samples_per_channel=READ_ALL_AVAILABLE, timeout=10.0): + """ + Reads one or more pulse samples in terms of frequency from a + single counter input channel in a task. + + This read method accepts preallocated NumPy arrays to hold the + samples requested, which can be advantageous for performance and + interoperability with NumPy and SciPy. + + Passing in preallocated arrays is valuable in continuous + acquisition scenarios, where the same array can be used + repeatedly in each call to the method. + + Args: + frequencies (numpy.ndarray): Specifies a preallocated 1D + NumPy array of floating-point values to hold the frequency + portion of the pulse samples requested. + + Each element in the array corresponds to a sample from + the channel. The size of the array must be large enough + to hold all requested samples from the channel in the + task; otherwise, an error is thrown. + duty_cycles (numpy.ndarray): Specifies a preallocated 1D + NumPy array of floating-point values to hold the duty + cycle portion of the pulse samples requested. + + Each element in the array corresponds to a sample from + the channel. The size of the array must be large enough + to hold all requested samples from the channel in the + task; otherwise, an error is thrown. + number_of_samples_per_channel (Optional[int]): Specifies the + number of samples to read. + + If you set this input to nidaqmx.constants. + READ_ALL_AVAILABLE, NI-DAQmx determines how many samples + to read based on if the task acquires samples + continuously or acquires a finite number of samples. + + If the task acquires samples continuously and you set + this input to nidaqmx.constants.READ_ALL_AVAILABLE, this + method reads all the samples currently available in the + buffer. + + If the task acquires a finite number of samples and you + set this input to nidaqmx.constants.READ_ALL_AVAILABLE, + the method waits for the task to acquire all requested + samples, then reads those samples. If you set the + "read_all_avail_samp" property to True, the method reads + the samples currently available in the buffer and does + not wait for the task to acquire all requested samples. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for samples to become available. If the + time elapses, the method returns an error and any + samples read before the timeout elapsed. The default + timeout is 10 seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to read the requested samples and returns an error + if it is unable to. + Returns: + int: + + Indicates the number of samples acquired by each channel. + NI-DAQmx returns a single value because this value is the + same for all channels. + """ + number_of_samples_per_channel = ( + self._task._calculate_num_samps_per_chan( + number_of_samples_per_channel)) + + self._verify_array( + frequencies, number_of_samples_per_channel, False, True) + self._verify_array( + duty_cycles, number_of_samples_per_channel, False, True) + + return _read_ctr_freq( + self._handle, frequencies, duty_cycles, + number_of_samples_per_channel, timeout) + + def read_many_sample_pulse_ticks( + self, high_ticks, low_ticks, + number_of_samples_per_channel=READ_ALL_AVAILABLE, timeout=10.0): + """ + Reads one or more pulse samples in terms of ticks from a single + counter input channel in a task. + + This read method accepts preallocated NumPy arrays to hold the + samples requested, which can be advantageous for performance and + interoperability with NumPy and SciPy. + + Passing in preallocated arrays is valuable in continuous + acquisition scenarios, where the same array can be used + repeatedly in each call to the method. + + Args: + high_ticks (numpy.ndarray): Specifies a preallocated 1D + NumPy array of 32-bit unsigned integer values to hold + the high ticks portion of the pulse samples requested. + + Each element in the array corresponds to a sample from + the channel. The size of the array must be large enough + to hold all requested samples from the channel in the + task; otherwise, an error is thrown. + low_ticks (numpy.ndarray): Specifies a preallocated 1D NumPy + array of 32-bit unsigned integer values to hold the low + ticks portion of the pulse samples requested. + + Each element in the array corresponds to a sample from + the channel. The size of the array must be large enough + to hold all requested samples from the channel in the + task; otherwise, an error is thrown. + number_of_samples_per_channel (Optional[int]): Specifies the + number of samples to read. + + If you set this input to nidaqmx.constants. + READ_ALL_AVAILABLE, NI-DAQmx determines how many samples + to read based on if the task acquires samples + continuously or acquires a finite number of samples. + + If the task acquires samples continuously and you set + this input to nidaqmx.constants.READ_ALL_AVAILABLE, this + method reads all the samples currently available in the + buffer. + + If the task acquires a finite number of samples and you + set this input to nidaqmx.constants.READ_ALL_AVAILABLE, + the method waits for the task to acquire all requested + samples, then reads those samples. If you set the + "read_all_avail_samp" property to True, the method reads + the samples currently available in the buffer and does + not wait for the task to acquire all requested samples. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for samples to become available. If the + time elapses, the method returns an error and any + samples read before the timeout elapsed. The default + timeout is 10 seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to read the requested samples and returns an error + if it is unable to. + Returns: + int: + + Indicates the number of samples acquired by each channel. + NI-DAQmx returns a single value because this value is the + same for all channels. + """ + number_of_samples_per_channel = ( + self._task._calculate_num_samps_per_chan( + number_of_samples_per_channel)) + + self._verify_array( + high_ticks, number_of_samples_per_channel, False, True) + self._verify_array( + low_ticks, number_of_samples_per_channel, False, True) + + return _read_ctr_ticks( + self._handle, high_ticks, low_ticks, + number_of_samples_per_channel, timeout) + + def read_many_sample_pulse_time( + self, high_times, low_times, + number_of_samples_per_channel=READ_ALL_AVAILABLE, timeout=10.0): + """ + Reads one or more pulse samples in terms of time from a single + counter input channel in a task. + + This read method accepts preallocated NumPy arrays to hold the + samples requested, which can be advantageous for performance and + interoperability with NumPy and SciPy. + + Passing in preallocated arrays is valuable in continuous + acquisition scenarios, where the same array can be used + repeatedly in each call to the method. + + Args: + high_times (numpy.ndarray): Specifies a preallocated 1D + NumPy array of floating-point values to hold the high + time portion of the pulse samples requested. + + Each element in the array corresponds to a sample from + the channel. The size of the array must be large enough + to hold all requested samples from the channel in the + task; otherwise, an error is thrown. + low_times (numpy.ndarray): Specifies a preallocated 1D + NumPy array of floating-point values to hold the low + time portion of the pulse samples requested. + + Each element in the array corresponds to a sample from + the channel. The size of the array must be large enough + to hold all requested samples from the channel in the + task; otherwise, an error is thrown. + number_of_samples_per_channel (Optional[int]): Specifies the + number of samples to read. + + If you set this input to nidaqmx.constants. + READ_ALL_AVAILABLE, NI-DAQmx determines how many samples + to read based on if the task acquires samples + continuously or acquires a finite number of samples. + + If the task acquires samples continuously and you set + this input to nidaqmx.constants.READ_ALL_AVAILABLE, this + method reads all the samples currently available in the + buffer. + + If the task acquires a finite number of samples and you + set this input to nidaqmx.constants.READ_ALL_AVAILABLE, + the method waits for the task to acquire all requested + samples, then reads those samples. If you set the + "read_all_avail_samp" property to True, the method reads + the samples currently available in the buffer and does + not wait for the task to acquire all requested samples. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for samples to become available. If the + time elapses, the method returns an error and any + samples read before the timeout elapsed. The default + timeout is 10 seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to read the requested samples and returns an error + if it is unable to. + Returns: + int: + + Indicates the number of samples acquired by each channel. + NI-DAQmx returns a single value because this value is the + same for all channels. + """ + number_of_samples_per_channel = ( + self._task._calculate_num_samps_per_chan( + number_of_samples_per_channel)) + + self._verify_array( + high_times, number_of_samples_per_channel, False, True) + self._verify_array( + low_times, number_of_samples_per_channel, False, True) + + return _read_ctr_time( + self._handle, high_times, low_times, + number_of_samples_per_channel, timeout) + + def read_many_sample_uint32( + self, data, number_of_samples_per_channel=READ_ALL_AVAILABLE, + timeout=10.0): + """ + Reads one or more 32-bit unsigned integer samples from a single + counter input channel in a task. + + This read method accepts a preallocated NumPy array to hold the + samples requested, which can be advantageous for performance and + interoperability with NumPy and SciPy. + + Passing in a preallocated array is valuable in continuous + acquisition scenarios, where the same array can be used + repeatedly in each call to the method. + + Args: + data (numpy.ndarray): Specifies a preallocated 1D NumPy + array of 32-bit unsigned integer values to hold the + samples requested. + + Each element in the array corresponds to a sample from + the channel. The size of the array must be large enough + to hold all requested samples from the channel in the + task; otherwise, an error is thrown. + number_of_samples_per_channel (Optional[int]): Specifies the + number of samples to read. + + If you set this input to nidaqmx.constants. + READ_ALL_AVAILABLE, NI-DAQmx determines how many samples + to read based on if the task acquires samples + continuously or acquires a finite number of samples. + + If the task acquires samples continuously and you set + this input to nidaqmx.constants.READ_ALL_AVAILABLE, this + method reads all the samples currently available in the + buffer. + + If the task acquires a finite number of samples and you + set this input to nidaqmx.constants.READ_ALL_AVAILABLE, + the method waits for the task to acquire all requested + samples, then reads those samples. If you set the + "read_all_avail_samp" property to True, the method reads + the samples currently available in the buffer and does + not wait for the task to acquire all requested samples. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for samples to become available. If the + time elapses, the method returns an error and any + samples read before the timeout elapsed. The default + timeout is 10 seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to read the requested samples and returns an error + if it is unable to. + Returns: + int: + + Indicates the number of samples acquired by each channel. + NI-DAQmx returns a single value because this value is the + same for all channels. + """ + number_of_samples_per_channel = ( + self._task._calculate_num_samps_per_chan( + number_of_samples_per_channel)) + + self._verify_array(data, number_of_samples_per_channel, False, True) + + return _read_counter_u_32_ex( + self._handle, data, number_of_samples_per_channel, + timeout) + + def read_one_sample_double(self, timeout=10): + """ + Reads a single floating-point sample from a single counter input + channel in a task. + + Args: + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for samples to become available. If the + time elapses, the method returns an error and any + samples read before the timeout elapsed. The default + timeout is 10 seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to read the requested samples and returns an error + if it is unable to. + Returns: + float: Indicates a single floating-point sample from the + task. + """ + return _read_counter_scalar_f_64(self._handle, timeout) + + def read_one_sample_pulse_frequency(self, timeout=10): + """ + Reads a pulse sample in terms of frequency from a single counter + input channel in a task. + + Args: + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for samples to become available. If the + time elapses, the method returns an error and any + samples read before the timeout elapsed. The default + timeout is 10 seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to read the requested samples and returns an error + if it is unable to. + Returns: + nidaqmx.types.CtrFreq: + + Indicates a pulse sample in terms of frequency from the task. + """ + return _read_ctr_freq_scalar(self._handle, timeout) + + def read_one_sample_pulse_ticks(self, timeout=10): + """ + Reads a pulse sample in terms of ticks from a single counter + input channel in a task. + + Args: + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for samples to become available. If the + time elapses, the method returns an error and any + samples read before the timeout elapsed. The default + timeout is 10 seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to read the requested samples and returns an error + if it is unable to. + Returns: + nidaqmx.types.CtrTick: + + Indicates a pulse sample in terms of ticks from the task. + """ + return _read_ctr_ticks_scalar(self._handle, timeout) + + def read_one_sample_pulse_time(self, timeout=10): + """ + Reads a pulse sample in terms of time from a single counter + input channel in a task. + + Args: + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for samples to become available. If the + time elapses, the method returns an error and any + samples read before the timeout elapsed. The default + timeout is 10 seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to read the requested samples and returns an error + if it is unable to. + Returns: + nidaqmx.types.CtrTime: + + Indicates a pulse sample in terms of time from the task. + """ + return _read_ctr_time_scalar(self._handle, timeout) + + def read_one_sample_uint32(self, timeout=10): + """ + Reads a single 32-bit unsigned integer sample from a single + counter input channel in a task. + + Args: + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for samples to become available. If the + time elapses, the method returns an error and any + samples read before the timeout elapsed. The default + timeout is 10 seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to read the requested samples and returns an error + if it is unable to. + Returns: + int: + + Indicates a single 32-bit unsigned integer sample from the + task. + """ + return _read_counter_scalar_u_32(self._handle, timeout) + + +class DigitalSingleChannelReader(ChannelReaderBase): + """ + Reads samples from a digital input channel in an NI-DAQmx task. + """ + + def read_many_sample_port_byte( + self, data, number_of_samples_per_channel=READ_ALL_AVAILABLE, + timeout=10.0): + """ + Reads one or more 8-bit unsigned integer samples from a single + digital input channel in a task. + + Use this method for devices with up to 8 lines per port. + + This read method accepts a preallocated NumPy array to hold + the samples requested, which can be advantageous for performance + and interoperability with NumPy and SciPy. + + Passing in a preallocated array is valuable in continuous + acquisition scenarios, where the same array can be used + repeatedly in each call to the method. + + Args: + data (numpy.ndarray): Specifies a preallocated 1D NumPy + array of 8-bit unsigned integer values to hold the + samples requested. + + Each element in the array corresponds to a sample from + the channel. The size of the array must be large enough + to hold all requested samples from the channel in the + task; otherwise, an error is thrown. + number_of_samples_per_channel (Optional[int]): Specifies the + number of samples to read. + + If you set this input to nidaqmx.constants. + READ_ALL_AVAILABLE, NI-DAQmx determines how many samples + to read based on if the task acquires samples + continuously or acquires a finite number of samples. + + If the task acquires samples continuously and you set + this input to nidaqmx.constants.READ_ALL_AVAILABLE, this + method reads all the samples currently available in the + buffer. + + If the task acquires a finite number of samples and you + set this input to nidaqmx.constants.READ_ALL_AVAILABLE, + the method waits for the task to acquire all requested + samples, then reads those samples. If you set the + "read_all_avail_samp" property to True, the method reads + the samples currently available in the buffer and does + not wait for the task to acquire all requested samples. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for samples to become available. If the + time elapses, the method returns an error and any + samples read before the timeout elapsed. The default + timeout is 10 seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to read the requested samples and returns an error + if it is unable to. + Returns: + int: + + Indicates the number of samples acquired by each channel. + NI-DAQmx returns a single value because this value is the + same for all channels. + """ + number_of_samples_per_channel = ( + self._task._calculate_num_samps_per_chan( + number_of_samples_per_channel)) + + self._verify_array(data, number_of_samples_per_channel, False, True) + + return _read_digital_u_8( + self._handle, data, number_of_samples_per_channel, timeout) + + def read_many_sample_port_uint16( + self, data, number_of_samples_per_channel=READ_ALL_AVAILABLE, + timeout=10.0): + """ + Reads one or more 16-bit unsigned integer samples from a single + digital input channel in a task. + + Use this method for devices with up to 16 lines per port. + + This read method accepts a preallocated NumPy array to hold + the samples requested, which can be advantageous for performance + and interoperability with NumPy and SciPy. + + Passing in a preallocated array is valuable in continuous + acquisition scenarios, where the same array can be used + repeatedly in each call to the method. + + Args: + data (numpy.ndarray): Specifies a preallocated 1D NumPy + array of 16-bit unsigned integer values to hold the + samples requested. + + Each element in the array corresponds to a sample from + the channel. The size of the array must be large enough + to hold all requested samples from the channel in the + task; otherwise, an error is thrown. + number_of_samples_per_channel (Optional[int]): Specifies the + number of samples to read. + + If you set this input to nidaqmx.constants. + READ_ALL_AVAILABLE, NI-DAQmx determines how many samples + to read based on if the task acquires samples + continuously or acquires a finite number of samples. + + If the task acquires samples continuously and you set + this input to nidaqmx.constants.READ_ALL_AVAILABLE, this + method reads all the samples currently available in the + buffer. + + If the task acquires a finite number of samples and you + set this input to nidaqmx.constants.READ_ALL_AVAILABLE, + the method waits for the task to acquire all requested + samples, then reads those samples. If you set the + "read_all_avail_samp" property to True, the method reads + the samples currently available in the buffer and does + not wait for the task to acquire all requested samples. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for samples to become available. If the + time elapses, the method returns an error and any + samples read before the timeout elapsed. The default + timeout is 10 seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to read the requested samples and returns an error + if it is unable to. + Returns: + int: + + Indicates the number of samples acquired by each channel. + NI-DAQmx returns a single value because this value is the + same for all channels. + """ + number_of_samples_per_channel = ( + self._task._calculate_num_samps_per_chan( + number_of_samples_per_channel)) + + self._verify_array(data, number_of_samples_per_channel, False, True) + + return _read_digital_u_16( + self._handle, data, number_of_samples_per_channel, timeout) + + def read_many_sample_port_uint32( + self, data, number_of_samples_per_channel=READ_ALL_AVAILABLE, + timeout=10.0): + """ + Reads one or more 32-bit unsigned integer samples from a single + digital input channel in a task. + + Use this method for devices with up to 32 lines per port. + + This read method accepts a preallocated NumPy array to hold + the samples requested, which can be advantageous for performance + and interoperability with NumPy and SciPy. + + Passing in a preallocated array is valuable in continuous + acquisition scenarios, where the same array can be used + repeatedly in each call to the method. + + Args: + data (numpy.ndarray): Specifies a preallocated 1D NumPy + array of 32-bit unsigned integer values to hold the + samples requested. + + Each element in the array corresponds to a sample from + the channel. The size of the array must be large enough + to hold all requested samples from the channel in the + task; otherwise, an error is thrown. + number_of_samples_per_channel (Optional[int]): Specifies the + number of samples to read. + + If you set this input to nidaqmx.constants. + READ_ALL_AVAILABLE, NI-DAQmx determines how many samples + to read based on if the task acquires samples + continuously or acquires a finite number of samples. + + If the task acquires samples continuously and you set + this input to nidaqmx.constants.READ_ALL_AVAILABLE, this + method reads all the samples currently available in the + buffer. + + If the task acquires a finite number of samples and you + set this input to nidaqmx.constants.READ_ALL_AVAILABLE, + the method waits for the task to acquire all requested + samples, then reads those samples. If you set the + "read_all_avail_samp" property to True, the method reads + the samples currently available in the buffer and does + not wait for the task to acquire all requested samples. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for samples to become available. If the + time elapses, the method returns an error and any + samples read before the timeout elapsed. The default + timeout is 10 seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to read the requested samples and returns an error + if it is unable to. + Returns: + int: + + Indicates the number of samples acquired by each channel. + NI-DAQmx returns a single value because this value is the + same for all channels. + """ + number_of_samples_per_channel = ( + self._task._calculate_num_samps_per_chan( + number_of_samples_per_channel)) + + self._verify_array(data, number_of_samples_per_channel, False, True) + + return _read_digital_u_32( + self._handle, data, number_of_samples_per_channel, timeout) + + def read_one_sample_multi_line(self, data, timeout=10): + """ + Reads a single boolean sample from a single digital input + channel in a task. The channel can contain multiple digital + lines. + + This read method accepts a preallocated NumPy array to hold the + samples requested, which can be advantageous for performance and + interoperability with NumPy and SciPy. + + Passing in a preallocated array is valuable in continuous + acquisition scenarios, where the same array can be used + repeatedly in each call to the method. + + Args: + data (numpy.ndarray): Specifies a preallocated 1D NumPy + array of boolean values to hold the samples requested. + + Each element in the array corresponds to a sample from + a line in the channel. The size of the array must be + large enough to hold all requested samples from the + channel in the task; otherwise, an error is thrown. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for samples to become available. If the + time elapses, the method returns an error and any + samples read before the timeout elapsed. The default + timeout is 10 seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to read the requested samples and returns an error + if it is unable to. + """ + self._verify_array_digital_lines(data, False, True) + + _read_digital_lines(self._handle, data, 1, timeout) + + def read_one_sample_one_line(self, timeout=10): + """ + Reads a single boolean sample from a single digital input + channel in a task. The channel can contain only one digital + line. + + Args: + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for samples to become available. If the + time elapses, the method returns an error and any + samples read before the timeout elapsed. The default + timeout is 10 seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to read the requested samples and returns an error + if it is unable to. + Returns: + bool: + + Indicates a single boolean sample from the task. + """ + data = numpy.zeros(1, dtype=numpy.bool) + _read_digital_lines(self._handle, data, 1, timeout) + + return bool(data[0]) + + def read_one_sample_port_byte(self, timeout=10): + """ + Reads a single 8-bit unsigned integer sample from a single + digital input channel in a task. + + Use this method for devices with up to 8 lines per port. + + Args: + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for samples to become available. If the + time elapses, the method returns an error and any + samples read before the timeout elapsed. The default + timeout is 10 seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to read the requested samples and returns an error + if it is unable to. + Returns: + int: + + Indicates a single 8-bit unsigned integer sample from the + task. + """ + data = numpy.zeros(1, dtype=numpy.uint8) + _read_digital_u_8(self._handle, data, 1, timeout) + + return int(data[0]) + + def read_one_sample_port_uint16(self, timeout=10): + """ + Reads a single 16-bit unsigned integer sample from a single + digital input channel in a task. + + Use this method for devices with up to 16 lines per port. + + Args: + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for samples to become available. If the + time elapses, the method returns an error and any + samples read before the timeout elapsed. The default + timeout is 10 seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to read the requested samples and returns an error + if it is unable to. + Returns: + int: + + Indicates a single 16-bit unsigned integer sample from the + task. + """ + data = numpy.zeros(1, dtype=numpy.uint16) + _read_digital_u_16(self._handle, data, 1, timeout) + + return int(data[0]) + + def read_one_sample_port_uint32(self, timeout=10): + """ + Reads a single 32-bit unsigned integer sample from a single + digital input channel in a task. + + Use this method for devices with up to 32 lines per port. + + Args: + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for samples to become available. If the + time elapses, the method returns an error and any + samples read before the timeout elapsed. The default + timeout is 10 seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to read the requested samples and returns an error + if it is unable to. + Returns: + int: + + Indicates a single 32-bit unsigned integer sample from the + task. + """ + return _read_digital_scalar_u_32(self._handle, timeout) + + +class DigitalMultiChannelReader(ChannelReaderBase): + """ + Reads samples from one or more digital input channels in an NI-DAQmx + task. + """ + + def read_many_sample_port_byte( + self, data, number_of_samples_per_channel=READ_ALL_AVAILABLE, + timeout=10.0): + """ + Reads one or more 8-bit unsigned integer samples from one or + more digital input channel in a task. + + Use this method for devices with up to 8 lines per port. + + This read method accepts a preallocated NumPy array to hold the + samples requested, which can be advantageous for performance and + interoperability with NumPy and SciPy. + + Passing in a preallocated array is valuable in continuous + acquisition scenarios, where the same array can be used + repeatedly in each call to the method. + + Args: + data (numpy.ndarray): Specifies a preallocated 2D NumPy + array of 8-bit unsigned integer values to hold the + samples requested. The size of the array must be large + enough to hold all requested samples from all channels + in the task; otherwise, an error is thrown. + + Each row corresponds to a channel in the task. Each + column corresponds to a sample from each channel. The + order of the channels in the array corresponds to the + order in which you add the channels to the task or to + the order of the channels you specify with the + "channels_to_read" property. + + If the size of the array is too large or the array is + shaped incorrectly, the previous statement may not hold + true as the samples read may not be separated into rows + and columns properly. Set the "verify_array_shape" + property on this channel reader object to True to + validate that the NumPy array object is shaped properly. + Setting this property may marginally adversely impact + the performance of the method. + number_of_samples_per_channel (Optional[int]): Specifies the + number of samples to read. + + If you set this input to nidaqmx.constants. + READ_ALL_AVAILABLE, NI-DAQmx determines how many samples + to read based on if the task acquires samples + continuously or acquires a finite number of samples. + + If the task acquires samples continuously and you set + this input to nidaqmx.constants.READ_ALL_AVAILABLE, this + method reads all the samples currently available in the + buffer. + + If the task acquires a finite number of samples and you + set this input to nidaqmx.constants.READ_ALL_AVAILABLE, + the method waits for the task to acquire all requested + samples, then reads those samples. If you set the + "read_all_avail_samp" property to True, the method reads + the samples currently available in the buffer and does + not wait for the task to acquire all requested samples. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for samples to become available. If the + time elapses, the method returns an error and any + samples read before the timeout elapsed. The default + timeout is 10 seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to read the requested samples and returns an error + if it is unable to. + Returns: + int: + + Indicates the number of samples acquired by each channel. + NI-DAQmx returns a single value because this value is the + same for all channels. + """ + number_of_samples_per_channel = ( + self._task._calculate_num_samps_per_chan( + number_of_samples_per_channel)) + + self._verify_array(data, number_of_samples_per_channel, True, True) + + return _read_digital_u_8( + self._handle, data, number_of_samples_per_channel, timeout) + + def read_many_sample_port_uint16( + self, data, number_of_samples_per_channel=READ_ALL_AVAILABLE, + timeout=10.0): + """ + Reads one or more 16-bit unsigned integer samples from one or + more digital input channels in a task. + + Use this method for devices with up to 16 lines per port. + + This read method accepts a preallocated NumPy array to hold the + samples requested, which can be advantageous for performance and + interoperability with NumPy and SciPy. + + Passing in a preallocated array is valuable in continuous + acquisition scenarios, where the same array can be used + repeatedly in each call to the method. + + Args: + data (numpy.ndarray): Specifies a preallocated 2D NumPy + array of 16-bit unsigned integer values to hold the + samples requested. The size of the array must be large + enough to hold all requested samples from all channels + in the task; otherwise, an error is thrown. + + Each row corresponds to a channel in the task. Each + column corresponds to a sample from each channel. The + order of the channels in the array corresponds to the + order in which you add the channels to the task or to + the order of the channels you specify with the + "channels_to_read" property. + + If the size of the array is too large or the array is + shaped incorrectly, the previous statement may not hold + true as the samples read may not be separated into rows + and columns properly. Set the "verify_array_shape" + property on this channel reader object to True to + validate that the NumPy array object is shaped properly. + Setting this property may marginally adversely impact + the performance of the method. + number_of_samples_per_channel (Optional[int]): Specifies the + number of samples to read. + + If you set this input to nidaqmx.constants. + READ_ALL_AVAILABLE, NI-DAQmx determines how many samples + to read based on if the task acquires samples + continuously or acquires a finite number of samples. + + If the task acquires samples continuously and you set + this input to nidaqmx.constants.READ_ALL_AVAILABLE, this + method reads all the samples currently available in the + buffer. + + If the task acquires a finite number of samples and you + set this input to nidaqmx.constants.READ_ALL_AVAILABLE, + the method waits for the task to acquire all requested + samples, then reads those samples. If you set the + "read_all_avail_samp" property to True, the method reads + the samples currently available in the buffer and does + not wait for the task to acquire all requested samples. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for samples to become available. If the + time elapses, the method returns an error and any + samples read before the timeout elapsed. The default + timeout is 10 seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to read the requested samples and returns an error + if it is unable to. + Returns: + int: + + Indicates the number of samples acquired by each channel. + NI-DAQmx returns a single value because this value is the + same for all channels. + """ + number_of_samples_per_channel = ( + self._task._calculate_num_samps_per_chan( + number_of_samples_per_channel)) + + self._verify_array(data, number_of_samples_per_channel, True, True) + + return _read_digital_u_16( + self._handle, data, number_of_samples_per_channel, timeout) + + def read_many_sample_port_uint32( + self, data, number_of_samples_per_channel=READ_ALL_AVAILABLE, + timeout=10.0): + """ + Reads one or more 32-bit unsigned integer samples from one or + more digital input channels in a task. + + Use this method for devices with up to 32 lines per port. + + This read method accepts a preallocated NumPy array to hold the + samples requested, which can be advantageous for performance and + interoperability with NumPy and SciPy. + + Passing in a preallocated array is valuable in continuous + acquisition scenarios, where the same array can be used + repeatedly in each call to the method. + + Args: + data (numpy.ndarray): Specifies a preallocated 2D NumPy + array of 32-bit unsigned integer values to hold the + samples requested. The size of the array must be large + enough to hold all requested samples from all channels + in the task; otherwise, an error is thrown. + + Each row corresponds to a channel in the task. Each + column corresponds to a sample from each channel. The + order of the channels in the array corresponds to the + order in which you add the channels to the task or to + the order of the channels you specify with the + "channels_to_read" property. + + If the size of the array is too large or the array is + shaped incorrectly, the previous statement may not hold + true as the samples read may not be separated into rows + and columns properly. Set the "verify_array_shape" + property on this channel reader object to True to + validate that the NumPy array object is shaped properly. + Setting this property may marginally adversely impact + the performance of the method. + number_of_samples_per_channel (Optional[int]): Specifies the + number of samples to read. + + If you set this input to nidaqmx.constants. + READ_ALL_AVAILABLE, NI-DAQmx determines how many samples + to read based on if the task acquires samples + continuously or acquires a finite number of samples. + + If the task acquires samples continuously and you set + this input to nidaqmx.constants.READ_ALL_AVAILABLE, this + method reads all the samples currently available in the + buffer. + + If the task acquires a finite number of samples and you + set this input to nidaqmx.constants.READ_ALL_AVAILABLE, + the method waits for the task to acquire all requested + samples, then reads those samples. If you set the + "read_all_avail_samp" property to True, the method reads + the samples currently available in the buffer and does + not wait for the task to acquire all requested samples. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for samples to become available. If the + time elapses, the method returns an error and any + samples read before the timeout elapsed. The default + timeout is 10 seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to read the requested samples and returns an error + if it is unable to. + Returns: + int: + + Indicates the number of samples acquired by each channel. + NI-DAQmx returns a single value because this value is the + same for all channels. + """ + number_of_samples_per_channel = ( + self._task._calculate_num_samps_per_chan( + number_of_samples_per_channel)) + + self._verify_array(data, number_of_samples_per_channel, True, True) + + return _read_digital_u_32( + self._handle, data, number_of_samples_per_channel, timeout) + + def read_one_sample_multi_line(self, data, timeout=10): + """ + Reads a single boolean sample from one or more digital input + channels in a task. The channels can contain multiple digital + lines. + + This read method accepts a preallocated NumPy array to hold the + samples requested, which can be advantageous for performance and + interoperability with NumPy and SciPy. + + Passing in a preallocated array is valuable in continuous + acquisition scenarios, where the same array can be used + repeatedly in each call to the method. + + Args: + data (numpy.ndarray): Specifies a preallocated 2D NumPy + array of boolean values to hold the samples requested. + The size of the array must be large enough to hold all + requested samples from all channels in the task; + otherwise, an error is thrown. + + Each row corresponds to a channel in the task. Each + column corresponds to a line from each channel. The + order of the channels in the array corresponds to the + order in which you add the channels to the task or to + the order of the channels you specify with the + "channels_to_read" property. + + If the size of the array is too large or the array is + shaped incorrectly, the previous statement may not hold + true as the samples read may not be separated into rows + and columns properly. Set the "verify_array_shape" + property on this channel reader object to True to + validate that the NumPy array object is shaped properly. + Setting this property may marginally adversely impact + the performance of the method. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for samples to become available. If the + time elapses, the method returns an error and any + samples read before the timeout elapsed. The default + timeout is 10 seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to read the requested samples and returns an error + if it is unable to. + """ + self._verify_array_digital_lines(data, True, True) + + _read_digital_lines(self._handle, data, 1, timeout) + + def read_one_sample_one_line(self, data, timeout=10): + """ + Reads a single boolean sample from one or more digital input + channels in a task. The channel can contain only one digital + line. + + This read method accepts a preallocated NumPy array to hold the + samples requested, which can be advantageous for performance and + interoperability with NumPy and SciPy. + + Passing in a preallocated array is valuable in continuous + acquisition scenarios, where the same array can be used + repeatedly in each call to the method. + + Args: + data (numpy.ndarray): Specifies a preallocated 1D NumPy + array of boolean values to hold the samples requested. + + Each element in the array corresponds to a sample from + each channel. The size of the array must be large enough + to hold all requested samples from the channel in the + task; otherwise, an error is thrown. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for samples to become available. If the + time elapses, the method returns an error and any + samples read before the timeout elapsed. The default + timeout is 10 seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to read the requested samples and returns an error + if it is unable to. + """ + self._verify_array_digital_lines(data, True, False) + + _read_digital_lines(self._handle, data, 1, timeout) + + def read_one_sample_port_byte(self, data, timeout=10): + """ + Reads a single 8-bit unsigned integer sample from one or more + digital input channels in a task. + + Use this method for devices with up to 8 lines per port. + + This read method accepts a preallocated NumPy array to hold the + samples requested, which can be advantageous for performance and + interoperability with NumPy and SciPy. + + Passing in a preallocated array is valuable in continuous + acquisition scenarios, where the same array can be used + repeatedly in each call to the method. + + Args: + data (numpy.ndarray): Specifies a preallocated 1D NumPy + array of 8-bit unsigned integer values to hold the + samples requested. + + Each element in the array corresponds to a sample from + each channel. The size of the array must be large enough + to hold all requested samples from the channel in the + task; otherwise, an error is thrown. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for samples to become available. If the + time elapses, the method returns an error and any + samples read before the timeout elapsed. The default + timeout is 10 seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to read the requested samples and returns an error + if it is unable to. + """ + self._verify_array(data, 1, True, False) + + _read_digital_u_8(self._handle, data, 1, timeout) + + def read_one_sample_port_uint16(self, data, timeout=10): + """ + Reads a single 16-bit unsigned integer sample from one or more + digital input channels in a task. + + Use this method for devices with up to 16 lines per port. + + This read method accepts a preallocated NumPy array to hold the + samples requested, which can be advantageous for performance and + interoperability with NumPy and SciPy. + + Passing in a preallocated array is valuable in continuous + acquisition scenarios, where the same array can be used + repeatedly in each call to the method. + + Args: + data (numpy.ndarray): Specifies a preallocated 1D NumPy + array of 16-bit unsigned integer values to hold the + samples requested. + + Each element in the array corresponds to a sample from + each channel. The size of the array must be large enough + to hold all requested samples from the channel in the + task; otherwise, an error is thrown. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for samples to become available. If the + time elapses, the method returns an error and any + samples read before the timeout elapsed. The default + timeout is 10 seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to read the requested samples and returns an error + if it is unable to. + """ + self._verify_array(data, 1, True, False) + + _read_digital_u_16(self._handle, data, 1, timeout) + + def read_one_sample_port_uint32(self, data, timeout=10): + """ + Reads a single 32-bit unsigned integer sample from one or more + digital input channels in a task. + + Use this method for devices with up to 32 lines per port. + + This read method accepts a preallocated NumPy array to hold the + samples requested, which can be advantageous for performance and + interoperability with NumPy and SciPy. + + Passing in a preallocated array is valuable in continuous + acquisition scenarios, where the same array can be used + repeatedly in each call to the method. + + Args: + data (numpy.ndarray): Specifies a preallocated 1D NumPy + array of 32-bit unsigned integer values to hold the + samples requested. + + Each element in the array corresponds to a sample from + each channel. The size of the array must be large enough + to hold all requested samples from the channel in the + task; otherwise, an error is thrown. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for samples to become available. If the + time elapses, the method returns an error and any + samples read before the timeout elapsed. The default + timeout is 10 seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to read the requested samples and returns an error + if it is unable to. + """ + self._verify_array(data, 1, True, False) + + _read_digital_u_32(self._handle, data, 1, timeout) diff --git a/nidaqmx/stream_writers.py b/nidaqmx/stream_writers.py new file mode 100644 index 00000000..56dc75c6 --- /dev/null +++ b/nidaqmx/stream_writers.py @@ -0,0 +1,1410 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import numpy +from nidaqmx import DaqError +from nidaqmx._task_modules.write_functions import ( + _write_analog_f_64, _write_analog_scalar_f_64, _write_binary_i_16, + _write_binary_i_32, _write_binary_u_16, _write_binary_u_32, + _write_ctr_freq, _write_ctr_ticks, _write_ctr_time, _write_ctr_freq_scalar, + _write_ctr_ticks_scalar, _write_ctr_time_scalar, _write_digital_u_8, + _write_digital_u_16, _write_digital_u_32, _write_digital_lines, + _write_digital_scalar_u_32) +from nidaqmx.error_codes import DAQmxErrors + +__all__ = ['AnalogSingleChannelWriter', 'AnalogMultiChannelWriter', + 'AnalogUnscaledWriter', 'CounterWriter', + 'DigitalSingleChannelWriter', 'DigitalMultiChannelWriter'] + + +class UnsetAutoStartSentinel(object): + pass + + +AUTO_START_UNSET = UnsetAutoStartSentinel() + +del UnsetAutoStartSentinel + + +class ChannelWriterBase(object): + """ + Defines base class for all NI-DAQmx stream writers. + """ + + def __init__(self, task_out_stream, auto_start=AUTO_START_UNSET): + """ + Args: + task_out_stream: Specifies the output stream associated with + an NI-DAQmx task which to write samples. + auto_start (Optional[bool]): Specifies if the write method + automatically starts the task if you did not explicitly + start it with the DAQmx Start Task method. + + If you do not specify a value for this parameter, + NI-DAQmx determines its value based on the type of write + method used. If you use a one sample write method, the + value is True; conversely, if you use a many sample + write method, the value is False. + """ + self._out_stream = task_out_stream + self._task = task_out_stream._task + self._handle = task_out_stream._task._handle + + self._verify_array_shape = True + self._auto_start = auto_start + + @property + def auto_start(self): + """ + bool: Specifies if the write method automatically starts the + task if you did not explicitly start it with the DAQmx Start + Task method. + + If you do not specify a value for this parameter, NI-DAQmx + determines its value based on the type of write method used. + If you use a one sample write method, its value is True; + conversely, if you use a many sample write method, its value + is False. + """ + return self._auto_start + + @auto_start.setter + def auto_start(self, val): + self._auto_start = val + + @auto_start.deleter + def auto_start(self): + self._auto_start = AUTO_START_UNSET + + @property + def verify_array_shape(self): + """ + bool: Indicates whether the size and shape of the user-defined + NumPy arrays passed to read methods are verified. Defaults + to True when this object is instantiated. + + Setting this property to True may marginally adversely + impact the performance of read methods. + """ + return self._verify_array_shape + + @verify_array_shape.setter + def verify_array_shape(self, val): + self._verify_array_shape = val + + def _verify_array(self, data, is_many_chan, is_many_samp): + """ + Verifies that the shape of the specified NumPy array can be used + with the specified write method type, if the + "verify_array_shape" property is set to True. + + Args: + data (numpy.ndarray): Specifies the NumPy array to verify. + is_many_chan (bool): Specifies if the write method is a many + channel version. + is_many_samp (bool): Specifies if the write method is a many + sample version. + """ + if not self._verify_array_shape: + return + + channels_to_write = self._task.channels + number_of_channels = len(channels_to_write.channel_names) + + expected_num_dimensions = None + if is_many_chan: + if is_many_samp: + expected_num_dimensions = 2 + else: + expected_num_dimensions = 1 + + if data.shape[0] != number_of_channels: + self._task._raise_invalid_write_num_chans_error( + number_of_channels, data.shape[0]) + else: + if is_many_samp: + expected_num_dimensions = 1 + + if expected_num_dimensions is not None: + self._raise_error_if_invalid_write_dimensions( + expected_num_dimensions, len(data.shape)) + + def _verify_array_digital_lines( + self, data, is_many_chan, is_many_line): + """ + Verifies that the shape of the specified NumPy array can be used + to read samples from the current task which contains one or more + channels that have one or more digital lines per channel, if the + "verify_array_shape" property is set to True. + + Args: + data (numpy.ndarray): Specifies the NumPy array to verify. + is_many_chan (bool): Specifies if the write method is a + many channel version. + is_many_line (bool): Specifies if the write method is a + many line version. + """ + if not self._verify_array_shape: + return + + channels_to_write = self._task.channels + number_of_channels = len(channels_to_write.channel_names) + number_of_lines = self._out_stream.do_num_booleans_per_chan + + expected_num_dimensions = None + if is_many_chan: + if data.shape[0] != number_of_channels: + self._task._raise_invalid_write_num_chans_error( + number_of_channels, data.shape[0]) + + if is_many_line: + expected_num_dimensions = 2 + if data.shape[1] != number_of_lines: + self._task._raise_invalid_num_lines_error( + number_of_lines, data.shape[1]) + else: + expected_num_dimensions = 1 + else: + if is_many_line: + expected_num_dimensions = 1 + if data.shape[0] != number_of_lines: + self._task._raise_invalid_num_lines_error( + number_of_lines, data.shape[0]) + + if expected_num_dimensions is not None: + self._raise_error_if_invalid_write_dimensions( + expected_num_dimensions, len(data.shape)) + + def _raise_error_if_invalid_write_dimensions( + self, num_dimensions_expected, num_dimensions_in_data): + if num_dimensions_expected != num_dimensions_in_data: + raise DaqError( + 'Write cannot be performed because the NumPy array passed ' + 'into this function is not shaped correctly. ' + 'You must pass in a NumPy array of the correct number of ' + 'dimensions based on the write method you use.\n\n' + 'No. of dimensions of NumPy Array provided: {0}\n' + 'No. of dimensions of NumPy Array required: {1}' + .format(num_dimensions_in_data, num_dimensions_expected), + DAQmxErrors.UNKNOWN.value, task_name=self._task.name) + + +class AnalogSingleChannelWriter(ChannelWriterBase): + """ + Writes samples to an analog output channel in an NI-DAQmx task. + """ + + def write_many_sample(self, data, timeout=10.0): + """ + Writes one or more floating-point samples to a single analog + output channel in a task. + + If the task uses on-demand timing, this method returns only + after the device generates all samples. On-demand is the default + timing type if you do not use the timing property on the task to + configure a sample timing type. If the task uses any timing type + other than on-demand, this method returns immediately and does + not wait for the device to generate all samples. Your + application must determine if the task is done to ensure that + the device generated all samples. + + Args: + data (numpy.ndarray): Contains a 1D NumPy array of + floating-point samples to write to the task. Each + element of the array corresponds to a sample to write. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for the method to write all samples. + NI-DAQmx performs a timeout check only if the method + must wait before it writes data. This method returns an + error if the time elapses. The default timeout is 10 + seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to write the submitted samples. If the method could + not write all the submitted samples, it returns an error + and the number of samples successfully written. + Returns: + int: + + Specifies the actual number of samples this method + successfully wrote. + """ + self._verify_array(data, False, True) + + auto_start = (self._auto_start if self._auto_start is not + AUTO_START_UNSET else False) + + return _write_analog_f_64( + self._handle, data, data.shape[0], auto_start, timeout) + + def write_one_sample(self, data, timeout=10): + """ + Writes a single floating-point sample to a single analog output + channel in a task. + + Args: + data (float): Specifies the floating-point sample to write + to the task. + auto_start (Optional[bool]): Specifies if this method + automatically starts the task if you did not explicitly + start it with the DAQmx Start Task method. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for the method to write all samples. + NI-DAQmx performs a timeout check only if the method + must wait before it writes data. This method returns an + error if the time elapses. The default timeout is 10 + seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to write the submitted samples. If the method could + not write all the submitted samples, it returns an error + and the number of samples successfully written. + """ + auto_start = (self._auto_start if self._auto_start is not + AUTO_START_UNSET else True) + + return _write_analog_scalar_f_64( + self._handle, data, auto_start, timeout) + + +class AnalogMultiChannelWriter(ChannelWriterBase): + """ + Writes samples to one or more analog output channels in an NI-DAQmx + task. + """ + + def write_many_sample(self, data, timeout=10.0): + """ + Writes one or more floating-point samples to one or more analog + output channels in a task. + + If the task uses on-demand timing, this method returns only + after the device generates all samples. On-demand is the default + timing type if you do not use the timing property on the task to + configure a sample timing type. If the task uses any timing type + other than on-demand, this method returns immediately and does + not wait for the device to generate all samples. Your + application must determine if the task is done to ensure that + the device generated all samples. + + Args: + data (numpy.ndarray): Contains a 2D NumPy array of + floating-point samples to write to the task. + + Each row corresponds to a channel in the task. Each + column corresponds to a sample to write to each channel. + The order of the channels in the array corresponds to + the order in which you add the channels to the task. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for the method to write all samples. + NI-DAQmx performs a timeout check only if the method + must wait before it writes data. This method returns an + error if the time elapses. The default timeout is 10 + seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to write the submitted samples. If the method could + not write all the submitted samples, it returns an error + and the number of samples successfully written. + Returns: + int: + + Specifies the actual number of samples this method + successfully wrote to each channel in the task. + """ + self._verify_array(data, True, True) + + auto_start = (self._auto_start if self._auto_start is not + AUTO_START_UNSET else False) + + return _write_analog_f_64( + self._handle, data, data.shape[1], auto_start, timeout) + + def write_one_sample(self, data, timeout=10): + """ + Writes a single floating-point sample to one or more analog + output channels in a task. + + Args: + data (numpy.ndarray): Contains a 1D NumPy array of + floating-point samples to write to the task. + + Each element of the array corresponds to a channel in + the task. The order of the channels in the array + corresponds to the order in which you add the channels + to the task. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for the method to write all samples. + NI-DAQmx performs a timeout check only if the method + must wait before it writes data. This method returns an + error if the time elapses. The default timeout is 10 + seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to write the submitted samples. If the method could + not write all the submitted samples, it returns an error + and the number of samples successfully written. + """ + self._verify_array(data, True, False) + + auto_start = (self._auto_start if self._auto_start is not + AUTO_START_UNSET else True) + + return _write_analog_f_64( + self._handle, data, 1, auto_start, timeout) + + +class AnalogUnscaledWriter(ChannelWriterBase): + """ + Writes unscaled samples to one or more analog output channels in + an NI-DAQmx task. + """ + + def write_int16(self, data, timeout=10.0): + """ + Writes one or more unscaled 16-bit integer samples to one or + more analog output channels in a task. + + If the task uses on-demand timing, this method returns only + after the device generates all samples. On-demand is the default + timing type if you do not use the timing property on the task to + configure a sample timing type. If the task uses any timing type + other than on-demand, this method returns immediately and does + not wait for the device to generate all samples. Your + application must determine if the task is done to ensure that + the device generated all samples. + + Args: + data (numpy.ndarray): Contains a 2D NumPy array of unscaled + 16-bit integer samples to write to the task. + + Each row corresponds to a channel in the task. Each + column corresponds to a sample to write to each channel. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for the method to write all samples. + NI-DAQmx performs a timeout check only if the method + must wait before it writes data. This method returns an + error if the time elapses. The default timeout is 10 + seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to write the submitted samples. If the method could + not write all the submitted samples, it returns an error + and the number of samples successfully written. + Returns: + int: + + Specifies the actual number of samples this method + successfully wrote to each channel in the task. + """ + self._verify_array(data, True, True) + + auto_start = (self._auto_start if self._auto_start is not + AUTO_START_UNSET else False) + + return _write_binary_i_16( + self._handle, data, data.shape[1], auto_start, timeout) + + def write_int32(self, data, timeout=10.0): + """ + Writes one or more unscaled 32-bit integer samples to one or + more analog output channels in a task. + + If the task uses on-demand timing, this method returns only + after the device generates all samples. On-demand is the default + timing type if you do not use the timing property on the task to + configure a sample timing type. If the task uses any timing type + other than on-demand, this method returns immediately and does + not wait for the device to generate all samples. Your + application must determine if the task is done to ensure that + the device generated all samples. + + Args: + data (numpy.ndarray): Contains a 2D NumPy array of unscaled + 32-bit integer samples to write to the task. + + Each row corresponds to a channel in the task. Each + column corresponds to a sample to write to each channel. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for the method to write all samples. + NI-DAQmx performs a timeout check only if the method + must wait before it writes data. This method returns an + error if the time elapses. The default timeout is 10 + seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to write the submitted samples. If the method could + not write all the submitted samples, it returns an error + and the number of samples successfully written. + Returns: + int: + + Specifies the actual number of samples this method + successfully wrote to each channel in the task. + """ + self._verify_array(data, True, True) + + auto_start = (self._auto_start if self._auto_start is not + AUTO_START_UNSET else False) + + return _write_binary_i_32( + self._handle, data, data.shape[1], auto_start, timeout) + + def write_uint16(self, data, timeout=10.0): + """ + Writes one or more unscaled 16-bit unsigned integer samples to + one or more analog output channels in a task. + + If the task uses on-demand timing, this method returns only + after the device generates all samples. On-demand is the default + timing type if you do not use the timing property on the task to + configure a sample timing type. If the task uses any timing type + other than on-demand, this method returns immediately and does + not wait for the device to generate all samples. Your + application must determine if the task is done to ensure that + the device generated all samples. + + Args: + data (numpy.ndarray): Contains a 2D NumPy array of unscaled + 16-bit unsigned integer samples to write to the task. + + Each row corresponds to a channel in the task. Each + column corresponds to a sample to write to each channel. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for the method to write all samples. + NI-DAQmx performs a timeout check only if the method + must wait before it writes data. This method returns an + error if the time elapses. The default timeout is 10 + seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to write the submitted samples. If the method could + not write all the submitted samples, it returns an error + and the number of samples successfully written. + Returns: + int: + + Specifies the actual number of samples this method + successfully wrote to each channel in the task. + """ + self._verify_array(data, True, True) + + auto_start = (self._auto_start if self._auto_start is not + AUTO_START_UNSET else False) + + return _write_binary_u_16( + self._handle, data, data.shape[1], auto_start, timeout) + + def write_uint32(self, data, timeout=10.0): + """ + Writes one or more unscaled 32-bit unsigned integer samples to + one or more analog output channels in a task. + + If the task uses on-demand timing, this method returns only + after the device generates all samples. On-demand is the default + timing type if you do not use the timing property on the task to + configure a sample timing type. If the task uses any timing type + other than on-demand, this method returns immediately and does + not wait for the device to generate all samples. Your + application must determine if the task is done to ensure that + the device generated all samples. + + Args: + data (numpy.ndarray): Contains a 2D NumPy array of unscaled + 32-bit unsigned integer samples to write to the task. + + Each row corresponds to a channel in the task. Each + column corresponds to a sample to write to each channel. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for the method to write all samples. + NI-DAQmx performs a timeout check only if the method + must wait before it writes data. This method returns an + error if the time elapses. The default timeout is 10 + seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to write the submitted samples. If the method could + not write all the submitted samples, it returns an error + and the number of samples successfully written. + Returns: + int: + + Specifies the actual number of samples this method + successfully wrote to each channel in the task. + """ + self._verify_array(data, True, True) + + auto_start = (self._auto_start if self._auto_start is not + AUTO_START_UNSET else False) + + return _write_binary_u_32( + self._handle, data, data.shape[1], auto_start, timeout) + + +class CounterWriter(ChannelWriterBase): + """ + Writes samples to a counter output channel in an NI-DAQmx task. + """ + + def write_many_sample_pulse_frequency( + self, frequencies, duty_cycles, timeout=10.0): + """ + Writes one or more pulse samples in terms of frequency to a + single counter output channel in a task. + + If the task uses on-demand timing, this method returns only + after the device generates all samples. On-demand is the default + timing type if you do not use the timing property on the task to + configure a sample timing type. If the task uses any timing type + other than on-demand, this method returns immediately and does + not wait for the device to generate all samples. Your + application must determine if the task is done to ensure that + the device generated all samples. + + Args: + frequencies (numpy.ndarray): Contains a 1D NumPy array of + floating-point values that holds the frequency portion + of the pulse samples to write to the task. Each element + of the array corresponds to a sample to write. + duty_cycles (numpy.ndarray): Contains a 1D NumPy array of + floating-point values that holds the duty cycle portion + of the pulse samples to write to the task. Each element + of the array corresponds to a sample to write. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for the method to write all samples. + NI-DAQmx performs a timeout check only if the method + must wait before it writes data. This method returns an + error if the time elapses. The default timeout is 10 + seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to write the submitted samples. If the method could + not write all the submitted samples, it returns an error + and the number of samples successfully written. + Returns: + int: + + Specifies the actual number of samples this method + successfully wrote. + """ + self._verify_array(frequencies, False, True) + self._verify_array(duty_cycles, False, True) + + auto_start = (self._auto_start if self._auto_start is not + AUTO_START_UNSET else False) + + return _write_ctr_freq( + self._handle, frequencies, duty_cycles, frequencies.shape[0], + auto_start, timeout) + + def write_many_sample_pulse_ticks( + self, high_ticks, low_ticks, timeout=10.0): + """ + Writes one or more pulse samples in terms of ticks to a single + counter output channel in a task. + + If the task uses on-demand timing, this method returns only + after the device generates all samples. On-demand is the default + timing type if you do not use the timing property on the task to + configure a sample timing type. If the task uses any timing type + other than on-demand, this method returns immediately and does + not wait for the device to generate all samples. Your + application must determine if the task is done to ensure that + the device generated all samples. + + Args: + high_ticks (numpy.ndarray): Contains a 1D NumPy array of + 32-bit unsigned integer values that holds the high ticks + portion of the pulse samples to write to the task. Each + element of the array corresponds to a sample to write. + low_ticks (numpy.ndarray): Contains a 1D NumPy array of + 32-bit unsigned integer values that holds the low ticks + portion of the pulse samples to write to the task. Each + element of the array corresponds to a sample to write. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for the method to write all samples. + NI-DAQmx performs a timeout check only if the method + must wait before it writes data. This method returns an + error if the time elapses. The default timeout is 10 + seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to write the submitted samples. If the method could + not write all the submitted samples, it returns an error + and the number of samples successfully written. + Returns: + int: + + Specifies the actual number of samples this method + successfully wrote. + """ + self._verify_array(high_ticks, False, True) + self._verify_array(low_ticks, False, True) + + auto_start = (self._auto_start if self._auto_start is not + AUTO_START_UNSET else False) + + return _write_ctr_ticks( + self._handle, high_ticks, low_ticks, high_ticks.shape[0], + auto_start, timeout) + + def write_many_sample_pulse_time( + self, high_times, low_times, timeout=10.0): + """ + Writes one or more pulse samples in terms of time to a single + counter output channel in a task. + + If the task uses on-demand timing, this method returns only + after the device generates all samples. On-demand is the default + timing type if you do not use the timing property on the task to + configure a sample timing type. If the task uses any timing type + other than on-demand, this method returns immediately and does + not wait for the device to generate all samples. Your + application must determine if the task is done to ensure that + the device generated all samples. + + Args: + high_times (numpy.ndarray): Contains a 1D NumPy array of + floating-point values that holds the high time portion + of the pulse samples to write to the task. Each element + of the array corresponds to a sample to write. + low_times (numpy.ndarray): Contains a 1D NumPy array of + floating-point values that holds the low time portion + of the pulse samples to write to the task. Each element + of the array corresponds to a sample to write. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for the method to write all samples. + NI-DAQmx performs a timeout check only if the method + must wait before it writes data. This method returns an + error if the time elapses. The default timeout is 10 + seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to write the submitted samples. If the method could + not write all the submitted samples, it returns an error + and the number of samples successfully written. + Returns: + int: + + Specifies the actual number of samples this method + successfully wrote. + """ + self._verify_array(high_times, False, True) + self._verify_array(low_times, False, True) + + auto_start = (self._auto_start if self._auto_start is not + AUTO_START_UNSET else False) + + return _write_ctr_time( + self._handle, high_times, low_times, high_times.shape[0], + auto_start, timeout) + + def write_one_sample_pulse_frequency( + self, frequency, duty_cycle, timeout=10): + """ + Writes a new pulse frequency and duty cycle to a single counter + output channel in a task. + + Args: + frequency (float): Specifies at what frequency to generate + pulses. + duty_cycle (float): Specifies the width of the pulse divided + by the pulse period. NI-DAQmx uses this ratio combined + with frequency to determine pulse width and the interval + between pulses. + auto_start (Optional[bool]): Specifies if this method + automatically starts the task if you did not explicitly + start it with the DAQmx Start Task method. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for the method to write all samples. + NI-DAQmx performs a timeout check only if the method + must wait before it writes data. This method returns an + error if the time elapses. The default timeout is 10 + seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to write the submitted samples. If the method could + not write all the submitted samples, it returns an error + and the number of samples successfully written. + """ + auto_start = (self._auto_start if self._auto_start is not + AUTO_START_UNSET else True) + + return _write_ctr_freq_scalar( + self._handle, frequency, duty_cycle, auto_start, timeout) + + def write_one_sample_pulse_ticks( + self, high_ticks, low_ticks, timeout=10): + """ + Writes a new pulse high tick count and low tick count to a + single counter output channel in a task. + + Args: + high_ticks (float): Specifies the number of ticks the pulse + is high. + low_ticks (float): Specifies the number of ticks the pulse + is low. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for the method to write all samples. + NI-DAQmx performs a timeout check only if the method + must wait before it writes data. This method returns an + error if the time elapses. The default timeout is 10 + seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to write the submitted samples. If the method could + not write all the submitted samples, it returns an error + and the number of samples successfully written. + """ + auto_start = (self._auto_start if self._auto_start is not + AUTO_START_UNSET else True) + + return _write_ctr_ticks_scalar( + self._handle, high_ticks, low_ticks, auto_start, timeout) + + def write_one_sample_pulse_time( + self, high_time, low_time, timeout=10): + """ + Writes a new pulse high time and low time to a single counter + output channel in a task. + + Args: + high_time (float): Specifies the amount of time the pulse + is high. + low_time (float): Specifies the amount of time the pulse + is low. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for the method to write all samples. + NI-DAQmx performs a timeout check only if the method + must wait before it writes data. This method returns an + error if the time elapses. The default timeout is 10 + seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to write the submitted samples. If the method could + not write all the submitted samples, it returns an error + and the number of samples successfully written. + """ + auto_start = (self._auto_start if self._auto_start is not + AUTO_START_UNSET else True) + + return _write_ctr_time_scalar( + self._handle, high_time, low_time, auto_start, timeout) + + +class DigitalSingleChannelWriter(ChannelWriterBase): + """ + Writes samples to a single digital output channel in an NI-DAQmx + task. + """ + + def write_many_sample_port_byte(self, data, timeout=10.0): + """ + Writes one or more 8-bit unsigned integer samples to a single + digital output channel in a task. + + Use this method for devices with up to 8 lines per port. + + If the task uses on-demand timing, this method returns only + after the device generates all samples. On-demand is the default + timing type if you do not use the timing property on the task to + configure a sample timing type. If the task uses any timing type + other than on-demand, this method returns immediately and does + not wait for the device to generate all samples. Your + application must determine if the task is done to ensure that + the device generated all samples. + + Args: + data (numpy.ndarray): Contains a 1D NumPy array of 8-bit + unsigned integer samples to write to the task. Each + element of the array corresponds to a sample to write. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for the method to write all samples. + NI-DAQmx performs a timeout check only if the method + must wait before it writes data. This method returns an + error if the time elapses. The default timeout is 10 + seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to write the submitted samples. If the method could + not write all the submitted samples, it returns an error + and the number of samples successfully written. + Returns: + int: + + Specifies the actual number of samples this method + successfully wrote. + """ + self._verify_array(data, False, True) + + auto_start = (self._auto_start if self._auto_start is not + AUTO_START_UNSET else False) + + return _write_digital_u_8( + self._handle, data, data.shape[0], auto_start, timeout) + + def write_many_sample_port_uint16(self, data, timeout=10.0): + """ + Writes one or more 16-bit unsigned integer samples to a single + digital output channel in a task. + + Use this method for devices with up to 16 lines per port. + + If the task uses on-demand timing, this method returns only + after the device generates all samples. On-demand is the default + timing type if you do not use the timing property on the task to + configure a sample timing type. If the task uses any timing type + other than on-demand, this method returns immediately and does + not wait for the device to generate all samples. Your + application must determine if the task is done to ensure that + the device generated all samples. + + Args: + data (numpy.ndarray): Contains a 1D NumPy array of 16-bit + unsigned integer samples to write to the task. Each + element of the array corresponds to a sample to write. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for the method to write all samples. + NI-DAQmx performs a timeout check only if the method + must wait before it writes data. This method returns an + error if the time elapses. The default timeout is 10 + seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to write the submitted samples. If the method could + not write all the submitted samples, it returns an error + and the number of samples successfully written. + Returns: + int: + + Specifies the actual number of samples this method + successfully wrote. + """ + self._verify_array(data, False, True) + + auto_start = (self._auto_start if self._auto_start is not + AUTO_START_UNSET else False) + + return _write_digital_u_16( + self._handle, data, data.shape[0], auto_start, timeout) + + def write_many_sample_port_uint32(self, data, timeout=10.0): + """ + Writes one or more 32-bit unsigned integer samples to a single + digital output channel in a task. + + Use this method for devices with up to 32 lines per port. + + If the task uses on-demand timing, this method returns only + after the device generates all samples. On-demand is the default + timing type if you do not use the timing property on the task to + configure a sample timing type. If the task uses any timing type + other than on-demand, this method returns immediately and does + not wait for the device to generate all samples. Your + application must determine if the task is done to ensure that + the device generated all samples. + + Args: + data (numpy.ndarray): Contains a 1D NumPy array of 32-bit + unsigned integer samples to write to the task. Each + element of the array corresponds to a sample to write. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for the method to write all samples. + NI-DAQmx performs a timeout check only if the method + must wait before it writes data. This method returns an + error if the time elapses. The default timeout is 10 + seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to write the submitted samples. If the method could + not write all the submitted samples, it returns an error + and the number of samples successfully written. + Returns: + int: + + Specifies the actual number of samples this method + successfully wrote. + """ + self._verify_array(data, False, True) + + auto_start = (self._auto_start if self._auto_start is not + AUTO_START_UNSET else False) + + return _write_digital_u_32( + self._handle, data, data.shape[0], auto_start, timeout) + + def write_one_sample_multi_line(self, data, timeout=10): + """ + Writes a single boolean sample to a single digital output + channel in a task. The channel can contain multiple digital + lines. + + Args: + data (numpy.ndarray): Contains a 1D NumPy array of boolean + samples to write to the task. Each element of the array + corresponds to a line in the channel. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for the method to write all samples. + NI-DAQmx performs a timeout check only if the method + must wait before it writes data. This method returns an + error if the time elapses. The default timeout is 10 + seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to write the submitted samples. If the method could + not write all the submitted samples, it returns an error + and the number of samples successfully written. + """ + self._verify_array_digital_lines(data, False, True) + + auto_start = (self._auto_start if self._auto_start is not + AUTO_START_UNSET else True) + + return _write_digital_lines( + self._handle, data, 1, auto_start, timeout) + + def write_one_sample_one_line(self, data, timeout=10): + """ + Writes a single boolean sample to a single digital output + channel in a task. The channel can contain only one digital + line. + + Args: + data (int): Specifies the boolean sample to write to the + task. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for the method to write all samples. + NI-DAQmx performs a timeout check only if the method + must wait before it writes data. This method returns an + error if the time elapses. The default timeout is 10 + seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to write the submitted samples. If the method could + not write all the submitted samples, it returns an error + and the number of samples successfully written. + """ + auto_start = (self._auto_start if self._auto_start is not + AUTO_START_UNSET else True) + + numpy_array = numpy.asarray([data], dtype=numpy.bool) + + return _write_digital_lines( + self._handle, numpy_array, 1, auto_start, timeout) + + def write_one_sample_port_byte(self, data, timeout=10): + """ + Writes a single 8-bit unsigned integer sample to a single + digital output channel in a task. + + Use this method for devices with up to 8 lines per port. + + Args: + data (int): Specifies the 8-bit unsigned integer sample to + write to the task. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for the method to write all samples. + NI-DAQmx performs a timeout check only if the method + must wait before it writes data. This method returns an + error if the time elapses. The default timeout is 10 + seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to write the submitted samples. If the method could + not write all the submitted samples, it returns an error + and the number of samples successfully written. + """ + auto_start = (self._auto_start if self._auto_start is not + AUTO_START_UNSET else True) + + numpy_array = numpy.asarray([data], dtype=numpy.uint8) + + return _write_digital_u_8( + self._handle, numpy_array, 1, auto_start, timeout) + + def write_one_sample_port_uint16(self, data, timeout=10): + """ + Writes a single 16-bit unsigned integer sample to a single + digital output channel in a task. + + Use this method for devices with up to 16 lines per port. + + Args: + data (int): Specifies the 16-bit unsigned integer sample to + write to the task. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for the method to write all samples. + NI-DAQmx performs a timeout check only if the method + must wait before it writes data. This method returns an + error if the time elapses. The default timeout is 10 + seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to write the submitted samples. If the method could + not write all the submitted samples, it returns an error + and the number of samples successfully written. + """ + auto_start = (self._auto_start if self._auto_start is not + AUTO_START_UNSET else True) + + numpy_array = numpy.asarray([data], dtype=numpy.uint16) + + return _write_digital_u_16( + self._handle, numpy_array, 1, auto_start, timeout) + + def write_one_sample_port_uint32(self, data, timeout=10): + """ + Writes a single 32-bit unsigned integer sample to a single + digital output channel in a task. + + Use this method for devices with up to 32 lines per port. + + Args: + data (int): Specifies the 32-bit unsigned integer sample to + write to the task. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for the method to write all samples. + NI-DAQmx performs a timeout check only if the method + must wait before it writes data. This method returns an + error if the time elapses. The default timeout is 10 + seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to write the submitted samples. If the method could + not write all the submitted samples, it returns an error + and the number of samples successfully written. + """ + auto_start = (self._auto_start if self._auto_start is not + AUTO_START_UNSET else True) + + return _write_digital_scalar_u_32( + self._handle, data, auto_start, timeout) + + +class DigitalMultiChannelWriter(ChannelWriterBase): + """ + Writes samples to one or more digital output channels in an NI-DAQmx + task. + """ + + def write_many_sample_port_byte(self, data, timeout=10.0): + """ + Writes one or more 8-bit unsigned integer samples to one or more + digital output channels in a task. + + Use this method for devices with up to 8 lines per port. + + If the task uses on-demand timing, this method returns only + after the device generates all samples. On-demand is the default + timing type if you do not use the timing property on the task to + configure a sample timing type. If the task uses any timing type + other than on-demand, this method returns immediately and does + not wait for the device to generate all samples. Your + application must determine if the task is done to ensure that + the device generated all samples. + + Args: + data (numpy.ndarray): Contains a 2D NumPy array of 8-bit + unsigned integer samples to write to the task. + + Each row corresponds to a channel in the task. Each + column corresponds to a sample to write to each channel. + The order of the channels in the array corresponds to + the order in which you add the channels to the task. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for the method to write all samples. + NI-DAQmx performs a timeout check only if the method + must wait before it writes data. This method returns an + error if the time elapses. The default timeout is 10 + seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to write the submitted samples. If the method could + not write all the submitted samples, it returns an error + and the number of samples successfully written. + Returns: + int: + + Specifies the actual number of samples this method + successfully wrote to each channel in the task. + """ + self._verify_array(data, True, True) + + auto_start = (self._auto_start if self._auto_start is not + AUTO_START_UNSET else False) + + return _write_digital_u_8( + self._handle, data, data.shape[1], auto_start, timeout) + + def write_many_sample_port_uint16(self, data, timeout=10.0): + """ + Writes one or more 16-bit unsigned integer samples to one or + more digital output channels in a task. + + Use this method for devices with up to 16 lines per port. + + If the task uses on-demand timing, this method returns only + after the device generates all samples. On-demand is the default + timing type if you do not use the timing property on the task to + configure a sample timing type. If the task uses any timing type + other than on-demand, this method returns immediately and does + not wait for the device to generate all samples. Your + application must determine if the task is done to ensure that + the device generated all samples. + + Args: + data (numpy.ndarray): Contains a 2D NumPy array of 16-bit + unsigned integer samples to write to the task. + + Each row corresponds to a channel in the task. Each + column corresponds to a sample to write to each channel. + The order of the channels in the array corresponds to + the order in which you add the channels to the task. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for the method to write all samples. + NI-DAQmx performs a timeout check only if the method + must wait before it writes data. This method returns an + error if the time elapses. The default timeout is 10 + seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to write the submitted samples. If the method could + not write all the submitted samples, it returns an error + and the number of samples successfully written. + Returns: + int: + + Specifies the actual number of samples this method + successfully wrote to each channel in the task. + """ + self._verify_array(data, True, True) + + auto_start = (self._auto_start if self._auto_start is not + AUTO_START_UNSET else False) + + return _write_digital_u_16( + self._handle, data, data.shape[1], auto_start, timeout) + + def write_many_sample_port_uint32(self, data, timeout=10.0): + """ + Writes one or more 32-bit unsigned integer samples to one or + more digital output channels in a task. + + Use this method for devices with up to 32 lines per port. + + If the task uses on-demand timing, this method returns only + after the device generates all samples. On-demand is the default + timing type if you do not use the timing property on the task to + configure a sample timing type. If the task uses any timing type + other than on-demand, this method returns immediately and does + not wait for the device to generate all samples. Your + application must determine if the task is done to ensure that + the device generated all samples. + + Args: + data (numpy.ndarray): Contains a 2D NumPy array of 32-bit + unsigned integer samples to write to the task. + + Each row corresponds to a channel in the task. Each + column corresponds to a sample to write to each channel. + The order of the channels in the array corresponds to + the order in which you add the channels to the task. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for the method to write all samples. + NI-DAQmx performs a timeout check only if the method + must wait before it writes data. This method returns an + error if the time elapses. The default timeout is 10 + seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to write the submitted samples. If the method could + not write all the submitted samples, it returns an error + and the number of samples successfully written. + Returns: + int: + + Specifies the actual number of samples this method + successfully wrote to each channel in the task. + """ + self._verify_array(data, True, True) + + auto_start = (self._auto_start if self._auto_start is not + AUTO_START_UNSET else False) + + return _write_digital_u_32( + self._handle, data, data.shape[1], auto_start, timeout) + + def write_one_sample_multi_line(self, data, timeout=10): + """ + Writes a single boolean sample to one or more digital output + channels in a task. The channel can contain multiple digital + lines. + + Args: + data (numpy.ndarray): Contains a 2D NumPy array of boolean + samples to write to the task. + + Each row corresponds to a channel in the task. Each + column corresponds to a line from each channel. The + order of the channels in the array corresponds to the + order in which you add the channels to the task. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for the method to write all samples. + NI-DAQmx performs a timeout check only if the method + must wait before it writes data. This method returns an + error if the time elapses. The default timeout is 10 + seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to write the submitted samples. If the method could + not write all the submitted samples, it returns an error + and the number of samples successfully written. + """ + self._verify_array_digital_lines(data, True, True) + + auto_start = (self._auto_start if self._auto_start is not + AUTO_START_UNSET else True) + + return _write_digital_lines( + self._handle, data, 1, auto_start, timeout) + + def write_one_sample_one_line(self, data, timeout=10): + """ + Writes a single boolean sample to one or more digital output + channels in a task. The channel can contain only one digital + line. + + Args: + data (numpy.ndarray): Contains a 1D NumPy array of boolean + samples to write to the task. + + Each element in the array corresponds to a channel in + the task. The order of the channels in the array + corresponds to the order in which you add the channels + to the task. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for the method to write all samples. + NI-DAQmx performs a timeout check only if the method + must wait before it writes data. This method returns an + error if the time elapses. The default timeout is 10 + seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to write the submitted samples. If the method could + not write all the submitted samples, it returns an error + and the number of samples successfully written. + """ + self._verify_array_digital_lines(data, True, False) + + auto_start = (self._auto_start if self._auto_start is not + AUTO_START_UNSET else True) + + return _write_digital_lines( + self._handle, data, 1, auto_start, timeout) + + def write_one_sample_port_byte(self, data, timeout=10): + """ + Writes a single 8-bit unsigned integer sample to one or more + digital output channels in a task. + + Use this method for devices with up to 8 lines per port. + + Args: + data (numpy.ndarray): Contains a 1D NumPy array of 8-bit + unsigned integer samples to write to the task. + + Each element in the array corresponds to a channel in + the task. The order of the channels in the array + corresponds to the order in which you add the channels + to the task. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for the method to write all samples. + NI-DAQmx performs a timeout check only if the method + must wait before it writes data. This method returns an + error if the time elapses. The default timeout is 10 + seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to write the submitted samples. If the method could + not write all the submitted samples, it returns an error + and the number of samples successfully written. + """ + self._verify_array(data, True, False) + + auto_start = (self._auto_start if self._auto_start is not + AUTO_START_UNSET else True) + + return _write_digital_u_8( + self._handle, data, 1, auto_start, timeout) + + def write_one_sample_port_uint16(self, data, timeout=10): + """ + Writes a single 16-bit unsigned integer sample to one or more + digital output channels in a task. + + Use this method for devices with up to 16 lines per port. + + Args: + data (numpy.ndarray): Contains a 1D NumPy array of 16-bit + unsigned integer samples to write to the task. + + Each element in the array corresponds to a channel in + the task. The order of the channels in the array + corresponds to the order in which you add the channels + to the task. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for the method to write all samples. + NI-DAQmx performs a timeout check only if the method + must wait before it writes data. This method returns an + error if the time elapses. The default timeout is 10 + seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to write the submitted samples. If the method could + not write all the submitted samples, it returns an error + and the number of samples successfully written. + """ + self._verify_array(data, True, False) + + auto_start = (self._auto_start if self._auto_start is not + AUTO_START_UNSET else True) + + return _write_digital_u_16( + self._handle, data, 1, auto_start, timeout) + + def write_one_sample_port_uint32(self, data, timeout=10): + """ + Writes a single 32-bit unsigned integer sample to one or more + digital output channels in a task. + + Use this method for devices with up to 32 lines per port. + + Args: + data (numpy.ndarray): Contains a 1D NumPy array of 32-bit + unsigned integer samples to write to the task. + + Each element in the array corresponds to a channel in + the task. The order of the channels in the array + corresponds to the order in which you add the channels + to the task. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for the method to write all samples. + NI-DAQmx performs a timeout check only if the method + must wait before it writes data. This method returns an + error if the time elapses. The default timeout is 10 + seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to write the submitted samples. If the method could + not write all the submitted samples, it returns an error + and the number of samples successfully written. + """ + self._verify_array(data, True, False) + + auto_start = (self._auto_start if self._auto_start is not + AUTO_START_UNSET else True) + + return _write_digital_u_32( + self._handle, data, 1, auto_start, timeout) diff --git a/nidaqmx/system/__init__.py b/nidaqmx/system/__init__.py new file mode 100644 index 00000000..48d1c747 --- /dev/null +++ b/nidaqmx/system/__init__.py @@ -0,0 +1,14 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +from nidaqmx.system.system import ( + System, AOPowerUpState, CDAQSyncConnection, DOPowerUpState, + DOResistorPowerUpState) +from nidaqmx.system.device import Device +from nidaqmx.system.physical_channel import PhysicalChannel +from nidaqmx.system.watchdog import ( + WatchdogTask, AOExpirationState, COExpirationState, DOExpirationState) + +__all__ = ['system', 'device', 'physical_channel', 'storage', 'watchdog'] diff --git a/nidaqmx/system/_collections/__init__.py b/nidaqmx/system/_collections/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/nidaqmx/system/_collections/device_collection.py b/nidaqmx/system/_collections/device_collection.py new file mode 100644 index 00000000..5c23ba80 --- /dev/null +++ b/nidaqmx/system/_collections/device_collection.py @@ -0,0 +1,118 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import ctypes +import six +from collections import Sequence + +from nidaqmx._lib import lib_importer, ctypes_byte_str +from nidaqmx.errors import ( + check_for_error, is_string_buffer_too_small, DaqError) +from nidaqmx.error_codes import DAQmxErrors +from nidaqmx.system.device import Device +from nidaqmx.utils import unflatten_channel_string + + +class DeviceCollection(Sequence): + """ + Contains the collection of devices for a DAQmx system. + + This class defines methods that implements a container object. + """ + def __contains__(self, item): + device_names = self.device_names + + if isinstance(item, six.string_types): + items = unflatten_channel_string(item) + return all([i in device_names for i in items]) + elif isinstance(item, Device): + return item.name in device_names + return False + + def __eq__(self, other): + if isinstance(other, self.__class__): + return True + return False + + def __getitem__(self, index): + """ + Indexes a subset of devices on this device collection. + + Args: + index: The value of the index. The following index types are + supported: + - str: Name of the device. You also can specify a string + that contains a list or range of names to this input. + If you have a list of names, use the DAQmx Flatten + Channel String function to convert the list to a + string. + - int: Index/position of the device in the collection. + - slice: Range of the indexes/positions of devices in the + collection. + Returns: + List[nidaqmx.system.device.Device]: + + Indicates the subset of devices indexed. + """ + if isinstance(index, six.integer_types): + return Device(self.device_names[index]) + elif isinstance(index, slice): + return [Device(name) for name in self.device_names[index]] + elif isinstance(index, six.string_types): + device_names = unflatten_channel_string(index) + if len(device_names) == 1: + return Device(device_names[0]) + return [Device(name) for name in device_names] + else: + raise DaqError( + 'Invalid index type "{0}" used to access collection.' + .format(type(index)), DAQmxErrors.UNKNOWN.value) + + def __iter__(self): + for device_name in self.device_names: + yield Device(device_name) + + def __len__(self): + return len(self.device_names) + + def __ne__(self, other): + return not self.__eq__(other) + + def __reversed__(self): + device_names = self.device_names + device_names.reverse() + + for device_name in device_names: + yield Device(device_name) + + @property + def device_names(self): + """ + List[str]: Indicates the names of all devices on this device + collection. + """ + cfunc = lib_importer.windll.DAQmxGetSysDevNames + cfunc.argtypes = [ + ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return unflatten_channel_string(val.value.decode('ascii')) diff --git a/nidaqmx/system/_collections/persisted_channel_collection.py b/nidaqmx/system/_collections/persisted_channel_collection.py new file mode 100644 index 00000000..dfea4f79 --- /dev/null +++ b/nidaqmx/system/_collections/persisted_channel_collection.py @@ -0,0 +1,120 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import ctypes +import six +from collections import Sequence + +from nidaqmx._lib import lib_importer, ctypes_byte_str +from nidaqmx.errors import ( + check_for_error, is_string_buffer_too_small, DaqError) +from nidaqmx.error_codes import DAQmxErrors +from nidaqmx.system.storage.persisted_channel import PersistedChannel +from nidaqmx.utils import unflatten_channel_string + + +class PersistedChannelCollection(Sequence): + """ + Contains the collection of global channels for a DAQmx system. + + This class defines methods that implements a container object. + """ + def __contains__(self, item): + channel_names = self.global_channel_names + + if isinstance(item, six.string_types): + items = unflatten_channel_string(item) + return all([i in channel_names for i in items]) + elif isinstance(item, PersistedChannel): + return item._name in channel_names + + def __eq__(self, other): + if isinstance(other, self.__class__): + return True + return False + + def __getitem__(self, index): + """ + Indexes a subset of global channels on this global channel + collection. + + Args: + index: The value of the index. The following index types + are supported: + - str: Name of the global channel. You also can specify + a string that contains a list or range of names to + this input. If you have a list of names, use the + DAQmx Flatten Channel String function to convert + the list to a string. + - int: Index/position of the global channel in the + collection. + - slice: Range of the indexes/positions of global + channels in the collection. + Returns: + List[nidaqmx.system.storage.persisted_channel.PersistedChannel]: + + Indicates the of global channels indexed. + """ + if isinstance(index, six.integer_types): + return PersistedChannel(self.global_channel_names[index]) + elif isinstance(index, slice): + return [PersistedChannel(name) for name in + self.global_channel_names[index]] + elif isinstance(index, six.string_types): + names = unflatten_channel_string(index) + if len(names) == 1: + return PersistedChannel(names[0]) + return [PersistedChannel(name) for name in names] + else: + raise DaqError( + 'Invalid index type "{0}" used to access collection.' + .format(type(index)), DAQmxErrors.UNKNOWN.value) + + def __iter__(self): + for channel_name in self.global_channel_names: + yield PersistedChannel(channel_name) + + def __len__(self): + return len(self.global_channel_names) + + def __ne__(self, other): + return not self.__eq__(other) + + def __reversed__(self): + channel_names = self.global_channel_names + channel_names.reverse() + + for channel_name in channel_names: + yield PersistedChannel(channel_name) + + @property + def global_channel_names(self): + """ + List[str]: The names of all the global channels on this + collection. + """ + cfunc = lib_importer.windll.DAQmxGetSysGlobalChans + cfunc.argtypes = [ + ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return unflatten_channel_string(val.value.decode('ascii')) diff --git a/nidaqmx/system/_collections/persisted_scale_collection.py b/nidaqmx/system/_collections/persisted_scale_collection.py new file mode 100644 index 00000000..ff245149 --- /dev/null +++ b/nidaqmx/system/_collections/persisted_scale_collection.py @@ -0,0 +1,119 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import ctypes +import six +from collections import Sequence + +from nidaqmx._lib import lib_importer, ctypes_byte_str +from nidaqmx.errors import ( + check_for_error, is_string_buffer_too_small, DaqError) +from nidaqmx.error_codes import DAQmxErrors +from nidaqmx.system.storage.persisted_scale import PersistedScale +from nidaqmx.utils import unflatten_channel_string + + +class PersistedScaleCollection(Sequence): + """ + Contains the collection of custom scales on a DAQmx system. + + This class defines methods that implements a container object. + """ + def __contains__(self, item): + scale_names = self.scale_names + + if isinstance(item, six.string_types): + items = unflatten_channel_string(item) + return all([i in scale_names for i in items]) + elif isinstance(item, PersistedScale): + return item._name in scale_names + + def __eq__(self, other): + if isinstance(other, self.__class__): + return True + return False + + def __getitem__(self, index): + """ + Indexes a subset of custom scales on this collection. + + Args: + index: The value of the index. The following index types + are supported: + - str: Name of the custom scale. You also can specify + a string that contains a list or range of names to + this input. If you have a list of names, use the + DAQmx Flatten Channel String function to convert + the list to a string. + - int: Index/position of the custom scale in the + collection. + - slice: Range of the indexes/positions of custom scales + in the collection. + Returns: + List[nidaqmx.system.storage.persisted_scale.PersistedScale]: + + Indicates the subset of custom scales indexed. + """ + if isinstance(index, six.integer_types): + return PersistedScale(self.scale_names[index]) + elif isinstance(index, slice): + return [PersistedScale(name) for name in + self.scale_names[index]] + elif isinstance(index, six.string_types): + names = unflatten_channel_string(index) + if len(names) == 1: + return PersistedScale(names[0]) + return [PersistedScale(name) for name in names] + else: + raise DaqError( + 'Invalid index type "{0}" used to access collection.' + .format(type(index)), DAQmxErrors.UNKNOWN.value) + + def __iter__(self): + for scale_name in self.scale_names: + yield PersistedScale(scale_name) + + def __len__(self): + return len(self.scale_names) + + def __ne__(self, other): + return not self.__eq__(other) + + def __reversed__(self): + scale_names = self.scale_names + scale_names.reverse() + + for scale_name in scale_names: + yield PersistedScale(scale_name) + + @property + def scale_names(self): + """ + List[str]: Indicates the names of all the custom scales on this + collection. + """ + cfunc = lib_importer.windll.DAQmxGetSysScales + cfunc.argtypes = [ + ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return unflatten_channel_string(val.value.decode('ascii')) diff --git a/nidaqmx/system/_collections/persisted_task_collection.py b/nidaqmx/system/_collections/persisted_task_collection.py new file mode 100644 index 00000000..84e8d1ce --- /dev/null +++ b/nidaqmx/system/_collections/persisted_task_collection.py @@ -0,0 +1,118 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import ctypes +import six +from collections import Sequence + +from nidaqmx._lib import lib_importer, ctypes_byte_str +from nidaqmx.errors import ( + check_for_error, is_string_buffer_too_small, DaqError) +from nidaqmx.error_codes import DAQmxErrors +from nidaqmx.system.storage.persisted_task import PersistedTask +from nidaqmx.utils import unflatten_channel_string + + +class PersistedTaskCollection(Sequence): + """ + Contains the collection of task saved on a DAQmx system. + + This class defines methods that implements a container object. + """ + def __contains__(self, item): + task_names = self.task_names + + if isinstance(item, six.string_types): + items = unflatten_channel_string(item) + return all([i in task_names for i in items]) + elif isinstance(item, PersistedTask): + return item._name in task_names + + def __eq__(self, other): + if isinstance(other, self.__class__): + return True + return False + + def __getitem__(self, index): + """ + Indexes a subset of saved tasks on this collection. + + Args: + index: The value of the index. The following index types + are supported: + - str: Name of the saved task. You also can specify + a string that contains a list or range of names to + this input. If you have a list of names, use the + DAQmx Flatten Channel String function to convert + the list to a string. + - int: Index/position of the saved task in the + collection. + - slice: Range of the indexes/positions of saved tasks + in the collection. + Returns: + List[nidaqmx.system.storage.persisted_task.PersistedTask]: + + Indicates the subset of saved tasks indexed. + """ + if isinstance(index, six.integer_types): + return PersistedTask(self.task_names[index]) + elif isinstance(index, slice): + return [PersistedTask(name) for name in + self.task_names[index]] + elif isinstance(index, six.string_types): + names = unflatten_channel_string(index) + if len(names) == 1: + return PersistedTask(names[0]) + return [PersistedTask(name) for name in names] + else: + raise DaqError( + 'Invalid index type "{0}" used to access collection.' + .format(type(index)), DAQmxErrors.UNKNOWN.value) + + def __iter__(self): + for task_name in self.task_names: + yield PersistedTask(task_name) + + def __len__(self): + return len(self.task_names) + + def __ne__(self, other): + return not self.__eq__(other) + + def __reversed__(self): + task_names = self.task_names + task_names.reverse() + + for task_name in task_names: + yield PersistedTask(task_name) + + @property + def task_names(self): + """ + List[str]: Indicates the names of all the tasks on this collection. + """ + cfunc = lib_importer.windll.DAQmxGetSysTasks + cfunc.argtypes = [ + ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return unflatten_channel_string(val.value.decode('ascii')) diff --git a/nidaqmx/system/_collections/physical_channel_collection.py b/nidaqmx/system/_collections/physical_channel_collection.py new file mode 100644 index 00000000..b6e8849b --- /dev/null +++ b/nidaqmx/system/_collections/physical_channel_collection.py @@ -0,0 +1,384 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import ctypes +import six +from collections import Sequence + +from nidaqmx._lib import lib_importer, ctypes_byte_str +from nidaqmx.errors import ( + check_for_error, is_string_buffer_too_small, DaqError) +from nidaqmx.error_codes import DAQmxErrors +from nidaqmx.system.physical_channel import PhysicalChannel +from nidaqmx.utils import unflatten_channel_string, flatten_channel_string + + +class PhysicalChannelCollection(Sequence): + """ + Contains the collection of physical channels for a DAQmx device. + + This class defines methods that implements a container object. + """ + def __init__(self, device_name): + self._name = device_name + + def __contains__(self, item): + channel_names = self.channel_names + + if isinstance(item, six.string_types): + items = unflatten_channel_string(item) + return all([i in channel_names for i in items]) + elif isinstance(item, PhysicalChannel): + return item._name in channel_names + return False + + def __eq__(self, other): + if isinstance(other, self.__class__): + return self._name == other._name + return False + + def __getitem__(self, index): + """ + Indexes a subset of physical channels on this physical channel + collection. + + Args: + index: The value of the index. The following index types + are supported: + - str: Name of the physical channel, without the + device name prefix, e.g. 'ai0'. You also can + specify a string that contains a list or range of + names to this input. If you have a list of names, + use the DAQmx Flatten Channel String function to + convert the list to a string. + - int: Index/position of the physical channel in the + collection. + - slice: Range of the indexes/positions of physical + channels in the collection. + Returns: + nidaqmx.system.physical_channel.PhysicalChannel: + + Indicates the subset of physical channels indexed. + """ + if isinstance(index, six.integer_types): + return PhysicalChannel(self.channel_names[index]) + elif isinstance(index, slice): + return PhysicalChannel(self.channel_names[index]) + elif isinstance(index, six.string_types): + return PhysicalChannel('{0}/{1}'.format(self._name, index)) + else: + raise DaqError( + 'Invalid index type "{0}" used to access collection.' + .format(type(index)), DAQmxErrors.UNKNOWN.value) + + def __iter__(self): + for channel_name in self.channel_names: + yield PhysicalChannel(channel_name) + + def __len__(self): + return len(self.channel_names) + + def __ne__(self, other): + return not self.__eq__(other) + + def __reversed__(self): + channel_names = self.channel_names + channel_names.reverse() + + for channel_name in channel_names: + yield PhysicalChannel(channel_name) + + @property + def all(self): + """ + nidaqmx.system.physical_channel.PhysicalChannel: Specifies a + physical channel object that represents the entire list of + physical channels on this channel collection. + """ + return PhysicalChannel(flatten_channel_string(self.channel_names)) + + @property + def channel_names(self): + """ + List[str]: Specifies the entire list of physical channels on this + collection. + """ + raise NotImplementedError() + + +class AIPhysicalChannelCollection(PhysicalChannelCollection): + """ + Contains the collection of analog input physical channels for a + DAQmx device. + + This class defines methods that implements a container object. + """ + + @property + def channel_names(self): + cfunc = lib_importer.windll.DAQmxGetDevAIPhysicalChans + cfunc.argtypes = [ + ctypes_byte_str, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return unflatten_channel_string(val.value.decode('ascii')) + + +class AOPhysicalChannelCollection(PhysicalChannelCollection): + """ + Contains the collection of analog output physical channels for a + DAQmx device. + + This class defines methods that implements a container object. + """ + + @property + def channel_names(self): + cfunc = lib_importer.windll.DAQmxGetDevAOPhysicalChans + cfunc.argtypes = [ + ctypes_byte_str, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return unflatten_channel_string(val.value.decode('ascii')) + + +class CIPhysicalChannelCollection(PhysicalChannelCollection): + """ + Contains the collection of counter input physical channels for a + DAQmx device. + + This class defines methods that implements a container object. + """ + + @property + def channel_names(self): + cfunc = lib_importer.windll.DAQmxGetDevCIPhysicalChans + cfunc.argtypes = [ + ctypes_byte_str, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return unflatten_channel_string(val.value.decode('ascii')) + + +class COPhysicalChannelCollection(PhysicalChannelCollection): + """ + Contains the collection of counter output physical channels for a + DAQmx device. + + This class defines methods that implements a container object. + """ + + @property + def channel_names(self): + cfunc = lib_importer.windll.DAQmxGetDevCOPhysicalChans + cfunc.argtypes = [ + ctypes_byte_str, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return unflatten_channel_string(val.value.decode('ascii')) + + +class DILinesCollection(PhysicalChannelCollection): + """ + Contains the collection of digital input lines for a DAQmx device. + + This class defines methods that implements a container object. + """ + + @property + def channel_names(self): + cfunc = lib_importer.windll.DAQmxGetDevDILines + cfunc.argtypes = [ + ctypes_byte_str, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return unflatten_channel_string(val.value.decode('ascii')) + + +class DOLinesCollection(PhysicalChannelCollection): + """ + Contains the collection of digital output lines for a DAQmx device. + + This class defines methods that implements a container object. + """ + + @property + def channel_names(self): + cfunc = lib_importer.windll.DAQmxGetDevDOLines + cfunc.argtypes = [ + ctypes_byte_str, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return unflatten_channel_string(val.value.decode('ascii')) + + +class DIPortsCollection(PhysicalChannelCollection): + """ + Contains the collection of digital input ports for a DAQmx device. + + This class defines methods that implements a container object. + """ + + @property + def channel_names(self): + cfunc = lib_importer.windll.DAQmxGetDevDIPorts + cfunc.argtypes = [ + ctypes_byte_str, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return unflatten_channel_string(val.value.decode('ascii')) + + +class DOPortsCollection(PhysicalChannelCollection): + """ + Contains the collection of digital output ports for a DAQmx device. + + This class defines methods that implements a container object. + """ + + @property + def channel_names(self): + cfunc = lib_importer.windll.DAQmxGetDevDOPorts + cfunc.argtypes = [ + ctypes_byte_str, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return unflatten_channel_string(val.value.decode('ascii')) diff --git a/nidaqmx/system/_watchdog_modules/__init__.py b/nidaqmx/system/_watchdog_modules/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/nidaqmx/system/_watchdog_modules/expiration_state.py b/nidaqmx/system/_watchdog_modules/expiration_state.py new file mode 100644 index 00000000..8f7576f7 --- /dev/null +++ b/nidaqmx/system/_watchdog_modules/expiration_state.py @@ -0,0 +1,197 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import ctypes + +from nidaqmx._lib import lib_importer, ctypes_byte_str +from nidaqmx.errors import ( + check_for_error, is_string_buffer_too_small, is_array_buffer_too_small) +from nidaqmx.constants import ( + Level, WatchdogAOExpirState, WatchdogCOExpirState) + + +class ExpirationState(object): + """ + Represents a DAQmx Watchdog expiration state. + """ + def __init__(self, task_handle, physical_channel): + self._handle = task_handle + self._physical_channel = physical_channel + + def __eq__(self, other): + if isinstance(other, self.__class__): + return (self._handle == other._handle and + self._physical_channel == other._physical_channel) + return False + + def __hash__(self): + return hash((self._handle.value, self._physical_channel)) + + def __ne__(self, other): + return not self.__eq__(other) + + @property + def expir_states_ao_state(self): + """ + float: Specifies the state to set the analog output physical + channels when the watchdog task expires. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetWatchdogAOExpirState + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, self._physical_channel, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @expir_states_ao_state.setter + def expir_states_ao_state(self, val): + cfunc = lib_importer.windll.DAQmxSetWatchdogAOExpirState + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + self._handle, self._physical_channel, val) + check_for_error(error_code) + + @expir_states_ao_state.deleter + def expir_states_ao_state(self): + cfunc = lib_importer.windll.DAQmxResetWatchdogAOExpirState + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._physical_channel) + check_for_error(error_code) + + @property + def expir_states_ao_type(self): + """ + :class:`nidaqmx.constants.WatchdogAOExpirState`: Specifies the + output type of the analog output physical channels when the + watchdog task expires. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetWatchdogAOOutputType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._physical_channel, ctypes.byref(val)) + check_for_error(error_code) + + return WatchdogAOExpirState(val.value) + + @expir_states_ao_type.setter + def expir_states_ao_type(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetWatchdogAOOutputType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._physical_channel, val) + check_for_error(error_code) + + @expir_states_ao_type.deleter + def expir_states_ao_type(self): + cfunc = lib_importer.windll.DAQmxResetWatchdogAOOutputType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._physical_channel) + check_for_error(error_code) + + @property + def expir_states_co_state(self): + """ + :class:`nidaqmx.constants.WatchdogCOExpirState`: Specifies the + state to set the counter output channel terminal when the + watchdog task expires. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetWatchdogCOExpirState + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._physical_channel, ctypes.byref(val)) + check_for_error(error_code) + + return WatchdogCOExpirState(val.value) + + @expir_states_co_state.setter + def expir_states_co_state(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetWatchdogCOExpirState + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._physical_channel, val) + check_for_error(error_code) + + @expir_states_co_state.deleter + def expir_states_co_state(self): + cfunc = lib_importer.windll.DAQmxResetWatchdogCOExpirState + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._physical_channel) + check_for_error(error_code) + + @property + def expir_states_do_state(self): + """ + :class:`nidaqmx.constants.Level`: Specifies the state to which + to set the digital physical channels when the watchdog task + expires. You cannot modify the expiration state of + dedicated digital input physical channels. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetWatchdogDOExpirState + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, self._physical_channel, ctypes.byref(val)) + check_for_error(error_code) + + return Level(val.value) + + @expir_states_do_state.setter + def expir_states_do_state(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetWatchdogDOExpirState + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._handle, self._physical_channel, val) + check_for_error(error_code) + + @expir_states_do_state.deleter + def expir_states_do_state(self): + cfunc = lib_importer.windll.DAQmxResetWatchdogDOExpirState + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, self._physical_channel) + check_for_error(error_code) + diff --git a/nidaqmx/system/_watchdog_modules/expiration_states_collection.py b/nidaqmx/system/_watchdog_modules/expiration_states_collection.py new file mode 100644 index 00000000..1c2c2319 --- /dev/null +++ b/nidaqmx/system/_watchdog_modules/expiration_states_collection.py @@ -0,0 +1,49 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import six + +from nidaqmx.errors import DaqError +from nidaqmx.system._watchdog_modules.expiration_state import ExpirationState + + +class ExpirationStatesCollection(object): + """ + Contains the collection of expiration states for a DAQmx Watchdog Task. + + This class defines methods that implements a container object. + """ + def __init__(self, task_handle): + self._handle = task_handle + + def __eq__(self, other): + if isinstance(other, self.__class__): + return self._handle == other._handle + return False + + def __hash__(self): + return hash(self._handle.value) + + def __ne__(self, other): + return not self.__eq__(other) + + def __getitem__(self, index): + """ + Indexes an expiration state on this collection. + + Args: + index (str): Name of the physical channel of which the + expiration state to retrieve. + Returns: + nidaqmx.system._watchdog_modules.expiration_state.ExpirationState: + + The object representing the indexed expiration state. + """ + if isinstance(index, six.string_types): + return ExpirationState(self._handle, index) + else: + raise DaqError( + 'Invalid index type "{0}" used to access expiration states.' + .format(type(index)), -1) diff --git a/nidaqmx/system/device.py b/nidaqmx/system/device.py new file mode 100644 index 00000000..1f1abd03 --- /dev/null +++ b/nidaqmx/system/device.py @@ -0,0 +1,2097 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import ctypes +import numpy + +from nidaqmx._lib import ( + lib_importer, wrapped_ndpointer, enum_bitfield_to_list, ctypes_byte_str, + c_bool32) +from nidaqmx.errors import ( + check_for_error, is_string_buffer_too_small, is_array_buffer_too_small) +from nidaqmx.utils import unflatten_channel_string +from nidaqmx.system._collections.physical_channel_collection import ( + AIPhysicalChannelCollection, AOPhysicalChannelCollection, + CIPhysicalChannelCollection, COPhysicalChannelCollection, + DILinesCollection, DIPortsCollection, DOLinesCollection, DOPortsCollection) +from nidaqmx.constants import ( + AcquisitionType, BusType, Coupling, FilterType, ProductCategory, + TriggerUsage, UsageTypeAI, UsageTypeAO, UsageTypeCI, UsageTypeCO, + _CouplingTypes, _TriggerUsageTypes) + +__all__ = ['Device'] + + +class Device(object): + """ + Represents a DAQmx device. + """ + __slots__ = ['_name', '__weakref__'] + + def __init__(self, name): + """ + Args: + name (str): Specifies the name of the device. + """ + self._name = name + + def __eq__(self, other): + if isinstance(other, self.__class__): + return self._name == other._name + return False + + def __hash__(self): + return hash(self._name) + + def __ne__(self, other): + return not self.__eq__(other) + + def __repr__(self): + return 'Device(name={0})'.format(self._name) + + @property + def name(self): + """ + str: Specifies the name of this device. + """ + return self._name + + # region Physical Channel Collections + + @property + def ai_physical_chans(self): + """ + List[nidaqmx.system._collections.PhysicalChannelCollection]: + Indicates a collection that contains all the analog input + physical channels available on the device. + """ + return AIPhysicalChannelCollection(self._name) + + @property + def ao_physical_chans(self): + """ + List[nidaqmx.system._collections.PhysicalChannelCollection]: + Indicates a collection that contains all the analog output + physical channels available on the device. + """ + return AOPhysicalChannelCollection(self._name) + + @property + def ci_physical_chans(self): + """ + List[nidaqmx.system._collections.PhysicalChannelCollection]: + Indicates a collection that contains all the counter input + physical channels available on the device. + """ + return CIPhysicalChannelCollection(self._name) + + @property + def co_physical_chans(self): + """ + List[nidaqmx.system._collections.PhysicalChannelCollection]: + Indicates a collection that contains all the counter output + physical channels available on the device. + """ + return COPhysicalChannelCollection(self._name) + + @property + def di_lines(self): + """ + List[nidaqmx.system._collections.PhysicalChannelCollection]: + Indicates a collection that contains all the digital input + lines available on the device. + """ + return DILinesCollection(self._name) + + @property + def di_ports(self): + """ + List[nidaqmx.system._collections.PhysicalChannelCollection]: + Indicates a collection that contains all the digital input + ports available on the device. + """ + return DIPortsCollection(self._name) + + @property + def do_lines(self): + """ + List[nidaqmx.system._collections.PhysicalChannelCollection]: + Indicates a collection that contains all the digital output + lines available on the device. + """ + return DOLinesCollection(self._name) + + @property + def do_ports(self): + """ + List[nidaqmx.system._collections.PhysicalChannelCollection]: + Indicates a collection that contains all the digital output + ports available on the device. + """ + return DOPortsCollection(self._name) + + # endregion + + @property + def accessory_product_nums(self): + """ + List[int]: Indicates the unique hardware identification number + for accessories connected to the device. Each list element + corresponds to a connector. For example, index 0 corresponds + to connector 0. The list contains 0 for each connector with + no accessory connected. + """ + cfunc = lib_importer.windll.DAQmxGetDevAccessoryProductNums + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.uint32, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.uint32) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.tolist() + + @property + def accessory_product_types(self): + """ + List[str]: Indicates the model names of accessories connected to + the device. Each list element corresponds to a connector. + For example, index 0 corresponds to connector 0. The list + contains an empty string for each connector with no + accessory connected. + """ + cfunc = lib_importer.windll.DAQmxGetDevAccessoryProductTypes + cfunc.argtypes = [ + ctypes_byte_str, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return unflatten_channel_string(val.value.decode('ascii')) + + @property + def accessory_serial_nums(self): + """ + List[int]: Indicates the serial number for accessories connected + to the device. Each list element corresponds to a connector. + For example, index 0 corresponds to connector 0. The list + contains 0 for each connector with no accessory connected. + """ + cfunc = lib_importer.windll.DAQmxGetDevAccessorySerialNums + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.uint32, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.uint32) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.tolist() + + @property + def ai_bridge_rngs(self): + """ + List[float]: Indicates pairs of input voltage ratio ranges, in + volts per volt, supported by devices that acquire using + ratiometric measurements. Each pair consists of the low + value followed by the high value. + """ + cfunc = lib_importer.windll.DAQmxGetDevAIBridgeRngs + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.float64, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.float64) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.tolist() + + @property + def ai_charge_rngs(self): + """ + List[float]: Indicates in coulombs pairs of input charge ranges + for the device. Each pair consists of the low value followed + by the high value. + """ + cfunc = lib_importer.windll.DAQmxGetDevAIChargeRngs + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.float64, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.float64) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.tolist() + + @property + def ai_couplings(self): + """ + List[:class:`nidaqmx.constants.Coupling`]: Indicates the + coupling types supported by this device. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetDevAICouplings + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return enum_bitfield_to_list( + val.value, _CouplingTypes, Coupling) + + @property + def ai_current_int_excit_discrete_vals(self): + """ + List[float]: Indicates the set of discrete internal current + excitation values supported by this device. + """ + cfunc = lib_importer.windll.DAQmxGetDevAICurrentIntExcitDiscreteVals + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.float64, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.float64) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.tolist() + + @property + def ai_current_rngs(self): + """ + List[float]: Indicates the pairs of current input ranges + supported by this device. Each pair consists of the low + value, followed by the high value. + """ + cfunc = lib_importer.windll.DAQmxGetDevAICurrentRngs + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.float64, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.float64) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.tolist() + + @property + def ai_dig_fltr_lowpass_cutoff_freq_discrete_vals(self): + """ + List[float]: Indicates the set of discrete lowpass cutoff + frequencies supported by this device. If the device supports + ranges of lowpass cutoff frequencies, use + AI.DigFltr.Lowpass.CutoffFreq.RangeVals to determine + supported frequencies. + """ + cfunc = (lib_importer.windll. + DAQmxGetDevAIDigFltrLowpassCutoffFreqDiscreteVals) + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.float64, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.float64) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.tolist() + + @property + def ai_dig_fltr_lowpass_cutoff_freq_range_vals(self): + """ + List[float]: Indicates pairs of lowpass cutoff frequency ranges + supported by this device. Each pair consists of the low + value, followed by the high value. If the device supports a + set of discrete lowpass cutoff frequencies, use + AI.DigFltr.Lowpass.CutoffFreq.DiscreteVals to determine the + supported frequencies. + """ + cfunc = (lib_importer.windll. + DAQmxGetDevAIDigFltrLowpassCutoffFreqRangeVals) + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.float64, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.float64) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.tolist() + + @property + def ai_dig_fltr_types(self): + """ + List[:class:`nidaqmx.constants.FilterType`]: Indicates the AI + digital filter types supported by the device. + """ + cfunc = lib_importer.windll.DAQmxGetDevAIDigFltrTypes + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.int32, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.int32) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return [FilterType(e) for e in val] + + @property + def ai_freq_rngs(self): + """ + List[float]: Indicates the pairs of frequency input ranges + supported by this device. Each pair consists of the low + value, followed by the high value. + """ + cfunc = lib_importer.windll.DAQmxGetDevAIFreqRngs + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.float64, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.float64) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.tolist() + + @property + def ai_gains(self): + """ + List[float]: Indicates the input gain settings supported by this + device. + """ + cfunc = lib_importer.windll.DAQmxGetDevAIGains + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.float64, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.float64) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.tolist() + + @property + def ai_lowpass_cutoff_freq_discrete_vals(self): + """ + List[float]: Indicates the set of discrete lowpass cutoff + frequencies supported by this device. If the device supports + ranges of lowpass cutoff frequencies, use + **ai_lowpass_cutoff_freq_range_vals** to determine supported + frequencies. + """ + cfunc = (lib_importer.windll. + DAQmxGetDevAILowpassCutoffFreqDiscreteVals) + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.float64, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.float64) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.tolist() + + @property + def ai_lowpass_cutoff_freq_range_vals(self): + """ + List[float]: Indicates pairs of lowpass cutoff frequency ranges + supported by this device. Each pair consists of the low + value, followed by the high value. If the device supports a + set of discrete lowpass cutoff frequencies, use + **ai_lowpass_cutoff_freq_discrete_vals** to determine the + supported frequencies. + """ + cfunc = lib_importer.windll.DAQmxGetDevAILowpassCutoffFreqRangeVals + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.float64, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.float64) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.tolist() + + @property + def ai_max_multi_chan_rate(self): + """ + float: Indicates the maximum sampling rate for an analog input + task from this device. To find the maximum rate for the + task, take the minimum of **ai_max_single_chan_rate** or the + indicated sampling rate of this device divided by the number + of channels to acquire data from (including cold-junction + compensation and autozero channels). + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetDevAIMaxMultiChanRate + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def ai_max_single_chan_rate(self): + """ + float: Indicates the maximum rate for an analog input task if + the task contains only a single channel from this device. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetDevAIMaxSingleChanRate + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def ai_meas_types(self): + """ + List[:class:`nidaqmx.constants.UsageTypeAI`]: Indicates the + measurement types supported by the physical channels of the + device. Refer to **ai_meas_types** for information on + specific channels. + """ + cfunc = lib_importer.windll.DAQmxGetDevAISupportedMeasTypes + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.int32, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.int32) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return [UsageTypeAI(e) for e in val] + + @property + def ai_min_rate(self): + """ + float: Indicates the minimum rate for an analog input task on + this device. NI-DAQmx returns a warning or error if you + attempt to sample at a slower rate. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetDevAIMinRate + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def ai_resistance_rngs(self): + """ + List[float]: Indicates pairs of input resistance ranges, in + ohms, supported by devices that have the necessary signal + conditioning to measure resistances. Each pair consists of + the low value followed by the high value. + """ + cfunc = lib_importer.windll.DAQmxGetDevAIResistanceRngs + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.float64, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.float64) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.tolist() + + @property + def ai_samp_modes(self): + """ + List[:class:`nidaqmx.constants.AcquisitionType`]: Indicates + sample modes supported by devices that support sample + clocked analog input. + """ + cfunc = lib_importer.windll.DAQmxGetDevAISampModes + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.int32, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.int32) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return [AcquisitionType(e) for e in val] + + @property + def ai_simultaneous_sampling_supported(self): + """ + bool: Indicates if the device supports simultaneous sampling. + """ + val = ctypes.c_bool() + + cfunc = (lib_importer.windll. + DAQmxGetDevAISimultaneousSamplingSupported) + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def ai_trig_usage(self): + """ + List[:class:`nidaqmx.constants.TriggerUsage`]: Indicates the + triggers supported by this device for an analog input task. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetDevAITrigUsage + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return enum_bitfield_to_list( + val.value, _TriggerUsageTypes, TriggerUsage) + + @property + def ai_voltage_int_excit_discrete_vals(self): + """ + List[float]: Indicates the set of discrete internal voltage + excitation values supported by this device. If the device + supports ranges of internal excitation values, use + **ai_voltage_int_excit_range_vals** to determine supported + excitation values. + """ + cfunc = lib_importer.windll.DAQmxGetDevAIVoltageIntExcitDiscreteVals + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.float64, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.float64) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.tolist() + + @property + def ai_voltage_int_excit_range_vals(self): + """ + List[float]: Indicates pairs of internal voltage excitation + ranges supported by this device. Each pair consists of the + low value, followed by the high value. If the device + supports a set of discrete internal excitation values, use + **ai_voltage_int_excit_discrete_vals** to determine the + supported excitation values. + """ + cfunc = lib_importer.windll.DAQmxGetDevAIVoltageIntExcitRangeVals + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.float64, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.float64) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.tolist() + + @property + def ai_voltage_rngs(self): + """ + List[float]: Indicates pairs of input voltage ranges supported + by this device. Each pair consists of the low value, + followed by the high value. + """ + cfunc = lib_importer.windll.DAQmxGetDevAIVoltageRngs + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.float64, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.float64) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.tolist() + + @property + def anlg_trig_supported(self): + """ + bool: Indicates if the device supports analog triggering. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetDevAnlgTrigSupported + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def ao_current_rngs(self): + """ + List[float]: Indicates pairs of output current ranges supported + by this device. Each pair consists of the low value, + followed by the high value. + """ + cfunc = lib_importer.windll.DAQmxGetDevAOCurrentRngs + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.float64, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.float64) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.tolist() + + @property + def ao_gains(self): + """ + List[float]: Indicates the output gain settings supported by + this device. + """ + cfunc = lib_importer.windll.DAQmxGetDevAOGains + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.float64, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.float64) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.tolist() + + @property + def ao_max_rate(self): + """ + float: Indicates the maximum analog output rate of the device. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetDevAOMaxRate + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def ao_min_rate(self): + """ + float: Indicates the minimum analog output rate of the device. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetDevAOMinRate + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def ao_output_types(self): + """ + List[:class:`nidaqmx.constants.UsageTypeAO`]: Indicates the + generation types supported by the physical channels of the + device. Refer to **ao_output_types** for information on + specific channels. + """ + cfunc = lib_importer.windll.DAQmxGetDevAOSupportedOutputTypes + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.int32, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.int32) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return [UsageTypeAO(e) for e in val] + + @property + def ao_samp_clk_supported(self): + """ + bool: Indicates if the device supports the sample clock timing + type for analog output tasks. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetDevAOSampClkSupported + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def ao_samp_modes(self): + """ + List[:class:`nidaqmx.constants.AcquisitionType`]: Indicates + sample modes supported by devices that support sample + clocked analog output. + """ + cfunc = lib_importer.windll.DAQmxGetDevAOSampModes + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.int32, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.int32) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return [AcquisitionType(e) for e in val] + + @property + def ao_trig_usage(self): + """ + List[:class:`nidaqmx.constants.TriggerUsage`]: Indicates the + triggers supported by this device for analog output tasks. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetDevAOTrigUsage + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return enum_bitfield_to_list( + val.value, _TriggerUsageTypes, TriggerUsage) + + @property + def ao_voltage_rngs(self): + """ + List[float]: Indicates pairs of output voltage ranges supported + by this device. Each pair consists of the low value, + followed by the high value. + """ + cfunc = lib_importer.windll.DAQmxGetDevAOVoltageRngs + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.float64, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.float64) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.tolist() + + @property + def bus_type(self): + """ + :class:`nidaqmx.constants.BusType`: Indicates the bus type of + the device. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetDevBusType + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return BusType(val.value) + + @property + def carrier_serial_num(self): + """ + int: Indicates the serial number of the device carrier. This + value is zero if the carrier does not have a serial number. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetCarrierSerialNum + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def chassis_module_devices(self): + """ + List[:class:`nidaqmx.system.device.Device`]: Indicates a list + containing the names of the modules in the chassis. + """ + cfunc = lib_importer.windll.DAQmxGetDevChassisModuleDevNames + cfunc.argtypes = [ + ctypes_byte_str, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return [Device(v) + for v in unflatten_channel_string(val.value.decode('ascii'))] + + @property + def ci_max_size(self): + """ + int: Indicates in bits the size of the counters on the device. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetDevCIMaxSize + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def ci_max_timebase(self): + """ + float: Indicates in hertz the maximum counter timebase + frequency. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetDevCIMaxTimebase + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def ci_meas_types(self): + """ + List[:class:`nidaqmx.constants.UsageTypeCI`]: Indicates the + measurement types supported by the physical channels of the + device. Refer to **ci_meas_types** for information on + specific channels. + """ + cfunc = lib_importer.windll.DAQmxGetDevCISupportedMeasTypes + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.int32, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.int32) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return [UsageTypeCI(e) for e in val] + + @property + def ci_samp_clk_supported(self): + """ + bool: Indicates if the device supports the sample clock timing + type for counter input tasks. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetDevCISampClkSupported + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def ci_samp_modes(self): + """ + List[:class:`nidaqmx.constants.AcquisitionType`]: Indicates + sample modes supported by devices that support sample + clocked counter input. + """ + cfunc = lib_importer.windll.DAQmxGetDevCISampModes + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.int32, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.int32) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return [AcquisitionType(e) for e in val] + + @property + def ci_trig_usage(self): + """ + List[:class:`nidaqmx.constants.TriggerUsage`]: Indicates the + triggers supported by this device for counter input tasks. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetDevCITrigUsage + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return enum_bitfield_to_list( + val.value, _TriggerUsageTypes, TriggerUsage) + + @property + def co_max_size(self): + """ + int: Indicates in bits the size of the counters on the device. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetDevCOMaxSize + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def co_max_timebase(self): + """ + float: Indicates in hertz the maximum counter timebase + frequency. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetDevCOMaxTimebase + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def co_output_types(self): + """ + List[:class:`nidaqmx.constants.UsageTypeCO`]: Indicates the + generation types supported by the physical channels of the + device. Refer to **co_output_types** for information on + specific channels. + """ + cfunc = lib_importer.windll.DAQmxGetDevCOSupportedOutputTypes + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.int32, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.int32) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return [UsageTypeCO(e) for e in val] + + @property + def co_samp_clk_supported(self): + """ + bool: Indicates if the device supports Sample Clock timing for + counter output tasks. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetDevCOSampClkSupported + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def co_samp_modes(self): + """ + List[:class:`nidaqmx.constants.AcquisitionType`]: Indicates + sample modes supported by devices that support sample + clocked counter output. + """ + cfunc = lib_importer.windll.DAQmxGetDevCOSampModes + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.int32, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.int32) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return [AcquisitionType(e) for e in val] + + @property + def co_trig_usage(self): + """ + List[:class:`nidaqmx.constants.TriggerUsage`]: Indicates the + triggers supported by this device for counter output tasks. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetDevCOTrigUsage + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return enum_bitfield_to_list( + val.value, _TriggerUsageTypes, TriggerUsage) + + @property + def compact_daq_chassis_device(self): + """ + :class:`nidaqmx.system.device.Device`: Indicates the name of the + CompactDAQ chassis that contains this module. + """ + cfunc = lib_importer.windll.DAQmxGetDevCompactDAQChassisDevName + cfunc.argtypes = [ + ctypes_byte_str, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return Device(val.value.decode('ascii')) + + @property + def compact_daq_slot_num(self): + """ + int: Indicates the slot number in which this module is located + in the CompactDAQ chassis. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetDevCompactDAQSlotNum + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def dev_is_simulated(self): + """ + bool: Indicates if the device is a simulated device. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetDevIsSimulated + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def dev_serial_num(self): + """ + int: Indicates the serial number of the device. This value is + zero if the device does not have a serial number. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetDevSerialNum + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def di_max_rate(self): + """ + float: Indicates the maximum digital input rate of the device. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetDevDIMaxRate + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def di_trig_usage(self): + """ + List[:class:`nidaqmx.constants.TriggerUsage`]: Indicates the + triggers supported by this device for digital input tasks. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetDevDITrigUsage + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return enum_bitfield_to_list( + val.value, _TriggerUsageTypes, TriggerUsage) + + @property + def dig_trig_supported(self): + """ + bool: Indicates if the device supports digital triggering. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetDevDigTrigSupported + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def do_max_rate(self): + """ + float: Indicates the maximum digital output rate of the device. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetDevDOMaxRate + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def do_trig_usage(self): + """ + List[:class:`nidaqmx.constants.TriggerUsage`]: Indicates the + triggers supported by this device for digital output tasks. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetDevDOTrigUsage + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return enum_bitfield_to_list( + val.value, _TriggerUsageTypes, TriggerUsage) + + @property + def num_dma_chans(self): + """ + int: Indicates the number of DMA channels on the device. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetDevNumDMAChans + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def pci_bus_num(self): + """ + int: Indicates the PCI bus number of the device. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetDevPCIBusNum + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def pci_dev_num(self): + """ + int: Indicates the PCI slot number of the device. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetDevPCIDevNum + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def product_category(self): + """ + :class:`nidaqmx.constants.ProductCategory`: Indicates the + product category of the device. This category corresponds to + the category displayed in MAX when creating NI-DAQmx + simulated devices. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetDevProductCategory + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return ProductCategory(val.value) + + @property + def product_num(self): + """ + int: Indicates the unique hardware identification number for the + device. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetDevProductNum + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def product_type(self): + """ + str: Indicates the product name of the device. + """ + cfunc = lib_importer.windll.DAQmxGetDevProductType + cfunc.argtypes = [ + ctypes_byte_str, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @property + def pxi_chassis_num(self): + """ + int: Indicates the PXI chassis number of the device, as + identified in MAX. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetDevPXIChassisNum + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def pxi_slot_num(self): + """ + int: Indicates the PXI slot number of the device. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetDevPXISlotNum + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def tcpip_ethernet_ip(self): + """ + str: Indicates the IPv4 address of the Ethernet interface in + dotted decimal format. This property returns 0.0.0.0 if the + Ethernet interface cannot acquire an address. + """ + cfunc = lib_importer.windll.DAQmxGetDevTCPIPEthernetIP + cfunc.argtypes = [ + ctypes_byte_str, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @property + def tcpip_hostname(self): + """ + str: Indicates the IPv4 hostname of the device. + """ + cfunc = lib_importer.windll.DAQmxGetDevTCPIPHostname + cfunc.argtypes = [ + ctypes_byte_str, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @property + def tcpip_wireless_ip(self): + """ + str: Indicates the IPv4 address of the 802.11 wireless interface + in dotted decimal format. This property returns 0.0.0.0 if + the wireless interface cannot acquire an address. + """ + cfunc = lib_importer.windll.DAQmxGetDevTCPIPWirelessIP + cfunc.argtypes = [ + ctypes_byte_str, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @property + def tedshwteds_supported(self): + """ + bool: Indicates whether the device supports hardware TEDS. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetDevTEDSHWTEDSSupported + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def terminals(self): + """ + List[str]: Indicates a list of all terminals on the device. + """ + cfunc = lib_importer.windll.DAQmxGetDevTerminals + cfunc.argtypes = [ + ctypes_byte_str, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return unflatten_channel_string(val.value.decode('ascii')) + + def reset_device(self): + """ + Immediately aborts all active tasks associated with a device, + disconnects any routes, and returns the device to an initialized + state. Aborting a task immediately terminates the currently + active operation, such as a read or a write. Aborting a task + puts the task into an unstable but recoverable state. To recover + the task, use DAQmx Start to restart the task or use DAQmx Stop + to reset the task without starting it. + """ + cfunc = lib_importer.windll.DAQmxResetDevice + cfunc.argtypes = [ + ctypes_byte_str] + + error_code = cfunc( + self._name) + check_for_error(error_code) + + def self_test_device(self): + """ + Performs a brief test of device resources. If a failure occurs, + refer to your device documentation for more information. + """ + cfunc = lib_importer.windll.DAQmxSelfTestDevice + cfunc.argtypes = [ + ctypes_byte_str] + + error_code = cfunc( + self._name) + check_for_error(error_code) + + # region Network Device Functions + + @staticmethod + def add_network_device( + ip_address, device_name="", attempt_reservation=False, + timeout=10.0): + """ + Adds a Network cDAQ device to the system and, if specified, + attempts to reserve it. + + Args: + ip_address (str): Specifies the string containing the IP + address (in dotted decimal notation) or hostname of the + device to add to the system. + device_name (Optional[str]): Indicates the name to assign to + the device. If unspecified, NI-DAQmx chooses the device + name. + attempt_reservation (Optional[bool]): Indicates if a + reservation should be attempted after the device is + successfully added. By default, this parameter is set to + False. + timeout (Optional[float]): Specifies the time in seconds to + wait for the device to respond before timing out. + Returns: + nidaqmx.system.device.Device: + + Specifies the object that represents the device this + operation applied to. + """ + cfunc = lib_importer.windll.DAQmxAddNetworkDevice + cfunc.argtypes = [ + ctypes_byte_str, ctypes_byte_str, c_bool32, ctypes.c_double, + ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + device_name_out = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + ip_address, device_name, attempt_reservation, timeout, + device_name_out, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return Device(device_name_out.value.decode('ascii')) + + def delete_network_device(self): + """ + Deletes a Network DAQ device previously added to the host. If + the device is reserved, it is unreserved before it is removed. + """ + cfunc = lib_importer.windll.DAQmxDeleteNetworkDevice + cfunc.argtypes = [ + ctypes_byte_str] + + error_code = cfunc( + self._name) + check_for_error(error_code) + + def reserve_network_device(self, override_reservation=None): + """ + Reserves the Network DAQ device for the current host. + Reservation is required to run NI-DAQmx tasks, and the device + must be added in MAX before it can be reserved. + + Args: + override_reservation (Optional[bool]): Indicates if an + existing reservation on the device should be overridden + by this reservation. By default, this parameter is set + to false. + """ + cfunc = lib_importer.windll.DAQmxReserveNetworkDevice + cfunc.argtypes = [ + ctypes_byte_str, c_bool32] + + error_code = cfunc( + self._name, override_reservation) + check_for_error(error_code) + + def unreserve_network_device(self): + """ + Unreserves or releases a Network DAQ device previously reserved + by the host. + """ + cfunc = lib_importer.windll.DAQmxUnreserveNetworkDevice + cfunc.argtypes = [ + ctypes_byte_str] + + error_code = cfunc( + self._name) + check_for_error(error_code) + + # endregion diff --git a/nidaqmx/system/physical_channel.py b/nidaqmx/system/physical_channel.py new file mode 100644 index 00000000..d18baaaf --- /dev/null +++ b/nidaqmx/system/physical_channel.py @@ -0,0 +1,906 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import ctypes +import numpy + +from nidaqmx._lib import ( + lib_importer, wrapped_ndpointer, enum_bitfield_to_list, ctypes_byte_str) +from nidaqmx.errors import ( + check_for_error, is_string_buffer_too_small, is_array_buffer_too_small) +from nidaqmx.utils import unflatten_channel_string +from nidaqmx.constants import ( + AOPowerUpOutputBehavior, AcquisitionType, TerminalConfiguration, + UsageTypeAI, UsageTypeAO, UsageTypeCI, UsageTypeCO, WriteBasicTEDSOptions, + _TermCfg) + +__all__ = ['PhysicalChannel'] + + +class PhysicalChannel(object): + """ + Represents a DAQmx physical channel. + """ + __slots__ = ['_name', '__weakref__'] + + def __init__(self, name): + """ + Args: + name (str): Specifies the name of the physical channel. + """ + self._name = name + + def __eq__(self, other): + if isinstance(other, self.__class__): + return self._name == other._name + return False + + def __hash__(self): + return hash(self._name) + + def __ne__(self, other): + return not self.__eq__(other) + + def __repr__(self): + return 'PhysicalChannel(name={0})'.format(self._name) + + @property + def name(self): + """ + str: Specifies the name of this physical channel. + """ + return self._name + + @property + def ai_input_srcs(self): + """ + List[str]: Indicates the list of input sources supported by the + channel. Channels may support using the signal from the I/O + connector or one of several calibration signals. + """ + cfunc = lib_importer.windll.DAQmxGetPhysicalChanAIInputSrcs + cfunc.argtypes = [ + ctypes_byte_str, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return unflatten_channel_string(val.value.decode('ascii')) + + @property + def ai_meas_types(self): + """ + List[:class:`nidaqmx.constants.UsageTypeAI`]: Indicates the + measurement types supported by the channel. + """ + cfunc = lib_importer.windll.DAQmxGetPhysicalChanAISupportedMeasTypes + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.int32, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.int32) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return [UsageTypeAI(e) for e in val] + + @property + def ai_term_cfgs(self): + """ + List[:class:`nidaqmx.constants.TerminalConfiguration`]: + Indicates the list of terminal configurations supported by + the channel. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetPhysicalChanAITermCfgs + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return enum_bitfield_to_list( + val.value, _TermCfg, TerminalConfiguration) + + @property + def ao_manual_control_amplitude(self): + """ + float: Indicates the current value of the front panel amplitude + control for the physical channel in volts. + """ + val = ctypes.c_double() + + cfunc = (lib_importer.windll. + DAQmxGetPhysicalChanAOManualControlAmplitude) + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def ao_manual_control_enable(self): + """ + bool: Specifies if you can control the physical channel + externally via a manual control located on the device. You + cannot simultaneously control a channel manually and with + NI-DAQmx. + """ + val = ctypes.c_bool() + + cfunc = (lib_importer.windll. + DAQmxGetPhysicalChanAOManualControlEnable) + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ao_manual_control_enable.setter + def ao_manual_control_enable(self, val): + cfunc = (lib_importer.windll. + DAQmxSetPhysicalChanAOManualControlEnable) + cfunc.argtypes = [ + ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._name, val) + check_for_error(error_code) + + @ao_manual_control_enable.deleter + def ao_manual_control_enable(self): + cfunc = (lib_importer.windll. + DAQmxResetPhysicalChanAOManualControlEnable) + cfunc.argtypes = [ + ctypes_byte_str] + + error_code = cfunc( + self._name) + check_for_error(error_code) + + @property + def ao_manual_control_freq(self): + """ + float: Indicates the current value of the front panel frequency + control for the physical channel in hertz. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetPhysicalChanAOManualControlFreq + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def ao_manual_control_short_detected(self): + """ + bool: Indicates whether the physical channel is currently + disabled due to a short detected on the channel. + """ + val = ctypes.c_bool() + + cfunc = (lib_importer.windll. + DAQmxGetPhysicalChanAOManualControlShortDetected) + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def ao_output_types(self): + """ + List[:class:`nidaqmx.constants.UsageTypeAO`]: Indicates the + output types supported by the channel. + """ + cfunc = (lib_importer.windll. + DAQmxGetPhysicalChanAOSupportedOutputTypes) + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.int32, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.int32) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return [UsageTypeAO(e) for e in val] + + @property + def ao_power_amp_channel_enable(self): + """ + bool: Specifies whether to enable or disable a channel for + amplification. This property can also be used to check if a + channel is enabled. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetAOPowerAmpChannelEnable + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @ao_power_amp_channel_enable.setter + def ao_power_amp_channel_enable(self, val): + cfunc = lib_importer.windll.DAQmxSetAOPowerAmpChannelEnable + cfunc.argtypes = [ + ctypes_byte_str, ctypes.c_bool] + + error_code = cfunc( + self._name, val) + check_for_error(error_code) + + @ao_power_amp_channel_enable.deleter + def ao_power_amp_channel_enable(self): + cfunc = lib_importer.windll.DAQmxResetAOPowerAmpChannelEnable + cfunc.argtypes = [ + ctypes_byte_str] + + error_code = cfunc( + self._name) + check_for_error(error_code) + + @property + def ao_power_amp_gain(self): + """ + float: Indicates the calibrated gain of the channel. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAOPowerAmpGain + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def ao_power_amp_offset(self): + """ + float: Indicates the calibrated offset of the channel in volts. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetAOPowerAmpOffset + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def ao_power_amp_overcurrent(self): + """ + bool: Indicates if the channel detected an overcurrent + condition. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetAOPowerAmpOvercurrent + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def ao_power_amp_scaling_coeff(self): + """ + List[float]: Indicates the coefficients of a polynomial equation + used to scale from pre-amplified values. + """ + cfunc = lib_importer.windll.DAQmxGetAOPowerAmpScalingCoeff + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.float64, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.float64) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.tolist() + + @property + def ao_power_up_output_types(self): + """ + List[:class:`nidaqmx.constants.AOPowerUpOutputBehavior`]: + Indicates the power up output types supported by the + channel. + """ + cfunc = (lib_importer.windll. + DAQmxGetPhysicalChanAOSupportedPowerUpOutputTypes) + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.int32, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.int32) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return [AOPowerUpOutputBehavior(e) for e in val] + + @property + def ao_term_cfgs(self): + """ + List[:class:`nidaqmx.constants.TerminalConfiguration`]: + Indicates the list of terminal configurations supported by + the channel. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetPhysicalChanAOTermCfgs + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return enum_bitfield_to_list( + val.value, _TermCfg, TerminalConfiguration) + + @property + def ci_meas_types(self): + """ + List[:class:`nidaqmx.constants.UsageTypeCI`]: Indicates the + measurement types supported by the channel. + """ + cfunc = lib_importer.windll.DAQmxGetPhysicalChanCISupportedMeasTypes + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.int32, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.int32) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return [UsageTypeCI(e) for e in val] + + @property + def co_output_types(self): + """ + List[:class:`nidaqmx.constants.UsageTypeCO`]: Indicates the + output types supported by the channel. + """ + cfunc = (lib_importer.windll. + DAQmxGetPhysicalChanCOSupportedOutputTypes) + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.int32, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.int32) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return [UsageTypeCO(e) for e in val] + + @property + def di_change_detect_supported(self): + """ + bool: Indicates if the change detection timing type is supported + for the digital input physical channel. + """ + val = ctypes.c_bool() + + cfunc = (lib_importer.windll. + DAQmxGetPhysicalChanDIChangeDetectSupported) + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def di_port_width(self): + """ + int: Indicates in bits the width of digital input port. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetPhysicalChanDIPortWidth + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def di_samp_clk_supported(self): + """ + bool: Indicates if the sample clock timing type is supported for + the digital input physical channel. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetPhysicalChanDISampClkSupported + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def di_samp_modes(self): + """ + List[:class:`nidaqmx.constants.AcquisitionType`]: Indicates the + sample modes supported by devices that support sample + clocked digital input. + """ + cfunc = lib_importer.windll.DAQmxGetPhysicalChanDISampModes + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.int32, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.int32) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return [AcquisitionType(e) for e in val] + + @property + def do_port_width(self): + """ + int: Indicates in bits the width of digital output port. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetPhysicalChanDOPortWidth + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def do_samp_clk_supported(self): + """ + bool: Indicates if the sample clock timing type is supported for + the digital output physical channel. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetPhysicalChanDOSampClkSupported + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def do_samp_modes(self): + """ + List[:class:`nidaqmx.constants.AcquisitionType`]: Indicates the + sample modes supported by devices that support sample + clocked digital output. + """ + cfunc = lib_importer.windll.DAQmxGetPhysicalChanDOSampModes + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.int32, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.int32) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return [AcquisitionType(e) for e in val] + + @property + def teds_bit_stream(self): + """ + List[int]: Indicates the TEDS binary bitstream without + checksums. + """ + cfunc = lib_importer.windll.DAQmxGetPhysicalChanTEDSBitStream + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.uint8, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.uint8) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.tolist() + + @property + def teds_mfg_id(self): + """ + int: Indicates the manufacturer ID of the sensor. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetPhysicalChanTEDSMfgID + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def teds_model_num(self): + """ + int: Indicates the model number of the sensor. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetPhysicalChanTEDSModelNum + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def teds_serial_num(self): + """ + int: Indicates the serial number of the sensor. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetPhysicalChanTEDSSerialNum + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def teds_template_ids(self): + """ + List[int]: Indicates the IDs of the templates in the bitstream + in **teds_bit_stream**. + """ + cfunc = lib_importer.windll.DAQmxGetPhysicalChanTEDSTemplateIDs + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.uint32, + flags=('C','W')), ctypes.c_uint] + + temp_size = 0 + while True: + val = numpy.zeros(temp_size, dtype=numpy.uint32) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_array_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.tolist() + + @property + def teds_version_letter(self): + """ + str: Indicates the version letter of the sensor. + """ + cfunc = lib_importer.windll.DAQmxGetPhysicalChanTEDSVersionLetter + cfunc.argtypes = [ + ctypes_byte_str, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @property + def teds_version_num(self): + """ + int: Indicates the version number of the sensor. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetPhysicalChanTEDSVersionNum + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + def clear_teds(self): + """ + Removes TEDS information from the physical channel you specify. + This function temporarily overrides any TEDS configuration for + the physical channel that you performed in MAX. + """ + cfunc = lib_importer.windll.DAQmxClearTEDS + cfunc.argtypes = [ + ctypes_byte_str] + + error_code = cfunc( + self._name) + check_for_error(error_code) + + def configure_teds(self, file_path=""): + """ + Associates TEDS information with the physical channel you + specify. If you do not specify the filename of a data sheet in + the **file_path** input, this function attempts to find a TEDS + sensor connected to the physical channel. This function + temporarily overrides any TEDS configuration for the physical + channel that you performed in MAX. + + Args: + file_path (Optional[str]): Is the path to a Virtual TEDS + data sheet that you want to associate with the physical + channel. If you do not specify anything for this input, + this function attempts to find a TEDS sensor connected + to the physical channel. + """ + cfunc = lib_importer.windll.DAQmxConfigureTEDS + cfunc.argtypes = [ + ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + self._name, file_path) + check_for_error(error_code) + + def write_to_teds_from_array( + self, bit_stream=None, + basic_teds_options=WriteBasicTEDSOptions.DO_NOT_WRITE): + """ + Writes data from a 1D list of 8-bit unsigned integers to the + TEDS sensor. + + Args: + bit_stream (Optional[List[int]]): Is the TEDS bitstream to + write to the sensor. This bitstream must be constructed + according to the IEEE 1451.4 specification. + basic_teds_options (Optional[nidaqmx.constants.WriteBasicTEDSOptions]): + Specifies how to handle basic TEDS data in the + bitstream. + """ + if bit_stream is None: + bit_stream = [] + + bit_stream = numpy.uint8(bit_stream) + + cfunc = lib_importer.windll.DAQmxWriteToTEDSFromArray + cfunc.argtypes = [ + ctypes_byte_str, wrapped_ndpointer(dtype=numpy.uint8, + flags=('C','W')), ctypes.c_uint, ctypes.c_int] + + error_code = cfunc( + self._name, bit_stream, len(bit_stream), basic_teds_options.value) + check_for_error(error_code) + + def write_to_teds_from_file( + self, file_path="", + basic_teds_options=WriteBasicTEDSOptions.DO_NOT_WRITE): + """ + Writes data from a virtual TEDS file to the TEDS sensor. + + Args: + file_path (Optional[str]): Specifies the filename of a + virtual TEDS file that contains the bitstream to write. + basic_teds_options (Optional[nidaqmx.constants.WriteBasicTEDSOptions]): + Specifies how to handle basic TEDS data in the + bitstream. + """ + cfunc = lib_importer.windll.DAQmxWriteToTEDSFromFile + cfunc.argtypes = [ + ctypes_byte_str, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + self._name, file_path, basic_teds_options.value) + check_for_error(error_code) + diff --git a/nidaqmx/system/storage/__init__.py b/nidaqmx/system/storage/__init__.py new file mode 100644 index 00000000..dfda2a1c --- /dev/null +++ b/nidaqmx/system/storage/__init__.py @@ -0,0 +1,10 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +from nidaqmx.system.storage.persisted_channel import PersistedChannel +from nidaqmx.system.storage.persisted_scale import PersistedScale +from nidaqmx.system.storage.persisted_task import PersistedTask + +__all__ = ['persisted_channel', 'persisted_scale', 'persisted_task'] diff --git a/nidaqmx/system/storage/_alternate_task_constructor.py b/nidaqmx/system/storage/_alternate_task_constructor.py new file mode 100644 index 00000000..69aa3695 --- /dev/null +++ b/nidaqmx/system/storage/_alternate_task_constructor.py @@ -0,0 +1,35 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +from nidaqmx.task import Task + + +class _TaskAlternateConstructor(Task): + """ + Provide an alternate constructor for the Task object. + + Since we want the user to create a Task simply by instantiating a + Task object, thus, the Task object's constructor has a DAQmx Create + Task call. + + Instantiating a Task object from a task handle - as required by + PersistedTask.load(), requires that we either change the original + constructor's prototype and add a parameter, or that we create this + derived class to 'overload' the constructor. + """ + + def __init__(self, task_handle): + """ + Args: + task_handle: Specifies the task handle from which to create a + Task object. + """ + self._handle = task_handle + self._initialize(self._handle) + + # Use meta-programming to change the type of this object to Task, + # so the user isn't confused when doing introspection. Not pretty, + # but works well. + self.__class__ = Task diff --git a/nidaqmx/system/storage/persisted_channel.py b/nidaqmx/system/storage/persisted_channel.py new file mode 100644 index 00000000..66b6e7c1 --- /dev/null +++ b/nidaqmx/system/storage/persisted_channel.py @@ -0,0 +1,123 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import ctypes + +from nidaqmx._lib import lib_importer, ctypes_byte_str, c_bool32 +from nidaqmx.errors import ( + check_for_error, is_string_buffer_too_small, is_array_buffer_too_small) + +__all__ = ['PersistedChannel'] + + +class PersistedChannel(object): + """ + Represents a saved DAQmx global channel. + + Use the DAQmx Persisted Channel properties to query information about + programmatically saved global channels. + """ + __slots__ = ['_name', '__weakref__'] + + def __init__(self, name): + """ + Args: + name: Specifies the name of the global channel. + """ + self._name = name + + def __eq__(self, other): + if isinstance(other, self.__class__): + return self._name == other._name + return False + + def __hash__(self): + return hash(self._name) + + def __ne__(self, other): + return not self.__eq__(other) + + def __repr__(self): + return 'PersistedChannel(name={0})'.format(self._name) + + @property + def author(self): + """ + str: Indicates the author of the global channel. + """ + cfunc = lib_importer.windll.DAQmxGetPersistedChanAuthor + cfunc.argtypes = [ + ctypes_byte_str, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @property + def allow_interactive_editing(self): + """ + bool: Indicates whether the global channel can be edited in the + DAQ Assistant. + """ + val = c_bool32() + + cfunc = (lib_importer.windll. + DAQmxGetPersistedChanAllowInteractiveEditing) + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(c_bool32)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def allow_interactive_deletion(self): + """ + bool: Indicates whether the global channel can be deleted + through MAX. + """ + val = c_bool32() + + cfunc = (lib_importer.windll. + DAQmxGetPersistedChanAllowInteractiveDeletion) + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(c_bool32)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + def delete(self): + """ + Deletes this global channel from MAX. + + This function does not remove the global channel from tasks that + use it. + """ + cfunc = lib_importer.windll.DAQmxDeleteSavedGlobalChan + cfunc.argtypes = [ctypes_byte_str] + + error_code = cfunc(self._name) + check_for_error(error_code) diff --git a/nidaqmx/system/storage/persisted_scale.py b/nidaqmx/system/storage/persisted_scale.py new file mode 100644 index 00000000..208a8977 --- /dev/null +++ b/nidaqmx/system/storage/persisted_scale.py @@ -0,0 +1,133 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import ctypes + +from nidaqmx._lib import lib_importer, ctypes_byte_str, c_bool32 +from nidaqmx.scale import Scale +from nidaqmx.errors import ( + check_for_error, is_string_buffer_too_small, is_array_buffer_too_small) + +__all__ = ['PersistedScale'] + + +class PersistedScale(object): + """ + Represents a saved DAQmx custom scale. + + Use the DAQmx Persisted Scale properties to query information about + programmatically saved custom scales. + """ + __slots__ = ['_name', '__weakref__'] + + def __init__(self, name): + """ + Args: + name: Specifies the name of the saved scale. + """ + self._name = name + + def __eq__(self, other): + if isinstance(other, self.__class__): + return self._name == other._name + return False + + def __hash__(self): + return hash(self._name) + + def __ne__(self, other): + return not self.__eq__(other) + + def __repr__(self): + return 'PersistedScale(name={0})'.format(self._name) + + @property + def author(self): + """ + str: Indicates the author of the custom scale. + """ + cfunc = lib_importer.windll.DAQmxGetPersistedScaleAuthor + cfunc.argtypes = [ + ctypes_byte_str, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @property + def allow_interactive_editing(self): + """ + bool: Indicates whether the custom scale can be edited in the + DAQ Assistant. + """ + val = c_bool32() + + cfunc = (lib_importer.windll. + DAQmxGetPersistedScaleAllowInteractiveEditing) + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(c_bool32)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def allow_interactive_deletion(self): + """ + bool: Indicates whether the custom scale can be deleted through + MAX. + """ + val = c_bool32() + + cfunc = (lib_importer.windll. + DAQmxGetPersistedScaleAllowInteractiveDeletion) + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(c_bool32)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + def delete(self): + """ + Deletes this custom scale from MAX. + + This function does not remove the custom scale from virtual + channels that use it. + """ + cfunc = lib_importer.windll.DAQmxDeleteSavedScale + cfunc.argtypes = [ctypes_byte_str] + + error_code = cfunc(self._name) + check_for_error(error_code) + + def load(self): + """ + Loads this custom scale. + + Returns: + nidaqmx.scale.Scale: Indicates the loaded Scale object. + """ + return Scale(self._name) diff --git a/nidaqmx/system/storage/persisted_task.py b/nidaqmx/system/storage/persisted_task.py new file mode 100644 index 00000000..e922c784 --- /dev/null +++ b/nidaqmx/system/storage/persisted_task.py @@ -0,0 +1,146 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import ctypes + +from nidaqmx._lib import lib_importer, ctypes_byte_str, c_bool32 +from nidaqmx.errors import ( + check_for_error, is_string_buffer_too_small) + +__all__ = ['PersistedTask'] + + +class PersistedTask(object): + """ + Represents a saved DAQmx task. + + Use the DAQmx Persisted Task properties to query information about + programmatically saved tasks. + """ + __slots__ = ['_name', '__weakref__'] + + def __init__(self, name): + """ + Args: + name: Specifies the name of the saved task. + """ + self._name = name + + def __eq__(self, other): + if isinstance(other, self.__class__): + return self._name == other._name + return False + + def __hash__(self): + return hash(self._name) + + def __ne__(self, other): + return not self.__eq__(other) + + def __repr__(self): + return 'PersistedTask(name={0})'.format(self._name) + + @property + def author(self): + """ + str: Indicates the author of the task. + """ + cfunc = lib_importer.windll.DAQmxGetPersistedTaskAuthor + cfunc.argtypes = [ + ctypes_byte_str, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._name, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @property + def allow_interactive_editing(self): + """ + bool: Indicates whether the task can be edited in the DAQ + Assistant. + """ + val = c_bool32() + + cfunc = (lib_importer.windll. + DAQmxGetPersistedTaskAllowInteractiveEditing) + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(c_bool32)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def allow_interactive_deletion(self): + """ + bool: Indicates whether the task can be deleted through MAX. + """ + val = c_bool32() + + cfunc = (lib_importer.windll. + DAQmxGetPersistedTaskAllowInteractiveDeletion) + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(c_bool32)] + + error_code = cfunc( + self._name, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + def delete(self): + """ + Deletes this task from MAX. + + This function does not clear the copy of the task stored in memory. + Use the DAQmx Clear Task function to clear that copy of the task. + """ + cfunc = lib_importer.windll.DAQmxDeleteSavedTask + cfunc.argtypes = [ctypes_byte_str] + + error_code = cfunc(self._name) + check_for_error(error_code) + + def load(self): + """ + Loads this saved task. + + If you use this function to load a task, you must use DAQmx Clear + Task to destroy it. + + Returns: + nidaqmx.task.Task: Indicates the loaded Task object. + """ + task_handle = lib_importer.task_handle(0) + + cfunc = lib_importer.windll.DAQmxLoadTask + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(lib_importer.task_handle)] + + error_code = cfunc(self._name, ctypes.byref(task_handle)) + check_for_error(error_code) + + from nidaqmx.system.storage._alternate_task_constructor import ( + _TaskAlternateConstructor) + + return _TaskAlternateConstructor(task_handle) diff --git a/nidaqmx/system/system.py b/nidaqmx/system/system.py new file mode 100644 index 00000000..14aaf833 --- /dev/null +++ b/nidaqmx/system/system.py @@ -0,0 +1,845 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import collections +import ctypes +import numpy + +from nidaqmx._lib import ( + lib_importer, wrapped_ndpointer, ctypes_byte_str, c_bool32) +from nidaqmx.errors import check_for_error, is_string_buffer_too_small +from nidaqmx.system.device import Device +from nidaqmx.system._collections.device_collection import DeviceCollection +from nidaqmx.system._collections.persisted_channel_collection import ( + PersistedChannelCollection) +from nidaqmx.system._collections.persisted_scale_collection import ( + PersistedScaleCollection) +from nidaqmx.system._collections.persisted_task_collection import ( + PersistedTaskCollection) +from nidaqmx.utils import flatten_channel_string, unflatten_channel_string +from nidaqmx.constants import ( + AOPowerUpOutputBehavior, LogicFamily, PowerUpStates, ResistorState, + SignalModifiers, WAIT_INFINITELY) +from nidaqmx.types import ( + AOPowerUpState, CDAQSyncConnection, DOPowerUpState, DOResistorPowerUpState) + +__all__ = ['System'] + + +class System(object): + """ + Represents a DAQmx system. + + Contains static properties that access tasks, scales, and global channels + stored in Measurement Automation Explorer (MAX), performs immediate + operations on DAQ hardware, and creates classes from which you can get + information about the hardware. + """ + + @staticmethod + def local(): + """ + nidaqmx.system.system.System: Represents the local DAQmx system. + """ + return System() + + @property + def devices(self): + """ + nidaqmx.system._collections.DeviceCollection: Indicates the + collection of devices for this DAQmx system. + """ + return DeviceCollection() + + @property + def driver_version(self): + """ + collections.namedtuple: Indicates the major, minor and update + portions of the installed version of NI-DAQmx. + + - major_version (int): Indicates the major portion of the + installed version of NI-DAQmx, such as 7 for version 7.0. + - minor_version (int): Indicates the minor portion of the + installed version of NI-DAQmx, such as 0 for version 7.0. + - update_version (int): Indicates the update portion of the + installed version of NI-DAQmx, such as 1 for version 9.0.1. + """ + DriverVersion = collections.namedtuple( + 'DriverVersion', ['major_version', 'minor_version', + 'update_version']) + + return DriverVersion(self._major_version, self._minor_version, + self._update_version) + + @property + def global_channels(self): + """ + nidaqmx.system._collections.PersistedChannelCollection: Indicates + the collection of global channels for this DAQmx system. + """ + return PersistedChannelCollection() + + @property + def scales(self): + """ + nidaqmx.system._collections.PersistedScaleCollection: Indicates + the collection of custom scales for this DAQmx system. + """ + return PersistedScaleCollection() + + @property + def tasks(self): + """ + nidaqmx.system._collections.PersistedTaskCollection: Indicates + the collection of saved tasks for this DAQmx system. + """ + return PersistedTaskCollection() + + @property + def _major_version(self): + """ + int: Indicates the major portion of the installed version of NI- + DAQmx, such as 7 for version 7.0. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetSysNIDAQMajorVersion + cfunc.argtypes = [ + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def _minor_version(self): + """ + int: Indicates the minor portion of the installed version of NI- + DAQmx, such as 0 for version 7.0. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetSysNIDAQMinorVersion + cfunc.argtypes = [ + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def _update_version(self): + """ + int: Indicates the update portion of the installed version of + NI-DAQmx, such as 1 for version 9.0.1. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetSysNIDAQUpdateVersion + cfunc.argtypes = [ + ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + def connect_terms( + self, source_terminal, destination_terminal, + signal_modifiers=SignalModifiers.DO_NOT_INVERT_POLARITY): + """ + Creates a route between a source and destination terminal. The + route can carry a variety of digital signals, such as triggers, + clocks, and hardware events. + + Args: + source_terminal (str): Specifies the originating terminal of + the route. A DAQmx terminal constant lists all terminals + available on devices installed in the system. You also + can specify a source terminal by specifying a string + that contains a terminal name. + destination_terminal (str): Specifies the receiving terminal + of the route. A DAQmx terminal constant provides a list + of all terminals available on devices installed in the + system. You also can specify a destination terminal by + specifying a string that contains a terminal name. + signal_modifiers (Optional[nidaqmx.constants.SignalModifiers]): + Specifies whether to invert the signal this function + routes from the source terminal to the destination + terminal. + """ + cfunc = lib_importer.windll.DAQmxConnectTerms + cfunc.argtypes = [ + ctypes_byte_str, ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + source_terminal, destination_terminal, signal_modifiers.value) + check_for_error(error_code) + + def disconnect_terms(self, source_terminal, destination_terminal): + """ + Removes signal routes you created by using the DAQmx Connect + Terminals function. The DAQmx Disconnect Terminals function + cannot remove task-based routes, such as those you create + through timing and triggering configuration. + + Args: + source_terminal (str): Specifies the originating terminal of + the route. A DAQmx terminal constant lists all terminals + available on devices installed in the system. You also + can specify a source terminal by specifying a string + that contains a terminal name. + destination_terminal (str): Specifies the receiving terminal + of the route. A DAQmx terminal constant provides a list + of all terminals available on devices installed in the + system. You also can specify a destination terminal by + specifying a string that contains a terminal name. + """ + cfunc = lib_importer.windll.DAQmxDisconnectTerms + cfunc.argtypes = [ + ctypes_byte_str, ctypes_byte_str] + + error_code = cfunc( + source_terminal, destination_terminal) + check_for_error(error_code) + + def tristate_output_term(self, output_terminal): + """ + Sets a terminal to high-impedance state. If you connect an + external signal to a terminal on the I/O connector, the terminal + must be in high-impedance state. Otherwise, the device could + double-drive the terminal and damage the hardware. If you use + this function on a terminal in an active route, the function + fails and returns an error. + + Args: + output_terminal (str): Specifies the terminal on the I/O + connector to set to high-impedance state. A DAQmx + terminal constant lists all available terminals on + installed devices. You also can specify an output + terminal by using a string that contains a terminal + name. + """ + cfunc = lib_importer.windll.DAQmxTristateOutputTerm + cfunc.argtypes = [ + ctypes_byte_str] + + error_code = cfunc( + output_terminal) + check_for_error(error_code) + + # region Power Up States Functions + + def set_digital_power_up_states( + self, device_name, power_up_states): + """ + Updates power up states for digital physical channels. + + Args: + device_name (str): Specifies the name as configured in MAX + of the device to which this operation applies. + power_up_states (List[nidaqmx.types.DOPowerUpState]): + Contains the physical channels and power up states to + set. Each element of the list contains a physical channel + and the power up state to set for that physical channel. + + - physical_channel (str): Specifies the digital line or + port to modify. You cannot modify dedicated digital + input lines. + - power_up_state (:class:`nidaqmx.constants.PowerUpStates`): + Specifies the power up state to set for the physical + channel specified with the **physical_channel** input. + """ + args = [device_name] + argtypes = [ctypes_byte_str] + + for p in power_up_states: + args.append(p.physical_channel) + argtypes.append(ctypes_byte_str) + + args.append(p.power_up_state.value) + argtypes.append(ctypes.c_int) + + args.append(None) + + cfunc = lib_importer.cdll.DAQmxSetDigitalPowerUpStates + cfunc.argtypes = argtypes + + error_code = cfunc(*args) + check_for_error(error_code) + + def get_digital_power_up_states(self, device_name): + """ + Gets the power up states for digital physical lines. + + Args: + device_name (str): Specifies the name as configured in MAX + of the device to which this operation applies. + Returns: + List[nidaqmx.types.DOPowerUpState]: + + Contains the physical channels and power up states set. Each + element of the list contains a physical channel and the power + up state set for that physical channel. + + - physical_channel (str): Indicates the physical channel that + was modified. + - power_up_state (:class:`nidaqmx.constants.PowerUpStates`): + Indicates the power up state set for the physical channel + specified with the **physical_channel** output. + """ + states = [] + + device = Device(device_name) + args = [device_name] + argtypes = [ctypes_byte_str] + + for do_line in device.do_lines: + state = ctypes.c_int() + states.append(state) + + args.append(do_line.name) + argtypes.append(ctypes_byte_str) + + args.append(ctypes.byref(state)) + argtypes.append(ctypes.POINTER(ctypes.c_int)) + + args.append(None) + + cfunc = lib_importer.cdll.DAQmxGetDigitalPowerUpStates + cfunc.argtypes = argtypes + + error_code = cfunc(*args) + check_for_error(error_code) + + power_up_states = [] + for d, p in zip(device.do_lines, states): + power_up_states.append( + DOPowerUpState(physical_channel=d.name, + power_up_state=PowerUpStates(p.value))) + + return power_up_states + + def set_digital_pull_up_pull_down_states( + self, device_name, power_up_states): + """ + Sets the resistor level to pull up or pull down for lines when + they are in tristate logic. + + Args: + device_name (str): Specifies the name as configured in MAX + of the device to which this operation applies. + power_up_states (List[nidaqmx.types.DOResistorPowerUpState]): + Contains the physical channels and power up states to + set. Each element of the list contains a physical channel + and the power up state to set for that physical channel. + + - physical_channel (str): Specifies the digital line or + port to modify. You cannot modify dedicated digital + input lines. + - power_up_state (:class:`nidaqmx.constants.ResistorState`): + Specifies the power up state to set for the physical + channel specified with the **physical_channel** input. + """ + args = [device_name] + argtypes = [ctypes_byte_str] + + for p in power_up_states: + args.append(p.physical_channel) + argtypes.append(ctypes_byte_str) + + args.append(p.power_up_state.value) + argtypes.append(ctypes.c_int) + + args.append(None) + + cfunc = lib_importer.cdll.DAQmxSetDigitalPullUpPullDownStates + cfunc.argtypes = argtypes + + error_code = cfunc(*args) + check_for_error(error_code) + + def get_digital_pull_up_pull_down_states(self, device_name): + """ + Gets the resistor level for lines when they are in tristate + logic. + + Args: + device_name (str): Specifies the name as configured in MAX + of the device to which this operation applies. + Returns: + List[nidaqmx.types.DOResistorPowerUpState]: + + Contains the physical channels and power up states set. Each + element of the list contains a physical channel and the power + up state set for that physical channel. + + - physical_channel (str): Indicates the physical channel that + was modified. + - power_up_state (:class:`nidaqmx.constants.ResistorState`): + Indicates the power up state set for the physical channel + specified with the **physical_channel** output. + """ + states = [] + + device = Device(device_name) + args = [device_name] + argtypes = [ctypes_byte_str] + + for do_line in device.do_lines: + state = ctypes.c_int() + states.append(state) + + args.append(do_line.name) + argtypes.append(ctypes_byte_str) + + args.append(ctypes.byref(state)) + argtypes.append(ctypes.POINTER(ctypes.c_int)) + + args.append(None) + + cfunc = lib_importer.cdll.DAQmxGetDigitalPullUpPullDownStates + cfunc.argtypes = argtypes + + error_code = cfunc(*args) + check_for_error(error_code) + + power_up_states = [] + for d, p in zip(device.do_lines, states): + power_up_states.append( + DOResistorPowerUpState( + physical_channel=d.name, + power_up_state=ResistorState(p.value))) + + return power_up_states + + def set_analog_power_up_states(self, device_name, power_up_states): + """ + Updates power up states for analog physical channels. + + Args: + device_name (str): Specifies the name as configured in MAX + of the device to which this operation applies. + power_up_states (List[nidaqmx.types.AOPowerUpState]): + Contains the physical channels and power up states to + set. Each element of the list contains a physical channel + and the power up state to set for that physical channel. + + - physical_channel (str): Specifies the physical channel + to modify. + - power_up_state (float): Specifies the power up state to + set for the physical channel specified with the + **physical_channel** input. + - channel_type (:class:`nidaqmx.constants.AOPowerUpOutputBehavior`): + Specifies the output type for the physical channel + specified with the **physical_channel** input. + """ + args = [device_name] + argtypes = [ctypes_byte_str] + + for p in power_up_states: + args.append(p.physical_channel) + argtypes.append(ctypes_byte_str) + + args.append(p.power_up_state) + argtypes.append(ctypes.c_double) + + args.append(p.channel_type.value) + argtypes.append(ctypes.c_int) + + args.append(None) + + cfunc = lib_importer.cdll.DAQmxSetAnalogPowerUpStates + cfunc.argtypes = argtypes + + error_code = cfunc(*args) + check_for_error(error_code) + + def set_analog_power_up_states_with_output_type( + self, power_up_states): + """ + Updates power up states for analog physical channels. + + Args: + power_up_states (List[nidaqmx.types.AOPowerUpState]): + Contains the physical channels and power up states to + set. Each element of the list contains a physical channel + and the power up state to set for that physical channel. + + - physical_channel (str): Specifies the physical channel to + modify. + - power_up_state (float): Specifies the power up state + to set for the physical channel specified with the + **physical_channel** input. + - channel_type (:class:`nidaqmx.constants.AOPowerUpOutputBehavior`): + Specifies the output type for the physical channel + specified with the **physical_channel** input. + """ + physical_channel = flatten_channel_string( + [p.physical_channel for p in power_up_states]) + state = numpy.float64( + [p.power_up_state for p in power_up_states]) + channel_type = numpy.int32( + [p.channel_type.value for p in power_up_states]) + + cfunc = lib_importer.cdll.DAQmxSetAnalogPowerUpStatesWithOutputType + cfunc.argtypes = [ + ctypes_byte_str, + wrapped_ndpointer(dtype=numpy.float64, flags=('C','W')), + wrapped_ndpointer(dtype=numpy.int32, flags=('C','W'))] + + error_code = cfunc( + physical_channel, state, channel_type, len(power_up_states)) + check_for_error(error_code) + + def get_analog_power_up_states(self, device_name): + """ + Gets the power up states for analog physical channels. + + Args: + device_name (str): Specifies the name as configured in MAX + of the device to which this operation applies. + Returns: + power_up_states (List[nidaqmx.types.AOPowerUpState]): + + Contains the physical channels and power up states set. Each + element of the list contains a physical channel and the + power up state set for that physical channel. + + - physical_channel (str): Specifies the physical channel that + was modified. + - power_up_state (float): Specifies the power up state set + for the physical channel specified with the + **physical_channel** input. + - channel_type (:class:`nidaqmx.constants.AOPowerUpOutputBehavior`): + Specifies the output type for the physical channel + specified with the **physical_channel** input. + """ + states = [] + channel_types = [] + + device = Device(device_name) + args = [device_name] + argtypes = [ctypes_byte_str] + + for ao_physical_chan in device.ao_physical_chans: + state = ctypes.c_double() + states.append(state) + + channel_type = ctypes.c_int() + channel_types.append(channel_type) + + args.append(ao_physical_chan.name) + argtypes.append(ctypes_byte_str) + + args.append(ctypes.byref(state)) + argtypes.append(ctypes.POINTER(ctypes.c_double)) + + args.append(ctypes.byref(channel_type)) + argtypes.append(ctypes.POINTER(ctypes.c_int)) + + args.append(None) + + cfunc = lib_importer.cdll.DAQmxGetAnalogPowerUpStates + cfunc.argtypes = argtypes + + error_code = cfunc(*args) + check_for_error(error_code) + + power_up_states = [] + for a, p, c in zip(device.ao_physical_chans, states, channel_types): + power_up_states.append( + AOPowerUpState( + physical_channel=a.name, + power_up_state=p.value, + channel_type=AOPowerUpOutputBehavior(c.value))) + + return power_up_states + + def get_analog_power_up_states_with_output_type(self, physical_channels): + """ + Gets the power up states for analog physical channels. + + Args: + physical_channels (List[str]): Indicates the physical + channels that were modified. + Returns: + power_up_states (List[nidaqmx.types.AOPowerUpState]): + + Contains the physical channels and power up states set. Each + element of the list contains a physical channel and the + power up state set for that physical channel. + + - physical_channel (str): Specifies the physical channel that + was modified. + - power_up_state (float): Specifies the power up state set + for the physical channel specified with the + **physical_channel** input. + - channel_type (:class:`nidaqmx.constants.AOPowerUpOutputBehavior`): + Specifies the output type for the physical channel + specified with the **physical_channel** input. + """ + size = len(physical_channels) + states = numpy.zeros(size, dtype=numpy.float64) + channel_types = numpy.zeros(size, dtype=numpy.int32) + + cfunc = lib_importer.cdll.DAQmxGetAnalogPowerUpStatesWithOutputType + cfunc.argtypes = [ + 'ctypes_byte_str', + wrapped_ndpointer(dtype=numpy.float64, flags=('C','W')), + wrapped_ndpointer(dtype=numpy.int32, flags=('C','W'))] + + error_code = cfunc( + flatten_channel_string(physical_channels), states, channel_types, + size) + + check_for_error(error_code) + + power_up_states = [] + for p, s, c in zip(physical_channels, states, channel_types): + power_up_states.append( + AOPowerUpState( + physical_channel=p, + power_up_state=float(s), + channel_type=AOPowerUpOutputBehavior(c.value))) + + return power_up_states + + def set_digital_logic_family_power_up_state( + self, device_name, logic_family): + """ + Sets the digital logic family to use when the device powers up. + + Args: + device_name (str): Specifies the name as configured in MAX + of the device to which this operation applies. + logic_family (nidaqmx.constants.LogicFamily): Specifies the + logic family set to the device to when it powers up. A + logic family corresponds to voltage thresholds that are + compatible with a group of voltage standards. Refer to + device documentation for information on the logic high + and logic low voltages for these logic families. + """ + cfunc = lib_importer.windll.DAQmxSetDigitalLogicFamilyPowerUpState + cfunc.argtypes = [ + ctypes_byte_str, ctypes.c_int] + + error_code = cfunc( + device_name, logic_family.value) + check_for_error(error_code) + + def get_digital_logic_family_power_up_state(self, device_name): + """ + Gets the digital logic family for a device. + + Args: + device_name (str): Specifies the name as configured in MAX + of the device to which this operation applies. + Returns: + nidaqmx.constants.LogicFamily: + + Specifies the logic family to set the device to when it powers + up. A logic family corresponds to voltage thresholds that are + compatible with a group of voltage standards. Refer to device + documentation for information on the logic high and logic low + voltages for these logic families. + """ + logic_family = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetDigitalLogicFamilyPowerUpState + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + device_name, ctypes.byref(logic_family)) + check_for_error(error_code) + + return LogicFamily(logic_family.value) + + # endregion + + # region cDAQ Sync Functions + + def auto_configure_cdaq_sync_connections( + self, chassis_devices_ports="", timeout=WAIT_INFINITELY): + """ + Detects and configures cDAQ Sync connections between devices. + Stop all NI-DAQmx tasks running on the devices prior to running + this function because any running tasks cause auto-configuration + to fail. + + Args: + chassis_devices_ports (Optional[str]): Specifies the names of the + CompactDAQ chassis, C Series modules, or cDAQ Sync ports in + comma separated form to search. If no names are specified, all + cDAQ Sync ports on connected, non-simulated devices are + scanned. + timeout (Optional[float]): Specifies the time in seconds to + wait for the device to respond before timing out. If a + timeout occurs, no configuration is changed. + Returns: + List[nidaqmx.types.CDAQSyncConnection]: + + Returns the configured port-to-port connections. + """ + cfunc = lib_importer.windll.DAQmxAutoConfigureCDAQSyncConnections + cfunc.argtypes = [ + ctypes_byte_str, ctypes.c_double] + + error_code = cfunc( + chassis_devices_ports, timeout) + check_for_error(error_code) + + cfunc = lib_importer.windll.DAQmxGetAutoConfiguredCDAQSyncConnections + cfunc.argtypes = [ + ctypes.c_char_p, ctypes.POINTER(ctypes.c_uint)] + + port_list_size = ctypes.c_uint() + + while True: + size_or_code = cfunc( + None, ctypes.byref(port_list_size)) + + if size_or_code < 0: + break + + port_list = ctypes.create_string_buffer(size_or_code) + + size_or_code = cfunc( + port_list, ctypes.byref(port_list_size)) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + continue + else: + break + + check_for_error(size_or_code) + + ports = unflatten_channel_string(port_list.value.decode('ascii')) + output_ports = ports[::2] + input_ports = ports[1::2] + + connections = [] + for output_port, input_port in zip(output_ports, input_ports): + connections.append( + CDAQSyncConnection(output_port=output_port, + input_port=input_port)) + + return connections + + def are_configured_cdaq_sync_ports_disconnected( + self, chassis_devices_ports="", timeout=WAIT_INFINITELY): + """ + Verifies configured cDAQ Sync connections between devices. + Failures generally indicate a wiring issue or that a device has + been powered off or removed. Stop all NI-DAQmx tasks running on + the devices prior to running this function because any running + tasks cause the verification process to fail. + + Args: + chassis_devices_ports (Optional[str]): Specifies the names + of the CompactDAQ chassis, C Series modules, or cDAQ + Sync ports in comma separated form to search. If no + names are specified, all cDAQ Sync ports on connected, + non-simulated devices are scanned. + timeout (Optional[float]): Specifies the time in seconds to + wait for the device to respond before timing out. + Returns: + List[nidaqmx.types.CDAQSyncConnection]: + + Returns the port-to-port connections that failed verification. + """ + disconnected_ports_exist = c_bool32() + + cfunc = lib_importer.windll.DAQmxAreConfiguredCDAQSyncPortsDisconnected + cfunc.argtypes = [ + ctypes_byte_str, ctypes.c_double, ctypes.POINTER(c_bool32)] + + error_code = cfunc( + chassis_devices_ports, timeout, + ctypes.byref(disconnected_ports_exist)) + check_for_error(error_code) + + cfunc = lib_importer.windll.DAQmxGetDisconnectedCDAQSyncPorts + cfunc.argtypes = [ + ctypes.c_char_p, ctypes.POINTER(ctypes.c_uint)] + + port_list_size = ctypes.c_uint() + + while True: + size_or_code = cfunc( + None, ctypes.byref(port_list_size)) + + if size_or_code < 0: + break + + port_list = ctypes.create_string_buffer(size_or_code) + + size_or_code = cfunc( + port_list, ctypes.byref(port_list_size)) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + continue + else: + break + + check_for_error(size_or_code) + + ports = unflatten_channel_string(port_list.value.decode('ascii')) + output_ports = ports[::2] + input_ports = ports[1::2] + + connections = [] + for output_port, input_port in zip(output_ports, input_ports): + connections.append( + CDAQSyncConnection(output_port=output_port, + input_port=input_port)) + + return connections + + def add_cdaq_sync_connection(self, ports_to_connect): + """ + Adds a cDAQ Sync connection between devices. The connection is + not verified. + + Args: + ports_to_connect (nidaqmx.types.CDAQSyncConnection): + Specifies the cDAQ Sync ports to connect. + """ + port_list = flatten_channel_string( + [ports_to_connect.output_port, ports_to_connect.input_port]) + + cfunc = lib_importer.windll.DAQmxAddCDAQSyncConnection + cfunc.argtypes = [ctypes_byte_str] + + error_code = cfunc(port_list) + check_for_error(error_code) + + def remove_cdaq_sync_connection(self, ports_to_disconnect): + """ + Removes a cDAQ Sync connection between devices. The connection + is not verified. + + Args: + ports_to_disconnect (nidaqmx.types.CDAQSyncConnection): + Specifies the cDAQ Sync ports to disconnect. + """ + port_list = flatten_channel_string( + [ports_to_disconnect.output_port, ports_to_disconnect.input_port]) + + cfunc = lib_importer.windll.DAQmxRemoveCDAQSyncConnection + cfunc.argtypes = [ctypes_byte_str] + + error_code = cfunc(port_list) + check_for_error(error_code) + + # endregion diff --git a/nidaqmx/system/watchdog.py b/nidaqmx/system/watchdog.py new file mode 100644 index 00000000..8cafd350 --- /dev/null +++ b/nidaqmx/system/watchdog.py @@ -0,0 +1,585 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import collections +import ctypes +import numpy +import warnings + +from nidaqmx._lib import lib_importer, wrapped_ndpointer, ctypes_byte_str +from nidaqmx.errors import ( + check_for_error, is_string_buffer_too_small, is_array_buffer_too_small, + DaqResourceWarning) +from nidaqmx.system._watchdog_modules.expiration_state import ExpirationState +from nidaqmx.system._watchdog_modules.expiration_states_collection import ( + ExpirationStatesCollection) +from nidaqmx.utils import flatten_channel_string +from nidaqmx.constants import ( + Edge, TriggerType, WDTTaskAction) +from nidaqmx.types import ( + AOExpirationState, COExpirationState, DOExpirationState) + +__all__ = ['WatchdogTask'] + + +class WatchdogTask(object): + """ + Represents the watchdog configurations for a DAQmx task. + """ + def __init__(self, device_name, task_name='', timeout=10): + """ + Creates and configures a task that controls the watchdog timer of a + device. The timer activates when you start the task. + + Use the DAQmx Configure Watchdog Expiration States functions to + configure channel expiration states. This class does not program + the watchdog timer on a real-time controller. + + Args: + device_name (str): Specifies is the name as configured in MAX of + the device to which this operation applies. + task_name (str): Specifies the name to assign to the task. If you + use this constructor in a loop and specify a name for the task, + you must use the DAQmx Clear Task method within the loop after + you are finished with the task. Otherwise, NI-DAQmx attempts to + create multiple tasks with the same name, which results in an + error. + timeout (float): Specifies the amount of time in seconds until the + watchdog timer expires. A value of -1 means the internal timer + never expires. Set this input to -1 if you use an Expiration + Trigger to expire the watchdog task. If this time elapses, the + device sets the physical channels to the states you specify + with the digital physical channel expiration states input. + """ + self._handle = lib_importer.task_handle(0) + + cfunc = lib_importer.windll.DAQmxCreateWatchdogTimerTaskEx + cfunc.argtypes = [ + ctypes_byte_str, ctypes_byte_str, + ctypes.POINTER(lib_importer.task_handle), ctypes.c_double] + + error_code = cfunc( + device_name, task_name, ctypes.byref(self._handle), timeout) + check_for_error(error_code) + + # Saved name is used in self.close() to throw graceful error on + # double closes. + self._saved_name = self.name + self._expiration_states = ExpirationStatesCollection(self._handle) + + def __del__(self): + if self._handle is not None: + warnings.warn( + 'Task of name "{0}" was not explicitly closed before it was ' + 'destructed. Resources on the task device may still be ' + 'reserved.'.format(self.name), DaqResourceWarning) + + def __enter__(self): + return self + + def __exit__(self, type, value, traceback): + self.close() + + @property + def expiration_states(self): + """ + nidaqmx.system._watchdog_modules.expiration_states_collection. + ExpirationStatesCollection: + Gets the collection of expiration states for this watchdog task. + """ + return self._expiration_states + + @property + def expir_trig_dig_edge_edge(self): + """ + :class:`nidaqmx.constants.Edge`: Specifies on which edge of a + digital signal to expire the watchdog task. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetDigEdgeWatchdogExpirTrigEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return Edge(val.value) + + @expir_trig_dig_edge_edge.setter + def expir_trig_dig_edge_edge(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetDigEdgeWatchdogExpirTrigEdge + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @expir_trig_dig_edge_edge.deleter + def expir_trig_dig_edge_edge(self): + cfunc = lib_importer.windll.DAQmxResetDigEdgeWatchdogExpirTrigEdge + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def expir_trig_dig_edge_src(self): + """ + str: Specifies the name of a terminal where a digital signal + exists to use as the source of the Expiration Trigger. + """ + cfunc = lib_importer.windll.DAQmxGetDigEdgeWatchdogExpirTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @expir_trig_dig_edge_src.setter + def expir_trig_dig_edge_src(self, val): + cfunc = lib_importer.windll.DAQmxSetDigEdgeWatchdogExpirTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @expir_trig_dig_edge_src.deleter + def expir_trig_dig_edge_src(self): + cfunc = lib_importer.windll.DAQmxResetDigEdgeWatchdogExpirTrigSrc + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def expir_trig_trig_on_network_conn_loss(self): + """ + bool: Specifies the watchdog timer behavior when the network + connection is lost between the host and the chassis. If set + to true, the watchdog timer expires when the chassis detects + the loss of network connection. + """ + val = ctypes.c_bool() + + cfunc = (lib_importer.windll. + DAQmxGetWatchdogExpirTrigOnNetworkConnLoss) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @expir_trig_trig_on_network_conn_loss.setter + def expir_trig_trig_on_network_conn_loss(self, val): + cfunc = (lib_importer.windll. + DAQmxSetWatchdogExpirTrigOnNetworkConnLoss) + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_bool] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @expir_trig_trig_on_network_conn_loss.deleter + def expir_trig_trig_on_network_conn_loss(self): + cfunc = (lib_importer.windll. + DAQmxResetWatchdogExpirTrigOnNetworkConnLoss) + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def expir_trig_trig_type(self): + """ + :class:`nidaqmx.constants.TriggerType`: Specifies the type of + trigger to use to expire a watchdog task. + """ + val = ctypes.c_int() + + cfunc = lib_importer.windll.DAQmxGetWatchdogExpirTrigType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_int)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return TriggerType(val.value) + + @expir_trig_trig_type.setter + def expir_trig_trig_type(self, val): + val = val.value + cfunc = lib_importer.windll.DAQmxSetWatchdogExpirTrigType + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @expir_trig_trig_type.deleter + def expir_trig_trig_type(self): + cfunc = lib_importer.windll.DAQmxResetWatchdogExpirTrigType + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def expired(self): + """ + bool: Indicates if the watchdog timer expired. You can read this + property only while the task is running. + """ + val = ctypes.c_bool() + + cfunc = lib_importer.windll.DAQmxGetWatchdogHasExpired + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_bool)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def timeout(self): + """ + float: Specifies in seconds the amount of time until the + watchdog timer expires. A value of -1 means the internal + timer never expires. Set this input to -1 if you use an + Expiration Trigger to expire the watchdog task. + """ + val = ctypes.c_double() + + cfunc = lib_importer.windll.DAQmxGetWatchdogTimeout + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_double)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @timeout.setter + def timeout(self, val): + cfunc = lib_importer.windll.DAQmxSetWatchdogTimeout + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc( + self._handle, val) + check_for_error(error_code) + + @timeout.deleter + def timeout(self): + cfunc = lib_importer.windll.DAQmxResetWatchdogTimeout + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + @property + def name(self): + """ + str: Indicates the name of the task. + """ + cfunc = lib_importer.windll.DAQmxGetTaskName + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + def _control_watchdog_task(self, action): + """ + Controls the watchdog timer task according to the action you + specify. This function does not program the watchdog timer on a + real-time controller. Use the Real-Time Watchdog VIs to program + the watchdog timer on a real-time controller. + + Args: + action (nidaqmx.constants.WDTTaskAction): Specifies how to + control the watchdog timer task. + """ + cfunc = lib_importer.windll.DAQmxControlWatchdogTask + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, action.value) + check_for_error(error_code) + + def cfg_watchdog_ao_expir_states(self, expiration_states): + """ + Configures the expiration states for an analog watchdog timer task. + + Args: + expiration_states + (List[nidaqmx.system.watchdog.AOExpirationState]): + Contains the states to which to set analog physical channels + when the watchdog timer expires. Each element of the list + contains an analog physical channel name, the corresponding + expiration state, and the output type for that analog + physical channel. The units of "expiration state" must be + specified in volts for an analog output voltage expiration + state, or amps for an analog output current expiration state. + + physical_channel (str): Specifies the analog output channel to + modify. You cannot modify dedicated analog input lines. + expiration_state (float): Specifies the value to set the + channel to upon expiration. + output_type (nidaqmx.constants.WatchdogAOExpirState): + Specifies the output type of the physical channel. + Returns: + List[nidaqmx.system._watchdog_modules.expiration_state.ExpirationState]: + + Indicates the list of objects representing the configured + expiration states. + """ + channel_names = flatten_channel_string( + [e.physical_channel for e in expiration_states]) + expir_state = numpy.float64( + [e.expiration_state for e in expiration_states]) + output_type = numpy.int32( + [e.output_type.value for e in expiration_states]) + + cfunc = lib_importer.windll.DAQmxCfgWatchdogAOExpirStates + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + wrapped_ndpointer(dtype=numpy.float64, flags=('C', 'W')), + wrapped_ndpointer(dtype=numpy.int32, flags=('C', 'W')), + ctypes.c_uint] + + error_code = cfunc( + self._handle, channel_names, expir_state, output_type, + len(expiration_states)) + check_for_error(error_code) + + return [ExpirationState(self._handle, e.physical_channel) + for e in expiration_states] + + def cfg_watchdog_co_expir_states(self, expiration_states): + """ + Configures the expiration states for a counter watchdog timer task. + + Args: + expiration_states + (List[nidaqmx.system.watchdog.COExpirationState]): + Contains the states to which to set counter physical channels + when the watchdog timer expires. Each element of the list + contains a counter physical channel name and the corresponding + state for that counter physical channel. + + physical_channel (str): Specifies the counter output channel to + modify. You cannot modify dedicated counter input lines. + expiration_state (nidaqmx.constants.WatchdogCOExpirState): + Specifies the value to set the channel to upon expiration. + Returns: + List[nidaqmx.system._watchdog_modules.expiration_state.ExpirationState]: + + Indicates the list of objects representing the configured + expiration states. + """ + channel_names = flatten_channel_string( + [e.physical_channel for e in expiration_states]) + expir_state = numpy.int32( + [e.expiration_state.value for e in expiration_states]) + + cfunc = lib_importer.windll.DAQmxCfgWatchdogCOExpirStates + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + wrapped_ndpointer(dtype=numpy.int32, flags=('C', 'W')), + ctypes.c_uint] + + error_code = cfunc( + self._handle, channel_names, expir_state, len(expiration_states)) + check_for_error(error_code) + + return [ExpirationState(self._handle, e.physical_channel) + for e in expiration_states] + + def cfg_watchdog_do_expir_states(self, expiration_states): + """ + Configures the expiration states for a digital watchdog timer task. + + Args: + expiration_states + (List[nidaqmx.system.watchdog.DOExpirationState]): + Contains the states to which to set digital physical channels + when the watchdog timer expires. Each element of the list + contains a digital physical channel name and the corresponding + state for that digital physical channel. + + physical_channel (str): Specifies the digital output channel to + modify. You cannot modify dedicated digital input lines. + expiration_state (nidaqmx.constants.Level): Specifies the + value to set the channel to upon expiration. + Returns: + List[nidaqmx.system._watchdog_modules.expiration_state.ExpirationState]: + + Indicates the list of objects representing the configured + expiration states. + """ + channel_names = flatten_channel_string( + [e.physical_channel for e in expiration_states]) + expir_state = numpy.int32( + [e.expiration_state.value for e in expiration_states]) + + cfunc = lib_importer.windll.DAQmxCfgWatchdogDOExpirStates + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, + wrapped_ndpointer(dtype=numpy.int32, flags=('C', 'W')), + ctypes.c_uint] + + error_code = cfunc( + self._handle, channel_names, expir_state, len(expiration_states)) + check_for_error(error_code) + + return [ExpirationState(self._handle, e.physical_channel) + for e in expiration_states] + + def clear_expiration(self): + """ + Unlock a device whose watchdog timer expired. + + This function does not program the watchdog timer on a real-time + controller. Use the Real-Time Watchdog VIs to program the watchdog + timer on a real-time controller. + """ + self._control_watchdog_task(WDTTaskAction.CLEAR_EXPIRATION) + + def close(self): + """ + Clears the task. + + Before clearing, this method aborts the task, if necessary, + and releases any resources the task reserved. You cannot use a task + after you clear it unless you recreate the task. + + If you create a DAQmx Task object within a loop, use this method + within the loop after you are finished with the task to avoid + allocating unnecessary memory. + """ + if self._handle is None: + warnings.warn( + 'Attempted to close NI-DAQmx task of name "{0}" but task was ' + 'already closed.'.format(self._saved_name), DaqResourceWarning) + return + + cfunc = lib_importer.windll.DAQmxClearTask + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc(self._handle) + check_for_error(error_code) + + self._handle = None + + def control(self, action): + """ + Alters the state of a task according to the action you specify. + + Args: + action (nidaqmx.constants.TaskMode): Specifies how to alter + the task state. + """ + cfunc = lib_importer.windll.DAQmxTaskControl + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, action.value) + check_for_error(error_code) + + def reset_timer(self): + """ + Reset the internal timer. You must continually reset the internal + timer to prevent it from timing out and locking the device. + + This function does not program the watchdog timer on a real-time + controller. Use the Real-Time Watchdog VIs to program the watchdog + timer on a real-time controller. + """ + self._control_watchdog_task(WDTTaskAction.RESET_TIMER) + + def start(self): + """ + Transitions the task to the running state to begin the measurement + or generation. Using this method is required for some applications and + is optional for others. + """ + cfunc = lib_importer.windll.DAQmxStartTask + cfunc.argtypes = [lib_importer.task_handle] + + error_code = cfunc(self._handle) + check_for_error(error_code) + + def stop(self): + """ + Stops the task and returns it to the state the task was in before the + DAQmx Start Task method ran. + """ + cfunc = lib_importer.windll.DAQmxStopTask + cfunc.argtypes = [lib_importer.task_handle] + + error_code = cfunc(self._handle) + check_for_error(error_code) diff --git a/nidaqmx/task.py b/nidaqmx/task.py new file mode 100644 index 00000000..afebe12f --- /dev/null +++ b/nidaqmx/task.py @@ -0,0 +1,1252 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import ctypes +import numpy +import six +import warnings + +from nidaqmx._lib import lib_importer, ctypes_byte_str, c_bool32 +from nidaqmx._task_modules.channels.channel import Channel +from nidaqmx._task_modules.export_signals import ExportSignals +from nidaqmx._task_modules.in_stream import InStream +from nidaqmx._task_modules.read_functions import ( + _read_analog_f_64, _read_digital_lines, _read_digital_u_32, _read_ctr_freq, + _read_ctr_time, _read_ctr_ticks, _read_counter_u_32_ex, + _read_counter_f_64_ex) +from nidaqmx._task_modules.timing import Timing +from nidaqmx._task_modules.triggers import Triggers +from nidaqmx._task_modules.out_stream import OutStream +from nidaqmx._task_modules.ai_channel_collection import ( + AIChannelCollection) +from nidaqmx._task_modules.ao_channel_collection import ( + AOChannelCollection) +from nidaqmx._task_modules.ci_channel_collection import ( + CIChannelCollection) +from nidaqmx._task_modules.co_channel_collection import ( + COChannelCollection) +from nidaqmx._task_modules.di_channel_collection import ( + DIChannelCollection) +from nidaqmx._task_modules.do_channel_collection import ( + DOChannelCollection) +from nidaqmx._task_modules.write_functions import ( + _write_analog_f_64, _write_digital_lines, _write_digital_u_32, + _write_ctr_freq, _write_ctr_time, _write_ctr_ticks) +from nidaqmx.constants import ( + AcquisitionType, ChannelType, UsageTypeCI, EveryNSamplesEventType, + READ_ALL_AVAILABLE, UsageTypeCO, _Save) +from nidaqmx.error_codes import DAQmxErrors +from nidaqmx.errors import ( + check_for_error, is_string_buffer_too_small, DaqError, DaqResourceWarning) +from nidaqmx.system.device import Device +from nidaqmx.types import CtrFreq, CtrTick, CtrTime +from nidaqmx.utils import unflatten_channel_string, flatten_channel_string + +__all__ = ['Task'] + + +class UnsetNumSamplesSentinel(object): + pass + + +class UnsetAutoStartSentinel(object): + pass + + +NUM_SAMPLES_UNSET = UnsetNumSamplesSentinel() +AUTO_START_UNSET = UnsetAutoStartSentinel() + +del UnsetNumSamplesSentinel +del UnsetAutoStartSentinel + + +class Task(object): + """ + Represents a DAQmx Task. + """ + + def __init__(self, new_task_name=''): + """ + Creates a DAQmx task. + + Args: + new_task_name (Optional[str]): Specifies the name to assign to + the task. + + If you use this method in a loop and specify a name for the + task, you must use the DAQmx Clear Task method within the loop + after you are finished with the task. Otherwise, NI-DAQmx + attempts to create multiple tasks with the same name, which + results in an error. + """ + self._handle = lib_importer.task_handle(0) + + cfunc = lib_importer.windll.DAQmxCreateTask + cfunc.argtypes = [ + ctypes_byte_str, ctypes.POINTER(lib_importer.task_handle)] + + error_code = cfunc( + new_task_name, ctypes.byref(self._handle)) + check_for_error(error_code) + + self._initialize(self._handle) + + def __del__(self): + if self._handle is not None: + warnings.warn( + 'Task of name "{0}" was not explicitly closed before it was ' + 'destructed. Resources on the task device may still be ' + 'reserved.'.format(self.name), DaqResourceWarning) + + def __enter__(self): + return self + + def __eq__(self, other): + if isinstance(other, self.__class__): + return self._handle == other._handle + return False + + def __exit__(self, type, value, traceback): + self.close() + + def __hash__(self): + return hash(self._handle) + + def __ne__(self, other): + return not self.__eq__(other) + + def __repr__(self): + return 'Task(name={0})'.format(self.name) + + @property + def name(self): + """ + str: Indicates the name of the task. + """ + cfunc = lib_importer.windll.DAQmxGetTaskName + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return val.value.decode('ascii') + + @property + def channels(self): + """ + :class:`nidaqmx._task_modules.channels.channel.Channel`: Specifies + a channel object that represents the entire list of virtual + channels in this task. + """ + return Channel._factory( + self._handle, flatten_channel_string(self.channel_names)) + + @property + def channel_names(self): + """ + List[str]: Indicates the names of all virtual channels in the task. + """ + cfunc = lib_importer.windll.DAQmxGetTaskChannels + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return unflatten_channel_string(val.value.decode('ascii')) + + @property + def number_of_channels(self): + """ + int: Indicates the number of virtual channels in the task. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetTaskNumChans + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def devices(self): + """ + List[:class:`nidaqmx.system.device.Device`]: Indicates a list + of Device objects representing all the devices in the task. + """ + cfunc = lib_importer.windll.DAQmxGetTaskDevices + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_char_p, ctypes.c_uint] + + temp_size = 0 + while True: + val = ctypes.create_string_buffer(temp_size) + + size_or_code = cfunc( + self._handle, val, temp_size) + + if is_string_buffer_too_small(size_or_code): + # Buffer size must have changed between calls; check again. + temp_size = 0 + elif size_or_code > 0 and temp_size == 0: + # Buffer size obtained, use to retrieve data. + temp_size = size_or_code + else: + break + + check_for_error(size_or_code) + + return [Device(v) for v in + unflatten_channel_string(val.value.decode('ascii'))] + + @property + def number_of_devices(self): + """ + int: Indicates the number of devices in the task. + """ + val = ctypes.c_uint() + + cfunc = lib_importer.windll.DAQmxGetTaskNumDevices + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(ctypes.c_uint)] + + error_code = cfunc( + self._handle, ctypes.byref(val)) + check_for_error(error_code) + + return val.value + + @property + def ai_channels(self): + """ + :class:`nidaqmx._task_modules.ai_channel_collection.AIChannelCollection`: + Gets the collection of analog input channels for this task. + """ + return self._ai_channels + + @property + def ao_channels(self): + """ + :class:`nidaqmx._task_modules.ao_channel_collection.AOChannelCollection`: + Gets the collection of analog output channels for this task. + """ + return self._ao_channels + + @property + def ci_channels(self): + """ + :class:`nidaqmx._task_modules.ci_channel_collection.CIChannelCollection`: + Gets the collection of counter input channels for this task. + """ + return self._ci_channels + + @property + def co_channels(self): + """ + :class:`nidaqmx._task_modules.co_channel_collection.COChannelCollection`: + Gets the collection of counter output channels for this task. + """ + return self._co_channels + + @property + def di_channels(self): + """ + :class:`nidaqmx._task_modules.di_channel_collection.DIChannelCollection`: + Gets the collection of digital input channels for this task. + """ + return self._di_channels + + @property + def do_channels(self): + """ + :class:`nidaqmx._task_modules.do_channel_collection.DOChannelCollection`: + Gets the collection of digital output channels for this task. + """ + return self._do_channels + + @property + def export_signals(self): + """ + :class:`nidaqmx._task_modules.export_signals.ExportSignals`: Gets the + exported signal configurations for the task. + """ + return self._export_signals + + @property + def in_stream(self): + """ + :class:`nidaqmx._task_modules.in_stream.InStream`: Gets the read + configurations for the task. + """ + return self._in_stream + + @property + def out_stream(self): + """ + :class:`nidaqmx._task_modules.out_stream.OutStream`: Gets the + write configurations for the task. + """ + return self._out_stream + + @property + def timing(self): + """ + :class:`nidaqmx._task_modules.timing.Timing`: Gets the timing + configurations for the task. + """ + return self._timing + + @property + def triggers(self): + """ + :class:`nidaqmx._task_modules.triggers.Triggers`: Gets the trigger + configurations for the task. + """ + return self._triggers + + def _initialize(self, task_handle): + """ + Instantiates and populates various attributes used by this task. + + Args: + task_handle (TaskHandle): Specifies the handle for this task. + """ + # Saved name is used in self.close() to throw graceful error on + # double closes. + self._saved_name = self.name + + self._ai_channels = AIChannelCollection(task_handle) + self._ao_channels = AOChannelCollection(task_handle) + self._ci_channels = CIChannelCollection(task_handle) + self._co_channels = COChannelCollection(task_handle) + self._di_channels = DIChannelCollection(task_handle) + self._do_channels = DOChannelCollection(task_handle) + self._export_signals = ExportSignals(task_handle) + self._in_stream = InStream(self) + self._timing = Timing(task_handle) + self._triggers = Triggers(task_handle) + self._out_stream = OutStream(self) + + # These lists keep C callback objects in memory as ctypes doesn't. + # Program will crash if callback is made after object is garbage + # collected. + self._done_event_callbacks = [] + self._every_n_transferred_event_callbacks = [] + self._every_n_acquired_event_callbacks = [] + self._signal_event_callbacks = [] + + def _calculate_num_samps_per_chan(self, num_samps_per_chan): + """ + Calculates the actual number of samples per channel to read. + + This method is necessary because the number of samples per channel + can be set to NUM_SAMPLES_UNSET or -1, where each value entails a + different method of calculating the actual number of samples per + channel to read. + + Args: + num_samps_per_chan (int): Specifies the number of samples per + channel. + """ + if num_samps_per_chan is NUM_SAMPLES_UNSET: + return 1 + elif num_samps_per_chan == READ_ALL_AVAILABLE: + acq_type = self.timing.samp_quant_samp_mode + + if (acq_type == AcquisitionType.FINITE and + not self.in_stream.read_all_avail_samp): + return self.timing.samp_quant_samp_per_chan + else: + return self.in_stream.avail_samp_per_chan + else: + return num_samps_per_chan + + def add_global_channels(self, global_channels): + """ + Adds global virtual channels from MAX to the given task. + + Args: + global_channels (List[nidaqmx.system.storage.persisted_channel.PersistedChannel]): + Specifies the channels to add to the task. + + These channels must be valid channels available from MAX. + If you pass an invalid channel, NI-DAQmx returns an error. + This value is ignored if it is empty. + """ + cfunc = lib_importer.windll.DAQmxAddGlobalChansToTask + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str] + + channels = flatten_channel_string([g._name for g in global_channels]) + + error_code = cfunc( + self._handle, channels) + check_for_error(error_code) + + def close(self): + """ + Clears the task. + + Before clearing, this method aborts the task, if necessary, + and releases any resources the task reserved. You cannot use a task + after you clear it unless you recreate the task. + + If you create a DAQmx Task object within a loop, use this method + within the loop after you are finished with the task to avoid + allocating unnecessary memory. + """ + if self._handle is None: + warnings.warn( + 'Attempted to close NI-DAQmx task of name "{0}" but task was ' + 'already closed.'.format(self._saved_name), DaqResourceWarning) + return + + cfunc = lib_importer.windll.DAQmxClearTask + cfunc.argtypes = [ + lib_importer.task_handle] + + error_code = cfunc( + self._handle) + check_for_error(error_code) + + self._handle = None + + def control(self, action): + """ + Alters the state of a task according to the action you specify. + + Args: + action (nidaqmx.constants.TaskMode): Specifies how to alter + the task state. + """ + cfunc = lib_importer.windll.DAQmxTaskControl + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int] + + error_code = cfunc( + self._handle, action.value) + check_for_error(error_code) + + def is_task_done(self): + """ + Queries the status of the task and indicates if it completed + execution. Use this function to ensure that the specified + operation is complete before you stop the task. + + Returns: + bool: + + Indicates if the measurement or generation completed. + """ + is_task_done = c_bool32() + + cfunc = lib_importer.windll.DAQmxIsTaskDone + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.POINTER(c_bool32)] + + error_code = cfunc( + self._handle, ctypes.byref(is_task_done)) + check_for_error(error_code) + + return is_task_done.value + + def read(self, number_of_samples_per_channel=NUM_SAMPLES_UNSET, + timeout=10.0): + """ + Reads samples from the task or virtual channels you specify. + + This read method is dynamic, and is capable of inferring an appropriate + return type based on these factors: + - The channel type of the task. + - The number of channels to read. + - The number of samples per channel. + + The data type of the samples returned is independently determined by + the channel type of the task. + + For digital input measurements, the data type of the samples returned + is determined by the line grouping format of the digital lines. + If the line grouping format is set to "one channel for all lines", the + data type of the samples returned is int. If the line grouping + format is set to "one channel per line", the data type of the samples + returned is boolean. + + If you do not set the number of samples per channel, this method + assumes one sample was requested. This method then returns either a + scalar (1 channel to read) or a list (N channels to read). + + If you set the number of samples per channel to ANY value (even 1), + this method assumes multiple samples were requested. This method then + returns either a list (1 channel to read) or a list of lists (N + channels to read). + + Args: + number_of_samples_per_channel (Optional[int]): Specifies the + number of samples to read. If this input is not set, + assumes samples to read is 1. Conversely, if this input + is set, assumes there are multiple samples to read. + + If you set this input to nidaqmx.constants. + READ_ALL_AVAILABLE, NI-DAQmx determines how many samples + to read based on if the task acquires samples + continuously or acquires a finite number of samples. + + If the task acquires samples continuously and you set + this input to nidaqmx.constants.READ_ALL_AVAILABLE, this + method reads all the samples currently available in the + buffer. + + If the task acquires a finite number of samples and you + set this input to nidaqmx.constants.READ_ALL_AVAILABLE, + the method waits for the task to acquire all requested + samples, then reads those samples. If you set the + "read_all_avail_samp" property to True, the method reads + the samples currently available in the buffer and does + not wait for the task to acquire all requested samples. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for samples to become available. If the + time elapses, the method returns an error and any + samples read before the timeout elapsed. The default + timeout is 10 seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to read the requested samples and returns an error + if it is unable to. + Returns: + dynamic: + + The samples requested in the form of a scalar, a list, or a + list of lists. See method docstring for more info. + + NI-DAQmx scales the data to the units of the measurement, + including any custom scaling you apply to the channels. Use a + DAQmx Create Channel method to specify these units. + + Example: + >>> task = Task() + >>> task.ai_channels.add_voltage_channel('Dev1/ai0:3') + >>> data = task.read() + >>> type(data) + + >>> type(data[0]) + + """ + channels_to_read = self.in_stream.channels_to_read + number_of_channels = len(channels_to_read.channel_names) + read_chan_type = channels_to_read.chan_type + + num_samples_not_set = (number_of_samples_per_channel is + NUM_SAMPLES_UNSET) + + number_of_samples_per_channel = self._calculate_num_samps_per_chan( + number_of_samples_per_channel) + + # Determine the array shape and size to create + if number_of_channels > 1: + if not num_samples_not_set: + array_shape = (number_of_channels, + number_of_samples_per_channel) + else: + array_shape = number_of_channels + else: + array_shape = number_of_samples_per_channel + + # Analog Input + if read_chan_type == ChannelType.ANALOG_INPUT: + data = numpy.zeros(array_shape, dtype=numpy.float64) + samples_read = _read_analog_f_64( + self._handle, data, number_of_samples_per_channel, timeout) + + # Digital Input or Digital Output + elif (read_chan_type == ChannelType.DIGITAL_INPUT or + read_chan_type == ChannelType.DIGITAL_OUTPUT): + if self.in_stream.di_num_booleans_per_chan == 1: + data = numpy.zeros(array_shape, dtype=numpy.bool) + samples_read = _read_digital_lines( + self._handle, data, number_of_samples_per_channel, timeout + ).samps_per_chan_read + else: + data = numpy.zeros(array_shape, dtype=numpy.uint32) + samples_read = _read_digital_u_32( + self._handle, data, number_of_samples_per_channel, timeout) + + # Counter Input + elif read_chan_type == ChannelType.COUNTER_INPUT: + meas_type = channels_to_read.ci_meas_type + + if meas_type == UsageTypeCI.PULSE_FREQ: + frequencies = numpy.zeros(array_shape, dtype=numpy.float64) + duty_cycles = numpy.zeros(array_shape, dtype=numpy.float64) + + samples_read = _read_ctr_freq( + self._handle, frequencies, duty_cycles, + number_of_samples_per_channel, timeout) + + data = [] + for f, d in zip(frequencies, duty_cycles): + data.append(CtrFreq(freq=f, duty_cycle=d)) + + elif meas_type == UsageTypeCI.PULSE_TIME: + high_times = numpy.zeros(array_shape, dtype=numpy.float64) + low_times = numpy.zeros(array_shape, dtype=numpy.float64) + + samples_read = _read_ctr_time( + self._handle, high_times, low_times, + number_of_samples_per_channel, timeout) + data = [] + for h, l in zip(high_times, low_times): + data.append(CtrTime(high_time=h, low_time=l)) + + elif meas_type == UsageTypeCI.PULSE_TICKS: + high_ticks = numpy.zeros(array_shape, dtype=numpy.uint32) + low_ticks = numpy.zeros(array_shape, dtype=numpy.uint32) + + samples_read = _read_ctr_ticks( + self._handle, high_ticks, low_ticks, + number_of_samples_per_channel, timeout) + data = [] + for h, l in zip(high_ticks, low_ticks): + data.append(CtrTick(high_tick=h, low_tick=l)) + + elif meas_type == UsageTypeCI.COUNT_EDGES: + data = numpy.zeros(array_shape, dtype=numpy.uint32) + + samples_read = _read_counter_u_32_ex( + self._handle, data, number_of_samples_per_channel, timeout) + + else: + data = numpy.zeros(array_shape, dtype=numpy.float64) + + samples_read = _read_counter_f_64_ex( + self._handle, data, number_of_samples_per_channel, timeout) + else: + raise DaqError( + 'Read failed, because there are no channels in this task from ' + 'which data can be read.', + DAQmxErrors.READ_NO_INPUT_CHANS_IN_TASK.value, + task_name=self.name) + + if (read_chan_type == ChannelType.COUNTER_INPUT and + (meas_type == UsageTypeCI.PULSE_FREQ or + meas_type == UsageTypeCI.PULSE_TICKS or + meas_type == UsageTypeCI.PULSE_TIME)): + + if num_samples_not_set and array_shape == 1: + return data[0] + # Counter pulse measurements should not have N channel versions. + if samples_read != number_of_samples_per_channel: + return data[:samples_read] + return data + + if num_samples_not_set and array_shape == 1: + return data.tolist()[0] + + if samples_read != number_of_samples_per_channel: + if number_of_channels > 1: + return data[:,:samples_read].tolist() + else: + return data[:samples_read].tolist() + + return data.tolist() + + def register_done_event(self, callback_method): + """ + Registers a callback function to receive an event when a task stops due + to an error or when a finite acquisition task or finite generation task + completes execution. A Done event does not occur when a task is stopped + explicitly, such as by calling DAQmx Stop Task. + + Args: + callback_method (function): Specifies the function that you want + DAQmx to call when the event occurs. The function you pass in + this parameter must have the following prototype: + + >>> def callback(task_handle, status, callback_data): + >>> return 0 + + Upon entry to the callback, the task_handle parameter contains + the handle to the task on which the event occurred. The status + parameter contains the status of the task when the event + occurred. If the status value is negative, it indicates an + error. If the status value is zero, it indicates no error. + If the status value is positive, it indicates a warning. The + callbackData parameter contains the value you passed in the + callbackData parameter of this function. + + Passing None for this parameter unregisters the event callback + function. + """ + DAQmxDoneEventCallbackPtr = ctypes.CFUNCTYPE( + ctypes.c_int32, lib_importer.task_handle, ctypes.c_int32, + ctypes.c_void_p) + + if callback_method is not None: + callback_method_ptr = DAQmxDoneEventCallbackPtr(callback_method) + self._done_event_callbacks.append(callback_method_ptr) + else: + del self._done_event_callbacks[:] + + cfunc = lib_importer.windll.DAQmxRegisterDoneEvent + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_uint, DAQmxDoneEventCallbackPtr, + ctypes.c_void_p] + + error_code = cfunc( + self._handle, 0, callback_method_ptr, None) + check_for_error(error_code) + + def register_every_n_samples_acquired_into_buffer_event( + self, sample_interval, callback_method): + """ + Registers a callback function to receive an event when the specified + number of samples is written from the device to the buffer. This + function only works with devices that support buffered tasks. + + When you stop a task explicitly any pending events are discarded. For + example, if you call DAQmx Stop Task then you do not receive any + pending events. + + Args: + sample_interval (int): Specifies the number of samples after + which each event should occur. + callback_method (function): Specifies the function that you want + DAQmx to call when the event occurs. The function you pass in + this parameter must have the following prototype: + + >>> def callback(task_handle, every_n_samples_event_type, + >>> number_of_samples, callback_data): + >>> return 0 + + Upon entry to the callback, the task_handle parameter contains + the handle to the task on which the event occurred. The + every_n_samples_event_type parameter contains the + EveryNSamplesEventType.ACQUIRED_INTO_BUFFER value. The + number_of_samples parameter contains the value you passed in + the sample_interval parameter of this function. The + callback_data parameter contains the value you passed in the + callback_data parameter of this function. + + Passing None for this parameter unregisters the event callback + function. + """ + DAQmxEveryNSamplesEventCallbackPtr = ctypes.CFUNCTYPE( + ctypes.c_int32, lib_importer.task_handle, ctypes.c_int32, + ctypes.c_uint32, ctypes.c_void_p) + + if callback_method is not None: + callback_method_ptr = DAQmxEveryNSamplesEventCallbackPtr( + callback_method) + self._every_n_acquired_event_callbacks.append( + callback_method_ptr) + else: + del self._every_n_acquired_event_callbacks[:] + + cfunc = lib_importer.windll.DAQmxRegisterEveryNSamplesEvent + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int, ctypes.c_uint, + ctypes.c_uint, DAQmxEveryNSamplesEventCallbackPtr, ctypes.c_void_p] + + error_code = cfunc( + self._handle, EveryNSamplesEventType.ACQUIRED_INTO_BUFFER.value, + sample_interval, 0, callback_method_ptr, None) + check_for_error(error_code) + + def register_every_n_samples_transferred_from_buffer_event( + self, sample_interval, callback_method): + """ + Registers a callback function to receive an event when the specified + number of samples is written from the buffer to the device. This + function only works with devices that support buffered tasks. + + When you stop a task explicitly any pending events are discarded. For + example, if you call DAQmx Stop Task then you do not receive any + pending events. + + Args: + sample_interval (int): Specifies the number of samples after + which each event should occur. + callback_method (function): Specifies the function that you want + DAQmx to call when the event occurs. The function you pass in + this parameter must have the following prototype: + + >>> def callback(task_handle, every_n_samples_event_type, + >>> number_of_samples, callback_data): + >>> return 0 + + Upon entry to the callback, the task_handle parameter contains + the handle to the task on which the event occurred. The + every_n_samples_event_type parameter contains the + EveryNSamplesEventType.TRANSFERRED_FROM_BUFFER value. The + number_of_samples parameter contains the value you passed in + the sample_interval parameter of this function. The + callback_data parameter contains the value you passed in the + callback_data parameter of this function. + + Passing None for this parameter unregisters the event callback + function. + """ + DAQmxEveryNSamplesEventCallbackPtr = ctypes.CFUNCTYPE( + ctypes.c_int32, lib_importer.task_handle, ctypes.c_int32, + ctypes.c_uint32, ctypes.c_void_p) + + if callback_method is not None: + callback_method_ptr = DAQmxEveryNSamplesEventCallbackPtr( + callback_method) + self._every_n_transferred_event_callbacks.append( + callback_method_ptr) + else: + del self._every_n_transferred_event_callbacks[:] + + cfunc = lib_importer.windll.DAQmxRegisterEveryNSamplesEvent + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int, ctypes.c_uint, + ctypes.c_uint, DAQmxEveryNSamplesEventCallbackPtr, + ctypes.c_void_p] + + error_code = cfunc( + self._handle, EveryNSamplesEventType.TRANSFERRED_FROM_BUFFER.value, + sample_interval, 0, callback_method_ptr, None) + check_for_error(error_code) + + def register_signal_event(self, signal_type, callback_method): + """ + Registers a callback function to receive an event when the specified + hardware event occurs. + + When you stop a task explicitly any pending events are discarded. For + example, if you call DAQmx Stop Task then you do not receive any + pending events. + + Args: + signal_type (nidaqmx.constants.Signal): Specifies the type of + signal for which you want to receive results. + callback_method (function): Specifies the function that you want + DAQmx to call when the event occurs. The function you pass in + this parameter must have the following prototype: + + >>> def callback(task_handle, signal_type, callback_data): + >>> return 0 + + Upon entry to the callback, the task_handle parameter contains + the handle to the task on which the event occurred. The + signal_type parameter contains the integer value you passed in + the signal_type parameter of this function. The callback_data + parameter contains the value you passed in the callback_data + parameter of this function. + + Passing None for this parameter unregisters the event callback + function. + """ + DAQmxSignalEventCallbackPtr = ctypes.CFUNCTYPE( + ctypes.c_int32, lib_importer.task_handle, ctypes.c_int32, + ctypes.c_void_p) + + if callback_method is not None: + callback_method_ptr = DAQmxSignalEventCallbackPtr(callback_method) + self._signal_event_callbacks.append(callback_method_ptr) + else: + del self._signal_event_callbacks[:] + + cfunc = lib_importer.daqlib.DAQmxRegisterSignalEvent + cfunc.argtypes = [ + lib_importer.task_handle, ctypes.c_int, ctypes.c_uint, + DAQmxSignalEventCallbackPtr, ctypes.c_void_p] + + error_code = cfunc( + self._handle, signal_type.value, 0, callback_method_ptr, None) + check_for_error(error_code) + + def save(self, save_as="", author="", overwrite_existing_task=False, + allow_interactive_editing=True, allow_interactive_deletion=True): + """ + Saves this task and any local channels it contains to MAX. + + This function does not save global channels. Use the DAQmx Save + Global Channel function to save global channels. + + Args: + save_as (Optional[str]): Is the name to save the task, + global channel, or custom scale as. If you do not + specify a value for this input, NI-DAQmx uses the name + currently assigned to the task, global channel, or + custom scale. + author (Optional[str]): Is a name to store with the task, + global channel, or custom scale. + overwrite_existing_task (Optional[bool]): Specifies whether to + overwrite a task of the same name if one is already saved in + MAX. If this input is False and a task of the same name is + already saved in MAX, this function returns an error. + allow_interactive_editing (Optional[bool]): Specifies whether to + allow the task, global channel, or custom scale to be edited + in the DAQ Assistant. If allow_interactive_editing is True, + the DAQ Assistant must support all task or global channel + settings. + allow_interactive_deletion (Optional[bool]): Specifies whether + to allow the task, global channel, or custom scale to be + deleted through MAX. + """ + options = 0 + if overwrite_existing_task: + options |= _Save.OVERWRITE.value + if allow_interactive_editing: + options |= _Save.ALLOW_INTERACTIVE_EDITING.value + if allow_interactive_deletion: + options |= _Save.ALLOW_INTERACTIVE_DELETION.value + + cfunc = lib_importer.windll.DAQmxSaveTask + cfunc.argtypes = [ + lib_importer.task_handle, ctypes_byte_str, ctypes_byte_str, + ctypes.c_uint] + + error_code = cfunc( + self._handle, save_as, author, options) + check_for_error(error_code) + + def start(self): + """ + Transitions the task to the running state to begin the measurement + or generation. Using this method is required for some applications and + is optional for others. + + If you do not use this method, a measurement task starts automatically + when the DAQmx Read method runs. The autostart input of the DAQmx Write + method determines if a generation task starts automatically when the + DAQmx Write method runs. + + If you do not use the DAQmx Start Task method and the DAQmx Stop Task + method when you use the DAQmx Read method or the DAQmx Write method + multiple times, such as in a loop, the task starts and stops + repeatedly. Starting and stopping a task repeatedly reduces the + performance of the application. + """ + cfunc = lib_importer.windll.DAQmxStartTask + cfunc.argtypes = [lib_importer.task_handle] + + error_code = cfunc(self._handle) + check_for_error(error_code) + + def stop(self): + """ + Stops the task and returns it to the state the task was in before the + DAQmx Start Task method ran or the DAQmx Write method ran with the + autostart input set to TRUE. + + If you do not use the DAQmx Start Task method and the DAQmx Stop Task + method when you use the DAQmx Read method or the DAQmx Write method + multiple times, such as in a loop, the task starts and stops + repeatedly. Starting and stopping a task repeatedly reduces the + performance of the application. + """ + cfunc = lib_importer.windll.DAQmxStopTask + cfunc.argtypes = [lib_importer.task_handle] + + error_code = cfunc(self._handle) + check_for_error(error_code) + + def wait_until_done(self, timeout=10.0): + """ + Waits for the measurement or generation to complete. + + Use this method to ensure that the specified operation is complete + before you stop the task. + + Args: + timeout (Optional[float]): Specifies the maximum amount of time in + seconds to wait for the measurement or generation to complete. + This method returns an error if the time elapses. The + default is 10. If you set timeout (sec) to + nidaqmx.WAIT_INFINITELY, the method waits indefinitely. If you + set timeout (sec) to 0, the method checks once and returns + an error if the measurement or generation is not done. + """ + cfunc = lib_importer.windll.DAQmxWaitUntilTaskDone + cfunc.argtypes = [lib_importer.task_handle, ctypes.c_double] + + error_code = cfunc(self._handle, timeout) + check_for_error(error_code) + + def _raise_invalid_num_lines_error( + self, num_lines_expected, num_lines_in_data): + raise DaqError( + 'Specified read or write operation failed, because the number ' + 'of lines in the data for a channel does not match the number ' + 'of lines in the channel.\n\n' + 'If you are using boolean data, make sure the array dimension ' + 'for lines in the data matches the number of lines in the ' + 'channel.\n\n' + 'Number of Lines Per Channel in Task: {0}\n' + 'Number of Lines Per Channel in Data: {1}' + .format(num_lines_expected, num_lines_in_data), + DAQmxErrors.NUM_LINES_MISMATCH_IN_READ_OR_WRITE.value, + task_name=self.name) + + def _raise_invalid_write_num_chans_error( + self, number_of_channels, number_of_channels_in_data): + + raise DaqError( + 'Write cannot be performed, because the number of channels in the ' + 'data does not match the number of channels in the task.\n\n' + 'When writing, supply data for all channels in the task. ' + 'Alternatively, modify the task to contain the same number of ' + 'channels as the data written.\n\n' + 'Number of Channels in Task: {0}\n' + 'Number of Channels in Data: {1}' + .format(number_of_channels, number_of_channels_in_data), + DAQmxErrors.WRITE_NUM_CHANS_MISMATCH.value, task_name=self.name) + + def write(self, data, auto_start=AUTO_START_UNSET, timeout=10.0): + """ + Writes samples to the task or virtual channels you specify. + + This write method is dynamic, and is capable of accepting the + samples to write in the various forms for most operations: + + - Scalar: Single sample for 1 channel. + - List/1D numpy.ndarray: Multiple samples for 1 channel or 1 + sample for multiple channels. + - List of lists/2D numpy.ndarray: Multiple samples for multiple + channels. + + The data type of the samples passed in must be appropriate for + the channel type of the task. + + For counter output pulse operations, this write method only + accepts samples in these forms: + + - Scalar CtrFreq, CtrTime, CtrTick (from nidaqmx.types): + Single sample for 1 channel. + - List of CtrFreq, CtrTime, CtrTick (from nidaqmx.types): + Multiple samples for 1 channel or 1 sample for multiple + channels. + + If the task uses on-demand timing, this method returns only + after the device generates all samples. On-demand is the default + timing type if you do not use the timing property on the task to + configure a sample timing type. If the task uses any timing type + other than on-demand, this method returns immediately and does + not wait for the device to generate all samples. Your + application must determine if the task is done to ensure that + the device generated all samples. + + Args: + data (dynamic): Contains the samples to write to the task. + + The data you write must be in the units of the + generation, including any custom scales. Use the DAQmx + Create Channel methods to specify these units. + auto_start (Optional[bool]): Specifies if this method + automatically starts the task if you did not explicitly + start it with the DAQmx Start Task method. + + The default value of this parameter depends on whether + you specify one sample or many samples to write to each + channel. If one sample per channel was specified, the + default value is True. If multiple samples per channel + were specified, the default value is False. + timeout (Optional[float]): Specifies the amount of time in + seconds to wait for the method to write all samples. + NI-DAQmx performs a timeout check only if the method + must wait before it writes data. This method returns an + error if the time elapses. The default timeout is 10 + seconds. If you set timeout to + nidaqmx.constants.WAIT_INFINITELY, the method waits + indefinitely. If you set timeout to 0, the method tries + once to write the submitted samples. If the method could + not write all the submitted samples, it returns an error + and the number of samples successfully written. + Returns: + int: + + Specifies the actual number of samples this method + successfully wrote. + """ + channels_to_write = self.channels + number_of_channels = len(channels_to_write.channel_names) + write_chan_type = channels_to_write.chan_type + + element = None + if number_of_channels == 1: + if isinstance(data, list): + if isinstance(data[0], list): + self._raise_invalid_write_num_chans_error( + number_of_channels, len(data)) + + number_of_samples_per_channel = len(data) + element = data[0] + + elif isinstance(data, numpy.ndarray): + if len(data.shape) == 2: + self._raise_invalid_write_num_chans_error( + number_of_channels, data.shape[0]) + + number_of_samples_per_channel = len(data) + element = data[0] + + else: + number_of_samples_per_channel = 1 + element = data + + else: + if isinstance(data, list): + if len(data) != number_of_channels: + self._raise_invalid_write_num_chans_error( + number_of_channels, len(data)) + + if isinstance(data[0], list): + number_of_samples_per_channel = len(data[0]) + element = data[0][0] + else: + number_of_samples_per_channel = 1 + element = data[0] + + elif isinstance(data, numpy.ndarray): + if data.shape[0] != number_of_channels: + self._raise_invalid_write_num_chans_error( + number_of_channels, data.shape[0]) + + if len(data.shape) == 2: + number_of_samples_per_channel = data.shape[1] + element = data[0][0] + else: + number_of_samples_per_channel = 1 + element = data[0] + + else: + self._raise_invalid_write_num_chans_error( + number_of_channels, 1) + + if auto_start is AUTO_START_UNSET: + if number_of_samples_per_channel > 1: + auto_start = False + else: + auto_start = True + + # Analog Input + if write_chan_type == ChannelType.ANALOG_OUTPUT: + data = numpy.asarray(data, dtype=numpy.float64) + return _write_analog_f_64( + self._handle, data, number_of_samples_per_channel, auto_start, + timeout) + + # Digital Input + elif write_chan_type == ChannelType.DIGITAL_OUTPUT: + if self.out_stream.do_num_booleans_per_chan == 1: + if (not isinstance(element, bool) and + not isinstance(element, numpy.bool_)): + raise DaqError( + 'Write failed, because this write method only accepts ' + 'boolean samples when there is one digital line per ' + 'channel in a task.\n\n' + 'Requested sample type: {0}'.format(type(element)), + DAQmxErrors.UNKNOWN.value, task_name=self.name) + + data = numpy.asarray(data, dtype=numpy.bool) + return _write_digital_lines( + self._handle, data, number_of_samples_per_channel, + auto_start, timeout) + else: + if (not isinstance(element, six.integer_types) and + not isinstance(element, numpy.uint32)): + raise DaqError( + 'Write failed, because this write method only accepts ' + 'unsigned 32-bit integer samples when there are ' + 'multiple digital lines per channel in a task.\n\n' + 'Requested sample type: {0}'.format(type(element)), + DAQmxErrors.UNKNOWN.value, task_name=self.name) + + data = numpy.asarray(data, dtype=numpy.uint32) + return _write_digital_u_32( + self._handle, data, number_of_samples_per_channel, + auto_start, timeout) + + # Counter Input + elif write_chan_type == ChannelType.COUNTER_OUTPUT: + output_type = channels_to_write.co_output_type + + if number_of_samples_per_channel == 1: + data = [data] + + if output_type == UsageTypeCO.PULSE_FREQUENCY: + frequencies = [] + duty_cycles = [] + for sample in data: + frequencies.append(sample.duty_cycle) + duty_cycles.append(sample.freq) + + frequencies = numpy.asarray(frequencies, dtype=numpy.float64) + duty_cycles = numpy.asarray(duty_cycles, dtype=numpy.float64) + + return _write_ctr_freq( + self._handle, frequencies, duty_cycles, + number_of_samples_per_channel, auto_start, timeout) + + elif output_type == UsageTypeCO.PULSE_TIME: + high_times = [] + low_times = [] + for sample in data: + high_times.append(sample.high_time) + low_times.append(sample.low_time) + + high_times = numpy.asarray(high_times, dtype=numpy.float64) + low_times = numpy.asarray(low_times, dtype=numpy.float64) + + return _write_ctr_time( + self._handle, high_times, low_times, + number_of_samples_per_channel, auto_start, timeout) + + elif output_type == UsageTypeCO.PULSE_TICKS: + high_ticks = [] + low_ticks = [] + for sample in data: + high_ticks.append(sample.high_tick) + low_ticks.append(sample.low_tick) + + high_ticks = numpy.asarray(high_ticks, dtype=numpy.uint32) + low_ticks = numpy.asarray(low_ticks, dtype=numpy.uint32) + + return _write_ctr_ticks( + self._handle, high_ticks, low_ticks, + number_of_samples_per_channel, auto_start, timeout) + else: + raise DaqError( + 'Write failed, because there are no output channels in this ' + 'task to which data can be written.', + DAQmxErrors.WRITE_NO_OUTPUT_CHANS_IN_TASK.value, + task_name=self.name) diff --git a/nidaqmx/tests/__init__.py b/nidaqmx/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/nidaqmx/tests/fixtures.py b/nidaqmx/tests/fixtures.py new file mode 100644 index 00000000..4e6a9350 --- /dev/null +++ b/nidaqmx/tests/fixtures.py @@ -0,0 +1,41 @@ +import pytest +import nidaqmx.system +from nidaqmx.constants import ProductCategory, UsageTypeAI + + +class Error(Exception): + pass + + +class NoFixtureDetectedError(Error): + pass + + +@pytest.fixture(scope="module") +def x_series_device(): + system = nidaqmx.system.System.local() + + for device in system.devices: + if (not device.dev_is_simulated and + device.product_category == ProductCategory.X_SERIES_DAQ and + len(device.ao_physical_chans) >= 2 and + len(device.ai_physical_chans) >= 4 and + len(device.do_lines) >= 8 and + (len(device.di_lines) == len(device.do_lines)) and + len(device.ci_physical_chans) >= 4): + return device + + raise NoFixtureDetectedError( + 'Could not detect a device that meets the requirements to be an ' + 'X Series fixture. Cannot proceed to run tests.') + + +@pytest.fixture(scope="module") +def bridge_device(): + system = nidaqmx.system.System.local() + + for device in system.devices: + if UsageTypeAI.BRIDGE in device.ai_meas_types: + return device + + return None diff --git a/nidaqmx/tests/helpers.py b/nidaqmx/tests/helpers.py new file mode 100644 index 00000000..850ef642 --- /dev/null +++ b/nidaqmx/tests/helpers.py @@ -0,0 +1,34 @@ +import random +import sys + + +def generate_random_seed(): + return random.randint(0, sys.maxsize) + + +def is_close(a, b, rel_tol=1e-09, abs_tol=0.0): + """ + Determines whether one float value is approximately equal or "close" + to another float value. + + Copied from PEP 485. + + Args: + a (float): Specifies the first value to be tested for relative + closeness. + b (float): Specifies the second value to be tested for relative + closeness. + rel_tol (float): Specifies the relative tolerance -- it is the + amount of error allowed, relative to the larger absolute + value of a or b. For example, to set a tolerance of 5%, use + rel_tol=0.05. The default tolerance is 1e-9, which assures + that the two values are the same within about 9 decimal + digits. rel_tol must be greater than 0.0. + abs_tol (float): Specifies a minimum absolute tolerance level -- + useful for comparisons near zero. + + Returns: + bool: Indicates whether the first float value is approximately + equal or "close" to the second float value. + """ + return abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol) \ No newline at end of file diff --git a/nidaqmx/tests/max_config/nidaqmxMaxConfig.nce b/nidaqmx/tests/max_config/nidaqmxMaxConfig.nce new file mode 100644 index 0000000000000000000000000000000000000000..4dedc2a92902239ca5a58e2e192754748ed7bd87 GIT binary patch literal 6896 zcmeI0ZBSHI7{|}9sIa-X3oMH-OORm*$lI7xG+3geYeH@ymLlpR7g$^Gr3(q98JH8G zgp6ruBvA&E?^;lcGqf1mT9T5`5DcR-rD&t2sbrb-KYMqPUHqiem*yTg^E>A}=XsuU z{`cPf@DMVn`Cwf9+dISsj384z4)xhzh3RdZG>fhvOss(oO)zqq3}QqI(}i=`Y=&RXWM*S6 zTrSh`jMYCiku_vzVQm3t%+8X_92af#`FYk*2+Qbs=L4{uHLrn9ziDdgl;79K~vhXI4RC#>w&kg3xF}YAVX$r%LEcF{CMM zD}i_^6$-PPFtxrr^hJA=kP(Eqyu9~Tw}kW~gbV%@{r&wz0{ssbEdIEJgh=y;-o>K> z2CFIsi%7Y3gJez1BkIkq)4x^nA!QLF(I^mjh-l2+?`r>N=+CbPO zwA<}Zb?gW;2HXl@L#Lhf{qTCMvw!1VRZNiLz#EHyt>08VV)kWcyTNo__lM!UGXKQB zt9>!d2lPxr7xMEJ%7kaD-dkUOCB8S(ta5?Bly-am{5d;bT3b`Tb;8yf?~QZ+-Yr#_ z3GH@!*x~x66MLpGm7dX+&FUZa!`I>b!66%&$hVu@6?2CtmnuyO&i)1Z9De5+*RrGQ zRh<9UZmqNbnwV1lX4iM~-rXHJ?s#(mi^O>9M4rzI=TDks$!+wAdHRO>&Cy@4;J)fzy zEqk@RbNtygo!{SytJxA@I-+Zm7hZzhjdpwd5h2&ws@-d5mhz`g-cCHe1M%sXfG*^h z>%Ki7^o?fB>f-p*6^3WJ;On4Ib@~2_O$|NarR!utVUr8*!tU^W_+Hs|J>kc7abGmb z-tP=~fj)m)y&uS*vZ44!QiIRyri;cSzKwl*o&C)vmfO3wX~OR$r_5;6@NKX==y!L# r?#@nr^@XoCNopG!V*k45k1Y2Zy%T 0: + assert isinstance(scales[0], nidaqmx.system.storage.PersistedScale) + + # Test specific property on object. + assert isinstance(scales[0].author, six.string_types) + + def test_persisted_task_collection_property(self): + system = nidaqmx.system.System.local() + + tasks = system.tasks + assert isinstance(tasks, PersistedTaskCollection) + assert isinstance(tasks, collections.Sequence) + + if len(tasks) > 0: + assert isinstance(tasks[0], nidaqmx.system.storage.PersistedTask) + + # Test specific property on object. + assert isinstance(tasks[0].author, six.string_types) + + def test_persisted_channel_collection_property(self): + system = nidaqmx.system.System.local() + + global_channels = system.global_channels + assert isinstance(global_channels, PersistedChannelCollection) + assert isinstance(global_channels, collections.Sequence) + + if len(global_channels) > 0: + assert isinstance(global_channels[0], + nidaqmx.system.storage.PersistedChannel) + + # Test specific property on object. + assert isinstance(global_channels[0].author, six.string_types) + + def test_physical_channel_collection_property(self, x_series_device): + phys_chans = x_series_device.ai_physical_chans + + assert isinstance(phys_chans, PhysicalChannelCollection) + assert isinstance(phys_chans, collections.Sequence) + + assert isinstance(phys_chans[0], nidaqmx.system.PhysicalChannel) + + # Test specific property on object. + assert isinstance(phys_chans[0].ai_meas_types, list) diff --git a/nidaqmx/tests/test_teds.py b/nidaqmx/tests/test_teds.py new file mode 100644 index 00000000..0af762f0 --- /dev/null +++ b/nidaqmx/tests/test_teds.py @@ -0,0 +1,46 @@ +import os +import pytest +import random + +import nidaqmx +from nidaqmx.constants import TerminalConfiguration, TEDSUnits +from nidaqmx.tests.fixtures import x_series_device +from nidaqmx.tests.helpers import generate_random_seed + + +class TestTEDS(object): + """ + Contains a collection of pytest tests that validate the TEDS + functionality in the NI-DAQmx Python API. + """ + + @pytest.mark.parametrize('seed', [generate_random_seed()]) + def test_create_teds_ai_voltage_chan(self, x_series_device, seed): + # Reset the pseudorandom number generator with seed. + random.seed(seed) + + ai_phys_chan = random.choice(x_series_device.ai_physical_chans) + + # Generate path to a virtual TEDS file. + teds_file_path = os.path.join( + os.path.dirname(__file__), 'teds', 'Voltage.ted') + + ai_phys_chan.configure_teds(teds_file_path) + + assert ai_phys_chan.teds_mfg_id == 17 + assert ai_phys_chan.teds_model_num == 1 + assert ai_phys_chan.teds_version_letter == 'A' + assert ai_phys_chan.teds_version_num == 1 + assert ai_phys_chan.teds_template_ids == [30] + + with nidaqmx.Task() as task: + ai_channel = task.ai_channels.add_teds_ai_voltage_chan( + ai_phys_chan.name, + name_to_assign_to_channel="TEDSVoltageChannel", + terminal_config=TerminalConfiguration.DEFAULT, min_val=-300.0, + max_val=100.0, units=TEDSUnits.FROM_TEDS) + + assert ai_channel.ai_teds_is_teds + assert ai_channel.ai_teds_units == 'Kelvin' + assert ai_channel.ai_min == -300.0 + assert ai_channel.ai_max == 100.0 diff --git a/nidaqmx/tests/test_triggers.py b/nidaqmx/tests/test_triggers.py new file mode 100644 index 00000000..6ee6747d --- /dev/null +++ b/nidaqmx/tests/test_triggers.py @@ -0,0 +1,104 @@ +import pytest +import random + +import nidaqmx +from nidaqmx import DaqError +from nidaqmx.constants import TriggerType, Edge, AcquisitionType, TaskMode +from nidaqmx.tests.fixtures import x_series_device +from nidaqmx.tests.helpers import generate_random_seed +from nidaqmx.tests.test_read_write import TestDAQmxIOBase + + +class TestTriggers(TestDAQmxIOBase): + """ + Contains a collection of pytest tests that validate the triggers + functionality in the NI-DAQmx Python API. + """ + + @pytest.mark.parametrize('seed', [generate_random_seed()]) + def test_arm_start_trigger(self, x_series_device, seed): + # Reset the pseudorandom number generator with seed. + random.seed(seed) + + counter = random.choice(self._get_device_counters(x_series_device)) + + with nidaqmx.Task() as task: + task.co_channels.add_co_pulse_chan_freq(counter) + task.triggers.arm_start_trigger.trig_type = ( + TriggerType.DIGITAL_EDGE) + assert (task.triggers.arm_start_trigger.trig_type == + TriggerType.DIGITAL_EDGE) + + task.triggers.arm_start_trigger.trig_type = ( + TriggerType.NONE) + assert (task.triggers.arm_start_trigger.trig_type == + TriggerType.NONE) + + @pytest.mark.parametrize('seed', [generate_random_seed()]) + def test_handshake_trigger(self, x_series_device, seed): + # Reset the pseudorandom number generator with seed. + random.seed(seed) + + counter = random.choice(self._get_device_counters(x_series_device)) + + with nidaqmx.Task() as task: + task.co_channels.add_co_pulse_chan_freq(counter) + + with pytest.raises(DaqError) as e: + task.triggers.handshake_trigger.trig_type = ( + TriggerType.INTERLOCKED) + assert e.value.error_code == -200452 + + @pytest.mark.parametrize('seed', [generate_random_seed()]) + def test_pause_trigger(self, x_series_device, seed): + # Reset the pseudorandom number generator with seed. + random.seed(seed) + + counter = random.choice(self._get_device_counters(x_series_device)) + + with nidaqmx.Task() as task: + task.co_channels.add_co_pulse_chan_freq(counter) + task.timing.cfg_implicit_timing( + sample_mode=AcquisitionType.CONTINUOUS) + + task.triggers.pause_trigger.trig_type = ( + TriggerType.DIGITAL_LEVEL) + assert (task.triggers.pause_trigger.trig_type == + TriggerType.DIGITAL_LEVEL) + + task.triggers.pause_trigger.trig_type = ( + TriggerType.NONE) + assert (task.triggers.pause_trigger.trig_type == + TriggerType.NONE) + + @pytest.mark.parametrize('seed', [generate_random_seed()]) + def test_reference_trigger(self, x_series_device, seed): + # Reset the pseudorandom number generator with seed. + random.seed(seed) + + counter = random.choice(self._get_device_counters(x_series_device)) + + with nidaqmx.Task() as task: + task.co_channels.add_co_pulse_chan_freq(counter) + + with pytest.raises(DaqError) as e: + task.triggers.reference_trigger.trig_type = ( + TriggerType.NONE) + assert e.value.error_code == -200452 + + @pytest.mark.parametrize('seed', [generate_random_seed()]) + def test_start_trigger(self, x_series_device, seed): + # Reset the pseudorandom number generator with seed. + random.seed(seed) + + counter = random.choice(self._get_device_counters(x_series_device)) + pfi_line = random.choice(self._get_device_pfi_lines(x_series_device)) + + with nidaqmx.Task() as task: + task.co_channels.add_co_pulse_chan_freq(counter) + task.triggers.start_trigger.cfg_dig_edge_start_trig( + pfi_line, trigger_edge=Edge.FALLING) + + assert (task.triggers.start_trigger.trig_type == + TriggerType.DIGITAL_EDGE) + assert task.triggers.start_trigger.dig_edge_edge == Edge.FALLING diff --git a/nidaqmx/tests/test_utils.py b/nidaqmx/tests/test_utils.py new file mode 100644 index 00000000..6dfe92b5 --- /dev/null +++ b/nidaqmx/tests/test_utils.py @@ -0,0 +1,35 @@ +import pytest +import random + +from nidaqmx.utils import flatten_channel_string, unflatten_channel_string +from nidaqmx.tests.fixtures import x_series_device +from nidaqmx.tests.helpers import generate_random_seed + + +class TestUtils(object): + """ + Contains a collection of pytest tests that validate the utilities + functionality in the NI-DAQmx Python API. + """ + + @pytest.mark.parametrize('seed', [generate_random_seed()]) + def test_flatten_channel_string(self, x_series_device, seed): + # Reset the pseudorandom number generator with seed. + random.seed(seed) + + channels = ['Dev1/ai0', 'Dev1/ai1', 'Dev1/ai3', 'Dev2/ai0'] + flattened_channels = 'Dev1/ai0:1,Dev1/ai3,Dev2/ai0' + assert flatten_channel_string(channels) == flattened_channels + + assert flatten_channel_string([]) == '' + + @pytest.mark.parametrize('seed', [generate_random_seed()]) + def test_unflatten_channel_string(self, x_series_device, seed): + # Reset the pseudorandom number generator with seed. + random.seed(seed) + + channels = ['Dev1/ai0', 'Dev1/ai1', 'Dev1/ai3', 'Dev2/ai0'] + flattened_channels = 'Dev1/ai0:1,Dev1/ai3,Dev2/ai0' + assert unflatten_channel_string(flattened_channels) == channels + + assert unflatten_channel_string('') == [] diff --git a/nidaqmx/tests/test_watchdog.py b/nidaqmx/tests/test_watchdog.py new file mode 100644 index 00000000..56a64b0e --- /dev/null +++ b/nidaqmx/tests/test_watchdog.py @@ -0,0 +1,73 @@ +import pytest +import random +import time + +import nidaqmx +import nidaqmx.system +from nidaqmx.system.watchdog import DOExpirationState +from nidaqmx.constants import Level +from nidaqmx.tests.fixtures import x_series_device +from nidaqmx.tests.helpers import generate_random_seed + + +class TestWatchdog(object): + """ + Contains a collection of pytest tests that validate the watchdog + functionality in the NI-DAQmx Python API. + """ + + @pytest.mark.parametrize('seed', [generate_random_seed()]) + def test_watchdog_task(self, x_series_device, seed): + # Reset the pseudorandom number generator with seed. + random.seed(seed) + + do_line = random.choice(x_series_device.do_lines) + + with nidaqmx.system.WatchdogTask( + x_series_device.name, timeout=0.5) as task: + expir_states = [DOExpirationState( + physical_channel=do_line.name, + expiration_state=Level.TRISTATE)] + + task.cfg_watchdog_do_expir_states(expir_states) + task.start() + + # First, assert that watchdog expires after timeout. + assert not task.expired + time.sleep(1) + assert task.expired + + task.clear_expiration() + assert not task.expired + task.stop() + + # Continually reset the watchdog timer using an interval less + # than the timeout and assert that it never expires. + task.start() + for _ in range(5): + task.reset_timer() + time.sleep(0.2) + assert not task.expired + + task.stop() + + @pytest.mark.parametrize('seed', [generate_random_seed()]) + def test_watchdog_expir_state(self, x_series_device, seed): + # Reset the pseudorandom number generator with seed. + random.seed(seed) + + do_line = random.choice(x_series_device.do_lines) + + with nidaqmx.system.WatchdogTask( + x_series_device.name, timeout=0.1) as task: + expir_states = [DOExpirationState( + physical_channel=do_line.name, + expiration_state=Level.TRISTATE)] + + task.cfg_watchdog_do_expir_states(expir_states) + + expir_state_obj = task.expiration_states[do_line.name] + assert expir_state_obj.expir_states_do_state == Level.TRISTATE + + expir_state_obj.expir_states_do_state = Level.LOW + assert expir_state_obj.expir_states_do_state == Level.LOW diff --git a/nidaqmx/types.py b/nidaqmx/types.py new file mode 100644 index 00000000..982495e6 --- /dev/null +++ b/nidaqmx/types.py @@ -0,0 +1,54 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import collections + +# region Task Counter IO namedtuples + +CtrFreq = collections.namedtuple( + 'CtrFreq', ['freq', 'duty_cycle']) + +CtrTick = collections.namedtuple( + 'CtrTick', ['high_tick', 'low_tick']) + +CtrTime = collections.namedtuple( + 'CtrTime', ['high_time', 'low_time']) + +# endregion + +# region Watchdog namedtuples + +AOExpirationState = collections.namedtuple( + 'AOExpirationState', + ['physical_channel', 'expiration_state', 'output_type']) + +COExpirationState = collections.namedtuple( + 'COExpirationState', ['physical_channel', 'expiration_state']) + +DOExpirationState = collections.namedtuple( + 'DOExpirationState', ['physical_channel', 'expiration_state']) + +# endregion + +# region Power Up States namedtuples + +AOPowerUpState = collections.namedtuple( + 'AOPowerUpState', ['physical_channel', 'power_up_state', 'channel_type']) + +DOPowerUpState = collections.namedtuple( + 'DOPowerUpState', ['physical_channel', 'power_up_state']) + +DOResistorPowerUpState = collections.namedtuple( + 'DOResistorPowerUpState', ['physical_channel', 'power_up_state']) + +# endregion + +# region System namedtuples + +CDAQSyncConnection = collections.namedtuple( + 'CDAQSyncConnection', ['output_port', 'input_port']) + +# endregion + diff --git a/nidaqmx/utils.py b/nidaqmx/utils.py new file mode 100644 index 00000000..b82a4118 --- /dev/null +++ b/nidaqmx/utils.py @@ -0,0 +1,175 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import re + +from nidaqmx.errors import DaqError + +# Method logic adapted from +# //Measurements/Infrastructure/dmxf/trunk/2.5/source/nimuck/parseUtilities.cpp + +_invalid_range_syntax_message = ( + "Syntax for a range of objects in the input string is invalid.\n\n" + "For ranges of objects, specify a number immediately before and after " + "every colon (':') in the input string. Or, if a name is specified after " + "the colon, it must be identical to the name specified immediately before " + "the colon. Colons are not allowed within the names of the individual " + "objects.") + + +def flatten_channel_string(channel_names): + """ + Converts a list of channel names to a comma-delimited list of names. + + You can use this method to convert a list of physical or virtual channel + names to a single string prior to using the DAQmx Create Channel methods or + instantiating a DAQmx Task object. + + Args: + channel_names (List[str]): The list of physical or virtual channel + names. + Returns: + str: + + The resulting comma-delimited list of physical or virtual channel + names. + """ + unflattened_channel_names = [] + for channel_name in channel_names: + unflattened_channel_names.extend(unflatten_channel_string(channel_name)) + + # Go through the channel names and flatten them. + flattened_channel_list = [] + previous = { + 'base_name': '', + 'start_index': -1, + 'end_index': -1 + } + for channel_name in unflattened_channel_names: + m = re.search('(.*[^0-9])?([0-9]+)$', channel_name) + if not m: + # If the channel name doesn't end in a valid number, just use the + # channel name as-is. + flattened_channel_list.append( + _channel_info_to_flattened_name(previous)) + previous = { + 'base_name': channel_name, + 'start_index': -1, + 'end_index': -1 + } + else: + # If the channel name ends in a valid number, we may need to flatten + # this channel with subsequent channels in the x:y format. + current_base_name = m.group(1) + current_index = int(m.group(2)) + + if current_base_name == previous['base_name'] and ( + (current_index == previous['end_index'] + 1 and + previous['end_index'] >= previous['start_index']) or + (current_index == previous['end_index'] - 1 and + previous['end_index'] <= previous['start_index'])): + # If the current channel name has the same base name as the + # previous and it's end index differs by 1, change the end + # index value. It gets flattened later. + previous['end_index'] = current_index + else: + # If the current channel name has the same base name as the + # previous or it's end index differs by more than 1, it doesn't + # get flattened with the previous channel. + flattened_channel_list.append( + _channel_info_to_flattened_name(previous)) + previous = { + 'base_name': current_base_name, + 'start_index': current_index, + 'end_index': current_index + } + + # Convert the final channel dictionary to a flattened string + flattened_channel_list.append( + _channel_info_to_flattened_name(previous)) + + # Remove empty strings in list, convert to comma-delimited string, then trim + # whitespace. + return ','.join([_f for _f in flattened_channel_list if _f]).strip() + + +def _channel_info_to_flattened_name(channel_info): + """ + Simple method to generate a flattened channel name. + """ + if channel_info['start_index'] == -1: + return channel_info['base_name'] + elif channel_info['start_index'] == channel_info['end_index']: + return '{0}{1}'.format(channel_info['base_name'], + channel_info['start_index']) + else: + return '{0}{1}:{2}'.format(channel_info['base_name'], + channel_info['start_index'], + channel_info['end_index']) + + +def unflatten_channel_string(channel_names): + """ + Converts a comma-delimited list of channel names to a list of names. + + You can use this method to convert a comma-delimited list or range of + physical or virtual channels into a list of physical or virtual channel + names. + + Args: + channel_names (str): The list or range of physical or virtual channels. + + Returns: + List[str]: + + The list of physical or virtual channel names. Each element of the + list contains a single channel. + """ + channel_list_to_return = [] + channel_list = [c for c in channel_names.strip().split(',') if c] + + for channel in channel_list: + channel = channel.strip() + colon_index = channel.find(':') + + if colon_index == -1: + channel_list_to_return.append(channel) + else: + before = channel[:colon_index] + after = channel[colon_index+1:] + + m_before = re.match('(.*?)([0-9]+)$', before) + m_after = re.match('(.*?)([0-9]+)$', after) + + if not m_before or not m_after: + raise DaqError(_invalid_range_syntax_message, + error_code=-200498) + + if m_after.group(1) and ( + m_before.group(1).lower() != m_after.group(1).lower()): + raise DaqError(_invalid_range_syntax_message, + error_code=-200498) + + num_before = int(m_before.group(2)) + num_after = int(m_after.group(2)) + num_max = max([num_before, num_after]) + num_min = min([num_before, num_after]) + number_of_channels = (num_max - num_min) + 1 + + if number_of_channels >= 15000: + raise DaqError(_invalid_range_syntax_message, + error_code=-200498) + + colon_expanded_channel = [] + for i in range(number_of_channels): + colon_expanded_channel.append( + '{0}{1}'.format(m_before.group(1), num_min + i)) + + if num_after < num_before: + colon_expanded_channel.reverse() + + channel_list_to_return.extend(colon_expanded_channel) + + return channel_list_to_return diff --git a/nidaqmx_examples/__init__.py b/nidaqmx_examples/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/nidaqmx_examples/ai_multi_task_pxie_ref_clk.py b/nidaqmx_examples/ai_multi_task_pxie_ref_clk.py new file mode 100644 index 00000000..de65420d --- /dev/null +++ b/nidaqmx_examples/ai_multi_task_pxie_ref_clk.py @@ -0,0 +1,40 @@ +import pprint +import nidaqmx +from nidaqmx.constants import AcquisitionType, TaskMode + +pp = pprint.PrettyPrinter(indent=4) + + +with nidaqmx.Task() as master_task, nidaqmx.Task() as slave_task: + master_task.ai_channels.add_ai_voltage_chan("/PXI1Slot3/ai0") + slave_task.ai_channels.add_ai_voltage_chan("/PXI1Slot7/ai0") + + master_task.timing.ref_clk_src = "PXIe_Clk100" + master_task.timing.ref_clk_rate = 100000000 + master_task.timing.cfg_samp_clk_timing( + 1000, sample_mode=AcquisitionType.CONTINUOUS) + master_task.triggers.sync_type.MASTER = True + + slave_task.timing.ref_clk_src = "PXIe_Clk100" + slave_task.timing.ref_clk_rate = 100000000 + slave_task.timing.cfg_samp_clk_timing( + 1000, sample_mode=AcquisitionType.CONTINUOUS) + slave_task.triggers.sync_type.SLAVE = True + + master_task.control(TaskMode.TASK_COMMIT) + + slave_task.triggers.start_trigger.cfg_dig_edge_start_trig( + "/PXI1Slot3/ai/StartTrigger") + + print('2 Channels 1 Sample Read Loop 10: ') + slave_task.start() + master_task.start() + + for _ in range(10): + master_data = master_task.read(number_of_samples_per_channel=10) + slave_data = slave_task.read(number_of_samples_per_channel=10) + + print('Master Task Data: ') + pp.pprint(master_data) + print('Slave Task Data: ') + pp.pprint(slave_data) diff --git a/nidaqmx_examples/ai_raw.py b/nidaqmx_examples/ai_raw.py new file mode 100644 index 00000000..d5e24650 --- /dev/null +++ b/nidaqmx_examples/ai_raw.py @@ -0,0 +1,25 @@ +import pprint +import nidaqmx + +pp = pprint.PrettyPrinter(indent=4) + +with nidaqmx.Task() as task: + task.ai_channels.add_ai_voltage_chan("cDAQ1Mod1/ai0") + + print('1 Channel 1 Sample Read Raw: ') + data = task.read_raw() + pp.pprint(data) + + print('1 Channel N Samples Read Raw: ') + data = task.read_raw(number_of_samples_per_channel=8) + pp.pprint(data) + + task.ai_channels.add_ai_voltage_chan("cDAQ1Mod1/ai1:3") + + print('N Channel 1 Sample Read Raw: ') + data = task.read_raw() + pp.pprint(data) + + print('N Channel N Samples Read Raw: ') + data = task.read_raw(number_of_samples_per_channel=8) + pp.pprint(data) \ No newline at end of file diff --git a/nidaqmx_examples/ai_voltage_sw_timed.py b/nidaqmx_examples/ai_voltage_sw_timed.py new file mode 100644 index 00000000..cef81be3 --- /dev/null +++ b/nidaqmx_examples/ai_voltage_sw_timed.py @@ -0,0 +1,29 @@ +import pprint +import nidaqmx + +pp = pprint.PrettyPrinter(indent=4) + + +with nidaqmx.Task() as task: + task.ai_channels.add_ai_voltage_chan("cDAQ1Mod1/ai0") + + print('1 Channel 1 Sample Read: ') + data = task.read() + pp.pprint(data) + + data = task.read(number_of_samples_per_channel=1) + pp.pprint(data) + + print('1 Channel N Samples Read: ') + data = task.read(number_of_samples_per_channel=8) + pp.pprint(data) + + task.ai_channels.add_ai_voltage_chan("cDAQ1Mod1/ai1:3") + + print('N Channel 1 Sample Read: ') + data = task.read() + pp.pprint(data) + + print('N Channel N Samples Read: ') + data = task.read(number_of_samples_per_channel=2) + print data \ No newline at end of file diff --git a/nidaqmx_examples/ao_voltage_hw_timed.py b/nidaqmx_examples/ao_voltage_hw_timed.py new file mode 100644 index 00000000..b4df6024 --- /dev/null +++ b/nidaqmx_examples/ao_voltage_hw_timed.py @@ -0,0 +1,27 @@ +import nidaqmx + + +with nidaqmx.Task() as task: + task.ao_channels.add_ao_voltage_chan('Dev1/ao0') + + task.timing.cfg_samp_clk_timing(1000) + + print('1 Channel 1 Sample Write: ') + print(task.write(1.0)) + task.stop() + + print('1 Channel N Samples Write: ') + print(task.write([1.1, 2.2, 3.3, 4.4, 5.5], auto_start=True)) + task.stop() + + task.ao_channels.add_ao_voltage_chan('Dev1/ao1:3') + + print('N Channel 1 Sample Write: ') + print(task.write([1.1, 2.2, 3.3, 4.4])) + task.stop() + + print('N Channel N Samples Write: ') + print(task.write([[1.1, 2.2, 3.3], [1.1, 2.2, 4.4], + [2.2, 3.3, 4.4], [2.2, 3.3, 4.4]], + auto_start=True)) + task.stop() diff --git a/nidaqmx_examples/ao_voltage_sw_timed.py b/nidaqmx_examples/ao_voltage_sw_timed.py new file mode 100644 index 00000000..c79f3a40 --- /dev/null +++ b/nidaqmx_examples/ao_voltage_sw_timed.py @@ -0,0 +1,24 @@ +import nidaqmx + + +with nidaqmx.Task() as task: + task.ao_channels.add_ao_voltage_chan('Dev1/ao0') + + print('1 Channel 1 Sample Write: ') + print(task.write(1.0)) + task.stop() + + print('1 Channel N Samples Write: ') + print(task.write([1.1, 2.2, 3.3, 4.4, 5.5], auto_start=True)) + task.stop() + + task.ao_channels.add_ao_voltage_chan('Dev1/ao1') + + print('N Channel 1 Sample Write: ') + print(task.write([1.1, 2.2])) + task.stop() + + print('N Channel N Samples Write: ') + print(task.write([[1.1, 2.2, 3.3], [1.1, 2.2, 4.4]], + auto_start=True)) + task.stop() diff --git a/nidaqmx_examples/channel_properties.py b/nidaqmx_examples/channel_properties.py new file mode 100644 index 00000000..9a1476bc --- /dev/null +++ b/nidaqmx_examples/channel_properties.py @@ -0,0 +1,28 @@ +import pprint +import nidaqmx + +pp = pprint.PrettyPrinter(indent=4) + + +with nidaqmx.Task() as task: + ai_channel = task.ai_channels.add_ai_voltage_chan( + "Dev1/ai0", max_val=0.1, min_val=-0.1) + + print(ai_channel.ai_max) + print(ai_channel.ai_min) + + ai_channel.ai_max = 5 + + print(ai_channel.ai_max) + print(ai_channel.ai_min) + + ai_channels_1_to_3 = task.ai_channels.add_ai_voltage_chan( + "Dev1/ai1:3", max_val=10, min_val=-10) + + print(ai_channels_1_to_3.ai_max) + print(ai_channels_1_to_3.ai_min) + + print(ai_channel.ai_max) + print(ai_channel.ai_min) + + print(task.ai_channels["Dev1/ai2"].physical_channel.name) \ No newline at end of file diff --git a/nidaqmx_examples/ci_count_edges.py b/nidaqmx_examples/ci_count_edges.py new file mode 100644 index 00000000..cc6d2b83 --- /dev/null +++ b/nidaqmx_examples/ci_count_edges.py @@ -0,0 +1,17 @@ +import nidaqmx +import pprint + + +pp = pprint.PrettyPrinter(indent=4) + + +with nidaqmx.Task() as task: + task.ci_channels.add_ci_count_edges_chan("Dev1/ctr0") + + print('1 Channel 1 Sample Read: ') + data = task.read() + pp.pprint(data) + + print('1 Channel N Samples Read: ') + data = task.read(number_of_samples_per_channel=8) + pp.pprint(data) \ No newline at end of file diff --git a/nidaqmx_examples/ci_pulse_freq.py b/nidaqmx_examples/ci_pulse_freq.py new file mode 100644 index 00000000..ed95a645 --- /dev/null +++ b/nidaqmx_examples/ci_pulse_freq.py @@ -0,0 +1,17 @@ +import nidaqmx +import pprint + + +pp = pprint.PrettyPrinter(indent=4) + + +with nidaqmx.Task() as task: + task.ci_channels.add_ci_pulse_chan_freq("Dev1/ctr1") + + print('1 Channel 1 Sample Read: ') + data = task.read() + pp.pprint(data) + + print('1 Channel N Samples Read: ') + data = task.read(number_of_samples_per_channel=8) + pp.pprint(data) \ No newline at end of file diff --git a/nidaqmx_examples/co_pulse_time.py b/nidaqmx_examples/co_pulse_time.py new file mode 100644 index 00000000..b535c212 --- /dev/null +++ b/nidaqmx_examples/co_pulse_time.py @@ -0,0 +1,19 @@ +import nidaqmx +from nidaqmx.types import CtrTime + + +with nidaqmx.Task() as task: + task.co_channels.add_co_pulse_chan_time("Dev1/ctr1") + + sample = CtrTime(high_time=0.001, low_time=0.002) + + print('1 Channel 1 Sample Write: ') + print(task.write(sample)) + + samples = [] + for i in range(1, 5): + x = i/float(1000) + samples.append(CtrTime(high_time=x, low_time=x)) + + print('1 Channel N Samples Write: ') + print(task.write(samples, auto_start=True)) \ No newline at end of file diff --git a/nidaqmx_examples/di_sw_timed.py b/nidaqmx_examples/di_sw_timed.py new file mode 100644 index 00000000..ebb1e7d7 --- /dev/null +++ b/nidaqmx_examples/di_sw_timed.py @@ -0,0 +1,31 @@ +import nidaqmx +import pprint + +from nidaqmx.constants import ( + LineGrouping) + +pp = pprint.PrettyPrinter(indent=4) + + +with nidaqmx.Task() as task: + task.di_channels.add_di_chan('Dev1/port0/line0', + line_grouping=LineGrouping.CHAN_PER_LINE) + + print('1 Channel 1 Sample Read: ') + data = task.read() + pp.pprint(data) + + print('1 Channel N Samples Read: ') + data = task.read(number_of_samples_per_channel=8) + pp.pprint(data) + + task.di_channels.add_di_chan("Dev1/port0/line1:3", + line_grouping=LineGrouping.CHAN_PER_LINE) + + print('N Channel 1 Sample Read: ') + data = task.read() + pp.pprint(data) + + print('N Channel N Samples Read: ') + data = task.read(number_of_samples_per_channel=2) + print data \ No newline at end of file diff --git a/nidaqmx_examples/do_sw_timed.py b/nidaqmx_examples/do_sw_timed.py new file mode 100644 index 00000000..d665a140 --- /dev/null +++ b/nidaqmx_examples/do_sw_timed.py @@ -0,0 +1,21 @@ +import nidaqmx +from nidaqmx.constants import ( + LineGrouping) + + +with nidaqmx.Task() as task: + task.do_channels.add_do_chan( + 'Dev1/port0/line0:3', + line_grouping=LineGrouping.CHAN_FOR_ALL_LINES) + + try: + print('N Lines 1 Sample Boolean Write (Error Expected): ') + print(task.write([True, False, True, False])) + except nidaqmx.DaqError as e: + print(e) + + print('1 Channel N Lines 1 Sample Unsigned Integer Write: ') + print(task.write(8)) + + print('1 Channel N Lines N Samples Unsigned Integer Write: ') + print(task.write([1, 2, 4, 8], auto_start=True)) \ No newline at end of file diff --git a/nidaqmx_examples/every_n_samples_event.py b/nidaqmx_examples/every_n_samples_event.py new file mode 100644 index 00000000..db431089 --- /dev/null +++ b/nidaqmx_examples/every_n_samples_event.py @@ -0,0 +1,32 @@ +import pprint +import nidaqmx + +pp = pprint.PrettyPrinter(indent=4) + + +with nidaqmx.Task() as task: + task.ai_channels.add_ai_voltage_chan("Dev1/ai0") + + task.timing.cfg_samp_clk_timing(1000) + + # Python 2.X does not have nonlocal keyword. + non_local_var = {'samples': []} + + def callback(task_handle, every_n_samples_event_type, + number_of_samples, callback_data): + print('Every N Samples callback invoked.') + + samples = task.read(number_of_samples_per_channel=200) + non_local_var['samples'].extend(samples) + + return 0 + + task.register_every_n_samples_acquired_into_buffer_event( + 200, callback) + + task.start() + + input('Running task. Press Enter to stop and see number of ' + 'accumulated samples.\n') + + print(len(non_local_var['samples'])) \ No newline at end of file diff --git a/nidaqmx_examples/nidaqmx_warnings.py b/nidaqmx_examples/nidaqmx_warnings.py new file mode 100644 index 00000000..83b4436a --- /dev/null +++ b/nidaqmx_examples/nidaqmx_warnings.py @@ -0,0 +1,54 @@ +import nidaqmx +import warnings + + +# By default warnings are shown. +with nidaqmx.Task() as task: + task.ao_channels.add_ao_voltage_chan('cDAQ1Mod3/ao0') + task.timing.cfg_samp_clk_timing(1000) + + task.write([1.1, 2.2, 3.3, 4.4, 5.5], auto_start=True) + task.write([1.1, 2.2, 3.3, 4.4, 5.5], auto_start=True) + + +# Catching warnings using the built-in warnings context manager. +with nidaqmx.Task() as task: + task.ao_channels.add_ao_voltage_chan('cDAQ1Mod3/ao0') + task.timing.cfg_samp_clk_timing(1000) + + with warnings.catch_warnings(record=True) as w: + task.write([1.1, 2.2, 3.3, 4.4, 5.5], auto_start=True) + task.write([1.1, 2.2, 3.3, 4.4, 5.5], auto_start=True) + + # Verify some things + assert len(w) == 1 + assert issubclass(w[-1].category, nidaqmx.DaqWarning) + + print('DaqWarning caught: {0}\n'.format(w[-1].message)) + + +# Raising warnings as exceptions. +with nidaqmx.Task() as task: + task.ao_channels.add_ao_voltage_chan('cDAQ1Mod3/ao0') + task.timing.cfg_samp_clk_timing(1000) + + warnings.filterwarnings('error', category=nidaqmx.DaqWarning) + + try: + task.write([1.1, 2.2, 3.3, 4.4, 5.5], auto_start=True) + task.write([1.1, 2.2, 3.3, 4.4, 5.5], auto_start=True) + except nidaqmx.DaqWarning as e: + print('DaqWarning caught as exception: {0}\n'.format(e)) + assert e.error_code == 200015 + + +# Suppressing DaqWarnings. +print('Suppressing warnings.') +warnings.filterwarnings('ignore', category=nidaqmx.DaqWarning) + +with nidaqmx.Task() as task: + task.ao_channels.add_ao_voltage_chan('cDAQ1Mod3/ao0') + task.timing.cfg_samp_clk_timing(1000) + + task.write([1.1, 2.2, 3.3, 4.4, 5.5], auto_start=True) + task.write([1.1, 2.2, 3.3, 4.4, 5.5], auto_start=True) diff --git a/nidaqmx_examples/system_properties.py b/nidaqmx_examples/system_properties.py new file mode 100644 index 00000000..75b9523e --- /dev/null +++ b/nidaqmx_examples/system_properties.py @@ -0,0 +1,10 @@ +import nidaqmx + + +system = nidaqmx.System.local() +print('DAQmx {0}.{1}.{2}'.format(system.major_version, system.minor_version, + system.update_version)) + +for device in system.devices: + print('Device Name: {0}, Product Category: {1}, Product Type: {2}'.format( + device.name, device.product_category, device.product_type)) diff --git a/python_packages.txt b/python_packages.txt new file mode 100644 index 00000000..672245e0 --- /dev/null +++ b/python_packages.txt @@ -0,0 +1 @@ +setup path: nidaqmx \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..f33cbd44 --- /dev/null +++ b/setup.py @@ -0,0 +1,76 @@ +import os +from setuptools import setup +from setuptools.command.test import test as TestCommand + + +class PyTest(TestCommand): + def finalize_options(self): + TestCommand.finalize_options(self) + self.test_args = [] + self.test_suite = True + + def run_tests(self): + import pytest + pytest.main(self.test_args) + + +pypi_name = 'nidaqmx' + + +def get_version(): + version = None + script_dir = os.path.dirname(os.path.realpath(__file__)) + script_dir = os.path.join(script_dir, pypi_name) + if not os.path.exists(os.path.join(script_dir, 'VERSION')): + version = '1.0.0dev0' + else: + with open(os.path.join(script_dir, 'VERSION'), 'r') as version_file: + version = version_file.read().rstrip() + return version + + +def read_contents(file_to_read): + with open(file_to_read, 'r') as f: + return f.read() + + +setup( + name=pypi_name, + version=get_version(), + description='This is the incomplete draft for NI\'s version of a NI-DAQmx Python API.', + long_description=read_contents('README.rst'), + author='National Instruments', + maintainer="Brian Lee, Neil Stoddard", + maintainer_email="brian.lee@ni.com, neil.stoddard@ni.com", + keywords=['nidaqmx', 'nidaq', 'daqmx', 'daq'], + license='MIT', + include_package_data=True, + packages=['nidaqmx'], + install_requires=[ + 'enum34;python_version<"3.4"', + 'numpy', + 'six' + ], + tests_require=['pytest'], + classifiers=[ + "Development Status :: 5 - Production/Stable", + "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.3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "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/tox.ini b/tox.ini new file mode 100644 index 00000000..28119d3b --- /dev/null +++ b/tox.ini @@ -0,0 +1,13 @@ +# Tox (http://tox.testrun.org/) is a tool for running tests +# in multiple virtualenvs. This configuration file will run the +# test suite on all supported python versions. To use it, "pip install tox" +# and then run "tox" from this directory. + +[tox] +envlist = py27,py34,py35,py36 + +[testenv] +install_command = pip install --pre -i http://ni-pypi.amer.corp.natinst.com --trusted-host ni-pypi.amer.corp.natinst.com {opts} {packages} +commands = pytest --quiet --junitxml=pytests-{envname}.xml +deps = + pytest