diff options
-rw-r--r-- | app/BtnGuidance.qml | 4 | ||||
-rw-r--r-- | app/app.pro | 8 | ||||
-rw-r--r-- | app/dbus_server.cpp | 134 | ||||
-rw-r--r-- | app/dbus_server.h | 40 | ||||
-rw-r--r-- | app/dbusinterface/org.agl.naviapi.xml | 36 | ||||
-rw-r--r-- | app/main.cpp | 16 | ||||
-rwxr-xr-x | app/navigation.qml | 132 | ||||
-rw-r--r-- | navigation.pro | 2 | ||||
-rw-r--r-- | package/config.xml | 1 |
9 files changed, 1 insertions, 372 deletions
diff --git a/app/BtnGuidance.qml b/app/BtnGuidance.qml index 18efd9f..da36cda 100644 --- a/app/BtnGuidance.qml +++ b/app/BtnGuidance.qml @@ -36,10 +36,6 @@ Item { function discardWaypoints() {
map.initDestination()
- if(btn_guidance.sts_guide != 0){
- map.qmlSignalStopDemo()
- }
-
if(map.center !== map.currentpostion){
btn_present_position.state = "Optional"
}
diff --git a/app/app.pro b/app/app.pro index c693ee9..b88affa 100644 --- a/app/app.pro +++ b/app/app.pro @@ -5,25 +5,19 @@ QT += 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 -SOURCES += main.cpp \ - dbus_server.cpp +SOURCES += main.cpp RESOURCES += \ navigation.qrc \ images/images.qrc -DBUS_ADAPTORS += dbusinterface/org.agl.naviapi.xml -DBUS_INTERFACES += dbusinterface/org.agl.naviapi.xml - include(app.pri) diff --git a/app/dbus_server.cpp b/app/dbus_server.cpp deleted file mode 100644 index d83528e..0000000 --- a/app/dbus_server.cpp +++ /dev/null @@ -1,134 +0,0 @@ -#include"dbus_server.h" -#include <QDebug> - -DBus_Server::DBus_Server(const QString &pathName, - const QString &objName, - const QString &serverName, - QObject *parent) : - m_serverName(serverName), - m_pathName(pathName + serverName), - m_objName(objName + serverName) -{ - initDBus(); - initAPIs(parent); -} -DBus_Server::~DBus_Server(){} - -void DBus_Server::initDBus(){ - - new NaviapiAdaptor(this); - - if (!QDBusConnection::sessionBus().registerService(m_pathName)) - qDebug() << m_pathName << "registerService() failed"; - - if (!QDBusConnection::sessionBus().registerObject(m_objName, this)) - qDebug() << m_objName << "registerObject() failed"; - - QDBusConnection sessionBus = QDBusConnection::connectToBus(QDBusConnection::SessionBus, m_serverName); - if (!sessionBus.isConnected()) { - qDebug() << 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()))){ - qDebug() << m_serverName << "sessionBus.connect():getRouteInfoSlot failed"; - } - -} - -void DBus_Server::initAPIs(QObject *parent){ - - if(!QObject::connect(this,SIGNAL(doAddPOI(QVariant,QVariant,QVariant)), - parent,SLOT(addPoiIconSLOT(QVariant,QVariant,QVariant)))) { - qDebug() << m_serverName << "cppSIGNAL:doAddPOI to qmlSLOT:addPoiIcon connect is failed"; - } - - if(!QObject::connect(this,SIGNAL(doRemovePOIs(QVariant)), - parent,SLOT(removePoiIconsSLOT(QVariant)))) { - qDebug() << m_serverName << "cppSIGNAL:doRemovePOIs to qmlSLOT:removePoiIcons connect is failed"; - } - - if(!QObject::connect(this,SIGNAL(doGetRouteInfo()), - parent,SLOT(doGetRouteInfoSlot()))) { - qDebug() << m_serverName << "cppSIGNAL:doGetRouteInfo to qmlSLOT:doGetRouteInfoSlot connect is failed"; - } - - if(!QObject::connect(parent,SIGNAL(qmlSignalRouteInfo(double,double,double,double)), - this,SLOT(sendSignalRouteInfo(double,double,double,double)))) { - qDebug() << m_serverName << "qmlSIGNAL:qmlSignalRouteInfo to cppSLOT:sendSignalRouteInfo connect is failed"; - } - - if(!QObject::connect(parent,SIGNAL(qmlSignalPosInfo(double,double,double,double)), - this,SLOT(sendSignalPosInfo(double,double,double,double)))) { - qDebug() << m_serverName << "qmlSIGNAL:qmlSignalPosInfo to cppSLOT:sendSignalPosInfo connect is failed"; - } - - if(!QObject::connect(parent,SIGNAL(qmlSignalStopDemo()), - this,SLOT(sendSignalStopDemo()))) { - qDebug() << m_serverName << "qmlSIGNAL:qmlSignalStopDemo to cppSLOT:sendSignalStopDemo connect is failed"; - } - - if(!QObject::connect(parent,SIGNAL(qmlSignalArrvied()), - this,SLOT(sendSignalArrvied()))) { - qDebug() << m_serverName << "qmlSIGNAL:qmlSignalArrvied to cppSLOT:sendSignalArrvied connect is failed"; - } -} - -void DBus_Server::getRouteInfoSlot(){ - qDebug() << "call getRouteInfoSlot "; - emit doGetRouteInfo(); - return; -} - -// Signal -void DBus_Server::sendSignalRouteInfo(double srt_lat, double srt_lon, double end_lat, double end_lon){ - qDebug() << "call sendSignalRouteInfo "; - 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){ -// qDebug() << "call sendSignalPosInfo "; - 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(){ - qDebug() << "call sendSignalStopDemo "; - QDBusMessage message = QDBusMessage::createSignal(m_objName, - org::agl::naviapi::staticInterfaceName(), - "signalStopDemo"); - QDBusConnection::sessionBus().send(message); - return; -} - -void DBus_Server::sendSignalArrvied(){ - qDebug() << "call sendSignalArrvied "; - QDBusMessage message = QDBusMessage::createSignal(m_objName, - org::agl::naviapi::staticInterfaceName(), - "signalArrvied"); - QDBusConnection::sessionBus().send(message); - return; -} - -// Method -void DBus_Server::addPOI(uint category_id, double poi_Lat, double poi_Lon){ - qDebug() << "call addPOI category_id: " << category_id << " poi_Lat: " << poi_Lat << " poi_Lon: " << poi_Lon; - emit doAddPOI(poi_Lat,poi_Lon,category_id); - return; -} -void DBus_Server::removePOIs(uint category_id){ - qDebug() << "call removePOIs category_id: " << category_id; - emit doRemovePOIs(category_id); - return; -} diff --git a/app/dbus_server.h b/app/dbus_server.h deleted file mode 100644 index 8cd2f52..0000000 --- a/app/dbus_server.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef DBUS_SERVER_H -#define DBUS_SERVER_H -#include "naviapi_interface.h" -#include "naviapi_adaptor.h" -#include <QtQml/QQmlApplicationEngine> - -class DBus_Server : public QObject{ - - Q_OBJECT - - QString m_serverName; - QString m_pathName; - QString m_objName; - -public: - DBus_Server(const QString &pathName, - const QString &objName, - const QString &serverName, - QObject *parent = nullptr); - ~DBus_Server(); - -private: - void initDBus(); - void initAPIs(QObject*); - -signals: - void doAddPOI(QVariant,QVariant,QVariant); - void doRemovePOIs(QVariant); - void doGetRouteInfo(); - -public slots: - void addPOI(uint category_id, double poi_Lat, double poi_Lon); - void removePOIs(uint category_id); - 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 sendSignalArrvied(); -}; -#endif // DBUS_SERVER_H diff --git a/app/dbusinterface/org.agl.naviapi.xml b/app/dbusinterface/org.agl.naviapi.xml deleted file mode 100644 index f5b095c..0000000 --- a/app/dbusinterface/org.agl.naviapi.xml +++ /dev/null @@ -1,36 +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"> - <method name="addPOI"> - <arg direction="in" name="category_id" type="u"/> - <arg direction="in" name="poi_Lat" type="d"/> - <arg direction="in" name="poi_Lon" type="d"/> - </method> - <method name="removePOIs"> - <arg direction="in" name="category_id" type="u"/> - </method> - <!-- 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 signalArrvied() --> - <signal name="signalArrvied"> - </signal> - <!-- void getRouteInfo() --> - <signal name="getRouteInfo"> - </signal> - </interface> -</node> diff --git a/app/main.cpp b/app/main.cpp index e609dda..15a11e1 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -35,26 +35,12 @@ #include <QtQml/QQmlContext> #include <QtQuickControls2/QQuickStyle> #include <QQuickWindow> -#include <QtDBus/QDBusConnection> #include "markermodel.h" -#include "dbus_server.h" #include "guidance_module.h" #include "file_operation.h" int main(int argc, char *argv[]) { - - // for dbusIF - QString pathBase = "org.agl."; - QString objBase = "/org/agl/"; - QString serverName = "naviapi"; - - 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; - } - #if USE_QTAGLEXTRAS AGLApplication app(argc, argv); app.setApplicationName("navigation"); @@ -142,7 +128,6 @@ int main(int argc, char *argv[]) QQuickWindow *window = qobject_cast<QQuickWindow *>(root); QObject::connect(window, SIGNAL(frameSwapped()), qwmHandler, SLOT(slotActivateSurface())); QObject *map = engine.rootObjects().first()->findChild<QObject*>("map"); - DBus_Server dbus(pathBase,objBase,serverName,map); #else // for only libwindowmanager QGuiApplication app(argc, argv); @@ -162,7 +147,6 @@ int main(int argc, char *argv[]) engine.load(QUrl(QStringLiteral("qrc:/navigation.qml"))); QObject *map = engine.rootObjects().first()->findChild<QObject*>("map"); - DBus_Server dbus(pathBase,objBase,serverName,map); #endif diff --git a/app/navigation.qml b/app/navigation.qml index ffc0ded..4741685 100755 --- a/app/navigation.qml +++ b/app/navigation.qml @@ -55,11 +55,6 @@ ApplicationWindow { property var poiArray: new Array property int last_segmentcounter : -1 - signal qmlSignalRouteInfo(double srt_lat,double srt_lon,double end_lat,double end_lon); - signal qmlSignalPosInfo(double lat,double lon,double drc,double dst); - signal qmlSignalStopDemo(); - signal qmlSignalArrvied(); - width: parent.width height: parent.height plugin: Plugin { @@ -307,12 +302,9 @@ ApplicationWindow { var waypointlist = routeQuery.waypoints for(var i=1; i<waypoint_count; i++) { markerModel.addMarker(waypointlist[i]) - -// map.addPoiIconSLOT(waypointlist[i].latitude,waypointlist[i].longitude,i % 5) // for Debug } routeModel.update() - map.qmlSignalRouteInfo(car_position_lat, car_position_lon,coord.latitude,coord.longitude) // update icon_end_point icon_end_point.coordinate = coord @@ -327,7 +319,6 @@ ApplicationWindow { // reset currentpostion map.currentpostion = QtPositioning.coordinate(car_position_lat, car_position_lon) car_accumulated_distance = 0 - map.qmlSignalPosInfo(car_position_lat, car_position_lon,car_direction,car_accumulated_distance) routeQuery.clearWaypoints(); routeQuery.addWaypoint(map.currentpostion) @@ -418,112 +409,6 @@ ApplicationWindow { map.currentpostion = QtPositioning.coordinate(curlat+addlat, curlon+addlon); } - function addPoiIconSLOT(lat,lon,type) { - console.log("called addPoiIcon") - var poiItem; - switch(type){ - case 0: - poiItem = Qt.createQmlObject(" - import QtQuick 2.0; - import QtLocation 5.9; - MapQuickItem { - id: poi_icon; - anchorPoint.x: icon_flag_liteblue_image.width/2; - anchorPoint.y: icon_flag_liteblue_image.height; - sourceItem: Image { - id: icon_flag_liteblue_image; - width: 32; - height: 37; - source: \"images/Flag-export_lightblue.png\"; - } - } - ",map,"dynamic"); - break; - case 1: - poiItem = Qt.createQmlObject(" - import QtQuick 2.0; - import QtLocation 5.9; - MapQuickItem { - id: poi_icon; - anchorPoint.x: icon_building_image.width/2; - anchorPoint.y: icon_building_image.height; - sourceItem: Image { - id: icon_building_image; - width: 32; - height: 37; - source: \"images/BuildingIcon.png\"; - } - } - ",map,"dynamic"); - break; - case 2: - poiItem = Qt.createQmlObject(" - import QtQuick 2.0; - import QtLocation 5.9; - MapQuickItem { - id: poi_icon; - anchorPoint.x: icon_church_image.width/2; - anchorPoint.y: icon_church_image.height; - sourceItem: Image { - id: icon_church_image; - width: 32; - height: 37; - source: \"images/ChurchIcon.png\"; - } - } - ",map,"dynamic"); - break; - case 3: - poiItem = Qt.createQmlObject(" - import QtQuick 2.0; - import QtLocation 5.9; - MapQuickItem { - id: poi_icon; - anchorPoint.x: icon_restaurant_image.width/2; - anchorPoint.y: icon_restaurant_image.height; - sourceItem: Image { - id: icon_restaurant_image; - width: 32; - height: 37; - source: \"images/RestaurantMapIcon.png\"; - } - } - ",map,"dynamic"); - break; - case 4: - poiItem = Qt.createQmlObject(" - import QtQuick 2.0; - import QtLocation 5.9; - MapQuickItem { - id: poi_icon; - anchorPoint.x: icon_supermarket_image.width/2; - anchorPoint.y: icon_supermarket_image.height; - sourceItem: Image { - id: icon_supermarket_image; - width: 32; - height: 37; - source: \"images/SupermarketMapIcon.png\"; - } - } - ",map,"dynamic"); - break; - default: - poiItem = null; - break; - } - - if(poiItem === null) { - console.log("error creating object" + poiItem.errorString()); - return false; - } - - poiItem.coordinate = QtPositioning.coordinate(lat, lon); - map.addMapItem(poiItem); - poiArray.push(poiItem); -// console.log("success creating object"); - return true; - } - MouseArea { id: mouseArea property variant lastCoordinate @@ -595,7 +480,6 @@ ApplicationWindow { if(pathcounter != 0){ car_accumulated_distance += next_distance } - map.qmlSignalPosInfo(map.currentpostion.latitude, map.currentpostion.longitude,next_direction,car_accumulated_distance) if(pathcounter < routeModel.get(0).path.length - 1){ pathcounter++ } @@ -603,14 +487,12 @@ ApplicationWindow { { // Arrive at your destination btn_guidance.sts_guide = 0 - map.qmlSignalArrvied() } }else{ setNextCoordinate(map.currentpostion.latitude, map.currentpostion.longitude,next_direction,root.car_moving_distance) if(pathcounter != 0){ car_accumulated_distance += root.car_moving_distance } - map.qmlSignalPosInfo(map.currentpostion.latitude, map.currentpostion.longitude,next_direction,car_accumulated_distance) } // console.log("NextCoordinate:",map.currentpostion.latitude,",",map.currentpostion.longitude) @@ -662,20 +544,6 @@ ApplicationWindow { map.removeMapItem(poiArray.pop()) } - function doGetRouteInfoSlot(){ - if(btn_guidance.sts_guide == 0){ // idle - console.log("called doGetRouteInfoSlot sts_guide == idle") - map.qmlSignalPosInfo(car_position_lat, car_position_lon,car_direction,car_accumulated_distance); - }else if(btn_guidance.sts_guide == 1){ // Routing - console.log("called doGetRouteInfoSlot sts_guide == Routing") - map.qmlSignalPosInfo(car_position_lat, car_position_lon,car_direction,car_accumulated_distance); - map.qmlSignalRouteInfo(car_position_lat, car_position_lon,routeQuery.waypoints[1].latitude,routeQuery.waypoints[1].longitude); - }else if(btn_guidance.sts_guide == 2){ // onGuide - console.log("called doGetRouteInfoSlot sts_guide == onGuide") - map.qmlSignalRouteInfo(car_position_lat, car_position_lon,routeQuery.waypoints[1].latitude,routeQuery.waypoints[1].longitude); - } - } - function rotateMapSmooth(){ var prev = root.prev_car_direction var now = root.car_direction diff --git a/navigation.pro b/navigation.pro index b6f0588..579a952 100644 --- a/navigation.pro +++ b/navigation.pro @@ -1,5 +1,3 @@ TEMPLATE = subdirs SUBDIRS = app package - - package.depends += app diff --git a/package/config.xml b/package/config.xml index ae5c1f6..5ad9001 100644 --- a/package/config.xml +++ b/package/config.xml @@ -12,7 +12,6 @@ </feature> <feature name="urn:AGL:widget:required-permission"> <param name="urn:AGL:permission::public:no-htdocs" value="required"/> - <param name="http://tizen.org/privilege/internal/dbus" value="required"/> </feature> </widget> |