QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
SDLPlatform Namespace Reference

Enumerations

enum  AndroidStorageState { StorageStateNone = 0 , StorageStateRead = 0x01 , StorageStateWrite = 0x02 }
 Android external storage state flags. More...
 

Functions

QString getVersion ()
 Get SDL version as string (e.g., "3.4.0")
 
QString getRevision ()
 Get SDL revision string (git hash)
 
bool setHint (const QString &name, const QString &value)
 Set an SDL hint.
 
QString getHint (const QString &name)
 Get an SDL hint value.
 
bool getHintBoolean (const QString &name, bool defaultValue=false)
 Get an SDL hint as boolean.
 
bool resetHint (const QString &name)
 Reset an SDL hint to default.
 
void resetHints ()
 Reset all hints to defaults.
 
QString getPlatform ()
 Get the current platform name.
 
bool isAndroid ()
 Check if we're running on a specific platform.
 
bool isIOS ()
 
bool isWindows ()
 
bool isMacOS ()
 
bool isLinux ()
 
bool isTablet ()
 Check if tablet mode is active (Android/Windows)
 
bool isTV ()
 Check if running on a TV device.
 
bool isDeXMode ()
 Check if running in DeX mode (Samsung)
 
bool isChromebook ()
 Check if running on a Chromebook (Chrome OS)
 
int getNumLogicalCPUCores ()
 Get number of logical CPU cores.
 
int getSystemRAM ()
 Get system RAM in MB.
 
int getAndroidSDKVersion ()
 
QString getAndroidInternalStoragePath ()
 
QString getAndroidExternalStoragePath ()
 
int getAndroidExternalStorageState ()
 
bool requestAndroidPermission (const QString &permission, std::function< void(bool granted)> callback)
 
QString getDevicePowerInfo (int *seconds, int *percent)
 

Detailed Description

SDL platform utilities General SDL functionality not specific to joysticks

Enumeration Type Documentation

◆ AndroidStorageState

Android external storage state flags.

Enumerator
StorageStateNone 
StorageStateRead 
StorageStateWrite 

Definition at line 95 of file SDLPlatform.h.

Function Documentation

◆ getAndroidExternalStoragePath()

QString SDLPlatform::getAndroidExternalStoragePath ( )

Get Android external storage path Returns empty string on non-Android platforms

Definition at line 189 of file SDLPlatform.cc.

◆ getAndroidExternalStorageState()

int SDLPlatform::getAndroidExternalStorageState ( )

Get Android external storage state (read/write permissions) Returns StorageStateNone on non-Android platforms

Definition at line 199 of file SDLPlatform.cc.

References StorageStateNone, StorageStateRead, and StorageStateWrite.

◆ getAndroidInternalStoragePath()

QString SDLPlatform::getAndroidInternalStoragePath ( )

Get Android internal storage path Returns empty string on non-Android platforms

Definition at line 179 of file SDLPlatform.cc.

◆ getAndroidSDKVersion()

int SDLPlatform::getAndroidSDKVersion ( )

Get Android SDK version (API level) Returns 0 on non-Android platforms

Definition at line 170 of file SDLPlatform.cc.

◆ getDevicePowerInfo()

QString SDLPlatform::getDevicePowerInfo ( int *  seconds = nullptr,
int *  percent = nullptr 
)

Get device (phone/tablet) power information

Parameters
secondsOutput: seconds of battery remaining, or -1 if unknown
percentOutput: battery percentage (0-100), or -1 if unknown
Returns
Power state string

Definition at line 252 of file SDLPlatform.cc.

◆ getHint()

QString SDLPlatform::getHint ( const QString &  name)

Get an SDL hint value.

Definition at line 41 of file SDLPlatform.cc.

◆ getHintBoolean()

bool SDLPlatform::getHintBoolean ( const QString &  name,
bool  defaultValue 
)

Get an SDL hint as boolean.

Definition at line 47 of file SDLPlatform.cc.

◆ getNumLogicalCPUCores()

int SDLPlatform::getNumLogicalCPUCores ( )

Get number of logical CPU cores.

Definition at line 156 of file SDLPlatform.cc.

◆ getPlatform()

QString SDLPlatform::getPlatform ( )

Get the current platform name.

Definition at line 66 of file SDLPlatform.cc.

◆ getRevision()

QString SDLPlatform::getRevision ( )

Get SDL revision string (git hash)

Definition at line 26 of file SDLPlatform.cc.

◆ getSystemRAM()

int SDLPlatform::getSystemRAM ( )

Get system RAM in MB.

Definition at line 161 of file SDLPlatform.cc.

◆ getVersion()

QString SDLPlatform::getVersion ( )

Get SDL version as string (e.g., "3.4.0")

Definition at line 17 of file SDLPlatform.cc.

◆ isAndroid()

bool SDLPlatform::isAndroid ( )

Check if we're running on a specific platform.

Definition at line 71 of file SDLPlatform.cc.

◆ isChromebook()

bool SDLPlatform::isChromebook ( )

Check if running on a Chromebook (Chrome OS)

Definition at line 143 of file SDLPlatform.cc.

◆ isDeXMode()

bool SDLPlatform::isDeXMode ( )

Check if running in DeX mode (Samsung)

Definition at line 134 of file SDLPlatform.cc.

◆ isIOS()

bool SDLPlatform::isIOS ( )

Definition at line 80 of file SDLPlatform.cc.

◆ isLinux()

bool SDLPlatform::isLinux ( )

Definition at line 107 of file SDLPlatform.cc.

◆ isMacOS()

bool SDLPlatform::isMacOS ( )

Definition at line 98 of file SDLPlatform.cc.

◆ isTablet()

bool SDLPlatform::isTablet ( )

Check if tablet mode is active (Android/Windows)

Definition at line 116 of file SDLPlatform.cc.

◆ isTV()

bool SDLPlatform::isTV ( )

Check if running on a TV device.

Definition at line 125 of file SDLPlatform.cc.

◆ isWindows()

bool SDLPlatform::isWindows ( )

Definition at line 89 of file SDLPlatform.cc.

◆ requestAndroidPermission()

bool SDLPlatform::requestAndroidPermission ( const QString &  permission,
std::function< void(bool granted)>  callback 
)

Request an Android runtime permission

Parameters
permissionThe permission string (e.g., "android.permission.CAMERA")
callbackCalled with (granted) when permission result is available
Returns
true if request was initiated, false on error On non-Android platforms, callback is called immediately with granted=true

Definition at line 227 of file SDLPlatform.cc.

◆ resetHint()

bool SDLPlatform::resetHint ( const QString &  name)

Reset an SDL hint to default.

Definition at line 52 of file SDLPlatform.cc.

◆ resetHints()

void SDLPlatform::resetHints ( )

Reset all hints to defaults.

Definition at line 57 of file SDLPlatform.cc.

◆ setHint()

bool SDLPlatform::setHint ( const QString &  name,
const QString &  value 
)

Set an SDL hint.

Definition at line 36 of file SDLPlatform.cc.