Commit ef7db0cb authored by Volker Krause's avatar Volker Krause
Browse files

Add support for GBFS v2.1 vehicle type names

parent d4b7fdfb
......@@ -205,6 +205,9 @@ static void appendResults(const GBFSService &service, const LocationRequest &req
}
const auto vehicleType = vehicleTypes.vehicleType(vehicleTypeId);
vehicle.setType(gbfs2kptVehicleType(vehicleType));
if (!vehicleType.name.isEmpty()) {
loc.setName(vehicleType.name);
}
const auto range = bike.value(QLatin1String("current_range_meters")).toInt();
if (range > 0) { // there's too many reporting 0 for unknown that we can assume 0 means actually empty...
......
......@@ -81,6 +81,7 @@ GBFSVehicleType GBFSVehicleType::fromJson(const QJsonObject &obj)
{
GBFSVehicleType v;
v.typeId = obj.value(QLatin1String("vehicle_type_id")).toString();
v.name = obj.value(QLatin1String("name")).toString();
v.formFactor = lookupValue(form_factor_map, obj.value(QLatin1String("form_factor")).toString());
v.propulsionType = lookupValue(propulsion_map, obj.value(QLatin1String("propulsion_type")).toString());
return v;
......
......@@ -22,6 +22,7 @@ class GBFSVehicleType
{
public:
QString typeId;
QString name;
enum FormFactor {
UndefinedFormFactor,
Bicycle,
......
Supports Markdown
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