Example #1
0
        void  timer_Tick(object sender, EventArgs e)
        {
            int size_ret;

#if channelmethod
#if channeldata
            uint frames = device.ChannelBlock_AvailFrames(0);
            if (frames > channelblocksize)
            {
                int totalchannels, offset, channels;
                device.ChannelBlock_GetChannel(0, 0, out totalchannels, out offset, out channels);
                ushort[] data = device.ChannelBlock_ReadFramesUI16(0, channelblocksize, out size_ret);
                for (int i = 0; i < totalchannels; i++)
                {
                    ushort[] data1 = new ushort[channelblocksize];
                    for (int j = 0; j < channelblocksize; j++)
                    {
                        data1[j] = data[j * m_channel_handles + i];
                    }
                    OnChannelDataLater(data1, i);
                }
            }
#else // !channeldata
            for (int i = 0; i < m_channel_handles; i++)
            {
                uint frames = device.ChannelBlock_AvailFrames(i);
                if (frames > channelblocksize)
                {
                    int totalchannels, offset, channels;
                    device.ChannelBlock_GetChannel(i, 0, out totalchannels, out offset, out channels);
                    Debug.Assert(totalchannels == 1);
                    Debug.Assert(channels == 1);
                    ushort[] data = device.ChannelBlock_ReadFramesUI16(i, channelblocksize, out size_ret);
                    OnChannelDataLater(data, offset);
                }
            }
#endif // !channeldata
#else // !channelmethod
            uint frames = device.ChannelBlock_AvailFrames(0);
            if (frames > channelblocksize)
            {
                Dictionary <int, ushort[]> data = device.ChannelBlock_ReadFramesDictUI16(0, channelblocksize, out size_ret);
                OnChannelDataLater(data);
            }
#endif // !channelmethod
        }
        private void TimerTickForChannelMethodAndChannelData()
        {
            uint frames = device.ChannelBlock_AvailFrames(0);

            if ((LastData == 1 || frames > channelblocksize) && frames > 0)
            {
                device.ChannelBlock_GetChannel(0, 0, out int totalChannels, out int byte_offset, out int channel_offset, out int channels);
                ushort[] data = device.ChannelBlock_ReadFramesUI16(0, channelblocksize, out int sizeRet);
                for (int i = 0; i < totalChannels; i++)
                {
                    ushort[] channelData = new ushort[sizeRet];
                    for (int j = 0; j < sizeRet; j++)
                    {
                        channelData[j] = data[j * totalChannels + i];
                    }
                    DrawChannelDataWithChannelMethod(channelData, i);
                }
            }
        }