/*
 * Copyright (C) 2022, KylinSoft Co., Ltd.
 *
 * 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
 * (at your option) 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 <https://www.gnu.org/licenses/>.
 *
 */

#ifndef WIFIDBUSQUERY_H
#define WIFIDBUSQUERY_H

#include <QObject>
#include <QThread>
#include <QDBusInterface>

#define NETWORK_MANAGER_NAME         "org.freedesktop.NetworkManager"
#define NETWORK_MANAGER_PATH         "/org/freedesktop/NetworkManager"
#define NETWORK_MANAGER_INTERFACE    "org.freedesktop.NetworkManager"

class WifiDbusQuery : public QObject
{
    Q_OBJECT
public:
    WifiDbusQuery(QObject *parent = nullptr);

public Q_SLOTS:
    void isWirelessDeviceEnabled();
    void queryUsedWifiConnect(QDBusInterface *networkDbusInterface);
    void onPropertiesChanged(const QString &interface, const QVariantMap &propertyContent);

private:
    bool m_isWirelessDeviceEnable = false;

signals:
    void deviceQuery(bool wirelessDeviceIsEnable);
    void usedWifiName(QString wifiName);
    void updateState();
};


#endif // WIFIDBUSQUERY_H
