public float[][] ReadData()
        {
            //if (!IsConnected)
            //{
            //    Toast.MakeText(ApplicationContext, "Устройство не готово к  данных", ToastLength.Long).Show();
            //    throw new Exception();
            //}
            float[][] _DataBuffer        = new float[][] { new float[dataSize], new float[dataSize], new float[dataSize], new float[dataSize] };
            int       ActiveChannelCount = 0;

            for (int i = 0; i < activeChannel.Length; i++)
            {
                if (activeChannel[i] == true)
                {
                    ActiveChannelCount++;
                }
            }

            device.ClearProtocol();
            R4RegisterBase r4    = device.GetStatus();
            uint           Start = (uint)(r4.PreReg - (r4.PreReg % ActiveChannelCount));

            // Указываем адрес, откуда будем читать
            device.PrepareForReading(Start);
            int count = dataSize * ActiveChannelCount;

            Array.Resize(ref UInt16Buffer, count);
            device.GetData(UInt16Buffer);

            //Calibration[] calibrs = GetCurrentCallibrations(_Device);

            for (int k = 0, j = 0; j < dataSize; j++)
            {
                for (int i = 0; i < ChannelCount; i++)
                {
                    if (_DataBuffer[i].Length > 0)
                    {
                        _DataBuffer[i][j] = ParseRawData(UInt16Buffer[k]);
                        k++;
                    }
                }
            }

            return(_DataBuffer);
        }
        public async Task GetDataStatus()
        {
            //if (!IsConnected)
            //    Toast.MakeText(ApplicationContext, "Устройство не готово", ToastLength.Long).Show();

            device.ClearProtocol();

            R4RegisterBase r4 = device.GetStatus();

            while (!r4.MemIsEnd)
            {
                await Task.Delay(200);

                r4 = device.GetStatus();
            }
            //Message: data is ready
            //Toast.MakeText(ApplicationContext, "data is ready", ToastLength.Long).Show();
        }
        public override bool IsDataReady()
        {
            if(!_isConnected) throw new TimeoutException();
            if (_isDataReady) return true;
            _registerR4 = _device.GetStatus();
            if (_registerR4.MemIsEnd)
            {
                uint startpos = (uint)(_registerR4.PreReg - (_registerR4.PreReg % _enabledChannelsCount));

                double[][] buffer = { new double[_recordLength], new double[_recordLength], new double[_recordLength], new double[_recordLength] };

                uint segment = (startpos) >> 8;
                uint offset = (startpos) & 0xFF;

                // Указываем адрес, откуда будем читать
                _device.PrepareForReading(segment);
                int count = (int) (_recordLength * _enabledChannelsCount);

                var rawdata = new ushort[(int)(count + offset)];
                _device.GetData(rawdata);

                for (int k = 0, j = 0; j < _recordLength; j++)
                {
                    for (int i = 0; i < _enabledChannelsCount; i++)
                        if (buffer[i].Length > 0)
                        {
                            buffer[i][j] = _callibrs[i].ToValue(rawdata[offset + k]);
                            k++;
                        }
                }
                for (int i = 0, k =0 ; i < ChannelCount; i++)
                {
                    if (_channelsStates[i]) _data[i] = buffer[k++];
                }
                _isDataReady = true;
                return true;
            }
            return false;
        }