feat(travel): Refactor route handling to use direction instead of destination

This commit is contained in:
GW_MC
2026-02-03 20:11:16 +08:00
parent c4635948e4
commit 3617a206ff
9 changed files with 137 additions and 57 deletions

View File

@@ -1,7 +1,5 @@
#pragma once
#include "external/mtr/arrival.h"
#include "cJSON.h"
#include "external/mtr/mtr.h"
#include <string>
#include <vector>

View File

@@ -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 "";
}

View File

@@ -35,6 +35,8 @@ public:
return &_stations;
}
const char* get_station_name(const std::string& station_code) const;
friend class MTRNextTrainHandler;
private: