#ifndef __DY_COMMON_H
#define __DY_COMMON_H
#include <sys/stat.h>
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <syslog.h>
#include <sys/resource.h>
#include <sys/types.h>
#include <fcntl.h>
#include <sys/timerfd.h>
#include <errno.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <pthread.h>
#include <sys/syscall.h>

#include "tool.h"
#include "cJSON.h"
#include "lnxall_list.h"
#include "libubox/utils.h"

#define UBOOT_ENV "/app/uboot.env"
#define BOARD_NAME_PATH "/tmp/sysinfo/board_name"
#define BOARD_INFO_PATH "/app/config/fac.ini"
#define NODES_CFG_PATH "/app/node/nodes_cfg.json"
#define TEMPLATES_CFG_PATH "/app/node/templates_cfg.json"
#define OBJECTS_CFG_PATH "/app/node/object_model_cfg.json"
#define MQTT_SERVER_FILE "/app/config/mqtt_server.json"
#define GAYEWAY_VERSIONS "/app/config/versions.json"
#define RS485_PORT_CFG "/app/config/rs485_port_cfg.json"
#define VIRTUAL_PORT_CFG "/app/config/virtual_interface.json"
#define COMMON_SOCKET_CFG "/app/config/common_socket.json"
#define SUPEC5100_CFG "/app/config/supec5100.json"
#define HUAYUN_CFG "/app/config/huayun_cfg.json"
#define ALINK_CFG "/app/config/linkkit_cfg.json"
#define SOFTWARE_VER_PATH "/etc/issue"
#define SOFTWARE_VER_PATH1 "/lib/dyiot/issue"
#define LORA_MODULE_SATUS_CACHE "/tmp/cache/lora"
#define NET_BASH_PATH "/lib/dyiot/bin/"
#define NODES_CACHE "/tmp/devices"
#define LORAWAN_MODULE_CFG "/app/config/lorawan_cfg.json"
#define LORA_MODULE_CFG "/app/config/lora_cfg.json"
#define RULES_CFG_LOCAL "/etc/whsnbg.rules"
#define MQTT_VINTERFACE_CONFIG_PATH "/app/config/virtual_interface.json"
#define CAN_MODULE_CFG "/app/config/canbus_cfg.json"
#define NODES_CFG "/app/node"
#define CLOUD_MQTT_CFG "/app/config/uplink_channels.json"
#define NETWORk_WAN_CFG "/app/config/wan_cfg.json"
#define NETWORk_LAN_CFG "/app/config/lan_cfg.json"
#define MAC_IP_BIND_CFG "/app/config/mac_ip_bind_cfg.json"
#define RADIO_CFG "/app/config/radio_cfg.json"
#define VAP_CFG "/app/config/vap_cfg.json"
#define LOG_SRV_CFG "/app/config/log_server_cfg.json"
#define WEBUI_CFG "/app/config/webui_cfg.json"
#define NTP_CFG "/app/config/ntp_cfg.json"
#define LANZHUO_CFG "/app/config/lanzhuo.json"
#define ZIGBEE_CFG "/app/config/zigbee_cfg.json"
#define PERIOD_PROPERTY_CFG "/app/config/period_property_cfg.json"
#define CLOUD_MQTT_TLS_FILE_PATH "/app/config/mqtt_tls/cloud_mqtt"
#define COMMON_SOCKET_TLS_FILE_PATH "/app/config/mqtt_tls/common_socket"
#define CONFIG_MQTT_TLS_FILE_PATH "/app/config/mqtt_tls/config_mqtt"
#define DC_CONFIG_FILE_PATH	"/app/config/dc.json"

//#define DEF_MQTT_SERVER_IP "mqtt.lnxall.com"
//#define DEF_MQTT_SERVER_PORT 3883
//#define DEF_MQTT_SERVER_USER "localuser"
//#define DEF_MQTT_SERVER_PASS "dywl@galaxy"

#define PROGRAM_NAME_LEN 32
#define PRODUCT_NAME_LEN 32
#define IDENTIFIER_LEN 48
#define MAX_APP_KEY_LEN 32
#define MAX_EXT_DATA_LEN 1024

#define SN_MAX_LEN 64
#define MAXBUF 4096

