using NIDAQmx.DAQmxEnum;
using System.Text;

namespace NIDAQmx
{
    public class Class : BaseDevice
    {
        internal Class(DAQmxSession session, string deviceName) : base(session, deviceName)
        {
            ModuleDevNames = GetModuleDevNames();
        }
        private string[] GetModuleDevNames()
        {
            byte[] bytes = new byte[1024];
            _Session.CheckResult(_Session.GetDelegate<Internal.Internal.DAQmxGetDevChassisModuleDevNames>()(DeviceName, ref bytes[0], (uint)bytes.Length));
            return Encoding.UTF8.GetString(bytes).Trim('\0').Split(',').Select(x => x.Trim('\0')).Where(x => !string.IsNullOrEmpty(x)).ToArray();
        }

        public string[] ModuleDevNames { get; }
    }
}
