feat(travel): Refactor route handling to use direction instead of destination
This commit is contained in:
2
main/external/mtr/arrival.h
vendored
2
main/external/mtr/arrival.h
vendored
@@ -1,7 +1,5 @@
|
||||
#pragma once
|
||||
#include "external/mtr/arrival.h"
|
||||
#include "cJSON.h"
|
||||
#include "external/mtr/mtr.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
9
main/external/mtr/line_info.cpp
vendored
9
main/external/mtr/line_info.cpp
vendored
@@ -51,3 +51,12 @@ LineInfo::LineInfo(cJSON* line_json) {
|
||||
ESP_LOGW(LINE_INFO_TAG, "Missing or invalid 'stations' array");
|
||||
}
|
||||
}
|
||||
|
||||
const char* LineInfo::get_station_name(const std::string& station_code) const {
|
||||
for (const auto& station : _stations) {
|
||||
if (std::string(station.code()) == station_code) {
|
||||
return station.name();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
2
main/external/mtr/line_info.h
vendored
2
main/external/mtr/line_info.h
vendored
@@ -35,6 +35,8 @@ public:
|
||||
return &_stations;
|
||||
}
|
||||
|
||||
const char* get_station_name(const std::string& station_code) const;
|
||||
|
||||
friend class MTRNextTrainHandler;
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user