From cf12dec6fe37e47ed71e8d28518c0d77040b75f9 Mon Sep 17 00:00:00 2001 From: Matt Ranostay Date: Thu, 17 Oct 2019 06:34:09 -0700 Subject: ondemandnavi: remove DBus interface For proper afb interfae to function the DBus support needs to be removed. Bug-AGL: SPEC-2880 Change-Id: Ib501583e5cb3821bf5479d875e447411477c7da3 Signed-off-by: Matt Ranostay --- app/app.pro | 12 +- app/dbus_server.cpp | 108 ----------------- app/dbus_server.h | 33 ----- app/dbus_server_navigationcore.cpp | 175 --------------------------- app/dbus_server_navigationcore.h | 48 -------- app/main.cpp | 14 --- dbus_interface/dbus_interface.pro | 44 ------- dbus_interface/dbus_types.h | 75 ------------ dbus_interface/org.agl.naviapi.xml | 34 ------ dbus_interface/org.genivi.navigationcore.xml | 61 ---------- navigation.pro | 6 +- 11 files changed, 4 insertions(+), 606 deletions(-) delete mode 100644 app/dbus_server.cpp delete mode 100644 app/dbus_server.h delete mode 100644 app/dbus_server_navigationcore.cpp delete mode 100644 app/dbus_server_navigationcore.h delete mode 100644 dbus_interface/dbus_interface.pro delete mode 100644 dbus_interface/dbus_types.h delete mode 100644 dbus_interface/org.agl.naviapi.xml delete mode 100644 dbus_interface/org.genivi.navigationcore.xml diff --git a/app/app.pro b/app/app.pro index e881bc5..0a69833 100644 --- a/app/app.pro +++ b/app/app.pro @@ -3,29 +3,21 @@ QT = quick qml aglextras PKGCONFIG += qlibhomescreen qlibwindowmanager QT += positioning -QT += dbus QT += core CONFIG += c++11 link_pkgconfig HEADERS += \ markermodel.h \ - dbus_server.h \ guidance_module.h \ - file_operation.h \ - dbus_server_navigationcore.h + file_operation.h SOURCES += main.cpp \ - dbus_server.cpp \ - file_operation.cpp \ - dbus_server_navigationcore.cpp + file_operation.cpp RESOURCES += \ navigation.qrc \ images/images.qrc -LIBS += $$OUT_PWD/../dbus_interface/libdbus_interface.a -INCLUDEPATH += $$OUT_PWD/../dbus_interface - include(app.pri) DISTFILES += diff --git a/app/dbus_server.cpp b/app/dbus_server.cpp deleted file mode 100644 index 99ae363..0000000 --- a/app/dbus_server.cpp +++ /dev/null @@ -1,108 +0,0 @@ -#include"dbus_server.h" -#include - -DBus_Server::DBus_Server(QObject *parent) : - m_serverName("naviapi"), - m_pathName("org.agl.naviapi"), - m_objName("/org/agl/naviapi") -{ - initDBus(); - initAPIs(parent); -} - -DBus_Server::~DBus_Server(){ - QDBusConnection::sessionBus().unregisterObject(m_objName); - QDBusConnection::sessionBus().unregisterService(m_pathName); -} - -void DBus_Server::initDBus(){ - - new NaviapiAdaptor(this); - - if (!QDBusConnection::sessionBus().registerService(m_pathName)) - qWarning() << m_serverName << "registerService() failed"; - - if (!QDBusConnection::sessionBus().registerObject(m_objName, this)) - qWarning() << m_serverName << "registerObject() failed"; - - QDBusConnection sessionBus = QDBusConnection::connectToBus(QDBusConnection::SessionBus, m_serverName); - if (!sessionBus.isConnected()) { - qWarning() << m_serverName << "connectToBus() failed"; - } - - //for receive dbus signal - org::agl::naviapi *mInterface; - mInterface = new org::agl::naviapi(QString(),QString(),QDBusConnection::sessionBus(),this); - if (!connect(mInterface,SIGNAL(getRouteInfo()),this,SLOT(getRouteInfoSlot()))){ - qWarning() << m_serverName << "sessionBus.connect():getRouteInfoSlot failed"; - } - -} - -void DBus_Server::initAPIs(QObject *parent){ - - if(!QObject::connect(this,SIGNAL(doGetRouteInfo()), - parent,SLOT(doGetRouteInfoSlot()))) { - qWarning() << m_serverName << "cppSIGNAL:doGetRouteInfo to qmlSLOT:doGetRouteInfoSlot connect failed"; - } - - if(!QObject::connect(parent,SIGNAL(qmlSignalRouteInfo(double,double,double,double)), - this,SLOT(sendSignalRouteInfo(double,double,double,double)))) { - qWarning() << m_serverName << "qmlSIGNAL:qmlSignalRouteInfo to cppSLOT:sendSignalRouteInfo connect failed"; - } - - if(!QObject::connect(parent,SIGNAL(qmlSignalPosInfo(double,double,double,double)), - this,SLOT(sendSignalPosInfo(double,double,double,double)))) { - qWarning() << m_serverName << "qmlSIGNAL:qmlSignalPosInfo to cppSLOT:sendSignalPosInfo connect failed"; - } - - if(!QObject::connect(parent,SIGNAL(qmlSignalStopDemo()), - this,SLOT(sendSignalStopDemo()))) { - qWarning() << m_serverName << "qmlSIGNAL:qmlSignalStopDemo to cppSLOT:sendSignalStopDemo connect failed"; - } - - if(!QObject::connect(parent,SIGNAL(qmlSignalArrived()), - this,SLOT(sendSignalArrived()))) { - qWarning() << m_serverName << "qmlSIGNAL:qmlSignalArrived to cppSLOT:sendSignalArrived connect failed"; - } -} - -void DBus_Server::getRouteInfoSlot(){ - emit doGetRouteInfo(); - return; -} - -// Signal -void DBus_Server::sendSignalRouteInfo(double srt_lat, double srt_lon, double end_lat, double end_lon){ - QDBusMessage message = QDBusMessage::createSignal(m_objName, - org::agl::naviapi::staticInterfaceName(), - "signalRouteInfo"); - message << srt_lat << srt_lon << end_lat << end_lon; - QDBusConnection::sessionBus().send(message); - return; -} - -void DBus_Server::sendSignalPosInfo(double lat, double lon, double drc, double dst){ - QDBusMessage message = QDBusMessage::createSignal(m_objName, - org::agl::naviapi::staticInterfaceName(), - "signalPosInfo"); - message << lat << lon << drc << dst; - QDBusConnection::sessionBus().send(message); - return; -} - -void DBus_Server::sendSignalStopDemo(void){ - QDBusMessage message = QDBusMessage::createSignal(m_objName, - org::agl::naviapi::staticInterfaceName(), - "signalStopDemo"); - QDBusConnection::sessionBus().send(message); - return; -} - -void DBus_Server::sendSignalArrived(void){ - QDBusMessage message = QDBusMessage::createSignal(m_objName, - org::agl::naviapi::staticInterfaceName(), - "signalArrived"); - QDBusConnection::sessionBus().send(message); - return; -} diff --git a/app/dbus_server.h b/app/dbus_server.h deleted file mode 100644 index aaa4d73..0000000 --- a/app/dbus_server.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef DBUS_SERVER_H -#define DBUS_SERVER_H -#include "org.agl.naviapi_interface.h" -#include "org.agl.naviapi_adaptor.h" -#include - -class DBus_Server : public QObject{ - - Q_OBJECT - - QString m_serverName; - QString m_pathName; - QString m_objName; - -public: - DBus_Server(QObject *parent = nullptr); - ~DBus_Server(); - -private: - void initDBus(); - void initAPIs(QObject*); - -signals: - void doGetRouteInfo(); - -public slots: - void getRouteInfoSlot(); - void sendSignalRouteInfo(double srt_lat,double srt_lon,double end_lat,double end_lon); - void sendSignalPosInfo(double lat,double lon,double drc,double dst); - void sendSignalStopDemo(); - void sendSignalArrived(); -}; -#endif // DBUS_SERVER_H diff --git a/app/dbus_server_navigationcore.cpp b/app/dbus_server_navigationcore.cpp deleted file mode 100644 index e8f7a37..0000000 --- a/app/dbus_server_navigationcore.cpp +++ /dev/null @@ -1,175 +0,0 @@ -#include "dbus_server_navigationcore.h" -#include -#include -#include -#include - -dbus_server_navigationcore::dbus_server_navigationcore(QObject *parent) : - m_pathName("org.agl.naviapi"), - m_objName("/org/genivi/navicore"), - m_serverName("mapmatchedposition"), - m_object(parent) -{ - setupDBus(); - setupApi(); -} - -dbus_server_navigationcore::~dbus_server_navigationcore(){ - QDBusConnection::sessionBus().unregisterObject(m_objName); -} - -void dbus_server_navigationcore::setupDBus() -{ - qDBusRegisterMetaType(); - qDBusRegisterMetaType(); - qDBusRegisterMetaType(); - qDBusRegisterMetaType(); - qDBusRegisterMetaType(); - qDBusRegisterMetaType(); - - - if (!QDBusConnection::sessionBus().registerService(m_pathName)) - qDebug() << m_serverName << "registerService() failed"; - - if (!QDBusConnection::sessionBus().registerObject(m_objName, this)) - qDebug() << m_serverName << "registerObject() failed"; - - new MapMatchedPositionAdaptor(this); - new RoutingAdaptor(this); - new SessionAdaptor(this); -} - -void dbus_server_navigationcore::setupApi(){ - - if(!QObject::connect(this,SIGNAL(doPauseSimulation()), - m_object,SLOT(doPauseSimulationSlot()))) { - qDebug() << m_serverName << "cppSIGNAL:doPauseSimulation to qmlSLOT:doPauseSimulationSlot connect is failed"; - } - -} - -// Method -qPosition dbus_server_navigationcore::GetPosition(const qValuesToReturn &valuesToReturn){ - double Latitude =0; - double Longitude =0; - qPosition result; - qPositionPairElm Pair_1,Pair_2; - QVariant m_Variant = m_object->property("currentpostion"); - if(m_Variant.canConvert()){ - QGeoCoordinate coordinate = m_Variant.value(); - Latitude = coordinate.latitude(); - Longitude = coordinate.longitude(); - } - - for(int i = 0; i < valuesToReturn.size(); i++){ - switch(valuesToReturn[i]){ - case 160: - Pair_1.key = 160; - Pair_1.value = QDBusVariant(Latitude); - result.insert(160,Pair_1); - break; - case 161: - Pair_2.key = 161; - Pair_2.value = QDBusVariant(Longitude); - result.insert(161,Pair_2); - break; - default: - break; - } - } - return result; -} - -void dbus_server_navigationcore::PauseSimulation(uint sessionHandle){ - qDebug() << m_serverName << sessionHandle << "call PauseSimulation"; - emit doPauseSimulation(); - return; -} - -void dbus_server_navigationcore::SetSimulationMode(uint sessionHandle, bool activate){ - qDebug() << m_serverName << sessionHandle << activate << "call SetSimulationMode"; - return; -} - -void dbus_server_navigationcore::CalculateRoute(uint sessionHandle, uint routeHandle){ - qDebug() << m_objName << sessionHandle << routeHandle << "call dbus_server_routing"; - return; -} - -void dbus_server_navigationcore::CancelRouteCalculation(uint sessionHandle, uint routeHandle){ - qDebug() << m_objName << sessionHandle << routeHandle << "call CancelRouteCalculation"; - return; -} - -uint dbus_server_navigationcore::CreateRoute(uint sessionHandle){ - qDebug() << m_objName << sessionHandle << "call CreateRoute"; - QVariant returnvalue; - uint result; - - // call qml function - if(!QMetaObject::invokeMethod(m_object,"doGetAllRoutesSlot",Q_RETURN_ARG(QVariant, returnvalue))) - qDebug() << m_objName << "invokeMethod doGetAllRoutesSlot failed."; - - // we only manage 1 route for now - result = (uint)returnvalue.toInt(); - return result; -} - -qRoutesList dbus_server_navigationcore::GetAllRoutes(){ - qDebug() << m_objName << "call GetAllRoutes"; - QVariant returnvalue; - qRoutesList result; - - // call qml function - if(!QMetaObject::invokeMethod(m_object,"doGetAllRoutesSlot",Q_RETURN_ARG(QVariant, returnvalue))) - qDebug() << m_objName << "invokeMethod doGetAllRoutesSlot failed."; - - // we only manage 1 route for now - int ret = returnvalue.toInt(); - if(ret == 1){ - result.append(ret); - } - return result; -} - -void dbus_server_navigationcore::SetWaypoints(uint sessionHandle, uint routeHandle, bool startFromCurrentPosition, qWaypointsList waypointsList){ - qDebug() << m_objName << sessionHandle << routeHandle << startFromCurrentPosition << "call SetWaypoints"; - double Latitude =0; - double Longitude =0; - - // analize waypointlist only manage 1 waypoint - for(int i = 0; i < 1; i++){ - QMap::const_iterator itr = waypointsList[i].constBegin(); - while(itr != waypointsList[i].constEnd()){ - switch(itr.key()){ - case 160: - Latitude = itr.value().value.variant().toDouble(); - itr++; - break; - case 161: - Longitude = itr.value().value.variant().toDouble(); - itr++; - break; - default: - break; - } - } - } - - // call qml function - if(!QMetaObject::invokeMethod(m_object,"doSetWaypointsSlot",Q_ARG(QVariant, Latitude),Q_ARG(QVariant, Longitude),Q_ARG(QVariant, startFromCurrentPosition))) - qDebug() << m_objName << "invokeMethod doSetWaypointsSlot failed."; - - return; -} - -qSessionsList dbus_server_navigationcore::GetAllSessions(){ - qDebug() << m_objName << "call GetAllSessions"; - qSessionsList result; - qSessionsListElm element; - element.key = 1; - element.value = "dummy"; - result.append(element); - return result; -} - diff --git a/app/dbus_server_navigationcore.h b/app/dbus_server_navigationcore.h deleted file mode 100644 index 3f62dbb..0000000 --- a/app/dbus_server_navigationcore.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef DBUS_SERVER_NAVIGATIONCORE_H -#define DBUS_SERVER_NAVIGATIONCORE_H - -#include -#include -#include - -#include "org.genivi.navigationcore_adaptor.h" -#include "org.genivi.navigationcore_interface.h" - -class dbus_server_navigationcore : public QObject -{ - Q_OBJECT - - QString m_pathName; - QString m_objName; - QString m_serverName; - QObject *m_object; - -public: - dbus_server_navigationcore(QObject *parent = 0); - ~dbus_server_navigationcore(); - -public slots: - // mapmatchedposition - qPosition GetPosition(const qValuesToReturn &valuesToReturn); - void PauseSimulation(uint sessionHandle); - void SetSimulationMode(uint sessionHandle, bool activate); - // routing - void CalculateRoute(uint sessionHandle, uint routeHandle); - void CancelRouteCalculation(uint sessionHandle, uint routeHandle); - uint CreateRoute(uint sessionHandle); - qRoutesList GetAllRoutes(); - void SetWaypoints(uint sessionHandle, uint routeHandle, bool startFromCurrentPosition, qWaypointsList waypointsList); - // session - qSessionsList GetAllSessions(); - -signals: - void doPauseSimulation(); - -private: - void setupDBus(); - void setupApi(); - -}; - -#endif // DBUS_SERVER_NAVIGATIONCORE_H - diff --git a/app/main.cpp b/app/main.cpp index aa7768b..cbd121c 100755 --- a/app/main.cpp +++ b/app/main.cpp @@ -27,23 +27,12 @@ #include #include #include -#include #include "markermodel.h" -#include "dbus_server.h" -#include "dbus_server_navigationcore.h" #include "guidance_module.h" #include "file_operation.h" int main(int argc, char *argv[]) { - - // for dbusIF - 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); QString graphic_role = QString("navigation"); int port = 1700; @@ -108,9 +97,6 @@ int main(int argc, char *argv[]) QObject *root = engine.rootObjects().first(); QQuickWindow *window = qobject_cast(root); QObject::connect(window, SIGNAL(frameSwapped()), qwmHandler, SLOT(slotActivateSurface())); - QObject *map = engine.rootObjects().first()->findChild("map"); - DBus_Server dbus(map); - dbus_server_navigationcore dbus_navigationcore(map); return app.exec(); } diff --git a/dbus_interface/dbus_interface.pro b/dbus_interface/dbus_interface.pro deleted file mode 100644 index d647da3..0000000 --- a/dbus_interface/dbus_interface.pro +++ /dev/null @@ -1,44 +0,0 @@ -QT += dbus -TARGET = dbus_interface -TEMPLATE = lib -CONFIG += staticlib - -SOURCES += -HEADERS += \ - dbus_types.h - -XMLSOURCES = \ - org.genivi.navigationcore.xml \ - org.agl.naviapi.xml - -gen_adaptor_cpp.input = XMLSOURCES -gen_adaptor_cpp.commands = \ - qdbusxml2cpp -i $$PWD/dbus_types.h -m -a ${QMAKE_FILE_IN_BASE}_adaptor ${QMAKE_FILE_IN}; \ - moc $$OUT_PWD/${QMAKE_FILE_IN_BASE}_adaptor.h -o $$OUT_PWD/${QMAKE_FILE_IN_BASE}_adaptor.moc -gen_adaptor_cpp.output = ${QMAKE_FILE_IN_BASE}_adaptor.cpp -gen_adaptor_cpp.variable_out = SOURCES -gen_adaptor_cpp.clean = ${QMAKE_FILE_IN_BASE}_adaptor.cpp - -gen_adaptor_h.input = XMLSOURCES -gen_adaptor_h.commands = @echo Fake making the header for ${QMAKE_FILE_IN} -gen_adaptor_h.depends = ${QMAKE_FILE_IN_BASE}_adaptor.cpp -gen_adaptor_h.output = ${QMAKE_FILE_IN_BASE}_adaptor.h -gen_adaptor_h.clean = ${QMAKE_FILE_IN_BASE}_adaptor.h - -gen_interface_cpp.input = XMLSOURCES -gen_interface_cpp.commands = \ - qdbusxml2cpp -i $$PWD/dbus_types.h -m -p ${QMAKE_FILE_IN_BASE}_interface ${QMAKE_FILE_IN}; \ - moc $$OUT_PWD/${QMAKE_FILE_IN_BASE}_interface.h -o $$OUT_PWD/${QMAKE_FILE_IN_BASE}_interface.moc -gen_interface_cpp.output = ${QMAKE_FILE_IN_BASE}_interface.cpp -gen_interface_cpp.variable_out = SOURCES -gen_interface_cpp.clean = ${QMAKE_FILE_IN_BASE}_interface.cpp - -gen_interface_h.input = XMLSOURCES -gen_interface_h.commands = @echo Fake making the header for ${QMAKE_FILE_IN} -gen_interface_h.depends = ${QMAKE_FILE_IN_BASE}_interface.cpp -gen_interface_h.output = ${QMAKE_FILE_IN_BASE}_interface.h -gen_interface_h.clean = ${QMAKE_FILE_IN_BASE}_interface.h - -QMAKE_EXTRA_COMPILERS += gen_adaptor_cpp gen_adaptor_h gen_interface_cpp gen_interface_h - -DISTFILES += diff --git a/dbus_interface/dbus_types.h b/dbus_interface/dbus_types.h deleted file mode 100644 index 9b49adb..0000000 --- a/dbus_interface/dbus_types.h +++ /dev/null @@ -1,75 +0,0 @@ -#ifndef DBUS_TYPES_H -#define DBUS_TYPES_H -#include - -#include -#include -#include -#include -#include -#include - -// for org.genivi.navigationcore -struct qPositionPairElm{ - uint8_t key; - QDBusVariant value; -}; -Q_DECLARE_METATYPE(qPositionPairElm) - -inline QDBusArgument &operator <<(QDBusArgument &argument, const qPositionPairElm &qpositionpairelm) -{ - argument.beginStructure(); - argument << qpositionpairelm.key << qpositionpairelm.value; - argument.endStructure(); - return argument; -} - -inline const QDBusArgument &operator >>(const QDBusArgument &argument, qPositionPairElm &qpositionpairelm) -{ - argument.beginStructure(); - argument >> qpositionpairelm.key; - argument >> qpositionpairelm.value; - argument.endStructure(); - return argument; -} - -typedef QMap qPosition; -Q_DECLARE_METATYPE(qPosition) - -typedef QList qValuesToReturn; -Q_DECLARE_METATYPE(qValuesToReturn) - -typedef QList> qWaypointsList; // aa{i(yv)} -Q_DECLARE_METATYPE(qWaypointsList) - -typedef QList qCalculatedRoutesList; // au - -typedef QList qRoutesList; //au - -struct qSessionsListElm{ - uint32_t key; - QString value; -}; -Q_DECLARE_METATYPE(qSessionsListElm) - -inline QDBusArgument &operator <<(QDBusArgument &argument, const qSessionsListElm &qsessionslistelm) -{ - argument.beginStructure(); - argument << qsessionslistelm.key << qsessionslistelm.value; - argument.endStructure(); - return argument; -} - -inline const QDBusArgument &operator >>(const QDBusArgument &argument, qSessionsListElm &qsessionslistelm) -{ - argument.beginStructure(); - argument >> qsessionslistelm.key; - argument >> qsessionslistelm.value; - argument.endStructure(); - return argument; -} - -typedef QList qSessionsList; // a(us) -Q_DECLARE_METATYPE(qSessionsList) - -#endif diff --git a/dbus_interface/org.agl.naviapi.xml b/dbus_interface/org.agl.naviapi.xml deleted file mode 100644 index 87bf87d..0000000 --- a/dbus_interface/org.agl.naviapi.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dbus_interface/org.genivi.navigationcore.xml b/dbus_interface/org.genivi.navigationcore.xml deleted file mode 100644 index 1e4704e..0000000 --- a/dbus_interface/org.genivi.navigationcore.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/navigation.pro b/navigation.pro index bb839fa..ffa500e 100644 --- a/navigation.pro +++ b/navigation.pro @@ -1,7 +1,5 @@ CONFIG += ordered TEMPLATE = subdirs -SUBDIRS = dbus_interface \ - app package +SUBDIRS = app package -package.depends += dbus_interface \ - app +package.depends += app -- cgit 1.2.3-korg