/*
 * @Author: ghzhang gogosanmao@126.com
 * @Date: 2023-06-18 14:58:37
 * @LastEditors: ghzhang gogosanmao@126.com
 * @LastEditTime: 2023-07-01 12:04:59
 * @FilePath: \lnxall_package\proto_forward\src\main.h
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#ifndef __UTILS_H__
#define __UTILS_H__

#include <syslog.h>
#include "mqtt_session.h"
#include "lnxall_list.h"
#include "dy_utils/dy_common.h"
#include "dy_utils/dy_ipc.h"
#include "dy_utils/hash_intptr.h"
#include "dy_utils/modbus_utils.h"
#include "dy_utils/period_service.h"
#include "dy_utils/bitmap.h"
#include "sys/param.h"
#include "assert.h"
#include "pthread.h"
#include <sys/epoll.h>
#include "define.h"
#include "collector-api.h"
#include "deviceLayer.h"
#include "pub_fun.h"

#define EMS_UPGRADE_FILE "/tmp/ems.update"
#define WEB_UPGRADE_FILE "/tmp/web.update"

void sig_init(void);
bool check_float_equal(float a,float b);
void system_upgrade_ck(void);
void ems_base_variant_free();
int ems_base_variant_get(ems_base_variant_t ***val,int *size);
int ems_base_variant_sing_add(ems_base_variant_t *val);
int ems_base_variant_multi_add(const ems_base_variant_t *val,size_t size);
double update_plan_cfg(pcs_ctrl_var_t *var);
int getIccid(char *iccid,int size);
int getInternalIccid(char *iccid,int size);
int getExternalIccid(char *iccid,int size);
void get_cpu_usage(double *cpu_used);
void get_net_usage(int *net_status);
void get_mem_usage(double *mem_used);
void open_sysinfo(void);
bool is_dir(const char* path);
long long get_dir_size(const char*pathname,char*first_file) ;
int check_workstate_by_time(int time,float powernow);

cJSON* append_json_file(cJSON* test_json, const char* json_file_path, const char *prefix); 
cJSON* add_prefix_to_name(cJSON *json, const char *prefix);
bool automatic_cfg_merged(const char* object_file_path);
#endif
