mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2025-12-10 07:44:39 +01:00
Add support for different ubus arg types
Add support for boolean and integer values in the dynamic JSON ubus args.
This commit is contained in:
parent
8d1fa958e7
commit
7f0ca8ccd5
1 changed files with 11 additions and 1 deletions
|
|
@ -350,7 +350,17 @@ static int fill_ubus_arguments(struct dmctx *ctx, void *data, char *instance, ch
|
||||||
|
|
||||||
u_args[u_args_size].key = dm_dynamic_strdup(&json_memhead, buf_key);
|
u_args[u_args_size].key = dm_dynamic_strdup(&json_memhead, buf_key);
|
||||||
u_args[u_args_size].val = dm_dynamic_strdup(&json_memhead, buf_val);
|
u_args[u_args_size].val = dm_dynamic_strdup(&json_memhead, buf_val);
|
||||||
u_args[u_args_size].type = String;
|
switch (json_object_get_type(val)) {
|
||||||
|
case json_type_boolean:
|
||||||
|
u_args[u_args_size].type = Boolean;
|
||||||
|
break;
|
||||||
|
case json_type_int:
|
||||||
|
u_args[u_args_size].type = Integer;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
u_args[u_args_size].type = String;
|
||||||
|
break;
|
||||||
|
}
|
||||||
u_args_size++;
|
u_args_size++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue