Exemplo n.º 1
0
        private void _onChannelData(CMcsUsbDacqNet d, int cbHandle, int numSamples)
        {
            try {
                int returnedFrames, totalChannels, offset, channels;

                int handle       = 0;
                int channelEntry = 0;
                int frames       = 0;

                dataAcquisitionDevice.ChannelBlock_GetChannel
                    (handle,
                    channelEntry,
                    out totalChannels,
                    out offset,
                    out channels);

                Dictionary <int, int[]> data = dataAcquisitionDevice.ChannelBlock_ReadFramesDictI32
                                                   (handle,
                                                   segmentLength,
                                                   out returnedFrames);

                if (barfCounter < 3000)
                {
                    if (barfCounter == 2999)
                    {
                        log.info($"totalChannels:  {totalChannels}", "DAQ DEBUG");
                        log.info($"offset:         {totalChannels}", "DAQ DEBUG");
                        log.info($"channels:       {totalChannels}", "DAQ DEBUG");
                        log.info($"returnedFrames: {totalChannels}", "DAQ DEBUG");
                    }
                    barfCounter++;
                }

                onChannelData(data, returnedFrames);
            }
            catch (Exception e) {
                Console.ForegroundColor = ConsoleColor.Red;
                log.err("DAQ ERROR", "DAQ ");
                Console.WriteLine(e);
                dataAcquisitionDevice.Disconnect();
                throw e;
            }
        }