#ifndef ARRAY_SIZE
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
#endif
#ifndef STRINGIFY
#define STRINGIFY(x) #x
#endif
#ifndef STR
#define STR(x) STRINGIFY(x)
#endif

#define BOARD_WOOLINK_MT7621 "WOOLINK-MT7621-512M-256M"
#define BOARD_WOOLINK_MT7628 "WOOLINK-MT7628-128M-32M"
#define BOARD_WOOLink2F6280_W_4G "WooLink2F6280_W_4G"

#define BOARD_QIYANG "QIYANG"
#define BOARD_HUIWEI "HuiWei"

#define PRODUCT_WOOLINK_1004 "WooLink1004-G"
#define PRODUCT_WOOLINK_3002_W "WooLink3002-W-B"
#define PRODUCT_WooLink1002_W "WooLink1002-W"

typedef enum
{
    ERR_CODE_NONE = 0,
    ERR_CODE_JSON_FORMAT = 100,
    ERR_CODE_LOCAL_SAVE,
    ERR_CODE_NOT_SUPPORT,
    ERR_CODE_CMD_PARAM,
    ERR_CODE_LOGIN_FAILED,
    ERR_CODE_NODE_NOT_EXIST,
} error_code_e;

typedef struct
{
    int code;
    char *msg;
} error_code_msg_t;

#define ERROR_CODE_TAB_INIT                                    \
    {                                                          \
        {ERR_CODE_NONE, "successful"},                         \
        {ERR_CODE_JSON_FORMAT, "json format error"},           \
        {ERR_CODE_LOCAL_SAVE, "param save error"},             \
        {ERR_CODE_NOT_SUPPORT, "not support"},                 \
        {ERR_CODE_CMD_PARAM, "cmd param error"},               \
        {ERR_CODE_LOGIN_FAILED, "user or password not right"}, \
        {ERR_CODE_NODE_NOT_EXIST, "the node is not exist"},    \
    };

typedef signed char int8_t;
typedef signed short int16_t;
typedef signed int int32_t;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;

typedef enum
{
    PORT_NULL,
    LORA_DTU_RS485,
    LORAWAN_DTU_RS485,
    RS485_1,
    RS485_2,
    RS485_3,
    RS485_4,
    LORA_1,
    LORAWAN_1,
    VIRTUAL_1, //<虚拟设备,边缘计算
    VINTF_MQTT,
    MQTT_DTU_RS485,
    VINTF_TCP,
    VINTF_UDP,
    MODBUS_TCP,
    CANBUS_0,
    CANBUS_1,
    TCP_CLIENT,
    VINTF_NB,
    ZIGBEE,
    RS232_1,
    DI_1,
    DO_1,
    S7_PLC,
    BLE,
    LORA_2, // 第三方lora设备
    RS485_5, // USB based serial TTY device, /dev/ttysym1
    RS485_6, // USB based serial TTY device, /dev/ttysym2
    RS485_7, // USB based serial TTY device, /dev/ttysym3
    RS485_8, // USB based serial TTY device, /dev/ttysym4
    REMOTE_CH_01, // Ser2net based remote RS485 connection
    REMOTE_CH_02, // Ser2net based remote RS485 connection
    REMOTE_CH_03, // Ser2net based remote RS485 connection
    REMOTE_CH_04, // Ser2net based remote RS485 connection
    REMOTE_CH_05, // Ser2net based remote RS485 connection
    REMOTE_CH_06, // Ser2net based remote RS485 connection
    REMOTE_CH_07, // Ser2net based remote RS485 connection
    REMOTE_CH_08, // Ser2net based remote RS485 connection
    REMOTE_CH_09, // Ser2net based remote RS485 connection
    REMOTE_CH_10, // Ser2net based remote RS485 connection
    REMOTE_CH_11, // Ser2net based remote RS485 connection
    REMOTE_CH_12, // Ser2net based remote RS485 connection
    REMOTE_CH_13, // Ser2net based remote RS485 connection
    REMOTE_CH_14, // Ser2net based remote RS485 connection
    REMOTE_CH_15, // Ser2net based remote RS485 connection
    REMOTE_CH_16, // Ser2net based remote RS485 connection
    REMOTE_CH_17, // Ser2net based remote RS485 connection
    REMOTE_CH_18, // Ser2net based remote RS485 connection
    REMOTE_CH_19, // Ser2net based remote RS485 connection
    REMOTE_CH_20, // Ser2net based remote RS485 connection
    RS485_9, // USB based serial TTY device, /dev/ttysym5
    RS485_10, // USB based serial TTY device, /dev/ttysym6
    RS485_11, // USB based serial TTY device, /dev/ttysym7
    RS485_12, // USB based serial TTY device, /dev/ttysym8
    TCPDUMP, // Capture TCP package of without  
} gw_port_e;
#define REMOTE_CH_MAX_NUM 20

