diff options
author | Matt Ranostay <matt.ranostay@konsulko.com> | 2019-11-11 00:48:02 -0800 |
---|---|---|
committer | Scott Murray <scott.murray@konsulko.com> | 2019-11-27 23:39:00 +0000 |
commit | 477da952f98dda785c3a729dd297decc0503bb7f (patch) | |
tree | e5a195ad89ffd66faf4f85a94037c271836fb441 /MainApp.cpp | |
parent | 3b1d243f8e46523890ca4bf4188b197734235f31 (diff) |
poi-yelp: change to libqtappfw navigation interfacehalibut_8.0.4halibut/8.0.48.0.4
Switch from DBus interface to rewritten agl-service-nagivation
binding via the libqtappfw wrapper interface.
Bug-AGL: SPEC-2880
Change-Id: I4244de4db250af438dda6b6173940f6a49fe34f2
Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Diffstat (limited to 'MainApp.cpp')
-rw-r--r-- | MainApp.cpp | 119 |
1 files changed, 5 insertions, 114 deletions
diff --git a/MainApp.cpp b/MainApp.cpp index 6689507..a75462a 100644 --- a/MainApp.cpp +++ b/MainApp.cpp @@ -50,13 +50,13 @@ using namespace std; -MainApp::MainApp():QMainWindow(Q_NULLPTR, Qt::FramelessWindowHint), +MainApp::MainApp(Navigation *navigation):QMainWindow(Q_NULLPTR, Qt::FramelessWindowHint), networkManager(this),searchBtn(QIcon(tr(":/images/loupe-90.png")), tr(""), this), lineEdit(this),keyboard(QRect(0, 688, COMPLETE_W_WITH_KB, 720), this), mutex(QMutex::Recursive),token(""),currentSearchingText(""),currentSearchedText(""), pSearchReply(NULL),pInfoPanel(NULL),pResultList(NULL),currentLatitude(36.136261),currentLongitude(-115.151254), navicoreSession(0),currentIndex(0),fontId(-1),isInfoScreen(false), - isInputDisplayed(false),isKeyboard(false),isAglNavi(false) + isInputDisplayed(false),isKeyboard(false),isAglNavi(false), naviapi(navigation) { //this->setAttribute(Qt::WA_TranslucentBackground); this->setStyleSheet("border: none;"); @@ -115,8 +115,6 @@ MainApp::MainApp():QMainWindow(Q_NULLPTR, Qt::FramelessWindowHint), isAglNavi = true; connect(this, SIGNAL(positionGotSignal()), this, SLOT(positionGot())); - connect(this, SIGNAL(allRoutesGotSignal()), this, SLOT(allRoutesGot())); - connect(this, SIGNAL(routeCreatedSignal()), this, SLOT(routeCreated())); this->setGeometry(QRect(this->pos().x(), this->pos().y(), COMPLETE_W_WITH_KB, COMPLETE_H_WITH_KB)); this->setStyleSheet("background-image: url(:/images/AGL_POI_Background.png);"); @@ -275,11 +273,7 @@ void MainApp::textChanged(const QString & text) } this->currentSearchingText = text; - /* we need to know our current position */ - std::vector<int32_t> Params; - Params.push_back(naviapi::NAVICORE_LONGITUDE); - Params.push_back(naviapi::NAVICORE_LATITUDE); - naviapi.getPosition(Params); + emit positionGotSignal(); mutex.unlock(); } @@ -578,7 +572,7 @@ void MainApp::SetDestination(int index) this->destinationLatitude = Businesses[index].Latitude; this->destinationLongitude = Businesses[index].Longitude; - naviapi.getAllRoutes(); + SetWayPoints(0); mutex.unlock(); } @@ -766,18 +760,6 @@ bool MainApp::IsCoordinatesConsistent(Business & business) } /* end of workaround */ -bool MainApp::CheckNaviApi(int argc, char *argv[]) -{ - bool ret = naviapi.connect(argc, argv, this); - - if (ret == true) - { - naviapi.getAllSessions(); - } - - return ret; -} - int MainApp::AuthenticatePOI(const QString & CredentialsFile) { char buf[512]; @@ -899,12 +881,7 @@ int MainApp::StartMonitoringUserInput() void MainApp::SetWayPoints(uint32_t myRoute) { /* set the destination : */ - naviapi::Waypoint destWp(this->destinationLatitude, this->destinationLongitude); - std::vector<naviapi::Waypoint> myWayPoints; - myWayPoints.push_back(destWp); - naviapi.setWaypoints(navicoreSession, myRoute, true, myWayPoints); - - naviapi.calculateRoute(navicoreSession, myRoute); + naviapi->sendWaypoint(this->destinationLatitude, this->destinationLongitude); /* reset search: */ currentSearchingText = tr(""); @@ -946,60 +923,6 @@ void MainApp::getAllSessions_reply(const std::map< uint32_t, std::string >& allS mutex.unlock(); } - -void MainApp::getPosition_reply(std::map< int32_t, naviapi::variant > position) -{ - mutex.lock(); - - std::map< int32_t, naviapi::variant >::iterator it; - for (it = position.begin(); it != position.end(); it++) - { - if (it->first == naviapi::NAVICORE_LATITUDE) - { - currentLatitude = it->second._double; - } - else if (it->first == naviapi::NAVICORE_LONGITUDE) - { - currentLongitude = it->second._double; - } - } - - TRACE_INFO("Current position: %f, %f", currentLatitude, currentLongitude); - - mutex.unlock(); - - emit positionGotSignal(); -} - -void MainApp::getAllRoutes_reply(std::vector< uint32_t > allRoutes) -{ - mutex.lock(); - - uint32_t routeHandle = 0; - - if (allRoutes.size() != 0) - { - routeHandle = allRoutes[0]; - } - - this->currentRouteHandle = routeHandle; - - mutex.unlock(); - - emit allRoutesGotSignal(); -} - -void MainApp::createRoute_reply(uint32_t routeHandle) -{ - mutex.lock(); - - this->currentRouteHandle = routeHandle; - - mutex.unlock(); - - emit routeCreatedSignal(); -} - void MainApp::positionGot() { mutex.lock(); @@ -1021,35 +944,3 @@ void MainApp::positionGot() mutex.unlock(); } - -void MainApp::allRoutesGot() -{ - mutex.lock(); - - /* check if a route already exists, if not create it : */ - if (this->currentRouteHandle == 0) - { - naviapi.createRoute(navicoreSession); - } - else - { - naviapi.pauseSimulation(navicoreSession); - naviapi.setSimulationMode(navicoreSession, false); - naviapi.cancelRouteCalculation(navicoreSession, this->currentRouteHandle); - sleep(1); - - SetWayPoints(this->currentRouteHandle); - } - - mutex.unlock(); -} - -void MainApp::routeCreated() -{ - mutex.lock(); - - SetWayPoints(this->currentRouteHandle); - - mutex.unlock(); -} - |