methods for channel count?

Supporting Java SE version 7 and up
benji2505
Phidgetsian
Posts: 5
Joined: Fri Sep 22, 2017 5:47 pm
Contact:

methods for channel count?

Postby benji2505 » Fri Sep 22, 2017 6:01 pm

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.

User avatar
mparadis
Site Admin
Posts: 673
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: methods for channel count?

Postby mparadis » Mon Sep 25, 2017 8:41 am

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.

benji2505
Phidgetsian
Posts: 5
Joined: Fri Sep 22, 2017 5:47 pm
Contact:

Re: methods for channel count?

Postby benji2505 » Mon Sep 25, 2017 6:30 pm

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?

User avatar
mparadis
Site Admin
Posts: 673
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: methods for channel count?

Postby mparadis » Tue Sep 26, 2017 7:41 am

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.

benji2505
Phidgetsian
Posts: 5
Joined: Fri Sep 22, 2017 5:47 pm
Contact:

Re: methods for channel count?

Postby benji2505 » Tue Sep 26, 2017 12:00 pm

ok, thanks for the update.


Return to “Java”

Who is online

Users browsing this forum: No registered users and 0 guests