using System.Runtime.CompilerServices;

namespace NIDAQmx
{
    public class OutChannel : Channel
    {
        internal OutChannel(DAQmxSession session) : base(session)
        {
        }
        public void WriteRaw(int numSamps,bool autoStart, double timeout, ref byte writeArray, ref int sampsPerChanWritten)
        {
            _Session.CheckResult(_Session.GetDelegate<Internal.DataWrite.DAQmxWriteRaw>()(_Session.TaskHandle, numSamps,autoStart, timeout, ref writeArray, ref sampsPerChanWritten, IntPtr.Zero));
        }
        public void WriteRaw(int numSamps, bool autoStart, double timeout, ref ushort writeArray, ref int sampsPerChanWritten)
        {
            _Session.CheckResult(_Session.GetDelegate<Internal.DataWrite.DAQmxWriteRaw>()(_Session.TaskHandle, numSamps, autoStart, timeout, ref Unsafe.As<ushort,byte>(ref writeArray), ref sampsPerChanWritten, IntPtr.Zero));
        }
        public void WriteRaw(int numSamps, bool autoStart, double timeout, ref uint writeArray, ref int sampsPerChanWritten)
        {
            _Session.CheckResult(_Session.GetDelegate<Internal.DataWrite.DAQmxWriteRaw>()(_Session.TaskHandle, numSamps, autoStart, timeout, ref Unsafe.As<uint, byte>(ref writeArray), ref sampsPerChanWritten, IntPtr.Zero));
        }
        public void WriteRaw(int numSamps, bool autoStart, double timeout, ref sbyte writeArray, ref int sampsPerChanWritten)
        {
            _Session.CheckResult(_Session.GetDelegate<Internal.DataWrite.DAQmxWriteRaw>()(_Session.TaskHandle, numSamps, autoStart, timeout, ref Unsafe.As<sbyte, byte>(ref writeArray), ref sampsPerChanWritten, IntPtr.Zero));
        }
        public void WriteRaw(int numSamps, bool autoStart, double timeout, ref short writeArray, ref int sampsPerChanWritten)
        {
            _Session.CheckResult(_Session.GetDelegate<Internal.DataWrite.DAQmxWriteRaw>()(_Session.TaskHandle, numSamps, autoStart, timeout, ref Unsafe.As<short, byte>(ref writeArray), ref sampsPerChanWritten, IntPtr.Zero));
        }
        public void WriteRaw(int numSamps, bool autoStart, double timeout, ref int writeArray, ref int sampsPerChanWritten)
        {
            _Session.CheckResult(_Session.GetDelegate<Internal.DataWrite.DAQmxWriteRaw>()(_Session.TaskHandle, numSamps, autoStart, timeout, ref Unsafe.As<int, byte>(ref writeArray), ref sampsPerChanWritten, IntPtr.Zero));
        }
    }
}
