Page 1 of 1

methods for channel count?

Posted: Fri Sep 22, 2017 6:01 pm
by benji2505
This might be something obvious that I am missing:
I am migrating a larger program that read out the max number of channels for input (channels) and output (channels) with the getInputCount() and the getOutputCount() methods. It is used for graphics and the creation of arrays and helps with independence from the attached I/o board hardware.
Is there something comparable now? I did not see it in the respective channel classes and I did not realize it in the Phidget class.

Re: methods for channel count?

Posted: Mon Sep 25, 2017 8:41 am
by mparadis
Channel count functions don't exist in Phidget22 because channels attach individually instead of as one device.

You'll need to use the Phidget Manager class, which has an event handler for whenever a channel attaches. Once the channel is attached, you can use generic Phidget class functions to determine what kind of channel it is and which physical device it belongs to.

For more information see the API documentation (specifically the Phidget and Manager APIs), and the Manager page in our documentation.

Re: methods for channel count?

Posted: Mon Sep 25, 2017 6:30 pm
by benji2505
Well, I am well aware of the attach and detach events for channels and I am also aware of the APIs. I was also aware of the new methodology to connect channels directly.
So, your suggestion is to wait for an attach event, use that event to find out the underlying hardware and then use that info to set up graphics and arrays? Cheeez. What should be done with graphics before you have an attach event?

Re: methods for channel count?

Posted: Tue Sep 26, 2017 7:41 am
by mparadis
Just to clarify, when I say "attached", I mean physically plugged into your computer, not "opened and attached" (I know, it's confusing and I wish we had chosen a different word for this in the API). The Phidget Manager can see Phidgets before they are opened, so you can update the graphics as soon as you get that event. If you look at the way the Phidget Control Panel lists all Phidgets connected to your computer and over the network, this is accomplished using the manager. You can look at the code for how it's implemented in the C# example for the manager.

Re: methods for channel count?

Posted: Tue Sep 26, 2017 12:00 pm
by benji2505
ok, thanks for the update.