// Use this for initialization void Start() { deviceList = Tactonic.GetDeviceList(); }
public static TactonicDeviceList GetDeviceList() { Console.WriteLine("===================================================================="); Console.WriteLine("Copyright 2010-2013 Tactonics Technologies, LLC. All rights reserved"); Console.WriteLine("===================================================================="); deviceList = new TactonicDeviceList(); FTDI.FT_STATUS ftStatus = FTDI.FT_STATUS.FT_OK; UInt32 ftdiDeviceCount = 0; ftdi = new FTDI(); ftStatus = ftdi.GetNumberOfDevices(ref ftdiDeviceCount) | ftStatus; FTDI.FT_DEVICE_INFO_NODE[] ftdiDeviceList = new FTDI.FT_DEVICE_INFO_NODE[ftdiDeviceCount]; ftStatus = ftdi.GetDeviceList(ftdiDeviceList) | ftStatus; tactonicUSBList = new TactonicUSB[ftdiDeviceCount]; deviceList.devices = new TactonicDevice[ftdiDeviceCount]; deviceList.numDevices = 0; for (int i = 0; i < ftdiDeviceCount; i++) { tactonicUSBList[deviceList.numDevices] = new TactonicUSB(ftdi); string desc = "Dual RS232-HS A"; if (desc.Equals(ftdiDeviceList[i].Description, StringComparison.OrdinalIgnoreCase)) { tactonicUSBList[deviceList.numDevices].isTiles = true; if (tactonicUSBList[deviceList.numDevices].OpenDevice(ftdiDeviceList[i])) { deviceList.devices[deviceList.numDevices] = new TactonicDevice(); tactonicUSBList[deviceList.numDevices].GetDeviceInfo(deviceList.devices[deviceList.numDevices]); Console.WriteLine("Initializing Device " + deviceList.devices[deviceList.numDevices].serialNumber); Console.WriteLine("Device Firmware " + tactonicUSBList[deviceList.numDevices].firmwareVersion[0] + "." + tactonicUSBList[deviceList.numDevices].firmwareVersion[1]); Console.WriteLine("Tactonic Library "+TactonicUSB.LIBRARY_VERSION_MAJOR+"."+TactonicUSB.LIBRARY_VERSION_MINOR); deviceList.numDevices++; } i++; } else { if (tactonicUSBList[deviceList.numDevices].OpenDevice(ftdiDeviceList[i])) { deviceList.devices[deviceList.numDevices] = new TactonicDevice(); tactonicUSBList[deviceList.numDevices].GetDeviceInfo(deviceList.devices[deviceList.numDevices]); Console.WriteLine("Initializing Device " + deviceList.devices[deviceList.numDevices].serialNumber); Console.WriteLine("Device Firmware " + tactonicUSBList[deviceList.numDevices].firmwareVersion[0] + "." + tactonicUSBList[deviceList.numDevices].firmwareVersion[1]); Console.WriteLine("Tactonic Library " + TactonicUSB.LIBRARY_VERSION_MAJOR + "." + TactonicUSB.LIBRARY_VERSION_MINOR); deviceList.numDevices++; } } } return deviceList; }