typedef enum
{
    DEV_NULL,
    DEV_DTU,
} gw_device_type_e;

///<实时数据解析,输入参数
typedef struct
{
    unsigned char *data;      ///<数据
    unsigned short len;       ///<数据长度
    unsigned char *down_data; ///<下行数据
    unsigned short down_len;
    unsigned char port;
    unsigned int instruction_code;
    char sub_template_id[16];     ///<下挂设备协议模板
    unsigned int mi;              ///<流水号
    char src_identifier[64];      ///<原服务名称
    char sn[SN_MAX_LEN];          ///<逻辑SN
    char dtu_sn[SN_MAX_LEN];      ///< DTU SN
    unsigned char term_addr[128]; ///<物理SN
    char sub_term_addr[8];        ///<下挂设备的term addr
    char sub_term_addr_len;       ///<终端地址，长度
    time_t ts;                    ///<采集时间
    unsigned char *start_addr;    ///<开始地址
    char requester[8];            ///<调用方
} pp_real_time_data_t;

///<控制信号下发，输入参数
typedef struct
{
    unsigned char *data;                ///<数据
    unsigned int period;                ///<发送周期单位毫秒，0：表示只发送一次
    unsigned short len;                 ///<数据长度
    unsigned char port;                 ///<发送端口
    unsigned char protocol;             ///<协议类型
    unsigned int mi;                    ///<流水号
    char src_identifier[64];            ///<原服务名称
    char sn[SN_MAX_LEN];                ///<设备SN
    char dtu_sn[SN_MAX_LEN];            ///< DTU SN
    char app_key[MAX_APP_KEY_LEN];      ///< APP KEY information
    unsigned int communication_timeout; ///<通信超时
    unsigned char term_addr[128];       ///<物理SN
    char tcp_ip_addr[SN_MAX_LEN];       ///< modbus TCP IP
    int tcp_port;                       ///< modbus TCP PORT
    char requester[8];                  ///<服务调用方
    unsigned int dummy[4];              /// for further use
} pp_regulate_signal_t;

typedef struct cmd_info_node_s
{
    struct list_head list;
    time_t ts;
    pp_regulate_signal_t regulate_data;
} cmd_info_node_t;

typedef struct
{
    char refer_sn[SN_MAX_LEN]; ///<设备SN
} refer_param_t;

typedef struct template_cfg_s template_cfg_t;
typedef struct
{
    int32_t depth;                 ///<深度
    gw_device_type_e device_type;  ///<设备类型 1:DTU 其它保留
    gw_port_e port;                ///<设备连接在网关的端口
    char app_key[MAX_APP_KEY_LEN]; ///< APP KEY information
    char *ext_data;                ///<设备扩展配置数据
    char *user_defined;            ///<用户自定义数据
    char sn[SN_MAX_LEN];           ///<设备SN
    char dtu_sn[SN_MAX_LEN];       ///< DTU SN
    unsigned char term_addr[8];    ///<终端地址，地址强转存储地址
    char tcp_ip_addr[SN_MAX_LEN];  ///< modbus TCP IP
    int tcp_port;                  ///< modbus TCP PORT
    char appeui[17];               ///< lorawan reserve
    char appkey[33];               ///< lorawan reserve
    char dev_level[11];            ///< modbusbasecan reserve
    int node_type;                 ///< lorawan  reserve
    char term_addr_len;            ///<终端地址，长度
    char template_id[16];          ///<协议模板
    char product_key[16];
    char device_name[32];
    char device_secret[40];
    char device_id[SN_MAX_LEN];
    char huawei_app_id[SN_MAX_LEN];
    char connection_string[192]; ///< Azure IoT connectionString
    char sub_template_id[16];    ///<下挂设备协议模板
    int32_t calculate_window;    ///<计算窗口,虚拟设备用
    int32_t referCnt;            ///<涉及设备个数,虚拟设备用
    int other_platform;          ///<使用第三方云平台上报
    refer_param_t *pparam;       ///<涉及设备信息,虚拟设备用
    template_cfg_t *template;
    int priority;          /// for further use
    unsigned int dummy[4]; /// for further use
} node_cfg_t;

