#pragma once #include "assets/MTR_LINE_STATION.h" #include "cJSON.h" #include #include "esp_log.h" #include "external/mtr/line_info.h" #include #include "network/network.h" // Forward declaration struct StationArrivalInfo; struct LineInfo; enum class MtrArrivalErrorCode { NONE = 0, LINE_NOT_FOUND = 1, STATION_NOT_FOUND = 2, NO_ARRIVAL_INFO = 3, UNKNOWN = 99, }; enum class Language { EN, TC, }; class MTRNextTrainHandler { public: /** * @brief Construct a new MTR Next Train Handler object * @param json Pointer to cJSON object containing MTR Next Train data * * > Caller transfers ownership of the cJSON object to MTRNextTrainHandler * * cJSON structure for MTR Next Train data * This structure is used to parse and store the MTR Next Train JSON data. * Record */ MTRNextTrainHandler(); ~MTRNextTrainHandler(); std::vector get_lines(); MtrArrivalErrorCode get_next_arrival_info( NetworkHandler* network_handler, std::string& line_code, std::string& station_code, StationArrivalInfo*& out_info, Language lang = Language::TC ); private: cJSON* mtr_data; };