Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting current Task TaskAction State

Hello-

 

 I would like to conditionalize my interactions (reading) of task data until I verify that the task is in the correct state. The component we have that wraps the DAQmx drivers is shared across other components in our system, and I would like a way to prevent or reset the task if it is about to be asked to do something that will cause an exception.

 

For example, if the task is currently reserved, and I call

 

// Read the data

dataArray = m_DAQmxChannelReader.ReadSingleSample();

 

I get an exception that says :

"The specified resource is reserved. The operation could not be completed as specified."

 

I would like to do something like

 

if (m_Task.ActionState == reserved)

{

    m_Task.Control(Abort);

    m_Task.Control(Stop);

}

 

//Verify configuration

verifyCurrentTask();

 

// Read data

dataArray = m_DAQmxChannelReader.ReadSingleSample();

 

 

...Is this possible? What is the recommended strategy for dealing with this?

 

Thanks,

-Bill Ames

 

0 Kudos
Message 1 of 1
(3,111 Views)