Squash of branch setup
This commit is contained in:
58
main/external/mtr/mtr.h
vendored
Normal file
58
main/external/mtr/mtr.h
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
#pragma once
|
||||
|
||||
#include "assets/MTR_LINE_STATION.h"
|
||||
#include "cJSON.h"
|
||||
#include <string>
|
||||
#include "esp_log.h"
|
||||
#include "external/mtr/line_info.h"
|
||||
#include <vector>
|
||||
#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<code name string, {name: string, code: string, color: hex string, station: {code: string, name: string}[]}>
|
||||
*/
|
||||
MTRNextTrainHandler();
|
||||
~MTRNextTrainHandler();
|
||||
|
||||
std::vector<LineInfo> 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;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user