public int AvailableSamples(StreamType channelType, ushort channelNumber) { ItcmmCall(() => ITCMM.ITC_UpdateNow(DevicePtr, System.IntPtr.Zero)); ITCMM.ITCChannelDataEx[] channelData = new ITCMM.ITCChannelDataEx[1]; channelData[0].ChannelType = (ushort)channelType; channelData[0].ChannelNumber = channelNumber; uint err = ItcmmCall(() => ITCMM.ITC_GetDataAvailable(DevicePtr, 1, channelData)); if (err != ITCMM.ACQ_SUCCESS) { throw new HekaDAQException("Unable to get available FIFO points", err); } return(channelData[0].Value); }
public void ReadAvailableSamples() { HekkaDevice device = HekkaDevice.Zero; uint err = ITCMM.ITC_OpenDevice(ITCMM.USB18_ID, 0, ITCMM.SMART_MODE, out device); if (err != ITCMM.ACQ_SUCCESS) { Assert.Fail(ErrorDescription.ErrorString(err)); } try { //ITCMM.HWFunction hwf = new ITCMM.HWFunction(); err = ITCMM.ITC_InitDevice(device, IntPtr.Zero); // ref hwf); ITCMM.ITCPublicConfig config = new ITCMM.ITCPublicConfig(); config.OutputEnable = 1; err = ITCMM.ITC_ConfigDevice(device, ref config); if (err != ITCMM.ACQ_SUCCESS) { Assert.Fail(ErrorDescription.ErrorString(err)); } Assert.NotNull(device); ITCMM.ITCChannelInfo channelInfo = new ITCMM.ITCChannelInfo(); channelInfo.ChannelType = ITCMM.H2D; channelInfo.ChannelNumber = 0; channelInfo.SamplingRate = 1000.0; Assert.AreEqual(System.IntPtr.Zero, channelInfo.FIFOPointer); Assert.AreEqual(ITCMM.ACQ_SUCCESS, ITCMM.ITC_SetChannels(device, 1, new ITCMM.ITCChannelInfo[] { channelInfo }) ); Assert.AreEqual(ITCMM.ACQ_SUCCESS, (int)ITCMM.ITC_UpdateChannels(device) ); ITCMM.ITCChannelDataEx info = new ITCMM.ITCChannelDataEx(); info.ChannelType = ITCMM.H2D; info.ChannelNumber = 0; ITCMM.ITCChannelDataEx[] arr = new ITCMM.ITCChannelDataEx[] { info }; err = ITCMM.ITC_GetDataAvailable(device, 1, arr); if (err != ITCMM.ACQ_SUCCESS) { Assert.Fail(ErrorDescription.ErrorString(err)); } info = arr[0]; Assert.That(info.Value, Is.GreaterThanOrEqualTo(0)); } finally { err = ITCMM.ITC_CloseDevice(device); Assert.AreEqual(ITCMM.ACQ_SUCCESS, err, ErrorDescription.ErrorString(err) ); } }