private void Form1_Load(object sender, EventArgs e) { // Display library version textBoxInfo.Text = string.Concat("Using Quantis library version ", Quantis.GetLibVersion(), Environment.NewLine); // Count Quantis devices int countPci = Quantis.Count(QuantisDeviceType.QUANTIS_DEVICE_PCI); int countUsb = Quantis.Count(QuantisDeviceType.QUANTIS_DEVICE_USB); textBoxInfo.Text += string.Concat("Found: ", Environment.NewLine); textBoxInfo.Text += string.Concat(" - ", countPci, " Quantis PCI/PCIe", Environment.NewLine); textBoxInfo.Text += string.Concat(" - ", countUsb, " Quantis USB", Environment.NewLine); textBoxInfo.Text += Environment.NewLine; // Select first available device // Note that in a real application, it would be better to let the user choose the device he wants to use... if (countPci > 0) { deviceType = QuantisDeviceType.QUANTIS_DEVICE_PCI; deviceNumber = 0; textBoxInfo.Text += string.Concat("Using PCI card #", deviceNumber, Environment.NewLine); } else if (countUsb > 0) { deviceType = QuantisDeviceType.QUANTIS_DEVICE_USB; deviceNumber = 0; textBoxInfo.Text += string.Concat("Using USB device #", deviceNumber, Environment.NewLine); } else { textBoxInfo.Text = string.Concat("ERROR: No Quantis found!", Environment.NewLine); groupBoxData.Enabled = false; return; } // Display information about used device try { Quantis quantis = new Quantis(deviceType, deviceNumber); textBoxInfo.Text += string.Concat(" core version: ", quantis.GetBoardVersion().ToString("X"), Environment.NewLine); textBoxInfo.Text += string.Concat(" serial number: ", quantis.GetSerialNumber(), Environment.NewLine); textBoxInfo.Text += string.Concat(" manufacturer: ", quantis.GetManufacturer(), Environment.NewLine); } catch (QuantisException ex) { textBoxInfo.Text += string.Concat("ERROR while retrieving Quantis information: ", ex.Message, Environment.NewLine); } }
private static extern int QuantisReadFloat_01(QuantisDeviceType deviceType, uint deviceNumber, out float data);
private static extern int QuantisReadScaledDouble(QuantisDeviceType deviceType, uint deviceNumber, out double data, double min, double max);
private static extern int QuantisReadDouble_01(QuantisDeviceType deviceType, uint deviceNumber, out double data);
private static extern int QuantisRead(QuantisDeviceType deviceType, uint deviceNumber, byte[] data, IntPtr size);
private static extern int QuantisModulesReset(QuantisDeviceType deviceType, uint deviceNumber, int modulesMask);
/// <summary> /// Initializes a new instance of the Quantis class to access the specified device. /// </summary> /// <param name="deviceType">The type of Quantis device.</param> /// <param name="deviceNumber">The Quantis device number. Note that first device is 0.</param> public Quantis(QuantisDeviceType deviceType, uint deviceNumber) { this.deviceType = deviceType; this.deviceNumber = deviceNumber; }
private static extern int QuantisReadShort(QuantisDeviceType deviceType, uint deviceNumber, out short data);
private static extern IntPtr QuantisGetManufacturer(QuantisDeviceType deviceType, uint deviceNumber);
private static extern float QuantisGetDriverVersion(QuantisDeviceType deviceType);
private static extern int QuantisGetBoardVersion(QuantisDeviceType deviceType, uint deviceNumber);
private static extern int QuantisCount(QuantisDeviceType deviceType);
private static extern int QuantisBoardReset(QuantisDeviceType deviceType, uint deviceNumber);
/// <summary> /// Returns the number of specific Quantis type devices that have been detected on the system. /// </summary> /// <param name="deviceType">The type of Quantis device.</param> /// <returns>The number of Quantis devices that have been detected on the system.</returns> /// <remarks>If an error occurred while counting the devices, 0 is returned.</remarks> public static int Count(QuantisDeviceType deviceType) { return(QuantisCount(deviceType)); }
private static extern int QuantisReadScaledFloat(QuantisDeviceType deviceType, uint deviceNumber, out float data, float min, float max);
private static extern int QuantisReadScaledInt(QuantisDeviceType deviceType, uint deviceNumber, out int data, int min, int max);
private static extern int QuantisGetModulesStatus(QuantisDeviceType deviceType, uint deviceNumber);
private static extern int QuantisReadScaledShort(QuantisDeviceType deviceType, uint deviceNumber, out short data, short min, short max);
private static extern IntPtr QuantisGetSerialNumber(QuantisDeviceType deviceType, uint deviceNumber);