ui/map: update destination on param change (#28957)

* update destination on param change

* use ParamWatcher

* remove include
pull/28982/head
Dean Lee 2 years ago committed by GitHub
parent b4f7e76531
commit d47d8808d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      selfdrive/ui/qt/maps/map_settings.cc
  2. 2
      selfdrive/ui/qt/maps/map_settings.h

@ -299,6 +299,9 @@ NavigationRequest::NavigationRequest(QObject *parent) : QObject(parent) {
QObject::connect(repeater, &RequestRepeater::requestDone, this, &NavigationRequest::parseLocationsResponse);
}
{
auto param_watcher = new ParamWatcher(this);
QObject::connect(param_watcher, &ParamWatcher::paramChanged, this, &NavigationRequest::nextDestinationUpdated);
// Destination set while offline
QString url = CommaApi::BASE_URL + "/v1/navigation/" + *dongle_id + "/next";
HttpRequest *deleter = new HttpRequest(this);
@ -315,8 +318,8 @@ NavigationRequest::NavigationRequest(QObject *parent) : QObject(parent) {
deleter->sendRequest(url, HttpRequest::Method::DELETE);
}
// Update UI (athena can set destination at any time)
emit nextDestinationUpdated(resp, success);
// athena can set destination at any time
param_watcher->addParam("NavDestination");
});
}
}

@ -29,7 +29,7 @@ public:
signals:
void locationsUpdated(const QJsonArray &locations);
void nextDestinationUpdated(const QString &response, bool success);
void nextDestinationUpdated();
private:
NavigationRequest(QObject *parent);

Loading…
Cancel
Save