QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
JoystickSDL.cc File Reference
#include "JoystickSDL.h"
#include <array>
#include <QtCore/QMetaObject>
#include <QtCore/QMutex>
#include <QtCore/QThread>
#include "JoystickManager.h"
#include "QGCLoggingCategory.h"
#include "SDLJoystick.h"
#include <SDL3/SDL.h>
Include dependency graph for JoystickSDL.cc:

Go to the source code of this file.

Functions

static bool sdlEventWatcher (void *userdata, SDL_Event *event)
 SDL event watcher - uses Qt::QueuedConnection for thread safety.

Variables

static QMap< QString, Joystick * > s_discoveryCache
static QMutex s_discoveryCacheMutex

Function Documentation

◆ sdlEventWatcher()

bool sdlEventWatcher ( void * userdata,
SDL_Event * event )
static

SDL event watcher - uses Qt::QueuedConnection for thread safety.

Definition at line 30 of file JoystickSDL.cc.

References JoystickManager::instance(), and sdlEventWatcher().

Referenced by JoystickSDL::init(), sdlEventWatcher(), and JoystickSDL::shutdown().

Variable Documentation

◆ s_discoveryCache

QMap<QString, Joystick*> s_discoveryCache
static

Discovery cache - the last discover()'s joysticks. Only the main thread changes it; shutdown() empties it. The mutex guards the map alone, for the copy discover() returns off the main thread. Lock order: the SDL joystick lock, if held, comes first, and nothing that can block or re-enter runs under the mutex (only a copy, swap or assignment of the map).

Definition at line 26 of file JoystickSDL.cc.

Referenced by JoystickSDL::discover(), and JoystickSDL::shutdown().

◆ s_discoveryCacheMutex

QMutex s_discoveryCacheMutex
static

Definition at line 27 of file JoystickSDL.cc.

Referenced by JoystickSDL::discover(), and JoystickSDL::shutdown().