dde-dock/plugins/network/networkdevice.h
石博文 133b711d1f update license
Change-Id: I9df92e43b79f7c2b3688b595f80df7b3a7bb7ed2
2018-02-07 11:52:47 +08:00

90 lines
2.3 KiB
C++

/*
* Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw <sbw@sbw.so>
*
* Maintainer: sbw <sbw@sbw.so>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#ifndef NETWORKDEVICE_H
#define NETWORKDEVICE_H
#include "networkdevice.h"
#include <QUuid>
#include <QDBusObjectPath>
#include <QJsonObject>
class NetworkDevice
{
public:
enum NetworkState {
Unknow = 0,
Unmanaged = 10,
Unavailable = 20,
Disconnected = 30,
Prepare = 40,
Config = 50,
NeedAuth = 60,
IpConfig = 70,
IpCheck = 80,
Secondaries = 90,
Activated = 100,
Deactivation = 110,
Failed = 120,
};
enum NetworkType {
None = 0,
Generic = 1 << 0,
Wired = 1 << 1,
Wireless = 1 << 2,
Bluetooth = 1 << 3,
Bridge = 1 << 4,
};
Q_DECLARE_FLAGS(NetworkTypes, NetworkType)
public:
static NetworkType deviceType(const QString &type);
explicit NetworkDevice(const NetworkType type, const QJsonObject &info);
bool operator==(const QString &path) const;
bool operator==(const NetworkDevice &device) const;
NetworkState state() const;
NetworkType type() const;
const QString path() const;
const QDBusObjectPath dbusPath() const;
const QString usingHwAddr() const;
const QString vendor() const;
const QString activeAp() const;
private:
NetworkType m_type;
QString m_devicePath;
QJsonObject m_infoObj;
};
inline uint qHash(const NetworkDevice &device)
{
return qHash(device.path());
}
Q_DECLARE_OPERATORS_FOR_FLAGS(NetworkDevice::NetworkTypes)
#endif // NETWORKDEVICE_H