Commit 8b0e7b12 authored by Volker Krause's avatar Volker Krause
Browse files

Refactor departure query execution to allow for a prior location query

parent c9a2c84b
...@@ -62,6 +62,14 @@ bool HafasMgateBackend::queryDeparture(DepartureReply *reply, QNetworkAccessMana ...@@ -62,6 +62,14 @@ bool HafasMgateBackend::queryDeparture(DepartureReply *reply, QNetworkAccessMana
} }
m_parser.setLocationIdentifierType(locationIdentifierType()); m_parser.setLocationIdentifierType(locationIdentifierType());
queryDeparture(reply, id, nam);
return true;
}
void HafasMgateBackend::queryDeparture(DepartureReply *reply, const QString &locationId, QNetworkAccessManager *nam) const
{
const auto request = reply->request();
QJsonObject stationBoard; QJsonObject stationBoard;
{ {
QJsonObject cfg; QJsonObject cfg;
...@@ -73,7 +81,7 @@ bool HafasMgateBackend::queryDeparture(DepartureReply *reply, QNetworkAccessMana ...@@ -73,7 +81,7 @@ bool HafasMgateBackend::queryDeparture(DepartureReply *reply, QNetworkAccessMana
req.insert(QLatin1String("stbFltrEquiv"), true); req.insert(QLatin1String("stbFltrEquiv"), true);
QJsonObject stbLoc; QJsonObject stbLoc;
stbLoc.insert(QLatin1String("extId"), id); stbLoc.insert(QLatin1String("extId"), locationId);
stbLoc.insert(QLatin1String("state"), QLatin1String("F")); stbLoc.insert(QLatin1String("state"), QLatin1String("F"));
stbLoc.insert(QLatin1String("type"), QLatin1String("S")); stbLoc.insert(QLatin1String("type"), QLatin1String("S"));
...@@ -108,8 +116,6 @@ bool HafasMgateBackend::queryDeparture(DepartureReply *reply, QNetworkAccessMana ...@@ -108,8 +116,6 @@ bool HafasMgateBackend::queryDeparture(DepartureReply *reply, QNetworkAccessMana
} }
netReply->deleteLater(); netReply->deleteLater();
}); });
return true;
} }
bool HafasMgateBackend::queryLocation(LocationReply *reply, QNetworkAccessManager *nam) const bool HafasMgateBackend::queryLocation(LocationReply *reply, QNetworkAccessManager *nam) const
......
...@@ -58,6 +58,7 @@ public: ...@@ -58,6 +58,7 @@ public:
private: private:
QNetworkReply* postRequest(const QJsonObject &svcReq, QNetworkAccessManager *nam) const; QNetworkReply* postRequest(const QJsonObject &svcReq, QNetworkAccessManager *nam) const;
QNetworkReply* postLocationQuery(const LocationRequest &req, QNetworkAccessManager *nam) const; QNetworkReply* postLocationQuery(const LocationRequest &req, QNetworkAccessManager *nam) const;
void queryDeparture(DepartureReply *reply, const QString &locationId, QNetworkAccessManager *nam) const;
void setMicMacSalt(const QString &salt); void setMicMacSalt(const QString &salt);
void setChecksumSalt(const QString &salt); void setChecksumSalt(const QString &salt);
void setLineModeMap(const QJsonObject &obj); void setLineModeMap(const QJsonObject &obj);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment