#ifndef WIREDLINKSTATE_H
#define WIREDLINKSTATE_H

#include <QObject>
#include <QDBusInterface>
#include <QDBusReply>
#include <QDebug>
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
#include <QtQml/qqml.h>
#endif
#include "wirelessstatus.h"

class WirelessStatus;
//提供给Qml有线网络状态信号的类
class WiredLinkState: public QObject
{
    Q_OBJECT
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
    QML_ELEMENT
#endif
public:

    Q_PROPERTY(bool wiredState READ getWiredState NOTIFY wiredLinkChanged)
    Q_PROPERTY(int wiredStateValue READ getWiredStateValue NOTIFY wiredValueChanged)

    explicit WiredLinkState(QObject *parent = nullptr);

    //暴露给WirelessStatus使用的变量
    bool wiredStateChange;

    //获取有线网络连接状态
    bool getWiredState();

    //获取有线网络链接Connectivity的值
    int getWiredStateValue();

    //初始化网络状态信息
    bool initConnectionInfo();

signals:
    // 信号：可以直接在QML中访问信号
    void wiredLinkChanged(bool str);

    void wiredValueChanged(int stateValue);

private slots:
    //后台私有属性槽函数
    void onPropertiesChanged(QVariantMap);

private:
    bool myWiredState;

    int myWiredStateValue;

};

#endif // WIREDLINKSTATE_H
