Skip to content

Instantly share code, notes, and snippets.

@carbonrobot
Last active December 26, 2015 05:59
Show Gist options
  • Save carbonrobot/7104243 to your computer and use it in GitHub Desktop.
Save carbonrobot/7104243 to your computer and use it in GitHub Desktop.
Async options
public SpeedData MeasureSpeed(Dryer dryer)
{
lock (thisLock)
{
if (this.State == DAQState.Ready)
{
this.State = DAQState.Acquiring;
try
{
var configuration = new TriggeredScanConfiguration(2000.0, 2, 0.5, 2.0);
var task = new MeasureSpeedTask(deviceName, dryer, configuration);
var data = task.Measure();
return data;
}
catch (Exception ex)
{
this.Log().Error(() => "DAQController:MeasureSpeed Error");
this.Log().Error(() => ex.ToString());
}
finally
{
this.State = DAQState.Ready;
}
}
throw new InvalidOperationException(Messages.DAQControllerNotReady_0.FormatWith(this.State));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment