diff options
author | Raquel Medina <raquel.medina@konsulko.com> | 2019-06-17 19:39:23 +0200 |
---|---|---|
committer | raquel medina <raquel.medina@konsulko.com> | 2019-06-18 11:20:43 +0000 |
commit | e89c4886888a322a21cf7c89c1ee2864dbb4e815 (patch) | |
tree | 1f943c3afd60bf56f79d4e28803ffe1aca55f654 /network/network.cpp | |
parent | 9d896c9c8f5622370362091f38bbc5d1f4189901 (diff) |
network: add wired adapter & model
-Add WiredAdapter implementation
-Add WiredNetworkModel implementation
Bug-AGL: SPEC-2293
Signed-off-by: Raquel Medina <raquel.medina@konsulko.com>
Change-Id: Ibed93ae3a3cca1bc8e7a23c872c7ab3b8271e586
Diffstat (limited to 'network/network.cpp')
-rw-r--r-- | network/network.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/network/network.cpp b/network/network.cpp index 9574837..679f374 100644 --- a/network/network.cpp +++ b/network/network.cpp @@ -33,6 +33,8 @@ 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); + + m_adapters.append(new WiredAdapter(this, context, parent)); } Network::~Network() @@ -198,10 +200,9 @@ void Network::parseTechnologies(QJsonArray technologies) QJsonObject properties = technology.value("properties").toObject(); QString type = properties.value("type").toString(); - if (type == "wifi") { - WifiAdapter* wifi_a = static_cast<WifiAdapter*>(findAdapter(type)); - wifi_a->updateWifiStatus(properties); - } + AdapterIf* adapter = findAdapter(type); + if (adapter) + adapter->updateStatus(properties); } } @@ -243,11 +244,11 @@ void Network::processEvent(NetworkMessage *nmsg) updateServiceProperties(nmsg->eventData()); } else if (nmsg->eventName() == "technology_properties") { QJsonObject technology = nmsg->eventData(); - if (technology.value("technology").toString() == "wifi") { - QJsonObject properties = technology.value("properties").toObject(); - WifiAdapter* wifi_a = static_cast<WifiAdapter*>(findAdapter("wifi")); - wifi_a->updateWifiStatus(properties); - } + QJsonObject properties = technology.value("properties").toObject(); + QString type = technology.value("technology").toString(); + AdapterIf* adapter = findAdapter(type); + if (adapter) + adapter->updateStatus(properties); } } |