Exemple #1
0
        private string[] GetDeviceNames()
        {
            var buffer = new StringBuilder(256 + 1);
            var result = NidaQmxHelper.DAQmxGetSysDevNames(buffer, buffer.Length - 1);

            if (result < 0)
            {
                throw new SystemException("Could not query nidaq device list");
            }

            if (buffer.ToString().Length > 0)
            {
                return(buffer.ToString()
                       .Split(',')
                       .Select(s => s.Trim()).ToArray());
            }

            return(null);
        }
Exemple #2
0
        public List <IDevice> CreateDevices()
        {
            var buffer = new StringBuilder(256 + 1);
            var result = NidaQmxHelper.DAQmxGetSysDevNames(buffer, buffer.Length - 1);

            if (result < 0)
            {
                throw new SystemException("Could not query nidaq device list");
            }

            if (buffer.ToString().Length > 0)
            {
                return(buffer.ToString()
                       .Split(',')
                       .Select(s => s.Trim())
                       .Select(s => new NidaQmxDevice2(s, _gen))
                       .ToList <IDevice>());
            }
            else
            {
                return(new List <IDevice>());
            }
        }