File indexing completed on 2024-04-21 16:11:33
0001 /* 0002 * SPDX-FileCopyrightText: 2010 Alejandro Fiestas Olivares <alex@eyeos.org> 0003 * SPDX-FileCopyrightText: 2010 Eduardo Robles Elvira <edulix@gmail.com> 0004 * SPDX-FileCopyrightText: 2010 UFO Coders <info@ufocoders.com> 0005 * SPDX-FileCopyrightText: 2014-2015 David Rosca <nowrep@gmail.com> 0006 * 0007 * SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 0010 #ifndef BLUEDEVILDAEMON_H 0011 #define BLUEDEVILDAEMON_H 0012 0013 #include <QMap> 0014 0015 #include <KDEDModule> 0016 0017 #include <BluezQt/Manager> 0018 #include <BluezQt/ObexManager> 0019 0020 typedef QMap<QString, QString> DeviceInfo; 0021 typedef QMap<QString, DeviceInfo> QMapDeviceInfo; 0022 0023 class Q_DECL_EXPORT BlueDevilDaemon : public KDEDModule 0024 { 0025 Q_OBJECT 0026 Q_CLASSINFO("D-Bus Interface", "org.kde.BlueDevil") 0027 0028 public: 0029 BlueDevilDaemon(QObject *parent, const QList<QVariant> &); 0030 ~BlueDevilDaemon() override; 0031 0032 /** 0033 * Returns whether the daemon is in online mode (eg. Bluez services are 0034 * running and we have usable adapter) 0035 */ 0036 Q_SCRIPTABLE bool isOnline(); 0037 0038 /** 0039 * Returns QMap<Address, DeviceInfo> with all known devices 0040 */ 0041 Q_SCRIPTABLE QMapDeviceInfo allDevices(); 0042 0043 /** 0044 * Returns DeviceInfo for one device. 0045 */ 0046 Q_SCRIPTABLE DeviceInfo device(const QString &address); 0047 0048 /** 0049 * Starts discovery for timeout miliseconds (0 = forever) 0050 */ 0051 Q_SCRIPTABLE void startDiscovering(quint32 timeout); 0052 0053 /** 0054 * Stops discovery (if it was previously started) 0055 */ 0056 Q_SCRIPTABLE void stopDiscovering(); 0057 0058 BluezQt::Manager *manager() const; 0059 BluezQt::ObexManager *obexManager() const; 0060 0061 private Q_SLOTS: 0062 void initJobResult(BluezQt::InitManagerJob *job); 0063 void initObexJobResult(BluezQt::InitObexManagerJob *job); 0064 0065 void operationalChanged(bool operational); 0066 void obexOperationalChanged(bool operational); 0067 0068 void agentRegisted(BluezQt::PendingCall *call); 0069 void agentRequestedDefault(BluezQt::PendingCall *call); 0070 void obexAgentRegistered(BluezQt::PendingCall *call); 0071 0072 private: 0073 DeviceInfo deviceToInfo(BluezQt::DevicePtr device) const; 0074 0075 private: 0076 struct Private; 0077 Private *const d; 0078 }; 0079 0080 #endif // BLUEDEVILDAEMON_H