Notice: This page contains information for the legacy Phidget21 Library. Phidget21 does not support VINT Phidgets, and will not support any new Phidgets. Phidget21 will be maintained until 2020. We recommend that new projects be developed against the Phidget22 Library.
The Phidget Manager is a software object that lets you access all of the Phidgets attached to your system. If you want to 'search for all attached Phidgets', in your code the Manager is the tool you would use.
You are probably already used to Phidget software objects, where a single set of functions for a board - say, an Interface Kit:
....Is actually embedded into an object that also uses the Phidget Common library to open, close, and delete:
And this common set of functions does not vary from Phidget device to Phidget device:
This is not true for the Manager. The Manager is an object like other Phidget objects, but with a distinct difference - all of its functions are Manager functions:
For some languages, such as C, this means you do not have to change between a
Phidget type and your specific device type when opening, closing, etc. All manager functions take a Phidget Manager type object.
You can find the API for the Phidget Manager in the API on the page for your language.
Perhaps the most useful function of the Manager is the
getAttachedDevices() function. This is the tool that returns all attached Phidget devices, as its name implies. The returned devices are returned as an array:
This works due to the fact that all software objects for Phidget devices are Phidget software objects. So you get a whole array back of Phidget objects, upon which you can use the Phidget Common API - such as getSerialNumber(), or getDeviceName() - to determine what they are and then cast the array item into the Phidget device that it actually is:
This way, you can use the whole API for your device.
When using the Manager expressly for the
getAttachedDevices() function, you must allow time for the PhidgetManager to detect for any Phidgets attached to the system. This can be achieved by allowing the program to wait a short while before attempting to get the attached devices. Another method would be to get the attached devices once the PhidgetManager's attach event triggers.
Using the Phidget Manager
We even have a specific section of code snippets on using the Manager, in the Using the Manager section of General Phidget Programming.
Finally, all of our HelloWorld programming examples - available for most of the languages we support - use the Manager to work with any Phidget.