Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
bluetoothmanagement.cpp File Reference

(4d5da3f5beb7bc8588057e9f5304504fb3d220e5)

#include <QtCore/qloggingcategory.h>
#include <QtCore/qsocketnotifier.h>
#include <QtCore/qtimer.h>
#include "bluetoothmanagement_p.h"
#include "bluez_data_p.h"
#include "../qbluetoothsocketbase_p.h"
#include <unistd.h>
#include <sys/prctl.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <linux/capability.h>
#include <cerrno>
#include "moc_bluetoothmanagement_p.cpp"
+ Include dependency graph for bluetoothmanagement.cpp:

Go to the source code of this file.

Classes

struct  MgmtHdr
 
struct  MgmtEventDeviceFound
 
struct  capHdr
 
struct  capData
 

Macros

#define _LINUX_CAPABILITY_VERSION_3   0x20080522
 
#define _LINUX_CAPABILITY_U32S_3   2
 
#define CAP_NET_ADMIN   12
 
#define CAP_TO_INDEX(x)   ((x) >> 5) /* 1 << 5 == bits in __u32 */
 
#define CAP_TO_MASK(x)   (1 << ((x) & 31)) /* mask for indexed __u32 */
 

Functions

QT_BEGIN_NAMESPACE struct MgmtHdr __attribute__ ((packed))
 
static int sysCallCapGet (capHdr *header, capData *data)
 
static bool hasBtMgmtPermission ()
 

Variables

quint16 cmdCode
 
quint16 controllerIndex
 
quint16 length
 
bdaddr_t bdaddr
 
quint8 type
 
quint8 rssi
 
quint32 flags
 
quint16 eirLength
 
quint8 eirData [0]
 
struct capHdr __attribute__
 
const int msecInADay = 1000*60*60*24
 

Macro Definition Documentation

◆ _LINUX_CAPABILITY_U32S_3

#define _LINUX_CAPABILITY_U32S_3   2

Definition at line 72 of file bluetoothmanagement.cpp.

Referenced by hasBtMgmtPermission().

◆ _LINUX_CAPABILITY_VERSION_3

#define _LINUX_CAPABILITY_VERSION_3   0x20080522

Definition at line 68 of file bluetoothmanagement.cpp.

Referenced by hasBtMgmtPermission().

◆ CAP_NET_ADMIN

#define CAP_NET_ADMIN   12

Definition at line 76 of file bluetoothmanagement.cpp.

Referenced by hasBtMgmtPermission().

◆ CAP_TO_INDEX

#define CAP_TO_INDEX ( x)    ((x) >> 5) /* 1 << 5 == bits in __u32 */

Definition at line 80 of file bluetoothmanagement.cpp.

Referenced by hasBtMgmtPermission().

◆ CAP_TO_MASK

#define CAP_TO_MASK ( x)    (1 << ((x) & 31)) /* mask for indexed __u32 */

Definition at line 84 of file bluetoothmanagement.cpp.

Referenced by hasBtMgmtPermission().

Function Documentation

◆ __attribute__()

QT_BEGIN_NAMESPACE struct MgmtHdr __attribute__ ( (packed) )

◆ hasBtMgmtPermission()

static bool hasBtMgmtPermission ( )
static

Definition at line 97 of file bluetoothmanagement.cpp.

References _LINUX_CAPABILITY_U32S_3, _LINUX_CAPABILITY_VERSION_3, CAP_NET_ADMIN, CAP_TO_INDEX, CAP_TO_MASK, capData::effective, header(), qCWarning, qPrintable, qt_error_string(), and sysCallCapGet().

Referenced by BluetoothManagement::BluetoothManagement().

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

◆ sysCallCapGet()

static int sysCallCapGet ( capHdr * header,
capData * data )
static

Definition at line 89 of file bluetoothmanagement.cpp.

References header().

Referenced by hasBtMgmtPermission().

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

Variable Documentation

◆ __attribute__

struct hci_command_hdr __attribute__

◆ bdaddr

◆ cmdCode

quint16 cmdCode

Definition at line 0 of file bluetoothmanagement.cpp.

◆ controllerIndex

quint16 controllerIndex

Definition at line 1 of file bluetoothmanagement.cpp.

◆ eirData

quint8 eirData[0]

Definition at line 5 of file bluetoothmanagement.cpp.

◆ eirLength

quint16 eirLength

Definition at line 4 of file bluetoothmanagement.cpp.

◆ flags

Definition at line 3 of file bluetoothmanagement.cpp.

◆ length

Definition at line 2 of file bluetoothmanagement.cpp.

◆ msecInADay

const int msecInADay = 1000*60*60*24

Definition at line 87 of file bluetoothmanagement.cpp.

Referenced by BluetoothManagement::BluetoothManagement().

◆ rssi

◆ type

Definition at line 1 of file bluetoothmanagement.cpp.