summaryrefslogtreecommitdiffstats
path: root/app/main.cpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-07-05 10:45:01 +0200
committerMatt Ranostay <matt.ranostay@konsulko.com>2017-09-26 10:50:07 -0700
commitc6d1a519ef693de35c62ced469374f3a448bd600 (patch)
tree60566d278902315af4b67e185c7e64dd58c48fd1 /app/main.cpp
parentbb11bb4cf5f84ce3b28a127249be08b1b0be98df (diff)
support CAN information(VehicleSpeed and EngineSpeed)dab_4.0.3dab_4.0.2dab/4.0.3dab/4.0.24.0.34.0.2dab
This patch is support CAN inforamion(VehicleSpeed and EngineSpeed). CAN data is sent from can binder using websocket. Bug-AGL: SPEC-913 Change-Id: I26cc6afa5f5f6cea2e6c77e40c324cca5fc00516 Signed-off-by: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com> Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'app/main.cpp')
-rw-r--r--app/main.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/app/main.cpp b/app/main.cpp
index a86082e..1d73689 100644
--- a/app/main.cpp
+++ b/app/main.cpp
@@ -14,7 +14,10 @@
* limitations under the License.
*/
+#include <QUrlQuery>
+#include <QQmlContext>
#include <QtCore/QDebug>
+#include <QCommandLineParser>
#include <QtGui/QGuiApplication>
#include <QtQml/QQmlApplicationEngine>
#include <QtQuickControls2/QQuickStyle>
@@ -35,10 +38,36 @@ int main(int argc, char *argv[])
#endif
QGuiApplication app(argc, argv);
+ app.setApplicationName(QStringLiteral("Dashboard"));
+ app.setApplicationVersion(QStringLiteral("3.99.3"));
+ app.setOrganizationDomain(QStringLiteral("automotivelinux.org"));
+ app.setOrganizationName(QStringLiteral("AutomotiveGradeLinux"));
QQuickStyle::setStyle("AGL");
+ QCommandLineParser parser;
+ parser.addPositionalArgument("port", app.translate("main", "port for binding"));
+ parser.addPositionalArgument("secret", app.translate("main", "secret for binding"));
+ parser.addHelpOption();
+ parser.addVersionOption();
+ parser.process(app);
+ QStringList positionalArguments = parser.positionalArguments();
+
QQmlApplicationEngine engine;
+ if (positionalArguments.length() == 2) {
+ int port = positionalArguments.takeFirst().toInt();
+ QString secret = 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"), secret);
+ bindingAddress.setQuery(query);
+ QQmlContext *context = engine.rootContext();
+ context->setContextProperty(QStringLiteral("bindingAddress"), bindingAddress);
+ }
engine.load(QUrl(QStringLiteral("qrc:/Dashboard.qml")));
return app.exec();