AntiMicroX
Public Slots | Signals | Public Member Functions | Protected Member Functions | Private Slots | Private Member Functions | Private Attributes
InputDaemon Class Reference

Fetches hardware events from SDL and dispatch them to input objects like JoyAxis or JoyButton. Runs in a separate thread. More...

#include <inputdaemon.h>

Inheritance diagram for InputDaemon:
[legend]
Collaboration diagram for InputDaemon:
[legend]

Public Slots

void run ()
 
void quit ()
 
void refresh ()
 
void refreshJoystick (InputDevice *joystick)
 
void refreshJoysticks ()
 
void startWorker ()
 
void refreshMapping (QString mapping, InputDevice *device)
 
void removeDevice (InputDevice *device)
 
void addInputDevice (int index, QMap< QString, int > &uniques, int &counterUniques, bool &duplicatedGamepad)
 
void refreshIndexes ()
 

Signals

void joystickRefreshed (InputDevice *joystick)
 
void joysticksRefreshed (QMap< SDL_JoystickID, InputDevice * > *joysticks)
 
void complete (InputDevice *joystick)
 
void complete ()
 
void deviceUpdated (int index, InputDevice *device)
 
void deviceRemoved (SDL_JoystickID deviceID)
 
void deviceAdded (InputDevice *device)
 

Public Member Functions

 InputDaemon (QMap< SDL_JoystickID, InputDevice * > *joysticks, AntiMicroSettings *settings, bool graphical=true, QObject *parent=0)
 
 ~InputDaemon ()
 

Protected Member Functions

InputDeviceBitArrayStatuscreateOrGrabBitStatusEntry (QHash< InputDevice *, InputDeviceBitArrayStatus * > *statusHash, InputDevice *device, bool readCurrent=true)
 
QString getJoyInfo (SDL_JoystickGUID sdlvalue)
 
QString getJoyInfo (Uint16 sdlvalue)
 
void firstInputPass (QQueue< SDL_Event > *sdlEventQueue)
 Fetches events from SDL event queue, filters them and updates InputDeviceBitArrayStatus. More...
 
void secondInputPass (QQueue< SDL_Event > *sdlEventQueue)
 Dispatches postprocessed SDL events to the input objects like JoyAxis or JoyButton and activates them at the end. More...
 
void modifyUnplugEvents (QQueue< SDL_Event > *sdlEventQueue)
 Postprocesses fetched raw events. More...
 
QBitArray createUnplugEventBitArray (InputDevice *device)
 
JoystickopenJoystickDevice (int index)
 
void clearBitArrayStatusInstances ()
 
void convertMappingsToUnique (QSettings *sett, QString guidString, QString uniqueIdString)
 

Private Slots

void stop ()
 
void resetActiveButtonMouseDistances ()
 
void updatePollResetRate (int tempPollRate)
 

Private Member Functions

QHash< SDL_JoystickID, Joystick * > & getTrackjoysticksLocal ()
 
QHash< InputDevice *, InputDeviceBitArrayStatus * > & getReleaseEventsGeneratedLocal ()
 
QHash< InputDevice *, InputDeviceBitArrayStatus * > & getPendingEventValuesLocal ()
 

Private Attributes

QMap< SDL_JoystickID, InputDevice * > * m_joysticks
 
QHash< SDL_JoystickID, Joystick * > trackjoysticks
 
QHash< SDL_JoystickID, GameController * > trackcontrollers
 
QHash< InputDevice *, InputDeviceBitArrayStatus * > releaseEventsGenerated
 
QHash< InputDevice *, InputDeviceBitArrayStatus * > pendingEventValues
 
bool stopped
 
bool m_graphical
 
SDLEventReadereventWorker
 
QThread * sdlWorkerThread
 
AntiMicroSettingsm_settings
 
QTimer pollResetTimer
 

Detailed Description

Fetches hardware events from SDL and dispatch them to input objects like JoyAxis or JoyButton. Runs in a separate thread.

Constructor & Destructor Documentation

◆ InputDaemon()

InputDaemon::InputDaemon ( QMap< SDL_JoystickID, InputDevice * > *  joysticks,
AntiMicroSettings settings,
bool  graphical = true,
QObject *  parent = 0 
)
explicit
Here is the call graph for this function:

◆ ~InputDaemon()

InputDaemon::~InputDaemon ( )
Here is the call graph for this function:

Member Function Documentation

◆ addInputDevice

void InputDaemon::addInputDevice ( int  index,
QMap< QString, int > &  uniques,
int &  counterUniques,
bool &  duplicatedGamepad 
)
slot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearBitArrayStatusInstances()

void InputDaemon::clearBitArrayStatusInstances ( )
protected
Here is the call graph for this function:
Here is the caller graph for this function:

◆ complete [1/2]

void InputDaemon::complete ( )
signal
Here is the caller graph for this function:

◆ complete [2/2]

void InputDaemon::complete ( InputDevice joystick)
signal

◆ convertMappingsToUnique()

void InputDaemon::convertMappingsToUnique ( QSettings *  sett,
QString  guidString,
QString  uniqueIdString 
)
protected
Here is the caller graph for this function:

◆ createOrGrabBitStatusEntry()

