/*===================================================================== | GENERIC DETECTION ROUTINE | ====================================================================*/ static void find_devices() { ushort[] ports = new ushort[16]; uint[] unique_ids = new uint[16]; int nelem = 16; // Find all the attached devices int count = CheetahApi.ch_find_devices_ext(nelem, ports, nelem, unique_ids); int i; Console.Write("{0:d} device(s) found:\n", count); // Print the information on each device if (count > nelem) { count = nelem; } for (i = 0; i < count; ++i) { // Determine if the device is in-use String status = "(avail) "; if ((ports[i] & CheetahApi.CH_PORT_NOT_FREE) != 0) { ports[i] &= unchecked ((ushort)~CheetahApi.CH_PORT_NOT_FREE); status = "(in-use)"; } // Display device port number, in-use status, and serial number Console.Write(" port={0,-3:d} {1:s} ({2:d4}-{3:d6})\n", ports[i], status, unique_ids[i] / 1000000, unique_ids[i] % 1000000); } }