feat(travel): Implement settings UI and web server for MTR route configuration

- Added MainUIHandler class to manage the main UI and polling for arrival data.
- Introduced SettingsUI class for displaying QR code and configuration options.
- Created SettingsUIHandler to manage settings UI lifecycle and web server interactions.
- Developed WebHandler to handle HTTP requests for MTR route settings, including adding and removing routes.
- Implemented web endpoints for fetching MTR lines, routes, and saving settings.
- Enhanced UI with responsive design for e-ink displays and added error handling for web interactions.
This commit is contained in:
GW_MC
2026-02-03 19:26:53 +08:00
parent 0672a5fb74
commit c4635948e4
24 changed files with 2324 additions and 22 deletions

View File

@@ -11,8 +11,8 @@ StationArrivalInfo::StationArrivalInfo(
const std::string& train_line_code,
const std::string& train_station_code
) : _status(UNKNOWN_STATUS)
, _train_line(train_line_code)
, _train_station(train_station_code) {
, _train_line(train_line_code)
, _train_station(train_station_code) {
if (!arrival_json) {
ESP_LOGE(TAG, "arrival_json is null");
@@ -21,6 +21,8 @@ StationArrivalInfo::StationArrivalInfo(
return;
}
ESP_LOGD(TAG, "Parsing arrival JSON for %s-%s", train_line_code.c_str(), train_station_code.c_str());
// Parse status
cJSON* status_json = cJSON_GetObjectItem(arrival_json, "status");
if (status_json && cJSON_IsNumber(status_json)) {
@@ -30,7 +32,7 @@ StationArrivalInfo::StationArrivalInfo(
}
}
// TODO: verify the arrival json parsing
ESP_LOGD(TAG, "Status: %d, Message: %s", (int)_status, _message.c_str());
// Parse message (if present)
cJSON* message_json = cJSON_GetObjectItem(arrival_json, "message");