Virtual Gamepad
Virtual Gamepad peripheral interface for RemoteControl devices.
Allows to receive navigation events when some predefined inputs on the device are triggered.
The mapping between physical inputs (buttons, axes, etc.) on the device and received navigation events is specific to the remote control in use: please refer to the remote control documentation for further information.
This peripheral is provided by all remote control devices, unless explicitly stated otherwise in the specific remote control documentation.
To start receiving navigation events, the virtual gamepad peripheral must be grabbed and a listener (that will receive all events) must be provided. When the virtual gamepad is grabbed, the remote control will stop forwarding events associated to its navigation inputs to the connected drone (if any) and instead forward those events to the application-provided listener.
To stop receiving events and having the device forward navigation input events back to the connected drone, the virtual gamepad must be released.
Most remote control devices also provide a more specialized gamepad interface (please refer to the remote control documentation for further information), which usually allows to listen to finer-grained remote control input events. However, when inputs are grabbed using such a specialized interface, the virtual gamepad cannot be used anymore. In case it is also currently grabbed, it will switch to a preempted state where navigation events won't be forwarded to the provided listener anymore, until all inputs on the specialized gamepad interface are released. At that point, the virtual gamepad will grab the navigation inputs again and resume forwarding events to the application listener.
The application can also subscribe to gamepad application events that are forwarded through a local broadcastintent when a combination of some physical inputs is triggered on the remote control. Those events are the APP_ACTION_*
values defined in ButtonsMappableAction enum. How those events are mapped to physical inputs and how those mappings can be configured is specific to the remote control device in use, please refer to the remote control documentation for further information.
This peripheral can be obtained from a RemoteControl
using:
remoteControl.getPeripheral(VirtualGamepad.class)