How to check xem connection windows

Hi all,

i wrote a gui application in python which communicates with an xem6010.
I want to check the xem connection to avoid errors by trying to communicate with the xem if it is disconnected. I first tried to use the IsOpen function, but it always returns true, even if i unplug the xem. So i wrote a simple function that checks the connection using the GetDeviceListSerial function. So if the device list does not contain the serial of the connected xem, i know that it is disconnected. I don’t know if this is the recommended way to check the connection, but it works pretty good. But only on linux, so heres the problem:

When i start the application on windows(8.1) it immediatly reports that the board is disconnected. To find the error i started the python interpreter, imported ok and typed these commands (one xem6010 is connected):

xem = ok.FrontPanel()
xem.GetDeviceCount()          // that returns 1 as it should
xem.GetDeviceListSerial(0)   // it returns the serial
xem.OpenBySerial("serial") 
xem.GetDeviceCount()          // now it returns 0
xem.GetDeviceListSerial(0)   // it returns an empty string

so as you can see this way to check the connection does not work on windows (on linux GetDeviceCount() returns always 1 and GetDeviceListSerial(0) returns the correct serial).

Does anyone know about this error or even a solution? Or maybe do you know a better way to check the connection?

jk

Hi *,

i searched a bit and i found the API reference for the Version 4.2 which is installed with the Frontpanel app on windows. Can i find this reference Version on the internet?? when i’m working on linux i don’t know how to find the correct reference version.

Anyway i found out about the GetDeviceInfo( okTDeviceInfo * info ) function that fills a okTDeviceInfo() struct. So that works pretty good on windows. When plug in the device and open the connection i get the correct serial number using GetDeviceInfo(…) and then info.serialNumber. When i unplug the device and type GetDeviceInfo(…) i get the error DeviceNotConnected. So that works as i expected and solves the problem i described above…

But Hey! theres a new problem: it doesn’t work on linux! When i do the exact same stuff and run GetDeviceInfo(…) it doesn’t return -8 (DeviceNotOpen) as expected but 0 (NoError) and info.serialNumber still holds the old value of the disconnected device.

Does anyone have an idea how i can check the connection that works on windows and on linux??

thanks
jk