summaryrefslogtreecommitdiffstats
path: root/app/navigation_client.cpp
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2019-11-10 23:46:39 -0800
committerMatt Ranostay <matt.ranostay@konsulko.com>2019-11-11 20:36:36 -0800
commit8e070480a38956be76339cc6b81f3b0cb665cef5 (patch)
tree4730aff310062a120bd95802c0c07b477a8e7df3 /app/navigation_client.cpp
parentd01ce33b26daf332d4b8bd9e389e0877c1c38b88 (diff)
tbtnavi: add interface to agl-service-navigation
Add interface to agl-service-navigation via libqtappfw to replace navicore DBus completely. Bug-AGL: SPEC-2880 Change-Id: Idf3afcdd3c7424b8adb91a9aaf14df662d7fe107 Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Diffstat (limited to 'app/navigation_client.cpp')
-rw-r--r--app/navigation_client.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/app/navigation_client.cpp b/app/navigation_client.cpp
new file mode 100644
index 0000000..f07f6c7
--- /dev/null
+++ b/app/navigation_client.cpp
@@ -0,0 +1,50 @@
+#include "navigation_client.h"
+
+navigation_client::navigation_client(Navigation *navigation, QObject *parent) :
+ m_navigation(navigation)
+{
+ QObject::connect(m_navigation, &Navigation::statusEvent, this, &navigation_client::statusEvent);
+ QObject::connect(m_navigation, &Navigation::positionEvent, this, &navigation_client::positionEvent);
+}
+
+navigation_client::~navigation_client(){}
+
+void navigation_client::statusEvent(QVariantMap data)
+{
+ if (!data.contains("state"))
+ return;
+
+ QString state = data["state"].toString();
+
+ if (state == "arrived")
+ emit arrivedestQml();
+
+ if (state == "stopped" || state == "stop")
+ emit stopdemoQml();
+}
+
+void navigation_client::positionEvent(QVariantMap data)
+{
+ if (!data.contains("position"))
+ return;;
+
+ QString position = data["position"].toString();
+
+ if (position == "route") {
+ double route_Lat_s = data["latitude"].toDouble();
+ double route_Lon_s = data["longitude"].toDouble();
+ double route_Lat_e = data["route_latitude"].toDouble();
+ double route_Lon_e = data["route_longitude"].toDouble();
+
+ emit addRoutePointsQml(route_Lat_s, route_Lon_s, route_Lat_e, route_Lon_e);
+ }
+
+ if (position == "car") {
+ double cur_Lat_p = data["latitude"].toDouble();
+ double cur_Lon_p = data["longitude"].toDouble();
+ double cur_direction = data["direction"].toDouble();
+ double cur_distance = data["distance"].toDouble();
+
+ emit positionQml(cur_Lat_p, cur_Lon_p, cur_direction, cur_distance);
+ }
+}