PhidgetsMBS vs Phidgets Control Panel

I have a long-standing issue with PhidgetsMBS (which I love), to wit, that after my Xojo app using Phidgets has run on a Windows PC, the Phidgets Control Panel app will no longer run until I restart the machine. Windows briefly flickers the Phidgets Control Panel icon and then the app quits immediately. This is without my Xojo app running, i.e. I run it and then quit.

I can run my Xojo app an unlimited number of times and the Phidgets always work. I can run the Phidgets Control Panel an unlimited number of times and it always works, as long as I don’t run my Xojo app.

But once the Xojo app has run, Phidgets Control Panel will not, until I restart the PC.

Windows 10, Xojo 2021r2.1, MBS 24.1, Phidgets 22 latest release (I think).

Anyone else see this? Could it be that MBS is not releasing the Phidgets library or something?

Well, you could make sure you destroy all phidget objects and then on the end of the app call Phidget’s resetLibrary method.

Normally you don’t need to do this since quitting the app should free all objects automatically.

Did you ask Phidget’s support about this?

2 Likes

I believe i’ve seen this before. You need to close/release the local phidgets as the local phidgets are exclusive to 1 instance.

So i guess .close on all phidgets and releaseLibrary should do the trick.

After that you can open the control panel again. Keeping it open is not the way since the local usb phidgets are exclusive, and thus the control panel would open them and your app can’t then. And vice versa.

1 Like

I’ll add the finalize() function, which is optional to cleanup. Should happen automatically, but I can expose this as method.

Also I’ll add InstanceCount to query how many Phidget objects you have.

1 Like

That seems to have been sufficient, thanks!

I did not, because sadly they seem to not care about Xojo, even though they have programming examples for virtually every other language. I once wrote them telling them how great Xojo is and MBS, and they didn’t even reply.

Okay, with next pre-release, we get InstanceCount property. So you can put an if around it:

e.g.

Dim InstanceCount As Integer = PhidgetMBS.InstanceCount // shows 0
If InstanceCount > 0 Then
  // something wrong. Still objects around!
Else
  // explicit shutdown library
  PhidgetMBS.finalize(0)
End If
2 Likes

They addes my requested type of rfid reader connection :sunglasses: probably depends on volume?

1 Like