diff options
author | zheng_wenlong <wenlong_zheng@nexty-ele.com> | 2019-05-31 12:44:40 +0900 |
---|---|---|
committer | zheng_wenlong <wenlong_zheng@nexty-ele.com> | 2019-05-31 12:44:40 +0900 |
commit | 27c26952a5d1905f11ea4d8fe3d303fee82efd56 (patch) | |
tree | 730dedc9a0f8ddedb1bbb2c3644c0c48a00039d6 /app/qcheapruler.cpp | |
parent | ccfef630efc19a235d4451582fb98a3cae35558c (diff) |
change dbus to websocket
Diffstat (limited to 'app/qcheapruler.cpp')
-rw-r--r-- | app/qcheapruler.cpp | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/app/qcheapruler.cpp b/app/qcheapruler.cpp index 890fd63..6e2f59c 100644 --- a/app/qcheapruler.cpp +++ b/app/qcheapruler.cpp @@ -1,13 +1,12 @@ #include "qcheapruler.hpp" -#include "naviapi_adaptor.h" #include <QString> QCheapRuler::QCheapRuler() { //set the default current position - // m_currentPosition = QGeoCoordinate(36.136261, -115.151254); - m_currentPosition = QGeoCoordinate(35.692396, 139.691102); + m_currentPosition = QGeoCoordinate(36.136261, -115.151254); + //m_currentPosition = QGeoCoordinate(35.692396, 139.691102); } QCheapRuler::~QCheapRuler() @@ -26,6 +25,14 @@ double QCheapRuler::currentDistance() const return m_currentDistance; } +//get the current Coordinate +void QCheapRuler::setCurrentCoordinate(QString m_latitude,QString m_longitude) +{ + double latitude = m_latitude.toDouble(); + double longitude = m_longitude.toDouble(); + setCurrentPosition(latitude,longitude); +} + //set current position below the coordinate info from navigation service void QCheapRuler::setCurrentPosition(double latitude, double longitude) { @@ -39,10 +46,12 @@ void QCheapRuler::setCurrentPosition(double latitude, double longitude) } } -void QCheapRuler::setCurrentDistance(double distance) +void QCheapRuler::setCurrentDistance(QString strdistance) { + double distance = strdistance.toDouble(); //set current distance info and notify the changes when the info has changed //but it will not send notify when it start or stop demo + if((m_currentDistance != distance) &&(distance != 0.0)) { @@ -59,7 +68,7 @@ QGeoCoordinate QCheapRuler::currentPosition() const QJSValue QCheapRuler::path() const { - // Should neveer be called. + // Should never be called. return QJSValue(); } @@ -95,17 +104,6 @@ void QCheapRuler::setPath(const QJSValue &value) emit pathChanged(); } -//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"; - } -} - //init the CheapRuler class cr::CheapRuler QCheapRuler::ruler() const { |