File indexing completed on 2024-03-24 15:41:33

0001 /*
0002     SPDX-FileCopyrightText: 2013 Lukáš Tinkl <ltinkl@redhat.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #ifndef NETWORKMANAGERQT_TEAM_DEVICE_H
0008 #define NETWORKMANAGERQT_TEAM_DEVICE_H
0009 
0010 #include "device.h"
0011 #include <networkmanagerqt/networkmanagerqt_export.h>
0012 
0013 namespace NetworkManager
0014 {
0015 class TeamDevicePrivate;
0016 
0017 /**
0018  * A team device interface
0019  */
0020 class NETWORKMANAGERQT_EXPORT TeamDevice : public Device
0021 {
0022     Q_OBJECT
0023     Q_PROPERTY(bool carrier READ carrier NOTIFY carrierChanged)
0024     Q_PROPERTY(QString hwAddress READ hwAddress NOTIFY hwAddressChanged)
0025     Q_PROPERTY(QStringList slaves READ slaves NOTIFY slavesChanged)
0026     Q_PROPERTY(QString config READ config NOTIFY configChanged)
0027 
0028 public:
0029     typedef QSharedPointer<TeamDevice> Ptr;
0030     typedef QList<Ptr> List;
0031 
0032     explicit TeamDevice(const QString &path, QObject *parent = nullptr);
0033     ~TeamDevice() override;
0034 
0035     Type type() const override;
0036 
0037     /**
0038      * Indicates whether the physical carrier is found
0039      */
0040     bool carrier() const;
0041     /**
0042      * Hardware address of the device
0043      */
0044     QString hwAddress() const;
0045 
0046     /**
0047      * Devices which are currently slaved to this device
0048      */
0049     QStringList slaves() const;
0050 
0051     /**
0052      * The JSON configuration currently applied on the device.
0053      */
0054     QString config() const;
0055 
0056 Q_SIGNALS:
0057     /**
0058      * Emitted when the carrier of this device has changed
0059      */
0060     void carrierChanged(bool plugged);
0061     /**
0062      * Emitted when the hardware address of this device has changed
0063      */
0064     void hwAddressChanged(const QString &address);
0065 
0066     /**
0067      * Emitted when the list of devices slaved to this device has changed
0068      */
0069     void slavesChanged(const QStringList &slaves);
0070 
0071     /**
0072      * Emitted when the JSON confugration which is currently applied has changed
0073      */
0074     void configChanged(const QString &config);
0075 
0076 private:
0077     Q_DECLARE_PRIVATE(TeamDevice)
0078 };
0079 
0080 }
0081 
0082 #endif