What Is task_handle of nidaqmx.task in Python?

Updated Aug 30, 2018

Reported In

Driver

  • NI-DAQmx

Programming Language

  • Python

Issue Details

On defining a task and printing it, it results in the following:
>>> nidaqmx.Task()
Task (name=_unnamedTask<C>)

However, inside callback_method of register_done_event(callback_method), instead of above, I am rather getting an integer value in the task_handle variable, eg: 1844437056.

>>> task_handle
1844437056

So, what is this task_handle variable and how is it related to task?

Solution

Following is prototype of callback_method of register_done_event(callback_method)
>>> def callback(task_handle, status, callback_data): 
>>>     return 0

_handle is unique integer identifier which is assigned to each task when it is created. task_handle attribute of callback method contains the handle of the task which is calling that callback method.

To access handle of a particular task object (for ex. task1, access _handle attribute of that object), following code stores handle of task1 in variable task1_handle :

>>> task1_handle = task1._handle

WAS THIS ARTICLE HELPFUL?

Not Helpful