From 4221fd2f9e5b72090fe5c2c5f19aa16ab8bf68b8 Mon Sep 17 00:00:00 2001 From: Raquel Medina Date: Mon, 9 Sep 2019 00:35:55 +0200 Subject: wired: add hooks for addressing configuration - Add new roles to provide UI clients with the active configuration (values obtained from the stack: agl-service-network binding + connman). - Add Q_INVOKABLE methods to feed new values from the UI client. SPEC-2676 Signed-off-by: Raquel Medina Change-Id: Id239ddc549ec8471d44d56f7631d4e9e3efda798 --- network/wiredadapter.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'network/wiredadapter.cpp') diff --git a/network/wiredadapter.cpp b/network/wiredadapter.cpp index 224d13a..297ba44 100644 --- a/network/wiredadapter.cpp +++ b/network/wiredadapter.cpp @@ -74,16 +74,25 @@ bool WiredAdapter::addService(QString id, QJsonObject properties) if (type != getType()) return false; - QString state = properties.value("state").toString(); - // Initially support only IPv4 and the first security method found - QString address = properties.value("ipv4").toObject().value("address").toString(); - QString security = properties.value("security").toArray().at(0).toString(); - // Ignore services already added if (m_model->getNetwork(id)) return false; - ConnectionProfile *network = new ConnectionProfile(address, security, id, state, "",0); + QString state = properties.value("state").toString(); + // Initially support only IPv4 and the first security method found + QString security = properties.value("security").toArray().at(0).toString(); + QJsonObject ipv4obj = properties.value("ipv4").toObject(); + QString address = ipv4obj.value("address").toString(); + QString netmask = ipv4obj.value("netmask").toString(); + QString gateway = ipv4obj.value("gateway").toString(); + QString amethod = ipv4obj.value("method").toString(); + QString ns = properties.value("nameservers").toString(); + QString nsmethod = (amethod == "dhcp")? "auto" : "manual"; + + ConnectionProfile *network = new ConnectionProfile(address, security, id, + state, "", 0, netmask, + gateway, amethod, ns, + nsmethod); m_model->addNetwork(network); return true; -- cgit 1.2.3-korg