public ITCMM.ITCChannelInfo ChannelInfo(StreamType channelType, ushort channelNumber) { ITCMM.ITCChannelInfo[] info = new ITCMM.ITCChannelInfo[1]; info[0] = new ITCMM.ITCChannelInfo() { ChannelNumber = channelNumber, ChannelType = (uint)channelType }; uint err = ItcmmCall(() => ITCMM.ITC_GetChannels(DevicePtr, 1, info)); if (err != ITCMM.ACQ_SUCCESS) { throw new HekaDAQException("Unable to retrieve channel info struct.", err); } return(info[0]); }
public void RoundTripChannelConfig() { 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); err = ITCMM.ITC_ResetChannels(device); if (err != ITCMM.ACQ_SUCCESS) { Assert.Fail(ErrorDescription.ErrorString(err)); } ITCMM.ITCChannelInfo[] info = new ITCMM.ITCChannelInfo[2]; info[0].ChannelNumber = 0; info[0].ChannelType = ITCMM.OUTPUT_GROUP; info[1].ChannelNumber = 0; info[1].ChannelType = ITCMM.INPUT_GROUP; const double srate = 8000; info[0].SamplingRate = srate; info[1].SamplingRate = srate; err = ITCMM.ITC_SetChannels(device, 2, info); if (err != ITCMM.ACQ_SUCCESS) { Assert.Fail(ErrorDescription.ErrorString(err)); } err = ITCMM.ITC_UpdateChannels(device); if (err != ITCMM.ACQ_SUCCESS) { Assert.Fail(ErrorDescription.ErrorString(err)); } ITCMM.ITCChannelInfo[] actual = new ITCMM.ITCChannelInfo[2]; actual[0].ChannelType = info[0].ChannelType; actual[0].ChannelNumber = info[0].ChannelNumber; actual[1].ChannelType = info[1].ChannelType; actual[1].ChannelNumber = info[1].ChannelNumber; err = ITCMM.ITC_GetChannels(device, 2, actual); if (err != ITCMM.ACQ_SUCCESS) { Assert.Fail(ErrorDescription.ErrorString(err)); } Assert.AreEqual(info[0].SamplingRate, actual[0].SamplingRate); Assert.AreEqual(info[1].SamplingRate, actual[1].SamplingRate); } finally { err = ITCMM.ITC_CloseDevice(device); Assert.AreEqual(ITCMM.ACQ_SUCCESS, err, ErrorDescription.ErrorString(err) ); } }