mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2025-12-10 07:44:39 +01:00
Use the correct version when running JSON Plugin as micro-service
This commit is contained in:
parent
415ece6483
commit
e22698c246
3 changed files with 10 additions and 9 deletions
|
|
@ -76,7 +76,7 @@ int free_dotso_plugin(void *lib_handle)
|
|||
|
||||
int load_json_plugin(struct list_head *json_plugin, struct list_head *json_list, struct list_head *json_memhead, const char *file_path, DMOBJ **main_entry)
|
||||
{
|
||||
int json_plugin_version = 0;
|
||||
int json_plugin_version = JSON_VERSION_0;
|
||||
|
||||
if (!file_path || !strlen(file_path) || !main_entry)
|
||||
return -1;
|
||||
|
|
@ -91,7 +91,7 @@ int load_json_plugin(struct list_head *json_plugin, struct list_head *json_list,
|
|||
char node_obj[1024] = {0};
|
||||
|
||||
if (strcmp(key, "json_plugin_version") == 0) {
|
||||
json_plugin_version = json_object_get_int(jobj);
|
||||
json_plugin_version = get_json_plugin_version(jobj);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,12 +44,6 @@ struct dm_json_obj {
|
|||
event_args event_arg;
|
||||
};
|
||||
|
||||
enum json_plugin_version {
|
||||
JSON_VERSION_0 = 1,
|
||||
JSON_VERSION_1 = 1 << 1,
|
||||
JSON_VERSION_2 = 1 << 2
|
||||
};
|
||||
|
||||
static void save_json_data(struct list_head *json_list, char *name, json_object *data, int json_version,
|
||||
const char **in_p, const char **out_p, const char **ev_arg)
|
||||
{
|
||||
|
|
@ -112,7 +106,7 @@ static void free_loaded_json_files(struct list_head *json_list)
|
|||
}
|
||||
}
|
||||
|
||||
static int get_json_plugin_version(json_object *json_obj)
|
||||
int get_json_plugin_version(json_object *json_obj)
|
||||
{
|
||||
if (json_obj == NULL || json_object_get_type(json_obj) != json_type_int)
|
||||
return JSON_VERSION_0; // Return JSON_VERSION_0 for invalid input
|
||||
|
|
|
|||
|
|
@ -14,9 +14,16 @@
|
|||
|
||||
#include "../dmcommon.h"
|
||||
|
||||
enum json_plugin_version {
|
||||
JSON_VERSION_0 = 1,
|
||||
JSON_VERSION_1 = 1 << 1,
|
||||
JSON_VERSION_2 = 1 << 2
|
||||
};
|
||||
|
||||
void save_loaded_json_files(struct list_head *json_list, json_object *data);
|
||||
void parse_obj(char *object, json_object *jobj, DMOBJ *pobj, int index, int json_version, struct list_head *list);
|
||||
void json_plugin_find_prefix_obj(const char *full_obj, char *prefix_obj, size_t len);
|
||||
int get_json_plugin_version(json_object *json_obj);
|
||||
|
||||
int load_json_plugins(DMOBJ *entryobj, const char *path);
|
||||
int free_json_plugins(void);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue