net.jhid.core.devices
Interface IDevice

All Known Implementing Classes:
AbstractDevice

public interface IDevice

Represents a physical device. A device comprises a number of axes and buttons, which can be retrieved by the getAxes() and getButtons() methods. Axes and buttons are identified by constants in the AxisId and ButtonId classes. It is also possible to obtain a particular axis or button of a device with the getAxis(AxisId) and getButton(ButtonId) methods; these methods simply return null if the requested axis or button is not available for this device.

Each particular axis or button can be listened for events; it is also possible to listen to the whole device. In the latter case, the listener will receive the events of all axes and buttons of the device. See the following methods:

  • addListener(IDeviceListener)
  • #addListener(IAbsoluteAxisListener)
  • IRelativeAxis.addListener(IRelativeAxisListener)
  • IButton.addListener(IButtonListener)


    Method Summary
     void addListener(IDeviceListener aListener)
              Adds a listener that will be notified of all the events occuring on the buttons and axes of this device.
     IAxis[] getAxes()
               
     IAxis getAxis(AxisId aId)
               
     IButton getButton(ButtonId aId)
               
     IButton[] getButtons()
               
     IDeviceInfo getDeviceInfo()
               
     void removeListener(IDeviceListener aListener)
              Removes a previously added listener.
     

    Method Detail

    getDeviceInfo

    public IDeviceInfo getDeviceInfo()
    Returns:
    An object that can provide information about this device, such as its name, vendor id, etc.

    addListener

    public void addListener(IDeviceListener aListener)
    Adds a listener that will be notified of all the events occuring on the buttons and axes of this device.


    removeListener

    public void removeListener(IDeviceListener aListener)
    Removes a previously added listener.


    getAxes

    public IAxis[] getAxes()
    Returns:
    All the axes of this device.

    getButtons

    public IButton[] getButtons()
    Returns:
    All the buttons of this device.

    getAxis

    public IAxis getAxis(AxisId aId)
    Returns:
    The axis with the specified identifier, or null if absent.

    getButton

    public IButton getButton(ButtonId aId)
    Returns:
    The button with the specified identifier, or null if absent.