Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for reverse voltage error attributes to nidaqmx-python #183

Merged
merged 2 commits into from
Aug 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions nidaqmx/_task_modules/in_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,69 @@ def remote_sense_error_chans_exist(self):

return val.value

@property
def reverse_voltage_error_chans(self):
"""
List[str]: Indicates a list of names of any virtual channels in
the task for which reverse voltage error condition has been
detected. You must read the Reverse Voltage Error Channels
Exist property before you read this property. Otherwise, you
will receive an error.
"""
cfunc = lib_importer.windll.DAQmxGetReverseVoltageErrorChans
if cfunc.argtypes is None:
with cfunc.arglock:
if cfunc.argtypes is None:
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 reverse_voltage_error_chans_exist(self):
"""
bool: Indicates if the device(s) detected reverse voltage error
for any channel in the task. Reverse voltage error will
occured if the local voltage is equal to negative saturated
voltage. Reading this property clears the error condition
status for all channels in the task. You must read this
property before you read the Reverse Voltage Error Channels
property. Otherwise, you will receive an error.
"""
val = c_bool32()

cfunc = lib_importer.windll.DAQmxGetReverseVoltageErrorChansExist
if cfunc.argtypes is None:
with cfunc.arglock:
if cfunc.argtypes is None:
cfunc.argtypes = [
lib_importer.task_handle, ctypes.POINTER(c_bool32)]

error_code = cfunc(
self._handle, ctypes.byref(val))
check_for_error(error_code)

return val.value

@property
def sleep_time(self):
"""
Expand Down