FrontPanel SDK Examples

These pages include a number of resources to help make you more productive with our products. Please refer to the following resources if you need a hand.

Enumerating Devices

Prior to opening a device, you can use an instance of okCFrontPanel to list available devices. It’s important to note that a device is only available in one thread or process at a time and therefore will not be visible in this list if another thread or process has already opened it.
We’ll use GetDeviceCount() to query available devices, then use GetDeviceListModel() and GetDeviceListSerial() to list the model numbers and serial numbers for each attached device, respectively.

okCFrontPanel dev;
int devCount = dev.GetDeviceCount();
 
for (i=0; i < devCount; i++) {
	std::cout << "Device[" << i << "] Model : " << dev.GetDeviceListModel(i) << "\n";
	std::cout << "Device[" << i << "] Serial : " << dev.GetDeviceListSerial(i) << "\n";
}
okCFrontPanel device = new okCFrontPanel();
int count = device.GetDeviceCount();
int i;
 
for (i = 0; i < count; i++)
{
    Console.WriteLine("Device[{0}] Model: {1}", i, device.GetDeviceListModel(i));
    Console.WriteLine("Device[{0}] Serial: {1}", i, device.GetDeviceListSerial(i));
}
device = ok.okCFrontPanel()
 
deviceCount = device.GetDeviceCount()
for i in range(deviceCount):
        print 'Device[{0}] Model: {1}'.format(i, device.GetDeviceListModel(i))
        print 'Device[{0}] Serial: {1}'.format(i, device.GetDeviceListSerial(i))
public class EnumDevice{
	okCFrontPanel device;
	int devCount;
	int previousCount;
	int i;
 
	public void Initialize(){
		device = new okCFrontPanel();
		previousCount = device.GetDeviceCount();
	}
 
	public void Enumerate(){
		devCount = device.GetDeviceCount();
		if(devCount != previousCount){
			for(i = 0; i < devCount; i++){
				System.out.println("Device["+i+"] Model: " + device.GetDeviceListModel(i));
				System.out.println("Device["+i+"] Serial: " + device.GetDeviceListSerial(i));
			}
		}
	}
}