#ifndef HOST_H
#define HOST_H

#include "ti_msp_dl_config.h"
#include <stdint.h>
#include <cstdio>
#include "../../include/user/Print.h"
#include <stdlib.h>


#define MAX_KEYS 10
#define MAX_KEY_LENGTH 32

typedef struct {
    char key[MAX_KEY_LENGTH];
    double value;
} KeyValuePair;

class Host {
public:

    static double posX;
    static double posY;
    static int x_count;
    static int y_count;

    static void init();         // 模块初始化
    static void inject(char ch);       // 数据注入（串口、I2C回调函数注入数据）
    static double get(const char* key, double defaultValue = 0.0);
    static double getWithoutClean(const char *key, double defaultValue = 0.0);

    static void info(const char* format, ...);
    static void warn(const char* format, ...);
    static void error(const char* format, ...);
    static void plot(const char* key, double value);

private:
    static KeyValuePair data[MAX_KEYS];
    static int count;

    static void log(const char* level, const char* format, ...);
};

#endif //HOST_H