summaryrefslogtreecommitdiffstats
path: root/app/main.cpp
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2019-11-11 01:05:35 -0800
committerMatt Ranostay <matt.ranostay@konsulko.com>2019-11-11 01:05:35 -0800
commitee6e9af318150dc061787108fef94b230a63d218 (patch)
tree383ee62af2b18c9c2951161b45e957354b8fa66f /app/main.cpp
parentca2db695f1258e0b325c7454a8f79c6d7b2eb48b (diff)
ondemandnavi: add agl-service-navigation interface
Switch from the application providing DBus objects to consumers with using afb binding with proper JSON responses. Bug-AGL: SPEC-2880 Change-Id: If587ddeaea9a0f28e71c2bee790acbf53425de9f Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Diffstat (limited to 'app/main.cpp')
-rw-r--r--app/main.cpp29
1 files changed, 22 insertions, 7 deletions
diff --git a/app/main.cpp b/app/main.cpp
index cbd121c..b2b9185 100644
--- a/app/main.cpp
+++ b/app/main.cpp
@@ -27,6 +27,7 @@
#include <QtQml/QQmlContext>
#include <QtQuickControls2/QQuickStyle>
#include <QQuickWindow>
+#include <navigation.h>
#include "markermodel.h"
#include "guidance_module.h"
#include "file_operation.h"
@@ -47,10 +48,29 @@ int main(int argc, char *argv[])
parser.addHelpOption();
parser.addVersionOption();
parser.process(app);
+
+ // Load qml
+ QQmlApplicationEngine engine;
+ QQmlContext *context = engine.rootContext();
+
+ File_Operation file;
+ context->setContextProperty("fileOperation", &file);
+
QStringList positionalArguments = parser.positionalArguments();
if (positionalArguments.length() == 2) {
port = positionalArguments.takeFirst().toInt();
token = positionalArguments.takeFirst();
+ QUrl bindingAddress;
+ bindingAddress.setScheme(QStringLiteral("ws"));
+ bindingAddress.setHost(QStringLiteral("localhost"));
+ bindingAddress.setPort(port);
+ bindingAddress.setPath(QStringLiteral("/api"));
+ QUrlQuery query;
+ query.addQueryItem(QStringLiteral("token"), token);
+ bindingAddress.setQuery(query);
+
+ Navigation *navigation = new Navigation(bindingAddress, context);
+ context->setContextProperty("navigation", navigation);
}
fprintf(stderr, "[navigation] app_name: %s, port: %d, token: %s.\n",
graphic_role.toStdString().c_str(),
@@ -81,17 +101,12 @@ int main(int argc, char *argv[])
qDebug("Surface %s got showWindow\n", graphic_role.toStdString().c_str());
qwmHandler->activateWindow(graphic_role);
});
- // Load qml
- QQmlApplicationEngine engine;
MarkerModel model;
- engine.rootContext()->setContextProperty("markerModel", &model);
+ context->setContextProperty("markerModel", &model);
Guidance_Module guidance;
- engine.rootContext()->setContextProperty("guidanceModule", &guidance);
-
- File_Operation file;
- engine.rootContext()->setContextProperty("fileOperation", &file);
+ context->setContextProperty("guidanceModule", &guidance);
engine.load(QUrl(QStringLiteral("qrc:/navigation.qml")));
QObject *root = engine.rootObjects().first();