Open two 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.
To search for devices, GetDeviceCount() can be used to query a count of available devices, and then Get DeviceListModel() and GetDeviceListSerial() can be used to find the model number and serial numbers for each attached device, respectively.
C/C++
// Instantiate okCFrontPanel for each device
okCFrontPanel dev1;
okCFrontPanel dev2;
// Open each device separately
dev1.OpenBySerial("2002000ABC");
dev2.OpenBySerial("2002000DEF");
// It's a good idea to retrieve identifying information for each device
okTDeviceInfo infoDev1;
okTDeviceInfo infoDev2;
// Retrieve serial number for verification
dev1.GetDeviceInfo(infoDev1);
dev2.GetDeviceInfo(infoDev2);
std::cout << "Device 1 serial number: " << infoDev1.serialNumber << "n";
std::cout << "Device 2 serial number: " << infoDev2.serialNumber << "n";
Code language: PHP (php)
C#
// Instantiate okCFrontPanel for each device
okCFrontPanel dev1 = new okCFrontPanel();
okCFrontPanel dev2 = new okCFrontPanel();
// Open each device separately
dev1.OpenBySerial("2002000ABC");
dev2.OpenBySerial("2002000DEF");
// It is a good idea to retrieve identifying information for each device
okTDeviceInfo infoDev1 = new okTDeviceInfo();
okTDeviceInfo infoDev2 = new okTDeviceInfo();
// Retrieve serial number for verification
dev1.GetDeviceInfo(infoDev1);
dev2.GetDeviceInfo(infoDev2);
Console.WriteLine("Device 1 serial number: {0}", infoDev1.serialNumber);
Console.WriteLine("Device 2 serial number: {0}", infoDev2.serialNumber);
Code language: JavaScript (javascript)
Python
# Instantiate okCFrontPanel for each device
dev1 = ok.okCFrontPanel()
dev2 = ok.okCFrontPanel()
# Open each device separately
dev1.OpenBySerial("2002000ABC")
dev2.OpenBySerial("2002000DEF")
# It's a good idea to retrieve identifying information for each device
infoDev1 = ok.okTDeviceInfo();
infoDev2 = ok.okTDeviceInfo();
# Retrieve serial number for verification
dev1.GetDeviceInfo(infoDev1);
dev2.GetDeviceInfo(infoDev2);
print infoDev1.serialNumber;
print infoDev2.serialNumber;
Code language: PHP (php)
Java
public class example{
// Instantiate okCFrontPanel for each device
okCFrontPanel dev1;
okCFrontPanel dev2;
// It's a good idea to retrieve identifying information for each device
okTDeviceInfo infoDev1;
okTDeviceInfo infoDev2;
public void Open(){
dev1 = new okCFrontPanel();
dev2 = new okCFrontPanel();
// Open each device separately
dev1.OpenBySerial("2002000ABC");
dev2.OpenBySerial("2002000DEF");
// Retrieve serial number for verification
dev1.GetDeviceInfo(infoDev1);
dev2.GetDeviceInfo(infoDev2);
System.out.println("Device 1 serial number: " + infoDev1.serialNumber);
System.out.println("Device 2 serial number: " + infoDev2.serialNumber);
}
}
Code language: PHP (php)