public void Stop() { _done = true; if (_openDmxConnection.IsOpen) { _status = _openDmxConnection.Close(); } }
public static List <Device> GetDeviceList() { List <Device> devices = new List <Device>(); UInt32 ftdiDeviceCount = 0; // Create new instance of the FTDI device class FTDI tempFtdiDevice = new FTDI(); Logging.Info("Interogating FTDI for devices."); // Determine the number of FTDI devices connected to the machine FTDI.FT_STATUS ftStatus = tempFtdiDevice.GetNumberOfDevices(ref ftdiDeviceCount); // Check status if (ftStatus != FTDI.FT_STATUS.FT_OK) { Logging.Error($"An error occured getting FTDI devices. {ftStatus.ToString()}"); return(devices); } if (ftdiDeviceCount > 0) { // Allocate storage for device info list FTDI.FT_DEVICE_INFO_NODE[] ftdiDeviceList = new FTDI.FT_DEVICE_INFO_NODE[ftdiDeviceCount]; // Populate our device list ftStatus = tempFtdiDevice.GetDeviceList(ftdiDeviceList); //Show device properties if (ftStatus == FTDI.FT_STATUS.FT_OK) { for (var i = 0; i < ftdiDeviceCount; i++) { Device d = new Device { Index = i, Type = ftdiDeviceList[i].Type.ToString(), Id = ftdiDeviceList[i].ID.ToString(), Description = ftdiDeviceList[i].Description, SerialNumber = ftdiDeviceList[i].SerialNumber }; devices.Add(d); } } else { Logging.Error($"Error getting FTDI device list {ftStatus.ToString()}"); } } //Close device ftStatus = tempFtdiDevice.Close(); Logging.Info("Closing FTDI device interogation."); return(devices); }