typedef struct nodes_cfg_table_s
{
    int node_cnt;       // 节点数量
    node_cfg_t node[0]; //节点数据，使用0元数组方便扩展
} nodes_cfg_table_t;

extern long long clock_get_ms();
extern int my_timer_create();
extern int my_timer_read(int timer);
extern int my_timer_set(int timer, int start_sec, int interval_ms);
extern int my_timer_delete(int timer);
extern const char *get_board_name();
extern int get_board_sn(char *sn);
extern int get_process_name(char *process_name);
extern int get_product_name(char *product_name);
extern int get_software_ver(char *ver);
extern int get_hardware_ver(char *ver);
extern char *read_file_data_and_lens(const char *file, int *len);
extern char *read_file_data(const char *file);
extern int write_file_data(const char *file, char *data, int len);
extern int load_nodes_cfg(nodes_cfg_table_t **p_nodes_cfg, const char *cfg_file);
extern int format_hex(void *p, size_t l, char *hex_buff, int size);
extern ssize_t socket_send(int sockfd, const char *buffer, size_t buflen);
extern int replace_sub_str(const char *str, const char *srcSubStr, const char *dstSubStr, char *out);
extern long long get_time_stamp_ms();
extern long long get_time_stamp_us();
extern long long uptime_stamp_ms();
extern long long uptime_stamp_us();
extern bool gpio_set_value(int gpio, int state);
extern int mqtt_tls_file_overlow(char *url, char *path, char *script, int len);
extern int string_is_number(char *s);
extern ssize_t open_read_close(const char *filename, void *buf, size_t size);
extern int lnxall_encrypt_string(unsigned char *in, int len, unsigned char *out);
extern int lnxall_decrypt_string(unsigned char *in, int len, unsigned char *out);
extern int lnxall_encrypt_file(const char *file);
extern char *lnxall_read_encrypted_file(const char *file, int *len);
extern char *download_url_data(char *data, char *cfg_file);
extern char *get_board_mac();

