mirror of
https://github.com/kavishdevar/librepods.git
synced 2026-01-28 22:01:50 +00:00
34 lines
992 B
C++
34 lines
992 B
C++
#ifndef BLUETOOTHMONITOR_H
|
|
#define BLUETOOTHMONITOR_H
|
|
|
|
#include <QObject>
|
|
#include <QtDBus/QtDBus>
|
|
|
|
// Forward declarations for D-Bus types
|
|
typedef QMap<QDBusObjectPath, QMap<QString, QVariantMap>> ManagedObjectList;
|
|
Q_DECLARE_METATYPE(ManagedObjectList)
|
|
|
|
class BluetoothMonitor : public QObject, protected QDBusContext
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit BluetoothMonitor(QObject *parent = nullptr);
|
|
~BluetoothMonitor();
|
|
|
|
bool checkAlreadyConnectedDevices();
|
|
|
|
signals:
|
|
void deviceConnected(const QString &macAddress, const QString &deviceName);
|
|
void deviceDisconnected(const QString &macAddress, const QString &deviceName);
|
|
|
|
private slots:
|
|
void onPropertiesChanged(const QString &interface, const QVariantMap &changedProps, const QStringList &invalidatedProps);
|
|
|
|
private:
|
|
QDBusConnection m_dbus;
|
|
void registerDBusService();
|
|
bool isAirPodsDevice(const QString &devicePath);
|
|
QString getDeviceName(const QString &devicePath);
|
|
};
|
|
|
|
#endif // BLUETOOTHMONITOR_H
|