/* * Copyright (C) 2016 ~ 2018 Deepin Technology Co., Ltd. * * Author: zhaolong * * Maintainer: zhaolong * * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef ADAPTERSMANAGER_H #define ADAPTERSMANAGER_H #include using DBusBluetooth = com::deepin::daemon::Bluetooth; class Adapter; class Device; class AdaptersManager : public QObject { Q_OBJECT public: explicit AdaptersManager(QObject *parent = nullptr); // QMap adapters() const; // const Adapter *adapterById(const QString &id); void setAdapterPowered(const Adapter *adapter, const bool &powered); // void connectAllPairedDevice(const Adapter *adapter); void connectDevice(Device *device, Adapter *adapter); bool defaultAdapterInitPowerState(); int adaptersCount(); void adapterRefresh(const Adapter *adapter); void disconnectDevice(Device *device); signals: void adapterIncreased(Adapter *adapter); void adapterDecreased(Adapter *adapter); private slots: void onAdapterPropertiesChanged(const QString &json); void onDevicePropertiesChanged(const QString &json); void addAdapter(const QString &json); void removeAdapter(const QString &json); void addDevice(const QString &json); void removeDevice(const QString &json); private: void adapterAdd(Adapter *adapter, const QJsonObject &adpterObj); void inflateAdapter(Adapter *adapter, const QJsonObject &adapterObj); private: DBusBluetooth *m_bluetoothInter; QMap m_adapters; bool m_defaultAdapterState; }; #endif // ADAPTERSMANAGER_H