#define dy_syslog_hex(level, p, l, fmt, ...)                                                                                                                                                                             \
    do                                                                                                                                                                                                                   \
    {                                                                                                                                                                                                                    \
        char __buf[4096];                                                                                                                                                                                                \
        char __path[32] = {0};                                                                                                                                                                                           \
        int n = 0;                                                                                                                                                                                                       \
        n = snprintf(__buf, 4096, fmt, ##__VA_ARGS__);                                                                                                                                                                   \
        format_hex(p, l > 176 ? 176 : l, __buf + n, 4096 - n);                                                                                                                                                           \
        readlink("/proc/self/exe", __path, 32);                                                                                                                                                                          \
        if (1)                                                                                                                                                                                                           \
            syslog(LOG_USER | level, "%s:%d %s", __FILE__, __LINE__, __buf);                                                                                                                                             \
        else                                                                                                                                                                                                             \
            syslog(LOG_USER | level, "{\"file\":\"%s\",\"func\":%s,\"line\":%d,\"comm\":\"%s\",\"pid\":%d,\"tid\":%ld,\"msg\":\"%s\"}", __FILE__, __FUNCTION__, __LINE__, __path, getpid(), syscall(SYS_gettid), __buf); \
    } while (0)

#define dy_syslog(level, fmt, ...)                                                                                                                                                                                       \
    do                                                                                                                                                                                                                   \
    {                                                                                                                                                                                                                    \
        char __buf[4096];                                                                                                                                                                                                \
        char __path[32] = {0};                                                                                                                                                                                           \
        snprintf(__buf, 512, fmt, ##__VA_ARGS__);                                                                                                                                                                        \
        readlink("/proc/self/exe", __path, 32);                                                                                                                                                                          \
        if (1)                                                                                                                                                                                                           \
            syslog(LOG_USER | level, "%s:%d %s", __FILE__, __LINE__, __buf);                                                                                                                                             \
        else                                                                                                                                                                                                             \
            syslog(LOG_USER | level, "{\"file\":\"%s\",\"func\":%s,\"line\":%d,\"comm\":\"%s\",\"pid\":%d,\"tid\":%ld,\"msg\":\"%s\"}", __FILE__, __FUNCTION__, __LINE__, __path, getpid(), syscall(SYS_gettid), __buf); \
    } while (0)

#define SELECT_INIT()   \
    do                  \
    {                   \
        maxfd = 0;      \
        FD_ZERO(&rset); \
    } while (0)

#define SELECT_ADD_FD(fd)      \
    do                         \
    {                          \
        if (fd > 0)            \
        {                      \
            FD_SET(fd, &rset); \
            if (maxfd < fd)    \
                maxfd = fd;    \
        }                      \
    } while (0)

#define TIMER_CONFIRM(timer)          \
    do                                \
    {                                 \
        if (my_timer_read(timer) < 0) \
            return 0;                 \
    } while (0)

#define GET_JSON_VALUE_DOUBLE(root, key, value_p)                                    \
    do                                                                               \
    {                                                                                \
        cJSON *__item = cJSON_GetObjectItem(root, key);                              \
        if (__item)                                                                  \
            memcpy((void *)&value_p, (void *)&__item->valuedouble, sizeof(value_p)); \
    } while (0)

#define GET_JSON_VALUE_INT(root, key, value_p)                                    \
    do                                                                            \
    {                                                                             \
        cJSON *__item = cJSON_GetObjectItem(root, key);                           \
        if (__item)                                                               \
            memcpy((void *)&value_p, (void *)&__item->valueint, sizeof(value_p)); \
    } while (0)

#define GET_JSON_VALUE_STRING(root, key, value_p)       \
    do                                                  \
    {                                                   \
        cJSON *__item = cJSON_GetObjectItem(root, key); \
        memset(value_p, 0, sizeof(value_p));            \
        if (__item)                                     \
        {                                               \
            if (__item->valuestring)                    \
                strcpy(value_p, __item->valuestring);   \
        }                                               \
    } while (0)

#define GET_JSON_VALUE_DY_STRING(root, key, value_p)    \
    do                                                  \
    {                                                   \
        cJSON *__item = cJSON_GetObjectItem(root, key); \
        if (__item)                                     \
        {                                               \
            if (__item->valuestring)                    \
                value_p = strdup(__item->valuestring);  \
            else                                        \
                value_p = NULL;                         \
        }                                               \
        else                                            \
        {                                               \
            value_p = NULL;                             \
        }                                               \
    } while (0)

#define EACH_STRING_INDEX(str, const_ptr, value)                              \
    {                                                                         \
        int ii;                                                               \
        for (ii = 0; ii < (sizeof(const_ptr) / sizeof((const_ptr)[0])); ii++) \
        {                                                                     \
            if (!strcmp(str, const_ptr[ii]))                                  \
            {                                                                 \
                value = ii;                                                   \
                break;                                                        \
            }                                                                 \
        }                                                                     \
        if (ii == (sizeof(const_ptr) / sizeof((const_ptr)[0])))               \
            value = 0;                                                        \
    }                                                                         \
    while (0)

#define ASSERT(x)                                                                 \
    do                                                                            \
    {                                                                             \
        if (!(x))                                                                 \
        {                                                                         \
            syslog(LOG_USER | LOG_ERR, "[ASSERT]:%s:%d", __FUNCTION__, __LINE__); \
            abort();                                                              \
        }                                                                         \
    } while (0)

#define GET_SN_PROC                                                              \
    static char *sn = NULL;                                                      \
    static char *process = NULL;                                                 \
                                                                                 \
    if (sn == NULL)                                                              \
    {                                                                            \
        char tmp_sn[SN_MAX_LEN];                                                 \
        if (get_board_sn(tmp_sn) == 0)                                           \
        {                                                                        \
            size_t len = strlen(tmp_sn);                                         \
            if (len > SN_MAX_LEN) len = SN_MAX_LEN;                              \
            sn = (char *) malloc(len + 1);                                       \
            strcpy(sn, tmp_sn);                                                  \
            sn[len] = '\0';                                                      \
        }                                                                        \
        else                                                                     \
        {                                                                        \
            dy_syslog(LOG_ERR, "cannot get board SN");                           \
            return -1;                                                           \
        }                                                                        \
    }                                                                            \
                                                                                 \
    if (process == NULL)                                                         \
    {                                                                            \
        char tmp_proc[32];                                                       \
        if (get_process_name(tmp_proc) == 0)                                     \
        {                                                                        \
            size_t len = strlen(tmp_proc);                                       \
            if (len > 32) len = 32;                                              \
            process = (char *) malloc(len + 1);                                  \
            strcpy(process, tmp_proc);                                           \
            process[len] = '\0';                                                 \
            dy_syslog(LOG_DEBUG, "get board process name:%s", process);          \
        }                                                                        \
        else                                                                     \
        {                                                                        \
            dy_syslog(LOG_ERR, "cannot get board process name");                 \
            return -1;                                                           \
        }                                                                        \
    }

static inline int file_size2(const char *filename)
{
    struct stat statbuf;
    int size = 0;

    if (stat(filename, &statbuf) == 0)
    {
        size = statbuf.st_size;
    }

    return size;
}

/**********************************************
 *            COMMON                          *
 * *******************************************/
// 内部broker的地址信息
#define INTERNAL_BROKER_ADDR "localhost"
#define INTERNAL_BROKER_PORT 1883
#define INTERNAL_BROKER_USER ""
#define INTERNAL_BROKER_PASS ""
#define INTERNAL_RULE_ENG_PORT 1884

#define VINT_RESTART_CMD "/etc/init.d/virtual_interface" /* "/etc/init.d/virtual_interface reload" */
#define PP_RESTART_CMD "/etc/init.d/protocol_parser" /* "(/etc/init.d/protocol_parser reload; sleep 5;)" */
#define RS485_RESTART_CMD "/etc/init.d/rs485" /* "/etc/init.d/rs485 reload" */
#define RS485_SLAVE_RESTART_CMD "/etc/init.d/rs485_slave" /* "/etc/init.d/rs485_slave reload" */
#define ENTRANCE_GUARD_RESTART_CMD "/etc/init.d/entrance_guard" /* "/etc/init.d/entrance_guard reload" */
#define COMMON_SOCKET_RESTART_CMD "/etc/init.d/common_socket" /* "/etc/init.d/common_socket reload" */
#define HUAYUN_RESTART_CMD "/etc/init.d/huayun" /* "/etc/init.d/huayun reload" */
#define LINKKIT_GATEWAY_RESTART_CMD "/etc/init.d/linkkit_gateway" /* "/etc/init.d/linkkit_gateway reload" */
#define ALINK_RESTART_CMD "/etc/init.d/alink" /* "/etc/init.d/alink reload" */
#define LORAWAN_RESTART_CMD "/etc/init.d/lorawan_server" /* "/etc/init.d/lorawan_server reload" */
#define VDEV_RESTART_CMD "/etc/init.d/virtual_dev" /* "/etc/init.d/virtual_dev reload" */
#define RULE_ENG_RESTART_CMD "/etc/init.d/rule_eng" /* "/etc/init.d/rule_eng reload" */
#define WHSNBG_RESTART_CMD "/etc/init.d/whsnbg" /* "/etc/init.d/whsnbg restart" */
#define DATA_RPT_RESTART_CMD "/etc/init.d/data_reporter" /* "/etc/init.d/data_reporter reload" */
#define LORA_RESTART_CMD "/etc/init.d/lora" /* "/etc/init.d/lora reload" */
#define CAN2MODBUS_RESTART_CMD "/etc/init.d/can2modbus" /* "/etc/init.d/can2modbus reload" */
#define UPGRADE_NODE_RESTART_CMD "/etc/init.d/upgrade" /* "/etc/init.d/upgrade reload" */
#define XIENENG_CAR_BMS_RESTART_CMD "/etc/init.d/xieneng_car" /* "/etc/init.d/xieneng_car reload" */
#define NETWORK_RESTART_CMD "(sleep 60; /etc/init.d/network restart; /etc/init.d/dnsmasq restart; /etc/init.d/firewall restart;)&"
#define IOT_CLOUD_RESTART_CMD "/etc/init.d/cloud_conn_dayun" /* "/etc/init.d/cloud_conn_dayun reload" */
#define CAN_MQTT_PROXY_RESTART_CMD "/etc/init.d/can_mqtt_proxy" /* "/etc/init.d/can_mqtt_proxy reload" */
#define IP_CAMERA_RESTART_CMD "/etc/init.d/ip_camera" /* "/etc/init.d/ip_camera reload" */
#define IP_CAMERA_RELOAD_CMD "/etc/init.d/ipcamera" /* "/etc/init.d/ipcamera reload" */
#define SUPEC5100_RELOAD_CMD "/etc/init.d/supec5100" /* "/etc/init.d/supec5100 reload" */
#define CLOUD_MQTT_RESTART_CMD "/etc/init.d/cloud_mqtt" /* "/etc/init.d/cloud_mqtt reload" */
#define IP_SOUNDBOX_RESTART_CMD "/etc/init.d/ip_soundbox reload" /* "/etc/init.d/ip_soundbox reload; /etc/init.d/soundbox_data_server reload" */
#define IP_SOUNDBOX_RESTART_CMD1 "/etc/init.d/soundbox_data_server"
#define AZURE_RESTART_CMD "/etc/init.d/azure" /* "/etc/init.d/azure reload" */
#define AZURE_ROCHE_RESTART_CMD "/etc/init.d/azure_roche" /* "/etc/init.d/azure_roche reload" */
#define SHANGHAI_S5_RESTART_CMD "/etc/init.d/shanghai_S5" /* "/etc/init.d/shanghai_S5 reload" */
#define IP_ALARM_RESTART_CMD "/etc/init.d/ip_alarm" /* "/etc/init.d/ip_alarm reload" */
#define IP_ALARM_CLIENT_RESTART_CMD "/etc/init.d/ip_alarm_client" /* "/etc/init.d/ip_alarm_client reload" */
#define MODBUS_TCP_RESTART_CMD "/etc/init.d/modbus_tcp" /* "/etc/init.d/modbus_tcp reload" */
#define LANZHUO_RESTART_CMD "/etc/init.d/lanzhuo" /* "/etc/init.d/lanzhuo reload" */
#define S7_PLC_RESTART_CMD "/etc/init.d/S7_PLC" /* "/etc/init.d/S7_PLC reload" */
#define IPDEV_MANAGER_RESTART_CMD "/etc/init.d/ipdev_manager" /* "/etc/init.d/ipdev_manager reload" */
#define CLOUD_NANDU_RESTART_CMD "/etc/init.d/cloud_conn_nandu" /* "/etc/init.d/cloud_conn_nandu reload" */
#define OPC_UA_RESTART_CMD "/etc/init.d/opc_ua" /* "/etc/init.d/opc_ua reload" */
#define OPC_DA_RESTART_CMD "/etc/init.d/openopc" /* "/etc/init.d/openopc reload" */
#define IEC104_CLOUD_RESTART_CMD "/etc/init.d/cloud_conn_iec104" /* "/etc/init.d/cloud_conn_iec104 reload" */
#define DASLINK_CLOUD_RESTART_CMD "/etc/init.d/cloud_conn_daslink" /* "/etc/init.d/cloud_conn_daslink reload" */
#define OPCUA_SERVER_RESTART_CMD "/etc/init.d/opcua_server" /* "/etc/init.d/opcua_server reload" */
#define MHMP_TCP_CLIENT_RESTART_CMD "/etc/init.d/mhmp" /* "/etc/init.d/mhmp reload" */
#define MQTT_FORWARD_RESTART_CMD "/etc/init.d/mqtt_forward" /* "/etc/init.d/mqtt_forward reload" */
#define IEC104_SERVER_RESTART_CMD "/etc/init.d/iec104_server" /* "/etc/init.d/iec104_server reload" */
#define DOCKER_CONTROL_RESTART_CMD "/etc/init.d/docker_control" /* "/etc/init.d/docker_control restart" */
#define YOUCAN_RESTART_CMD "/etc/init.d/youcan"

/**********************************************
 *      VIRTUAL INTERFACE                     *
 * *******************************************/
#define VINTERFACE_CONFIG_PATH "/app/config/virtual_interface.json"

#endif
