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

namespace NIDAQmx
{
    public class AORange : BaseDevice
    {
        internal AORange(DAQmxSession session, string deviceName) : base(session, deviceName)
        {
            Range[] ranges= new Range[100];
            _Session.CheckResult(_Session.GetDelegate<Internal.Internal.DAQmxGetDevAOVoltageRngs>()(DeviceName, ref Unsafe.As<Range, double>(ref ranges[0]), (uint)(ranges.Length)));
            VoltageRngs = ranges.Where(x=>x.Max!=0 && x.Min!=0).ToArray();
            Array.Fill(ranges, default);

            _Session.CheckResult(_Session.GetDelegate<Internal.Internal.DAQmxGetDevAOCurrentRngs>()(DeviceName, ref Unsafe.As<Range, double>(ref ranges[0]), (uint)(ranges.Length)));
            CurrentRngs = ranges.Where(x => x.Max != 0 && x.Min != 0).ToArray();
        }
        public Range[] VoltageRngs { get; }
        public Range[] CurrentRngs { get; }
    }
}
