Direct Interface [dev]
Since version 0.5b WiimoteController supports a direct interface in a form of a publicly exposed service which enables other apps to get more data about connected controllers. In addition to configuration-independent key pressing and releasing events, apps can also get:
- number of currently connected wiimotes
- info about connected peripherals, if any
- notifications when wiimotes or peripherals connect and disconnect
- precise analog stick data from nunchuks and classic controllers connected
- a way to make everything look integrated and transparent to the user
Current version of the direct interface is 1. This number is important because it is used to check for compatibility as future updates get published. Some facts:
- as long as apps follow conventions about checking for compatibility, demonstrated in the demo project below, this interface will be compatible
- this interface will be backwards compatible. This means that the interface will only grow so that updates to the WiimoteController and the direct interface will not intentionally break any existing apps using the direct interface. Bug fixes will not increase the version number, but any additional functionality will
- this interface will not be forward compatible. This happens when an app tries using the latest version of the interface but the user has not yet updated the WiimoteController app. If this case appears, the interface should not be used but instead users should be given the opportunity to update the WiimoteController app in order to get support for the current and all previous interfaces
The demo project with the documented interface can be downloaded below.
Version 1 of the direct interface: wiimotecontrollerusagedemo1.zip [108 KiB]
This demo and its source code have been released under the the BSD 2-Clause License. This license grants you the usage of the code in your own project (even a commercial one), but makes no guarantees about proper functionality. Also, you are required to mention that you are using it. If your app will be or is published, contact me and I might put up a link to your app on this web page.
Currently known bugs in the implementation:
- getAnalogInputStatus(int, int) does not return correct values when analog feedback is disabled. Does not effect the callback interface. Already fixed in the current release candidate
- getNumberOfConnectedWiimotes() does not return the correct value once some (but not yet all) of the wiimotes get disconnected. Does not effect the callback interface