diff options
author | Matt Porter <mporter@konsulko.com> | 2018-07-30 21:10:29 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@automotivelinux.org> | 2018-07-30 21:10:29 +0000 |
commit | ee58ffc1da71d296fdae869dbaaa74a1c4a6c664 (patch) | |
tree | c67348444246644e98a56076337515059560f6a1 /network/network.cpp | |
parent | 3f7c96d135e64e22075b640e9ee301e444cd1582 (diff) | |
parent | 0c4d8bf4e0af08563c907148216ffdb485dd1922 (diff) |
Merge "network: add wifiStrength property"flounder_5.99.6flounder_5.99.5flounder_5.99.4flounder_5.99.3flounder/5.99.6flounder/5.99.5flounder/5.99.4flounder/5.99.35.99.65.99.55.99.45.99.3
Diffstat (limited to 'network/network.cpp')
-rw-r--r-- | network/network.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/network/network.cpp b/network/network.cpp index d2a00ff..7bcf6d0 100644 --- a/network/network.cpp +++ b/network/network.cpp @@ -31,7 +31,8 @@ Network::Network (QUrl &url, QQmlContext *context, QObject * parent) : m_mloop(nullptr), m_wifi(nullptr), m_wifiConnected(false), - m_wifiEnabled(false) + m_wifiEnabled(false), + m_wifiStrength(0) { m_mloop = new MessageEngine(url); m_wifi = new WifiNetworkModel(); @@ -41,6 +42,7 @@ Network::Network (QUrl &url, QQmlContext *context, QObject * parent) : QObject::connect(m_mloop, &MessageEngine::connected, this, &Network::onConnected); QObject::connect(m_mloop, &MessageEngine::disconnected, this, &Network::onDisconnected); QObject::connect(m_mloop, &MessageEngine::messageReceived, this, &Network::onMessageReceived); + QObject::connect(m_wifi, &WifiNetworkModel::strengthChanged, this, &Network::updateWifiStrength); } Network::~Network() @@ -159,6 +161,9 @@ bool Network::addService(QJsonObject service) WifiNetwork *network = new WifiNetwork(address, security, id, ssid, state, strength); m_wifi->addNetwork(network); + if ((state == "ready") || (state == "online")) + updateWifiStrength(strength); + return true; } @@ -202,6 +207,12 @@ void Network::updateWifiStatus(QJsonObject properties) } } +void Network::updateWifiStrength(int strength) +{ + m_wifiStrength = strength; + emit wifiStrengthChanged(m_wifiStrength); +} + void Network::parseTechnologies(QJsonArray technologies) { for (auto value : technologies) { |