using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace NIDAQmx
{
    public class InChannel : Channel
    {
        internal InChannel(DAQmxSession session) : base(session)
        {
        }
        public void ReadRaw(int numSampsPerChan, double timeout, ref byte data, uint arraySizeInBytes, ref int sampsRead, ref int numBytesPerSamp)
        {
            _Session.CheckResult(_Session.GetDelegate<Internal.DataRead.DAQmxReadRaw>()(_Session.TaskHandle, numSampsPerChan, timeout, ref data, arraySizeInBytes, ref sampsRead, ref numBytesPerSamp, IntPtr.Zero));
        }
        public void ReadRaw(int numSampsPerChan, double timeout, ref ushort data, uint arraySizeInBytes, ref int sampsRead, ref int numBytesPerSamp)
        {
            _Session.CheckResult(_Session.GetDelegate<Internal.DataRead.DAQmxReadRaw>()(_Session.TaskHandle, numSampsPerChan, timeout, ref Unsafe.As<ushort, byte>(ref data), arraySizeInBytes, ref sampsRead, ref numBytesPerSamp, IntPtr.Zero));
        }
        public void ReadRaw(int numSampsPerChan, double timeout, ref uint data, uint arraySizeInBytes, ref int sampsRead, ref int numBytesPerSamp)
        {
            _Session.CheckResult(_Session.GetDelegate<Internal.DataRead.DAQmxReadRaw>()(_Session.TaskHandle, numSampsPerChan, timeout, ref Unsafe.As<uint, byte>(ref data), arraySizeInBytes, ref sampsRead, ref numBytesPerSamp, IntPtr.Zero));
        }
        public void ReadRaw(int numSampsPerChan, double timeout, ref sbyte data, uint arraySizeInBytes, ref int sampsRead, ref int numBytesPerSamp)
        {
            _Session.CheckResult(_Session.GetDelegate<Internal.DataRead.DAQmxReadRaw>()(_Session.TaskHandle, numSampsPerChan, timeout, ref Unsafe.As<sbyte, byte>(ref data), arraySizeInBytes, ref sampsRead, ref numBytesPerSamp, IntPtr.Zero));
        }
        public void ReadRaw(int numSampsPerChan, double timeout, ref short data, uint arraySizeInBytes, ref int sampsRead, ref int numBytesPerSamp)
        {
            _Session.CheckResult(_Session.GetDelegate<Internal.DataRead.DAQmxReadRaw>()(_Session.TaskHandle, numSampsPerChan, timeout, ref Unsafe.As<short, byte>(ref data), arraySizeInBytes, ref sampsRead, ref numBytesPerSamp, IntPtr.Zero));
        }
        public void ReadRaw(int numSampsPerChan, double timeout, ref int data, uint arraySizeInBytes, ref int sampsRead, ref int numBytesPerSamp)
        {
            _Session.CheckResult(_Session.GetDelegate<Internal.DataRead.DAQmxReadRaw>()(_Session.TaskHandle, numSampsPerChan, timeout, ref Unsafe.As<int, byte>(ref data), arraySizeInBytes, ref sampsRead, ref numBytesPerSamp, IntPtr.Zero));
        }
    }
}
