|
VoltAir
|
Maintains global list of connected controllers and notifies registered listeners of changes in these statuses. More...
Classes | |
| class | DeviceConnectionListener |
| Interface for listening to changes in device connection statuses. More... | |
| class | StaticDeviceConnectionListener |
| Helper factory class to generate a new DeviceConnectionListerer instance for a static callback function. More... | |
Public Types | |
| typedef std::function< void(int, bool)> | DeviceConnectionCallback |
Callback indicating whether the device identified by deviceId has either connected or disconnected. More... | |
Public Member Functions | |
| template<class T = VirtualController> | |
| T * | getController (int deviceId, const ControllerFactory *factory=nullptr) const |
Returns the VirtualController corresponding to the specified deviceId. More... | |
| template<class T > | |
| bool | isControllerOfType (VirtualController *controller) const |
| Returns whether or not the specified VirtualController is of the template type. More... | |
| template<class T > | |
| bool | isControllerOfType (int deviceId) const |
Returns whether or not the VirtualController specified by deviceId is of the template type. More... | |
| void | reset () |
| Resets the state (i.e. disconnects) of all connected controllers. More... | |
| void | registerDeviceConnectionListener (DeviceConnectionListener *listener) |
| Registers a new listener to be notified of device connection change events. More... | |
| void | unregisterDeviceConnectionListener (DeviceConnectionListener *listener) |
| Unregisters a listener to no longer be notified of device connection change events. More... | |
| bool | isControllerConnected (int deviceId) const |
Returns whether or not the VirtualController specified by deviceId is currently known to be connected. More... | |
| const std::set< int > & | getConnectedControllers () const |
| Returns the list of all VirtualController deviceIds that are currently connected. More... | |
| void | onControllerDisconnect (int deviceId) |
Notifies the ControllerManager that the VirtualController specified by deviceId has disconnected. More... | |
Static Public Member Functions | |
| static ControllerManager * | getInstance () |
| Returns the global singleton instance of the ControllerManager. More... | |
Maintains global list of connected controllers and notifies registered listeners of changes in these statuses.
| typedef std::function<void(int, bool)> ControllerManager::DeviceConnectionCallback |
Callback indicating whether the device identified by deviceId has either connected or disconnected.
|
inline |
Returns the list of all VirtualController deviceIds that are currently connected.
|
inline |
Returns the VirtualController corresponding to the specified deviceId.
This method will construct the VirtualController if it does not exist and a ControllerFactory is provided (i.e. lazily initialize connection status).
| deviceId | Id of the device to retrieve a VirtualController for |
| factory | ControllerFactory to construct a non-existent VirtualController from |
|
static |
Returns the global singleton instance of the ControllerManager.
|
inline |
Returns whether or not the VirtualController specified by deviceId is currently known to be connected.
| deviceId | Id of the VirtualController to check for connection |
|
inline |
Returns whether or not the specified VirtualController is of the template type.
| controller | VirtualController whose type to check |
|
inline |
Returns whether or not the VirtualController specified by deviceId is of the template type.
| deviceId | Id of the VirtualController whose type to check |
| void ControllerManager::onControllerDisconnect | ( | int | deviceId | ) |
Notifies the ControllerManager that the VirtualController specified by deviceId has disconnected.
onControllerConnect(int) method since ControllerManager does lazy initialization of device connection status. | deviceId | Id of VirtualController which has become disconnected |
| void ControllerManager::registerDeviceConnectionListener | ( | DeviceConnectionListener * | listener | ) |
Registers a new listener to be notified of device connection change events.
| listener | Listener to be notified of all changes in device connection status |
| void ControllerManager::reset | ( | ) |
Resets the state (i.e. disconnects) of all connected controllers.
| void ControllerManager::unregisterDeviceConnectionListener | ( | DeviceConnectionListener * | listener | ) |
Unregisters a listener to no longer be notified of device connection change events.
| listener | Listener to no longer be notified of changes in device connection status |