summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/app.pro7
-rw-r--r--app/dbus_client.cpp116
-rw-r--r--app/dbus_client.h46
-rw-r--r--app/main.cpp15
-rw-r--r--app/org.agl.naviapi.xml28
-rw-r--r--app/qcheapruler.cpp8
6 files changed, 2 insertions, 218 deletions
diff --git a/app/app.pro b/app/app.pro
index bcad35a..a2f7283 100644
--- a/app/app.pro
+++ b/app/app.pro
@@ -1,7 +1,7 @@
TARGET = tbtnavi
TEMPLATE = app
-QT += qml network quick positioning location widgets dbus
+QT += qml network quick positioning location widgets
PKGCONFIG += qlibhomescreen qlibwindowmanager
CONFIG += c++1z link_pkgconfig
@@ -11,12 +11,10 @@ include(app.pri)
SOURCES += \
main.cpp \
qcheapruler.cpp \
- dbus_client.cpp \
file_operation.cpp
HEADERS += \
qcheapruler.hpp \
- dbus_client.h \
file_operation.h
INCLUDEPATH += \
@@ -28,6 +26,3 @@ OTHER_FILES += \
RESOURCES += \
images/images.qrc \
app.qrc
-
-DBUS_ADAPTORS += org.agl.naviapi.xml
-DBUS_INTERFACES += org.agl.naviapi.xml
diff --git a/app/dbus_client.cpp b/app/dbus_client.cpp
deleted file mode 100644
index 62dde46..0000000
--- a/app/dbus_client.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
-#include "dbus_client.h"
-
-dbus_client::dbus_client(const QString &pathName,
- const QString &objName,
- const QString &serverName,
- QObject *parent) :
- m_serverName(serverName),
- m_pathName(pathName + serverName),
- m_objName(objName + serverName)
-{
- // DBus & api init
- initDBus();
- initAPIs(parent);
-}
-
-dbus_client::~dbus_client(){}
-
-void dbus_client::initDBus(){
-
- new NaviapiAdaptor(this);
-
- // connect session to navigation service(add route info)
- if (!QDBusConnection::sessionBus().connect(
- QString(),
- QString(),
- m_pathName,
- "signalRouteInfo",
- this,
- SLOT(addRoutePointsSlot(double, double, double, double)))) { //slot
- qWarning() << m_serverName << "sessionBus.connect(): signalRouteInfo failed";
- }
-
- // connect session to navigation service(current postion info)
- if (!QDBusConnection::sessionBus().connect(
- QString(),
- QString(),
- m_pathName,
- "signalPosInfo",
- this,
- SLOT(positionSlot(double, double, double, double)))) { //slot
- qWarning() << m_serverName << "sessionBus.connect(): signalPosInfo failed";
- }
-
- // connect session to navigation service(when demo stopped)
- if (!QDBusConnection::sessionBus().connect(
- QString(),
- QString(),
- m_pathName,
- "signalStopDemo",
- this,
- SLOT(stopdemoSlot()))) { //slot
- qWarning() << m_serverName << "sessionBus.connect(): signalStopDemo failed";
- }
-
- // connect session to navigation service(when arrived destination)
- if (!QDBusConnection::sessionBus().connect(
- QString(),
- QString(),
- m_pathName,
- "signalArrived",
- this,
- SLOT(arrivedestSlot()))) { //slot
- qWarning() << m_serverName << "sessionBus.connect(): signalArrived failed";
- }
-}
-
-void dbus_client::initAPIs(QObject *parent){
- // connect the signal to qml inside function(addRoutePointsQml -> do_addRoutePoint)
- if(!QObject::connect(this, SIGNAL(addRoutePointsQml(QVariant, QVariant, QVariant, QVariant)),
- parent, SLOT(do_addRoutePoint(QVariant, QVariant, QVariant, QVariant)))) {
- qWarning() << m_serverName << "SIGNAL:addRoutePointsQml to qmlSLOT:do_addRoutePoint connect failed";
- }
-
- // connect the signal to qml inside function(positionQml -> do_setCoordinate)
- if(!QObject::connect(this, SIGNAL(positionQml(QVariant, QVariant,QVariant, QVariant)),
- parent, SLOT(do_setCoordinate(QVariant, QVariant,QVariant, QVariant)))) {
- qWarning() << m_serverName << "SIGNAL:positionQml to qmlSLOT:do_setCoordinate connect failed";
- }
-
- // connect the signal to qml inside function(stopdemoQml -> do_stopnavidemo)
- if(!QObject::connect(this, SIGNAL(stopdemoQml()),
- parent, SLOT(do_stopnavidemo()))) {
- qWarning() << m_serverName << "SIGNAL:stopdemoQml to qmlSLOT:do_stopnavidemo connect failed";
- }
-
- // connect the signal to qml inside function(arrivedestQml -> do_arrivedest)
- if(!QObject::connect(this, SIGNAL(arrivedestQml()),
- parent, SLOT(do_arrivedest()))) {
- qWarning() << m_serverName << "SIGNAL:arrivedestQml to qmlSLOT:do_arrivedest connect failed";
- }
-}
-
-// Signal&&Method
-// addRoutePointsSlot -> addRoutePointsQml(use for qml)
-void dbus_client::addRoutePointsSlot(double route_Lat_s, double route_Lon_s, double route_Lat_e, double route_Lon_e)
-{
- emit addRoutePointsQml(route_Lat_s, route_Lon_s, route_Lat_e, route_Lon_e);
-}
-
-// positionSlot -> positionQml(use for qml)
-void dbus_client::positionSlot(double cur_Lat_p, double cur_Lon_p,double cur_direction, double cur_distance)
-{
- emit positionQml(cur_Lat_p, cur_Lon_p,cur_direction,cur_distance);
-}
-
-// stopdemoSlot -> stopdemoQml(use for qml)
-void dbus_client::stopdemoSlot()
-{
- emit stopdemoQml();
-}
-
-// arrivedestSlot -> arrivedestQml(use for qml)
-void dbus_client::arrivedestSlot()
-{
- emit arrivedestQml();
-}
diff --git a/app/dbus_client.h b/app/dbus_client.h
deleted file mode 100644
index 0abae31..0000000
--- a/app/dbus_client.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifndef DBUS_CLIENT_H
-#define DBUS_CLIENT_H
-
-#include "naviapi_interface.h"
-#include "naviapi_adaptor.h"
-#include <QtQml/QQmlApplicationEngine>
-
-class dbus_client : public QObject{
- Q_OBJECT
- QString m_serverName;
- QString m_pathName;
- QString m_objName;
-
-public:
- dbus_client(const QString &pathName,
- const QString &objName,
- const QString &serverName,
- QObject *parent = nullptr);
- ~dbus_client();
-
-private:
- //DBus & API init
- void initDBus();
- void initAPIs(QObject*);
-
-signals:
- //notify add routepoints signal to qml
- void addRoutePointsQml(QVariant, QVariant, QVariant, QVariant);
- //notify current position signal to qml
- void positionQml(QVariant, QVariant,QVariant, QVariant);
- //notify stop demo signal to qml
- void stopdemoQml();
- //notify arrive destination signal to qml
- void arrivedestQml();
-
-private slots:
- //receive add routepoints notify from navigation service
- void addRoutePointsSlot(double route_Lat_s, double route_Lon_s, double route_Lat_e, double route_Lon_e);
- //receive current position notify from navigation service
- void positionSlot(double cur_Lat_p, double cur_Lon_p,double cur_direction, double cur_distance);
- //receive stop demo notify from navigation service
- void stopdemoSlot();
- //receive arrive destination notify from navigation service
- void arrivedestSlot();
-};
-#endif // DBUS_CLIENT_H
diff --git a/app/main.cpp b/app/main.cpp
index d82ca24..43e8586 100644
--- a/app/main.cpp
+++ b/app/main.cpp
@@ -7,24 +7,16 @@
#include <QtQml/QQmlApplicationEngine>
#include <QtQml/QQmlContext>
#include <QtQuick/QQuickWindow>
-#include <QtDBus/QDBusConnection>
#include <qlibwindowmanager.h>
#include <qlibhomescreen.h>
#include "qcheapruler.hpp"
-#include "dbus_client.h"
#include "file_operation.h"
int main(int argc, char *argv[])
{
QString graphic_role = QString("tbtnavi");
- if (!QDBusConnection::sessionBus().isConnected()) {
- qWarning("Cannot connect to the D-Bus session bus.\n"
- "Please check your system settings and try again.\n");
- return 1;
- }
-
QGuiApplication app(argc, argv);
QCoreApplication::setOrganizationDomain("automotivelinux.org");
QCoreApplication::setOrganizationName("AutomotiveGradeLinux");
@@ -88,12 +80,5 @@ int main(int argc, char *argv[])
QQuickWindow *window = qobject_cast<QQuickWindow *>(root);
QObject::connect(window, SIGNAL(frameSwapped()), qwmHandler, SLOT(slotActivateWindow()));
- // Make the DBus connection info
- QString pathBase = "org.agl.";
- QString objBase = "/org/agl/";
- QString serverName = "naviapi";
- QObject *mapWindow = root->findChild<QObject*>("mapwindow");
- dbus_client dbus(pathBase, objBase, serverName, mapWindow);
-
return app.exec();
}
diff --git a/app/org.agl.naviapi.xml b/app/org.agl.naviapi.xml
deleted file mode 100644
index 5874c35..0000000
--- a/app/org.agl.naviapi.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
-<node>
- <interface name="org.agl.naviapi">
- <!-- void signalRouteInfo() -->
- <signal name="signalRouteInfo">
- <arg name="start_latitude" type="d" direction="out"/>
- <arg name="start_longitude" type="d" direction="out"/>
- <arg name="end_latitude" type="d" direction="out"/>
- <arg name="end_longitude" type="d" direction="out"/>
- </signal>
- <!-- void signalPosInfo() -->
- <signal name="signalPosInfo">
- <arg name="latitude" type="d" direction="out"/>
- <arg name="longitude" type="d" direction="out"/>
- <arg name="direction" type="d" direction="out"/>
- <arg name="distance" type="d" direction="out"/>
- </signal>
- <!-- void signalStopDemo() -->
- <signal name="signalStopDemo">
- </signal>
- <!-- void signalArrived() -->
- <signal name="signalArrived">
- </signal>
- <!-- void getRouteInfo() -->
- <signal name="getRouteInfo">
- </signal>
- </interface>
-</node>
diff --git a/app/qcheapruler.cpp b/app/qcheapruler.cpp
index 890fd63..0744dab 100644
--- a/app/qcheapruler.cpp
+++ b/app/qcheapruler.cpp
@@ -1,5 +1,4 @@
#include "qcheapruler.hpp"
-#include "naviapi_adaptor.h"
#include <QString>
@@ -98,12 +97,7 @@ void QCheapRuler::setPath(const QJSValue &value)
//init the route and postion info when start in the first time.(can be called by qml)
void QCheapRuler::initRouteInfo()
{
- //send "getRouteInfo" message to the navigation service
- QDBusMessage message = QDBusMessage::createSignal("/", "org.agl.naviapi", "getRouteInfo");
- if(!QDBusConnection::sessionBus().send(message))
- {
- qDebug() << "initRouteInfo" << "sessionBus.send(): getRouteInfo failed";
- }
+ // TODO: this may be needed to get initial route info
}
//init the CheapRuler class