This library was written in Java as a JNI interface to the phidget21 C library. This base C library is available with the JNI extensions for Windows, MacOS and Linux, so Phidgets can be used with Java on all of these operating systems. The advantage of a JNI is that it is extremely fast compared to any sort of non-native interface. All of the functionality of the base library is provided through this JNI.
To start using a Phidget, it's object must first be created, and then one of the {@link com.phidgets.Phidget#open open} methods must be called to create a connection. Open is an asynchronous call, so it's returning can not be tacken as meaning that the Phidget is available. To this end, there are both synchronous and asynchronous notification processes availabel for determining when a Phidget is connected. See {@link com.phidgets.Phidget#open(int) open} for more information.
Many events are supported for each Phidget, with the base events {@link com.phidgets.event.AttachEvent Attach}, {@link com.phidgets.event.DetachEvent Detach}, {@link com.phidgets.event.ServerConnectEvent ServerConnect}, {@link com.phidgets.event.ServerDisconnectEvent ServerDisconnect} and {@link com.phidgets.event.ErrorEvent Error} being available for every Phidget. These events should be registered before the call to open, so as to not miss any events.
Also, note that open is pervasive. This means that a Phidget can be opened when it is not plugged in, and stay opened even if it is unplugged multiple times during operation. Use the {@link com.phidgets.event.AttachEvent Attach} and {@link com.phidgets.event.DetachEvent Detach} events to keep track of this. When the phidget is no longer required, {@link com.phidgets.Phidget#close close} should be called.