- 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.
52 lines
1.1 KiB
C++
52 lines
1.1 KiB
C++
#pragma once
|
|
#include "cJSON.h"
|
|
#include "esp_log.h"
|
|
#include "external/mtr/station_info.h"
|
|
#include "external/mtr/mtr.h"
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#define LINE_INFO_TAG "LineInfo"
|
|
|
|
// Forward declaration
|
|
class MTRNextTrainHandler;
|
|
struct StationInfo;
|
|
|
|
struct LineInfo {
|
|
public:
|
|
|
|
// caller does not own the returned char pointers
|
|
const char* code() const {
|
|
return _code.c_str();
|
|
}
|
|
// caller does not own the returned char pointers
|
|
const char* name() const {
|
|
return _name.c_str();
|
|
}
|
|
// caller does not own the returned char pointers
|
|
const char* color() const {
|
|
return _color.c_str();
|
|
}
|
|
size_t station_count() const {
|
|
return _stations.size();
|
|
}
|
|
// caller does not own the returned array or StationInfo pointers
|
|
const std::vector<StationInfo>* stations() const {
|
|
return &_stations;
|
|
}
|
|
|
|
friend class MTRNextTrainHandler;
|
|
|
|
private:
|
|
// Caller transfers ownership of stations array and its contents to LineInfo
|
|
LineInfo(
|
|
cJSON* line_json
|
|
);
|
|
|
|
std::string _code;
|
|
std::string _name;
|
|
std::string _color;
|
|
std::vector<StationInfo> _stations;
|
|
};
|
|
|