29 lines
509 B
C
29 lines
509 B
C
|
#pragma once
|
||
|
#include <stdio.h>
|
||
|
#include "json.hpp"
|
||
|
#include <vector>
|
||
|
|
||
|
const std::string ID_JSON_PATH = "./idconfig.json";
|
||
|
using json = nlohmann::json;
|
||
|
struct ID_Config
|
||
|
{
|
||
|
std::uint16_t vid;
|
||
|
std::uint16_t pid;
|
||
|
std::uint16_t cpu_type;
|
||
|
};
|
||
|
|
||
|
class id_config
|
||
|
{
|
||
|
public:
|
||
|
id_config();
|
||
|
std::vector<ID_Config> GetConfig();
|
||
|
void SaveConfig(std::vector<ID_Config> configs);
|
||
|
void SaveConfig(json j);
|
||
|
private:
|
||
|
json GetDefaultJson();
|
||
|
void jsoninit();
|
||
|
json to_json(ID_Config param);
|
||
|
ID_Config to_param(json j);
|
||
|
};
|
||
|
|