thermofisherlsms / iapi

Instrument Application Programming Interface
MIT License
44 stars 17 forks source link

New IScans property request: bool CanAcceptCustomScan #13

Closed chhh closed 6 years ago

chhh commented 6 years ago

Currently there's only event EventHandler CanAcceptNextCustomScan in IScans and this is never fired unless one successfully submits a custom scan with SetCustomScan(ICustomScan scan) : bool. However, when one connects to an instrument, it's not exactly obvious if it's ok to try to submit a custom scan in the first place. For me it doesn't work when a method acquisition is running that was initiated by Excalibur, because, I guess, it has exclusive access (IFusionControl.GetScans(true)?).

I see that you can try submitting and check the return value, but this is not a clear indication, I would retry submitting as long as SetCustomScan returns bool. However, I'd just show an error message, if CanAcceptCustomScan returned false.

dbaileychess commented 6 years ago

The purpose of the CanAcceptNextCustomScan event is to indicate that the previous CustomScan has been queued and ready for injection, and that the internal buffer is available for a new CustomScan to arrive. We do have a small buffer on the instrument that can hold multiple CustomScans in FIFO ordering. This event just lets you know that a buffer spot is now free.

You should always be able to submit a CustomScan, regardless if Tune/XCalibur is in control. I just submitted a method via XCalibur, started up the IAPI, and was able to send Custom Scans down with no issues.