The plugin headers are contained in the include directory

This commit is contained in:
lixiumei
2021-11-04 02:14:51 +00:00
committed by Parker Liu
parent 9f9aa5ec78
commit d035272b31
38 changed files with 56 additions and 56 deletions
+3 -3
View File
@@ -21,10 +21,10 @@
#include <stdio.h>
#include <string.h>
#include "utils/json.h"
#include "json/json.h"
#include "neu_json_fn.h"
#include "neu_json_param.h"
#include "json/neu_json_fn.h"
#include "json/neu_json_param.h"
int neu_json_encode_by_fn(void *param, neu_json_encode_fn fn, char **result)
{
-52
View File
@@ -1,52 +0,0 @@
/**
* NEURON IIoT System for Industry 4.0
* Copyright (C) 2020-2021 EMQ Technologies Co., Ltd All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
#ifndef _NEU_JSON_FN_H
#define _NEU_JSON_FN_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
typedef int (*neu_json_encode_fn)(void *object, void *param);
int neu_json_encode_by_fn(void *param, neu_json_encode_fn fn, char **result);
int neu_json_encode_with_mqtt(void *param, neu_json_encode_fn fn,
void *mqtt_param, neu_json_encode_fn mqtt_fn,
char **result);
typedef struct neu_parse_errors {
int n_error;
int64_t *errors;
} neu_parse_errors_t;
typedef struct neu_parse_error {
int64_t error;
} neu_parse_error_t;
int neu_parse_encode_error(void *json_object, void *param);
#ifdef __cplusplus
}
#endif
#endif
+2 -2
View File
@@ -20,9 +20,9 @@
#include <stdlib.h>
#include <string.h>
#include "utils/json.h"
#include "json/json.h"
#include "neu_json_group_config.h"
#include "json/neu_json_group_config.h"
int neu_parse_decode_add_group_config(char * buf,
neu_parse_add_group_config_req_t **result)
-112
View File
@@ -1,112 +0,0 @@
/**
* NEURON IIoT System for Industry 4.0
* Copyright (C) 2020-2021 EMQ Technologies Co., Ltd All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
#ifndef _NEU_JSON_API_GROUP_CONFIG_H_
#define _NEU_JSON_API_GROUP_CONFIG_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
typedef struct {
char *name;
int node_id;
} neu_parse_get_group_config_req_t;
typedef struct {
char * name;
uint32_t interval;
int pipe_count;
int tag_count;
} neu_parse_get_group_config_res_row_t;
typedef struct {
int n_config;
neu_parse_get_group_config_res_row_t *rows;
} neu_parse_get_group_config_res_t;
int neu_parse_decode_get_group_config(
char *buf, neu_parse_get_group_config_req_t **result);
void neu_parse_decode_get_group_config_free(
neu_parse_get_group_config_req_t *req);
int neu_parse_encode_get_group_config(void *json_object, void *param);
typedef struct {
char * name;
uint32_t node_id;
uint32_t interval;
} neu_parse_add_group_config_req_t;
int neu_parse_decode_add_group_config(
char *buf, neu_parse_add_group_config_req_t **result);
void neu_parse_decode_add_group_config_free(
neu_parse_add_group_config_req_t *req);
typedef struct {
char * name;
uint32_t node_id;
uint32_t interval;
} neu_parse_update_group_config_req_t;
int neu_parse_decode_update_group_config(
char *buf, neu_parse_update_group_config_req_t **result);
void neu_parse_decode_update_group_config_free(
neu_parse_update_group_config_req_t *req);
typedef struct {
char * name;
uint32_t node_id;
} neu_parse_del_group_config_req_t;
int neu_parse_decode_del_group_config(
char *buf, neu_parse_del_group_config_req_t **result);
void neu_parse_decode_del_group_config_free(
neu_parse_del_group_config_req_t *req);
typedef struct {
uint32_t dst_node_id;
uint32_t src_node_id;
char * name;
} neu_parse_subscribe_req_t, neu_parse_unsubscribe_req_t;
int neu_parse_decode_subscribe(char *buf, neu_parse_subscribe_req_t **result);
void neu_parse_decode_subscribe_free(neu_parse_subscribe_req_t *req);
int neu_parse_decode_unsubscribe(char * buf,
neu_parse_unsubscribe_req_t **result);
void neu_parse_decode_unsubscribe_free(neu_parse_unsubscribe_req_t *req);
typedef struct {
uint32_t node_id;
char * group_config_name;
} neu_parse_subscribe_res_grp_t;
typedef struct {
int n_config;
neu_parse_subscribe_res_grp_t *group_configs;
} neu_parse_get_subscribe_res_t;
int neu_parse_encode_get_subscribe(void *json_object, void *param);
#ifdef __cplusplus
}
#endif
#endif
+2 -2
View File
@@ -19,9 +19,9 @@
#include <stdio.h>
#include <stdlib.h>
#include "utils/json.h"
#include "json/json.h"
#include "neu_json_mqtt.h"
#include "json/neu_json_mqtt.h"
int neu_parse_decode_mqtt_param(char *buf, neu_parse_mqtt_t **req)
{
-83
View File
@@ -1,83 +0,0 @@
/**
* NEURON IIoT System for Industry 4.0
* Copyright (C) 2020-2021 EMQ Technologies Co., Ltd All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
#ifndef _NEU_JSON_MQTT_H
#define _NEU_JSON_MQTT_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
typedef enum neu_mqtt_function {
NEU_MQTT_OP_LOGIN = 1,
NEU_MQTT_OP_LOGOUT,
NEU_MQTT_OP_READ,
NEU_MQTT_OP_WRITE,
NEU_MQTT_OP_GET_TTY,
/*group config*/
NEU_MQTT_OP_ADD_GROUP_CONFIG,
NEU_MQTT_OP_UPDATE_GROUP_CONFIG,
NEU_MQTT_OP_DELETE_GROUP_CONFIG,
NEU_MQTT_OP_GET_GROUP_CONFIG,
NEU_MQTT_OP_SUBSCRIBE,
NEU_MQTT_OP_UNSUBSCRIBE,
NEU_MQTT_OP_GET_SUBSCRIBE_GRP_CONFIG,
/*tag */
NEU_MQTT_OP_ADD_TAGS,
NEU_MQTT_OP_UPDATE_TAGS,
NEU_MQTT_OP_DELETE_TAGS,
NEU_MQTT_OP_GET_TAGS,
/*nodes*/
NEU_MQTT_OP_ADD_NODES,
NEU_MQTT_OP_UPDATE_NODES,
NEU_MQTT_OP_DELETE_NODES,
NEU_MQTT_OP_GET_NODES,
NEU_MQTT_OP_NODE_SETTING,
NEU_MQTT_OP_GET_NODE_SETTING,
NEU_MQTT_OP_NODE_CTL,
NEU_MQTT_OP_GET_NODE_STATE,
/*plugin*/
NEU_MQTT_OP_ADD_PLUGIN,
NEU_MQTT_OP_UPDATE_PLUGIN,
NEU_MQTT_OP_DELETE_PLUGIN,
NEU_MQTT_OP_GET_PLUGIN,
} neu_mqtt_function_e;
typedef struct neu_parse_mqtt {
neu_mqtt_function_e function;
char * uuid;
} neu_parse_mqtt_t;
int neu_parse_decode_mqtt_param(char *buf, neu_parse_mqtt_t **req);
void neu_parse_decode_mqtt_param_free(neu_parse_mqtt_t *req);
int neu_parse_encode_mqtt_param(void *json_object, void *param);
#ifdef __cplusplus
}
#endif
#endif
+2 -2
View File
@@ -19,8 +19,8 @@
#include <stdlib.h>
#include "neu_json_node.h"
#include "utils/json.h"
#include "json/json.h"
#include "json/neu_json_node.h"
int neu_parse_decode_add_node(char *buf, neu_parse_add_node_req_t **result)
{
-100
View File
@@ -1,100 +0,0 @@
/**
* NEURON IIoT System for Industry 4.0
* Copyright (C) 2020-2021 EMQ Technologies Co., Ltd All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
#ifndef _NEU_JSON_API_NODES_H_
#define _NEU_JSON_API_NODES_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include "neu_adapter.h"
typedef struct {
neu_node_type_e node_type;
char * node_name;
char * plugin_name;
} neu_parse_add_node_req_t;
int neu_parse_decode_add_node(char *buf, neu_parse_add_node_req_t **result);
void neu_parse_decode_add_node_free(neu_parse_add_node_req_t *req);
typedef struct {
neu_node_type_e node_type;
} neu_parse_get_nodes_req_t;
typedef struct {
uint32_t id;
char * name;
uint32_t plugin_id;
} neu_parse_get_nodes_res_node_t;
typedef struct {
uint16_t n_node;
neu_parse_get_nodes_res_node_t *nodes;
} neu_parse_get_nodes_res_t;
int neu_parse_decode_get_nodes(char *buf, neu_parse_get_nodes_req_t **result);
void neu_parse_decode_get_nodes_free(neu_parse_get_nodes_req_t *req);
int neu_parse_encode_get_nodes(void *json_object, void *param);
typedef struct {
uint32_t node_id;
} neu_parse_del_node_req_t;
int neu_parse_decode_del_node(char *buf, neu_parse_del_node_req_t **result);
void neu_parse_decode_del_node_free(neu_parse_del_node_req_t *req);
typedef struct {
neu_node_type_e node_type;
char * node_name;
char * plugin_name;
} neu_parse_update_node_req_t;
int neu_parse_decode_update_node(char * buf,
neu_parse_update_node_req_t **result);
void neu_parse_decode_update_node_free(neu_parse_update_node_req_t *req);
typedef struct {
uint32_t node_id;
} neu_parse_node_setting_req_t;
int neu_parse_decode_node_setting(char * buf,
neu_parse_node_setting_req_t **result);
void neu_parse_decode_node_setting_free(neu_parse_node_setting_req_t *req);
typedef struct {
uint8_t running;
uint8_t link;
} neu_parse_node_state_res_t;
int neu_parse_encode_get_node_state(void *json_object, void *param);
typedef struct {
uint32_t node_id;
uint8_t cmd;
} neu_parse_node_ctl_req_t;
int neu_parse_decode_node_ctl(char *buf, neu_parse_node_ctl_req_t **result);
void neu_parse_decode_node_ctl_free(neu_parse_node_ctl_req_t *req);
#ifdef __cplusplus
}
#endif
#endif
-36
View File
@@ -1,36 +0,0 @@
/**
* NEURON IIoT System for Industry 4.0
* Copyright (C) 2020-2021 EMQ Technologies Co., Ltd All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
#ifndef _NEU_JSON_PARAM_H
#define _NEU_JSON_PARAM_H
#ifdef __cplusplus
extern "C" {
#endif
#include "utils/json.h"
int neu_parse_param(char *buf, char **err_param, int n, neu_json_elem_t *ele,
...);
#ifdef __cplusplus
}
#endif
#endif
+2 -2
View File
@@ -19,9 +19,9 @@
#include <stdlib.h>
#include "utils/json.h"
#include "json/json.h"
#include "neu_json_plugin.h"
#include "json/neu_json_plugin.h"
int neu_parse_decode_add_plugin(char *buf, neu_parse_add_plugin_req_t **result)
{
-85
View File
@@ -1,85 +0,0 @@
/**
* NEURON IIoT System for Industry 4.0
* Copyright (C) 2020-2021 EMQ Technologies Co., Ltd All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
#ifndef _NEU_JSON_API_PLUGIN_H_
#define _NEU_JSON_API_PLUGIN_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include "neu_adapter.h"
typedef struct {
plugin_kind_e kind;
neu_node_type_e node_type;
char * plugin_name;
char * plugin_lib_name;
} neu_parse_add_plugin_req_t;
int neu_parse_decode_add_plugin(char *buf, neu_parse_add_plugin_req_t **result);
void neu_parse_decode_add_plugin_free(neu_parse_add_plugin_req_t *req);
typedef struct {
uint32_t plugin_id;
} neu_parse_del_plugin_req_t;
int neu_parse_decode_del_plugin(char *buf, neu_parse_del_plugin_req_t **result);
void neu_parse_decode_del_plugin_free(neu_parse_del_plugin_req_t *req);
typedef struct {
plugin_kind_e kind;
neu_node_type_e node_type;
char * plugin_name;
char * plugin_lib_name;
} neu_parse_update_plugin_req_t;
int neu_parse_decode_update_plugin(char * buf,
neu_parse_update_plugin_req_t **result);
void neu_parse_decode_update_plugin_free(neu_parse_update_plugin_req_t *req);
typedef struct {
uint32_t reserved;
} neu_parse_get_plugins_req_t;
typedef struct {
uint32_t plugin_id;
plugin_kind_e kind;
neu_node_type_e node_type;
char * plugin_name;
char * plugin_lib_name;
} neu_parse_get_plugins_res_lib_t;
typedef struct neu_parse_get_plugins_res {
uint16_t n_plugin;
neu_parse_get_plugins_res_lib_t *plugin_libs;
} neu_parse_get_plugins_res_t;
int neu_parse_decode_get_plugins(char * buf,
neu_parse_get_plugins_req_t **result);
void neu_parse_decode_get_plugins_free(neu_parse_get_plugins_req_t *req);
int neu_parse_encode_get_plugins(void *json_object, void *param);
#ifdef __cplusplus
}
#endif
#endif
+2 -2
View File
@@ -20,9 +20,9 @@
#include <stdlib.h>
#include <string.h>
#include "utils/json.h"
#include "json/json.h"
#include "neu_json_rw.h"
#include "json/neu_json_rw.h"
int neu_parse_decode_read(char *buf, neu_parse_read_req_t **result)
{
-71
View File
@@ -1,71 +0,0 @@
/**
* NEURON IIoT System for Industry 4.0
* Copyright (C) 2020-2021 EMQ Technologies Co., Ltd All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
#ifndef _NEU_JSON_API_READ_H_
#define _NEU_JSON_API_READ_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include "neu_data_expr.h"
#include "utils/json.h"
typedef struct neu_parse_read_req {
uint32_t node_id;
char * group_config_name;
} neu_parse_read_req_t;
typedef struct neu_parse_read_res_tag {
uint32_t tag_id;
enum neu_json_type t;
union neu_json_value value;
} neu_parse_read_res_tag_t;
typedef struct {
int n_tag;
neu_parse_read_res_tag_t *tags;
} neu_parse_read_res_t;
int neu_parse_decode_read(char *buf, neu_parse_read_req_t **result);
void neu_parse_decode_read_free(neu_parse_read_req_t *req);
int neu_parse_encode_read(void *json_object, void *param);
typedef struct {
uint32_t tag_id;
enum neu_json_type t;
union neu_json_value value;
} neu_parse_write_req_tag_t;
typedef struct neu_parse_write_req {
uint32_t node_id;
char * group_config_name;
int n_tag;
neu_parse_write_req_tag_t *tags;
} neu_parse_write_req_t;
int neu_parse_decode_write(char *buf, neu_parse_write_req_t **req);
void neu_parse_decode_write_free(neu_parse_write_req_t *req);
neu_data_val_t *neu_parse_write_req_to_val(neu_parse_write_req_t *req);
#ifdef __cplusplus
}
#endif
#endif
+2 -2
View File
@@ -19,8 +19,8 @@
#include <stdlib.h>
#include "neu_json_tag.h"
#include "utils/json.h"
#include "json/json.h"
#include "json/neu_json_tag.h"
int neu_parse_decode_add_tags(char *buf, neu_parse_add_tags_req_t **result)
{
-98
View File
@@ -1,98 +0,0 @@
/**
* NEURON IIoT System for Industry 4.0
* Copyright (C) 2020-2021 EMQ Technologies Co., Ltd All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
#ifndef _NEU_JSON_API_ADD_TAG_H_
#define _NEU_JSON_API_ADD_TAG_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
typedef struct {
char *name;
char *address;
int type;
int attribute;
} neu_parse_add_tags_req_tag_t;
typedef struct {
uint32_t node_id;
char * group_config_name;
int n_tag;
neu_parse_add_tags_req_tag_t *tags;
} neu_parse_add_tags_req_t;
int neu_parse_decode_add_tags(char *buf, neu_parse_add_tags_req_t **req);
void neu_parse_decode_add_tags_free(neu_parse_add_tags_req_t *req);
typedef struct {
char * group_config_name;
uint32_t node_id;
int n_tag_id;
uint32_t *tag_ids;
} neu_parse_del_tags_req_t;
int neu_parse_decode_del_tags(char *buf, neu_parse_del_tags_req_t **req);
void neu_parse_decode_del_tags_free(neu_parse_del_tags_req_t *req);
typedef struct {
uint32_t tag_id;
char * name;
int type;
char * address;
int attribute;
} neu_parse_update_tags_req_tag_t;
typedef struct {
uint32_t node_id;
int n_tag;
neu_parse_update_tags_req_tag_t *tags;
} neu_parse_update_tags_req_t;
int neu_parse_decode_update_tags(char *buf, neu_parse_update_tags_req_t **req);
void neu_parse_decode_update_tags_free(neu_parse_update_tags_req_t *req);
typedef struct {
uint32_t id;
char * name;
char * group_config_name;
char * address;
int type;
int attribute;
} neu_parse_get_tags_res_tag_t;
typedef struct {
uint32_t node_id;
} neu_parse_get_tags_req_t;
typedef struct {
int n_tag;
neu_parse_get_tags_res_tag_t *tags;
} neu_parse_get_tags_res_t;
int neu_parse_decode_get_tags(char *buf, neu_parse_get_tags_req_t **req);
void neu_parse_decode_get_tags_free(neu_parse_get_tags_req_t *req);
int neu_parse_encode_get_tags(void *json_object, void *param);
#ifdef __cplusplus
}
#endif
#endif
+2 -2
View File
@@ -18,8 +18,8 @@
**/
#include <stdlib.h>
#include "neu_json_tty.h"
#include "utils/json.h"
#include "json/json.h"
#include "json/neu_json_tty.h"
int neu_parse_encode_get_tty(void *json_object, void *param)
{
-37
View File
@@ -1,37 +0,0 @@
/**
* NEURON IIoT System for Industry 4.0
* Copyright (C) 2020-2021 EMQ Technologies Co., Ltd All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
#ifndef _NEU_JSON_API_TTY_H
#define _NEU_JSON_API_TTY_H
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
int n_tty;
char **ttys;
} neu_parse_get_tty_res_t;
int neu_parse_encode_get_tty(void *json_object, void *param);
#ifdef __cplusplus
}
#endif
#endif
+1 -1
View File
@@ -24,7 +24,7 @@
#include "neu_log.h"
#include "schema.h"
#include "utils/json.h"
#include "json/json.h"
struct neu_schema_valid {
void * root;
+1 -1
View File
@@ -22,8 +22,8 @@
#include <jansson.h>
#include "json.h"
#include "neu_log.h"
#include "json/json.h"
static json_t *encode_object_value(neu_json_elem_t *ele)
{
-81
View File
@@ -1,81 +0,0 @@
/**
* NEURON IIoT System for Industry 4.0
* Copyright (C) 2020-2021 EMQ Technologies Co., Ltd All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
#ifndef _NEU_JSON__H_
#define _NEU_JSON__H_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdbool.h>
#include <stdint.h>
typedef enum neu_json_type {
NEU_JSON_UNDEFINE = 0,
NEU_JSON_INT = 1,
NEU_JSON_BIT,
NEU_JSON_STR,
NEU_JSON_DOUBLE,
NEU_JSON_FLOAT,
NEU_JSON_BOOL,
NEU_JSON_OBJECT
} neu_json_type_e;
typedef union neu_json_value {
int64_t val_int;
uint8_t val_bit;
float val_float;
double val_double;
bool val_bool;
char * val_str;
void * object;
} neu_json_value_u;
typedef struct neu_json_elem {
char * name;
enum neu_json_type t;
union neu_json_value v;
} neu_json_elem_t;
#define NEU_JSON_ELEM_SIZE(elems) sizeof(elems) / sizeof(neu_json_elem_t)
int neu_json_decode(char *buf, int size, neu_json_elem_t *ele);
int neu_json_decode_array_size_by_json(void *json, char *child);
int neu_json_decode_array_by_json(void *json, char *name, int index, int size,
neu_json_elem_t *ele);
int neu_json_decode_array_size(char *buf, char *child);
int neu_json_decode_array(char *buf, char *name, int index, int size,
neu_json_elem_t *ele);
void *neu_json_decode_new(char *buf);
void neu_json_decode_free(void *ob);
int neu_json_decode_value(void *object, neu_json_elem_t *ele);
void *neu_json_encode_new();
void neu_json_encode_free(void *json_object);
void *neu_json_encode_array(void *array, neu_json_elem_t *t, int n);
void *neu_json_encode_array_value(void *array, neu_json_elem_t *t, int n);
int neu_json_encode_field(void *json_object, neu_json_elem_t *elem, int n);
int neu_json_encode(void *json_object, char **str);
#ifdef __cplusplus
}
#endif
#endif