code_device/hgdriver/hgdev/jsonconfig.h

36 lines
919 B
C
Raw Normal View History

2022-05-03 03:56:07 +00:00
#pragma once
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <stdlib.h>
#include "json.hpp"
using json = nlohmann::json;
const std::string JSONPATH ="/opt/hgscannersdk.json";
static const std::string G100JSONPATH ="/opt/G100.json";
static const std::string G200JSONPATH ="/opt/G200.json";
static const std::string G300JSONPATH ="/opt/G300.json";
static const std::string G400JSONPATH ="/opt/G400.json";
class jsonconfig
{
public:
static json loadjson(std::string path);
static json load_json_from_text(const char* json_txt, std::vector<std::string>* children = nullptr);
2022-05-03 03:56:07 +00:00
static bool savejson(std::string path,json js);
static json defaultjson();
private:
json loadjson();
std::string DEVICEJSONPATH;
public:
jsonconfig();
jsonconfig(int devnum);
~jsonconfig();
std::string getdeviceparam(unsigned param_no);
};