summaryrefslogtreecommitdiffstats
path: root/network/network.cpp
diff options
context:
space:
mode:
authorRaquel Medina <raquel.medina@konsulko.com>2019-09-09 00:35:55 +0200
committerraquel medina <raquel.medina@konsulko.com>2019-09-10 14:09:30 +0000
commit4221fd2f9e5b72090fe5c2c5f19aa16ab8bf68b8 (patch)
tree82a6e7e606c85e75e36cdd71c07f6f5aed802f4d /network/network.cpp
parenta824dc2de24ac3789207a5fb9d89400bc83891f9 (diff)
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 <raquel.medina@konsulko.com> Change-Id: Id239ddc549ec8471d44d56f7631d4e9e3efda798
Diffstat (limited to 'network/network.cpp')
-rw-r--r--network/network.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/network/network.cpp b/network/network.cpp
index 4ce701f..f7baf06 100644
--- a/network/network.cpp
+++ b/network/network.cpp
@@ -102,6 +102,50 @@ void Network::input(int id, QString passphrase)
delete nmsg;
}
+void Network::configureAddress(QString service, QVariantList paramlist)
+{
+ NetworkMessage *nmsg = new NetworkMessage();
+ QJsonObject parameter, properties;
+ QJsonArray values = QJsonArray::fromVariantList(paramlist);
+
+ if (values.isEmpty() || values.count() < 4) {
+ qWarning("Invalid addressing params");
+ return;
+ }
+
+ properties.insert("method", values[0]);
+ properties.insert("address", values[1]);
+ properties.insert("netmask", values[2]);
+ properties.insert("gateway", values[3]);
+ parameter.insert("properties", properties);
+ parameter.insert("service", service);
+
+ nmsg->createRequest("set_property", parameter);
+ m_mloop->sendMessage(nmsg);
+ delete nmsg;
+}
+
+void Network::configureNameServer(QString service, QVariantList paramlist)
+{
+ NetworkMessage *nmsg = new NetworkMessage();
+ QJsonObject parameter, properties;
+ QJsonArray values = QJsonArray::fromVariantList(paramlist);
+
+ if (values.isEmpty() || values.count() < 2) {
+ qWarning("Invalid nameserver params");
+ return;
+ }
+
+ parameter.insert("service", service);
+ properties.insert("method", values[0]);
+ properties.insert("nameservers", values[1]);
+ parameter.insert("properties", properties);
+
+ nmsg->createRequest("set_property", parameter);
+ m_mloop->sendMessage(nmsg);
+ delete nmsg;
+}
+
void Network::getServices()
{
NetworkMessage *nmsg = new NetworkMessage();