Merge PR #4: Fix wireless protected flag and add open network connection support
This commit is contained in:
commit
bc181b9738
@ -309,6 +309,7 @@ void WirelessService::commandConnect(const QVariantMap &request)
|
|||||||
void WirelessService::commandConnectHidden(const QVariantMap &request)
|
void WirelessService::commandConnectHidden(const QVariantMap &request)
|
||||||
{
|
{
|
||||||
Q_UNUSED(request)
|
Q_UNUSED(request)
|
||||||
|
|
||||||
// TODO:
|
// TODO:
|
||||||
qCWarning(dcNetworkManagerBluetoothServer()) << "Connect to hidden network is not implemented yet.";
|
qCWarning(dcNetworkManagerBluetoothServer()) << "Connect to hidden network is not implemented yet.";
|
||||||
}
|
}
|
||||||
@ -535,6 +536,7 @@ void WirelessService::processCommand(const QVariantMap &request)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Process method
|
// Process method
|
||||||
|
qCDebug(dcNetworkManagerBluetoothServer()) << "Received command" << static_cast<WirelessServiceCommand>(command);
|
||||||
switch (command) {
|
switch (command) {
|
||||||
case WirelessServiceCommandGetNetworks:
|
case WirelessServiceCommandGetNetworks:
|
||||||
commandGetNetworks(request);
|
commandGetNetworks(request);
|
||||||
|
|||||||
@ -139,5 +139,5 @@ QDebug operator<<(QDebug debug, NetworkConnection *networkConnection)
|
|||||||
debug.nospace() << networkConnection->interfaceName() << ", ";
|
debug.nospace() << networkConnection->interfaceName() << ", ";
|
||||||
debug.nospace() << networkConnection->type() << ", ";
|
debug.nospace() << networkConnection->type() << ", ";
|
||||||
debug.nospace() << networkConnection->timeStamp().toString("dd.MM.yyyy hh:mm") << ") ";
|
debug.nospace() << networkConnection->timeStamp().toString("dd.MM.yyyy hh:mm") << ") ";
|
||||||
return debug;
|
return debug.space();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -329,7 +329,7 @@ QString NetworkDevice::deviceStateReasonToString(const NetworkDevice::NetworkDev
|
|||||||
|
|
||||||
void NetworkDevice::onStateChanged(uint newState, uint oldState, uint reason)
|
void NetworkDevice::onStateChanged(uint newState, uint oldState, uint reason)
|
||||||
{
|
{
|
||||||
Q_UNUSED(oldState);
|
Q_UNUSED(oldState)
|
||||||
qCDebug(dcNetworkManager()) << m_interface << "--> State changed:" << deviceStateToString(NetworkDeviceState(newState)) << ":" << deviceStateReasonToString(NetworkDeviceStateReason(reason));
|
qCDebug(dcNetworkManager()) << m_interface << "--> State changed:" << deviceStateToString(NetworkDeviceState(newState)) << ":" << deviceStateReasonToString(NetworkDeviceStateReason(reason));
|
||||||
if (m_deviceState != NetworkDeviceState(newState)) {
|
if (m_deviceState != NetworkDeviceState(newState)) {
|
||||||
m_deviceState = NetworkDeviceState(newState);
|
m_deviceState = NetworkDeviceState(newState);
|
||||||
@ -341,6 +341,6 @@ void NetworkDevice::onStateChanged(uint newState, uint oldState, uint reason)
|
|||||||
QDebug operator<<(QDebug debug, NetworkDevice *device)
|
QDebug operator<<(QDebug debug, NetworkDevice *device)
|
||||||
{
|
{
|
||||||
debug.nospace() << "NetworkDevice(" << device->interface() << " - " << NetworkDevice::deviceTypeToString(device->deviceType()) << ", " << device->deviceStateString() << ")";
|
debug.nospace() << "NetworkDevice(" << device->interface() << " - " << NetworkDevice::deviceTypeToString(device->deviceType()) << ", " << device->deviceStateString() << ")";
|
||||||
return debug;
|
return debug.space();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -148,6 +148,8 @@ NetworkManager::NetworkManagerError NetworkManager::connectWifi(const QString &i
|
|||||||
|
|
||||||
// Note: https://developer.gnome.org/NetworkManager/stable/ref-settings.html
|
// Note: https://developer.gnome.org/NetworkManager/stable/ref-settings.html
|
||||||
|
|
||||||
|
qCDebug(dcNetworkManager()) << "Start connecting to" << accessPoint << "hidden:" << hidden;
|
||||||
|
|
||||||
// Create network settings for this wifi
|
// Create network settings for this wifi
|
||||||
QVariantMap connectionSettings;
|
QVariantMap connectionSettings;
|
||||||
connectionSettings.insert("autoconnect", true);
|
connectionSettings.insert("autoconnect", true);
|
||||||
@ -183,7 +185,9 @@ NetworkManager::NetworkManagerError NetworkManager::connectWifi(const QString &i
|
|||||||
settings.insert("802-11-wireless", wirelessSettings);
|
settings.insert("802-11-wireless", wirelessSettings);
|
||||||
settings.insert("ipv4", ipv4Settings);
|
settings.insert("ipv4", ipv4Settings);
|
||||||
settings.insert("ipv6", ipv6Settings);
|
settings.insert("ipv6", ipv6Settings);
|
||||||
settings.insert("802-11-wireless-security", wirelessSecuritySettings);
|
|
||||||
|
if (accessPoint->isProtected())
|
||||||
|
settings.insert("802-11-wireless-security", wirelessSecuritySettings);
|
||||||
|
|
||||||
// Remove old configuration (if there is any)
|
// Remove old configuration (if there is any)
|
||||||
foreach (NetworkConnection *connection, m_networkSettings->connections()) {
|
foreach (NetworkConnection *connection, m_networkSettings->connections()) {
|
||||||
@ -226,7 +230,6 @@ NetworkManager::NetworkManagerError NetworkManager::startAccessPoint(const QStri
|
|||||||
if (!wirelessNetworkDevice)
|
if (!wirelessNetworkDevice)
|
||||||
return NetworkManagerErrorInvalidNetworkDeviceType;
|
return NetworkManagerErrorInvalidNetworkDeviceType;
|
||||||
|
|
||||||
|
|
||||||
// Note: https://developer.gnome.org/NetworkManager/stable/ref-settings.html
|
// Note: https://developer.gnome.org/NetworkManager/stable/ref-settings.html
|
||||||
|
|
||||||
// Create network settings for access point
|
// Create network settings for access point
|
||||||
@ -239,7 +242,7 @@ NetworkManager::NetworkManagerError NetworkManager::startAccessPoint(const QStri
|
|||||||
QVariantMap wirelessSettings;
|
QVariantMap wirelessSettings;
|
||||||
wirelessSettings.insert("band", "bg");
|
wirelessSettings.insert("band", "bg");
|
||||||
wirelessSettings.insert("mode", "ap");
|
wirelessSettings.insert("mode", "ap");
|
||||||
wirelessSettings.insert("ssid", ssid.toUtf8());
|
wirelessSettings.insert("ssid", ssid.toUtf8());
|
||||||
wirelessSettings.insert("security", "802-11-wireless-security");
|
wirelessSettings.insert("security", "802-11-wireless-security");
|
||||||
// Note: disable power save mode
|
// Note: disable power save mode
|
||||||
wirelessSettings.insert("powersave", 2);
|
wirelessSettings.insert("powersave", 2);
|
||||||
@ -384,6 +387,10 @@ bool NetworkManager::init()
|
|||||||
|
|
||||||
setAvailable(true);
|
setAvailable(true);
|
||||||
qCDebug(dcNetworkManager()) << "Network manager initialized successfully.";
|
qCDebug(dcNetworkManager()) << "Network manager initialized successfully.";
|
||||||
|
qCDebug(dcNetworkManager()) << "Start initial wireless network scan...";
|
||||||
|
foreach (WirelessNetworkDevice *wirelessDevice, m_wirelessNetworkDevices.values()) {
|
||||||
|
wirelessDevice->scanWirelessNetworks();
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -104,5 +104,5 @@ QDebug operator<<(QDebug debug, WiredNetworkDevice *networkDevice)
|
|||||||
debug.nospace() << networkDevice->bitRate() << " [Mb/s], ";
|
debug.nospace() << networkDevice->bitRate() << " [Mb/s], ";
|
||||||
debug.nospace() << networkDevice->pluggedIn() << ", ";
|
debug.nospace() << networkDevice->pluggedIn() << ", ";
|
||||||
debug.nospace() << networkDevice->deviceStateString() << ") ";
|
debug.nospace() << networkDevice->deviceStateString() << ") ";
|
||||||
return debug;
|
return debug.space();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,6 +41,7 @@
|
|||||||
\value ApSecurityModeGroupCcmp
|
\value ApSecurityModeGroupCcmp
|
||||||
\value ApSecurityModeKeyMgmtPsk
|
\value ApSecurityModeKeyMgmtPsk
|
||||||
\value ApSecurityModeKeyMgmt8021X
|
\value ApSecurityModeKeyMgmt8021X
|
||||||
|
\value ApSecurityModeKeyMgmtSae
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! \fn void WirelessAccessPoint::signalStrengthChanged();
|
/*! \fn void WirelessAccessPoint::signalStrengthChanged();
|
||||||
@ -66,8 +67,14 @@ WirelessAccessPoint::WirelessAccessPoint(const QDBusObjectPath &objectPath, QObj
|
|||||||
setMacAddress(accessPointInterface.property("HwAddress").toString());
|
setMacAddress(accessPointInterface.property("HwAddress").toString());
|
||||||
setFrequency(accessPointInterface.property("Frequency").toDouble() / 1000);
|
setFrequency(accessPointInterface.property("Frequency").toDouble() / 1000);
|
||||||
setSignalStrength(accessPointInterface.property("Strength").toInt());
|
setSignalStrength(accessPointInterface.property("Strength").toInt());
|
||||||
setSecurityFlags(WirelessAccessPoint::ApSecurityModes(accessPointInterface.property("WpaFlags").toUInt()));
|
m_capabilities = static_cast<WirelessAccessPoint::ApFlags>(accessPointInterface.property("Flags").toUInt());
|
||||||
setIsProtected(static_cast<bool>(accessPointInterface.property("Flags").toUInt()));
|
setWpaFlags(WirelessAccessPoint::ApSecurityModes(accessPointInterface.property("WpaFlags").toUInt()));
|
||||||
|
setRsnFlags(WirelessAccessPoint::ApSecurityModes(accessPointInterface.property("RsnFlags").toUInt()));
|
||||||
|
setIsProtected(m_rsnFlags != 0);
|
||||||
|
|
||||||
|
qCDebug(dcNetworkManager()) << ssid() << "WPA flags:" << m_wpaFlags;
|
||||||
|
qCDebug(dcNetworkManager()) << ssid() << "RSN flags:" << m_rsnFlags;
|
||||||
|
qCDebug(dcNetworkManager()) << ssid() << "Capabilities:" << m_capabilities;
|
||||||
|
|
||||||
QDBusConnection::systemBus().connect(NetworkManagerUtils::networkManagerServiceString(), objectPath.path(), NetworkManagerUtils::accessPointInterfaceString(), "PropertiesChanged", this, SLOT(onPropertiesChanged(QVariantMap)));
|
QDBusConnection::systemBus().connect(NetworkManagerUtils::networkManagerServiceString(), objectPath.path(), NetworkManagerUtils::accessPointInterfaceString(), "PropertiesChanged", this, SLOT(onPropertiesChanged(QVariantMap)));
|
||||||
}
|
}
|
||||||
@ -123,6 +130,16 @@ void WirelessAccessPoint::setSignalStrength(int signalStrength)
|
|||||||
emit signalStrengthChanged();
|
emit signalStrengthChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WirelessAccessPoint::setWpaFlags(WirelessAccessPoint::ApSecurityModes wpaFlags)
|
||||||
|
{
|
||||||
|
m_wpaFlags = wpaFlags;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WirelessAccessPoint::setRsnFlags(WirelessAccessPoint::ApSecurityModes rsnFlags)
|
||||||
|
{
|
||||||
|
m_rsnFlags = rsnFlags;
|
||||||
|
}
|
||||||
|
|
||||||
void WirelessAccessPoint::setIsProtected(bool isProtected)
|
void WirelessAccessPoint::setIsProtected(bool isProtected)
|
||||||
{
|
{
|
||||||
m_isProtected = isProtected;
|
m_isProtected = isProtected;
|
||||||
@ -134,18 +151,31 @@ bool WirelessAccessPoint::isProtected() const
|
|||||||
return m_isProtected;
|
return m_isProtected;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Returns the security flags of this \l{WirelessAccessPoint}.
|
WirelessAccessPoint::ApFlags WirelessAccessPoint::capabilities() const
|
||||||
|
{
|
||||||
|
return m_capabilities;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*! Returns the WPA security flags of this \l{WirelessAccessPoint}.
|
||||||
|
|
||||||
|
This flags are describing the access point's capabilities according to WPA (Wifi Protected Access).
|
||||||
|
|
||||||
\sa WirelessAccessPoint::ApSecurityModes
|
\sa WirelessAccessPoint::ApSecurityModes
|
||||||
*/
|
*/
|
||||||
WirelessAccessPoint::ApSecurityModes WirelessAccessPoint::securityFlags() const
|
WirelessAccessPoint::ApSecurityModes WirelessAccessPoint::wpaFlags() const
|
||||||
{
|
{
|
||||||
return m_securityFlags;
|
return m_wpaFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WirelessAccessPoint::setSecurityFlags(WirelessAccessPoint::ApSecurityModes securityFlags)
|
/*! Returns the RSN security flags of this \l{WirelessAccessPoint}.
|
||||||
|
|
||||||
|
Flags describing the access point's capabilities according to the RSN (Robust Secure Network) protocol.
|
||||||
|
|
||||||
|
\sa WirelessAccessPoint::ApSecurityModes
|
||||||
|
*/
|
||||||
|
WirelessAccessPoint::ApSecurityModes WirelessAccessPoint::rsnFlags() const
|
||||||
{
|
{
|
||||||
m_securityFlags = securityFlags;
|
return m_rsnFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WirelessAccessPoint::onPropertiesChanged(const QVariantMap &properties)
|
void WirelessAccessPoint::onPropertiesChanged(const QVariantMap &properties)
|
||||||
@ -157,5 +187,10 @@ void WirelessAccessPoint::onPropertiesChanged(const QVariantMap &properties)
|
|||||||
|
|
||||||
QDebug operator<<(QDebug debug, WirelessAccessPoint *accessPoint)
|
QDebug operator<<(QDebug debug, WirelessAccessPoint *accessPoint)
|
||||||
{
|
{
|
||||||
return debug.nospace() << "AccessPoint(" << accessPoint->signalStrength() << "%, " << accessPoint->frequency()<< " GHz, " << accessPoint->ssid() << ", " << (accessPoint->isProtected() ? "protected" : "open" ) << ")";
|
debug.nospace() << "AccessPoint(" << accessPoint->signalStrength() << "%, "
|
||||||
|
<< accessPoint->frequency()<< " GHz, "
|
||||||
|
<< accessPoint->ssid() << ", " <<
|
||||||
|
(accessPoint->isProtected() ? "protected" : "open" )
|
||||||
|
<< ")";
|
||||||
|
return debug.space();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,7 +34,6 @@
|
|||||||
class WirelessAccessPoint : public QObject
|
class WirelessAccessPoint : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_FLAGS(ApSecurityModes)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum ApSecurityMode {
|
enum ApSecurityMode {
|
||||||
@ -49,8 +48,21 @@ public:
|
|||||||
ApSecurityModeGroupCcmp = 0x080,
|
ApSecurityModeGroupCcmp = 0x080,
|
||||||
ApSecurityModeKeyMgmtPsk = 0x100,
|
ApSecurityModeKeyMgmtPsk = 0x100,
|
||||||
ApSecurityModeKeyMgmt8021X = 0x200,
|
ApSecurityModeKeyMgmt8021X = 0x200,
|
||||||
|
ApSecurityModeKeyMgmtSae = 0x400
|
||||||
};
|
};
|
||||||
Q_DECLARE_FLAGS(ApSecurityModes, ApSecurityMode)
|
Q_DECLARE_FLAGS(ApSecurityModes, ApSecurityMode)
|
||||||
|
Q_FLAG(ApSecurityModes)
|
||||||
|
|
||||||
|
|
||||||
|
enum ApCapabilities {
|
||||||
|
ApCapabilitiesNone = 0x00,
|
||||||
|
ApCapabilitiesPrivacy = 0x01,
|
||||||
|
ApCapabilitiesWps = 0x02,
|
||||||
|
ApCapabilitiesWpsPushButton = 0x04,
|
||||||
|
ApCapabilitiesWpsPin = 0x08
|
||||||
|
};
|
||||||
|
Q_DECLARE_FLAGS(ApFlags, ApCapabilities)
|
||||||
|
Q_FLAG(ApCapabilities)
|
||||||
|
|
||||||
explicit WirelessAccessPoint(const QDBusObjectPath &objectPath, QObject *parent = nullptr);
|
explicit WirelessAccessPoint(const QDBusObjectPath &objectPath, QObject *parent = nullptr);
|
||||||
|
|
||||||
@ -62,7 +74,9 @@ public:
|
|||||||
int signalStrength() const;
|
int signalStrength() const;
|
||||||
bool isProtected() const;
|
bool isProtected() const;
|
||||||
|
|
||||||
WirelessAccessPoint::ApSecurityModes securityFlags() const;
|
WirelessAccessPoint::ApFlags capabilities() const;
|
||||||
|
WirelessAccessPoint::ApSecurityModes wpaFlags() const;
|
||||||
|
WirelessAccessPoint::ApSecurityModes rsnFlags() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QDBusObjectPath m_objectPath;
|
QDBusObjectPath m_objectPath;
|
||||||
@ -71,14 +85,17 @@ private:
|
|||||||
double m_frequency;
|
double m_frequency;
|
||||||
int m_signalStrength = 0;
|
int m_signalStrength = 0;
|
||||||
bool m_isProtected = false;
|
bool m_isProtected = false;
|
||||||
WirelessAccessPoint::ApSecurityModes m_securityFlags = ApSecurityModeNone;
|
WirelessAccessPoint::ApFlags m_capabilities = ApCapabilitiesNone;
|
||||||
|
WirelessAccessPoint::ApSecurityModes m_wpaFlags = ApSecurityModeNone;
|
||||||
|
WirelessAccessPoint::ApSecurityModes m_rsnFlags = ApSecurityModeNone;
|
||||||
|
|
||||||
void setSsid(const QString &ssid);
|
void setSsid(const QString &ssid);
|
||||||
void setMacAddress(const QString &macAddress);
|
void setMacAddress(const QString &macAddress);
|
||||||
void setFrequency(double frequency);
|
void setFrequency(double frequency);
|
||||||
void setSignalStrength(int signalStrength);
|
void setSignalStrength(int signalStrength);
|
||||||
|
void setWpaFlags(WirelessAccessPoint::ApSecurityModes wpaFlags);
|
||||||
|
void setRsnFlags(WirelessAccessPoint::ApSecurityModes rsnFlags);
|
||||||
void setIsProtected(bool isProtected);
|
void setIsProtected(bool isProtected);
|
||||||
void setSecurityFlags(WirelessAccessPoint::ApSecurityModes securityFlags);
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void signalStrengthChanged();
|
void signalStrengthChanged();
|
||||||
@ -90,4 +107,7 @@ private slots:
|
|||||||
|
|
||||||
QDebug operator<<(QDebug debug, WirelessAccessPoint *accessPoint);
|
QDebug operator<<(QDebug debug, WirelessAccessPoint *accessPoint);
|
||||||
|
|
||||||
|
Q_DECLARE_OPERATORS_FOR_FLAGS(WirelessAccessPoint::ApSecurityModes)
|
||||||
|
Q_DECLARE_OPERATORS_FOR_FLAGS(WirelessAccessPoint::ApFlags)
|
||||||
|
|
||||||
#endif // WIRELESSACCESSPOINT_H
|
#endif // WIRELESSACCESSPOINT_H
|
||||||
|
|||||||
@ -110,7 +110,7 @@ WirelessAccessPoint *WirelessNetworkDevice::activeAccessPoint()
|
|||||||
/*! Perform a wireless network scan on this \l{WirelessNetworkDevice}. */
|
/*! Perform a wireless network scan on this \l{WirelessNetworkDevice}. */
|
||||||
void WirelessNetworkDevice::scanWirelessNetworks()
|
void WirelessNetworkDevice::scanWirelessNetworks()
|
||||||
{
|
{
|
||||||
qCDebug(dcNetworkManager()) << this << "Request scan";
|
qCDebug(dcNetworkManager()) << "Request scan" << this;
|
||||||
QDBusMessage query = m_wirelessInterface->call("RequestScan", QVariantMap());
|
QDBusMessage query = m_wirelessInterface->call("RequestScan", QVariantMap());
|
||||||
if (query.type() != QDBusMessage::ReplyMessage) {
|
if (query.type() != QDBusMessage::ReplyMessage) {
|
||||||
qCWarning(dcNetworkManager()) << "Scan error:" << query.errorName() << query.errorMessage();
|
qCWarning(dcNetworkManager()) << "Scan error:" << query.errorName() << query.errorMessage();
|
||||||
@ -132,6 +132,7 @@ WirelessAccessPoint *WirelessNetworkDevice::getAccessPoint(const QString &ssid)
|
|||||||
return accessPoint;
|
return accessPoint;
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Returns the \l{WirelessAccessPoint} with the given \a objectPath. If the \l{WirelessAccessPoint} could not be found, return nullptr. */
|
/*! Returns the \l{WirelessAccessPoint} with the given \a objectPath. If the \l{WirelessAccessPoint} could not be found, return nullptr. */
|
||||||
@ -183,6 +184,11 @@ void WirelessNetworkDevice::setBitrate(int bitRate)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WirelessNetworkDevice::setLastScan(int lastScan)
|
||||||
|
{
|
||||||
|
m_lastScan = lastScan;
|
||||||
|
}
|
||||||
|
|
||||||
void WirelessNetworkDevice::setActiveAccessPoint(const QDBusObjectPath &activeAccessPointObjectPath)
|
void WirelessNetworkDevice::setActiveAccessPoint(const QDBusObjectPath &activeAccessPointObjectPath)
|
||||||
{
|
{
|
||||||
if (m_activeAccessPointObjectPath != activeAccessPointObjectPath) {
|
if (m_activeAccessPointObjectPath != activeAccessPointObjectPath) {
|
||||||
@ -206,17 +212,17 @@ void WirelessNetworkDevice::accessPointAdded(const QDBusObjectPath &objectPath)
|
|||||||
{
|
{
|
||||||
QDBusInterface accessPointInterface(NetworkManagerUtils::networkManagerServiceString(), objectPath.path(), NetworkManagerUtils::accessPointInterfaceString(), QDBusConnection::systemBus());
|
QDBusInterface accessPointInterface(NetworkManagerUtils::networkManagerServiceString(), objectPath.path(), NetworkManagerUtils::accessPointInterfaceString(), QDBusConnection::systemBus());
|
||||||
if (!accessPointInterface.isValid()) {
|
if (!accessPointInterface.isValid()) {
|
||||||
qCWarning(dcNetworkManager()) << "WirelessNetworkDevice: Invalid access point dbus interface";
|
qCWarning(dcNetworkManager()) << this << "Invalid access point dbus interface";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_accessPointsTable.keys().contains(objectPath)) {
|
if (m_accessPointsTable.keys().contains(objectPath)) {
|
||||||
qCWarning(dcNetworkManager()) << "WirelessNetworkDevice: Access point already added" << objectPath.path();
|
qCWarning(dcNetworkManager()) << this << "Access point already added" << objectPath.path();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
WirelessAccessPoint *accessPoint = new WirelessAccessPoint(objectPath, this);
|
WirelessAccessPoint *accessPoint = new WirelessAccessPoint(objectPath, this);
|
||||||
//qCDebug(dcNetworkManager()) << "WirelessNetworkDevice: [+]" << accessPoint;
|
qCDebug(dcNetworkManager()) << interface() << "[+]" << accessPoint;
|
||||||
m_accessPointsTable.insert(objectPath, accessPoint);
|
m_accessPointsTable.insert(objectPath, accessPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,7 +235,7 @@ void WirelessNetworkDevice::accessPointRemoved(const QDBusObjectPath &objectPath
|
|||||||
if (accessPoint == m_activeAccessPoint)
|
if (accessPoint == m_activeAccessPoint)
|
||||||
m_activeAccessPoint = nullptr;
|
m_activeAccessPoint = nullptr;
|
||||||
|
|
||||||
//qCDebug(dcNetworkManager()) << "WirelessNetworkDevice: [-]" << accessPoint;
|
qCDebug(dcNetworkManager()) << interface() << "[-]" << accessPoint;
|
||||||
accessPoint->deleteLater();
|
accessPoint->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,6 +252,11 @@ void WirelessNetworkDevice::propertiesChanged(const QVariantMap &properties)
|
|||||||
if (properties.contains("Mode"))
|
if (properties.contains("Mode"))
|
||||||
setMode(static_cast<Mode>(m_wirelessInterface->property("Mode").toUInt()));
|
setMode(static_cast<Mode>(m_wirelessInterface->property("Mode").toUInt()));
|
||||||
|
|
||||||
|
// Note: available since 1.12 (-1 means never scanned)
|
||||||
|
if (properties.contains("LastScan"))
|
||||||
|
setLastScan(m_wirelessInterface->property("LastScan").toInt());
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Writes the given \a device to the given to \a debug. \sa WirelessNetworkDevice, */
|
/*! Writes the given \a device to the given to \a debug. \sa WirelessNetworkDevice, */
|
||||||
@ -256,5 +267,5 @@ QDebug operator<<(QDebug debug, WirelessNetworkDevice *device)
|
|||||||
debug.nospace() << device->mode() << ", ";
|
debug.nospace() << device->mode() << ", ";
|
||||||
debug.nospace() << device->bitRate() << " [Mb/s], ";
|
debug.nospace() << device->bitRate() << " [Mb/s], ";
|
||||||
debug.nospace() << device->deviceStateString() << ") ";
|
debug.nospace() << device->deviceStateString() << ") ";
|
||||||
return debug;
|
return debug.space();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -69,6 +69,7 @@ private:
|
|||||||
int m_bitRate;
|
int m_bitRate;
|
||||||
QString m_macAddress;
|
QString m_macAddress;
|
||||||
Mode m_mode = ModeUnknown;
|
Mode m_mode = ModeUnknown;
|
||||||
|
int m_lastScan = -1;
|
||||||
QDBusObjectPath m_activeAccessPointObjectPath;
|
QDBusObjectPath m_activeAccessPointObjectPath;
|
||||||
|
|
||||||
QHash<QDBusObjectPath, WirelessAccessPoint *> m_accessPointsTable;
|
QHash<QDBusObjectPath, WirelessAccessPoint *> m_accessPointsTable;
|
||||||
@ -78,6 +79,7 @@ private:
|
|||||||
void setMacAddress(const QString &macAddress);
|
void setMacAddress(const QString &macAddress);
|
||||||
void setMode(Mode mode);
|
void setMode(Mode mode);
|
||||||
void setBitrate(int bitRate);
|
void setBitrate(int bitRate);
|
||||||
|
void setLastScan(int lastScan);
|
||||||
void setActiveAccessPoint(const QDBusObjectPath &activeAccessPointObjectPath);
|
void setActiveAccessPoint(const QDBusObjectPath &activeAccessPointObjectPath);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|||||||
Reference in New Issue
Block a user