/* * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd. * * Author: sbw * * Maintainer: sbw * * 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 NETWORKDEVICE_H #define NETWORKDEVICE_H #include "networkdevice.h" #include #include #include 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