10-18-2024 03:29 AM
Again on callback topic (note that I am posting in HW forum where I have already seen python code snippets while nothing seems to match in SW boards. Maybe there could be a SW board about nidaqmx-python)
When I dump both handles, I get: task._handle: c_void_p(138902160250752) task_handle: 138902160250752. So it explains why task._handle.value works
Why is it not homogeneous ? Is it intended to be used as I am using it (at least in C API, I guess yes) ? nidaqmx-python is a front-end to C libs so I understand handles as ctypes but don't see why task_handled is not ctype
Solved! Go to Solution.
10-23-2024 10:39 AM
As discussed in other threads, task_handle can be answered through functools.partial like callback_data. Above method works but NI uses internally partial. In my case:
def callback_nidaq(task, task_handle, every_n_samples_event_type, number_of_samples, callback_data):
# task is the task referred by task_handle so no need to use task_handle
When configuring the tasks:
for task in all_tasks:
task.register_every_n_samples_acquired_into_buffer_event(xxx, functools.partial(callback_nidaq, task))