Skip to content

Commit

Permalink
add support for reverse voltage error attributes to nidqmx-python (#183)
Browse files Browse the repository at this point in the history
* add support for reverse voltage error attributes

* Replace in_stream.py to in_stream.py generated by internal generator
  • Loading branch information
archerleong authored Aug 12, 2022
1 parent 422a452 commit 13d0de3
Showing 1 changed file with 63 additions and 0 deletions.
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

0 comments on commit 13d0de3

Please sign in to comment.