InputDeviceBitArrayStatus * InputDaemon::createOrGrabBitStatusEntry ( QHash< InputDevice *, InputDeviceBitArrayStatus * > *  statusHash,
InputDevice device,
bool  readCurrent = true 
)
protected
Here is the caller graph for this function:

◆ createUnplugEventBitArray()

QBitArray InputDaemon::createUnplugEventBitArray ( InputDevice device)
protected
Here is the call graph for this function:
Here is the caller graph for this function:

◆ deviceAdded

void InputDaemon::deviceAdded ( InputDevice device)
signal
Here is the caller graph for this function:

◆ deviceRemoved

void InputDaemon::deviceRemoved ( SDL_JoystickID  deviceID)
signal
Here is the caller graph for this function:

◆ deviceUpdated

void InputDaemon::deviceUpdated ( int  index,
InputDevice device 
)
signal
Here is the caller graph for this function:

◆ firstInputPass()

void InputDaemon::firstInputPass ( QQueue< SDL_Event > *  sdlEventQueue)
protected

Fetches events from SDL event queue, filters them and updates InputDeviceBitArrayStatus.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getJoyInfo() [1/2]

QString InputDaemon::getJoyInfo ( SDL_JoystickGUID  sdlvalue)
protected
Here is the caller graph for this function:

◆ getJoyInfo() [2/2]

QString InputDaemon::getJoyInfo ( Uint16  sdlvalue)
protected

◆ getPendingEventValuesLocal()

QHash< InputDevice *, InputDeviceBitArrayStatus * > & InputDaemon::getPendingEventValuesLocal ( )
private
Here is the caller graph for this function:

◆ getReleaseEventsGeneratedLocal()

QHash< InputDevice *, InputDeviceBitArrayStatus * > & InputDaemon::getReleaseEventsGeneratedLocal ( )
private
Here is the caller graph for this function:

◆ getTrackjoysticksLocal()

QHash< SDL_JoystickID, Joystick * > & InputDaemon::getTrackjoysticksLocal ( )
private
Here is the caller graph for this function:

◆ joystickRefreshed

void InputDaemon::joystickRefreshed ( InputDevice joystick)
signal
Here is the caller graph for this function:

◆ joysticksRefreshed

void InputDaemon::joysticksRefreshed ( QMap< SDL_JoystickID, InputDevice * > *  joysticks)
signal
Here is the caller graph for this function:

◆ modifyUnplugEvents()

void InputDaemon::modifyUnplugEvents ( QQueue< SDL_Event > *  sdlEventQueue)
protected

Postprocesses fetched raw events.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ openJoystickDevice()

Joystick * InputDaemon::openJoystickDevice ( int  index)
protected
Here is the call graph for this function:
Here is the caller graph for this function:

◆ quit

void InputDaemon::quit ( )
slot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ refresh

void InputDaemon::refresh ( )
slot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ refreshIndexes

void InputDaemon::refreshIndexes ( )
slot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ refreshJoystick

void InputDaemon::refreshJoystick ( InputDevice joystick)
slot
Here is the call graph for this function:

◆ refreshJoysticks

void InputDaemon::refreshJoysticks ( )
slot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ refreshMapping

void InputDaemon::refreshMapping ( QString  mapping,
InputDevice device 
)
slot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeDevice

void InputDaemon::removeDevice ( InputDevice device)
slot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ resetActiveButtonMouseDistances

void InputDaemon::resetActiveButtonMouseDistances ( )
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ run

void InputDaemon::run ( )
slot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ secondInputPass()

void InputDaemon::secondInputPass ( QQueue< SDL_Event > *  sdlEventQueue)
protected

Dispatches postprocessed SDL events to the input objects like JoyAxis or JoyButton and activates them at the end.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ startWorker

void InputDaemon::startWorker ( )
slot

◆ stop

void InputDaemon::stop ( )
privateslot
Here is the caller graph for this function:

◆ updatePollResetRate

void InputDaemon::updatePollResetRate ( int  tempPollRate)
privateslot
Here is the caller graph for this function:

Field Documentation

◆ eventWorker

SDLEventReader* InputDaemon::eventWorker
private

◆ m_graphical

bool InputDaemon::m_graphical
private

◆ m_joysticks

QMap<SDL_JoystickID, InputDevice *>* InputDaemon::m_joysticks
private

◆ m_settings

AntiMicroSettings* InputDaemon::m_settings
private

◆ pendingEventValues

QHash<InputDevice *, InputDeviceBitArrayStatus *> InputDaemon::pendingEventValues
private

◆ pollResetTimer

QTimer InputDaemon::pollResetTimer
private

◆ releaseEventsGenerated

QHash<InputDevice *, InputDeviceBitArrayStatus *> InputDaemon::releaseEventsGenerated
private

◆ sdlWorkerThread

QThread* InputDaemon::sdlWorkerThread
private

◆ stopped

bool InputDaemon::stopped
private

◆ trackcontrollers

QHash<SDL_JoystickID, GameController *> InputDaemon::trackcontrollers
private

◆ trackjoysticks

QHash<SDL_JoystickID, Joystick *> InputDaemon::trackjoysticks
private

The documentation for this class was generated from the following files: