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

namespace NIDAQmx
{
    public class AOTiming : BaseDevice
    {
        internal AOTiming(DAQmxSession session, string deviceName) : base(session, deviceName)
        {
            _Session.CheckResult(_Session.GetDelegate<Internal.Internal.DAQmxGetDevAOMaxRate>()(DeviceName, ref maxrate));
            _Session.CheckResult(_Session.GetDelegate<Internal.Internal.DAQmxGetDevAOMinRate>()(DeviceName, ref minrate));
            _Session.CheckResult(_Session.GetDelegate<Internal.Internal.DAQmxGetDevAOSampClkSupported>()(DeviceName, ref sampClkSupported));
            SampleModes[] modes = new SampleModes[Enum.GetValues<SampleModes>().Length];
            _Session.CheckResult(_Session.GetDelegate<Internal.Internal.DAQmxGetDevAOSampModes>()(DeviceName, ref modes[0], (uint)modes.Length));
            SampModes = modes.Where(x=>x!=0).ToArray();
        }
        private double maxrate;
        private double minrate;
        private bool sampClkSupported;
        public double MaxRate => maxrate;
        public double MinRate => minrate;
        public bool SampClkSupported => sampClkSupported;
        public SampleModes[] SampModes { get; }
    }
}
