65 #include <amxc/amxc.h>
66 #include <amxp/amxp.h>
68 #include <amxd/amxd_common.h>
69 #include <amxd/amxd_dm.h>
70 #include <amxd/amxd_path.h>
71 #include <amxd/amxd_object.h>
80 amxc_string_t* full_name,
83 amxc_var_for_each(name, data) {
84 const char* str_name = amxc_var_constcast(cstring_t, name);
85 amxc_string_setf(full_name,
"%s%s",
object, str_name);
86 amxc_var_add(cstring_t, ret, amxc_string_get(full_name, 0));
95 amxc_var_t* table = GETI_ARG(full, 0);
96 amxc_var_t* obj = GET_ARG(table,
"objects");
97 amxc_var_t* inst = GET_ARG(table,
"instances");
98 amxc_var_t* funcs = GET_ARG(table,
"functions");
99 amxc_var_t* params = GET_ARG(table,
"parameters");
100 amxc_string_t full_name;
102 amxc_string_init(&full_name, strlen(
object) + 32);
105 amxc_var_for_each(name, inst) {
107 amxc_string_setf(&full_name,
"%s%s.",
object, GET_CHAR(name,
"name"));
109 amxc_string_setf(&full_name,
"%s%d.",
object, GET_UINT32(name,
"index"));
111 amxc_var_add(cstring_t, ret, amxc_string_get(&full_name, 0));
124 amxc_string_clean(&full_name);
134 amxc_var_t list_return;
138 int retval = amxd_status_unknown_error;
140 amxd_path_init(&path, NULL);
141 amxd_path_setf(&path,
true,
"%s",
object);
142 amxc_var_init(&list_return);
144 amxc_var_init(&args);
146 amxc_var_set_type(&args, AMXC_VAR_ID_HTABLE);
152 amxc_var_add_key(uint32_t, &args,
"access",
bus_ctx->
access);
154 when_failed(retval, exit);
155 retval =
amxb_invoke(invoke_ctx, &args, &list_return, NULL, NULL, 5);
156 when_failed(retval, exit);
158 amxc_var_set_type(&ret, AMXC_VAR_ID_LIST);
160 flags, &list_return);
169 amxc_var_clean(&ret);
170 amxd_path_clean(&path);
171 amxc_var_clean(&args);
172 amxc_var_clean(&list_return);
182 int retval = amxd_status_unknown_error;
185 bool lobject =
false;
187 amxd_path_init(&path, NULL);
190 if((
object != NULL) && ((*
object) != 0)) {
195 if((
object != NULL) && (*
object != 0)) {
196 amxd_path_setf(&path,
true,
"%s",
object);
201 when_null(req, exit);
211 when_null(req, exit);
226 amxd_path_clean(&path);
Ambiorix bus agnostic API header file.
static int amxb_invoke_list(amxb_bus_ctx_t *const bus_ctx, const char *object, uint32_t flags, amxb_be_cb_fn_t fn, void *priv)
static void amxb_build_list(amxc_var_t *ret, const char *object, uint32_t flags, amxc_var_t *full)
static void amxb_fill_list(amxc_var_t *ret, const char *object, amxc_string_t *full_name, amxc_var_t *data)
Ambiorix Bus Backend Interface.
#define AMXB_FLAG_INSTANCES
#define AMXB_FLAG_FUNCTIONS
#define AMXB_FLAG_PARAMETERS
#define AMXB_FLAG_TEMPLATE_INFO
#define AMXB_FLAG_OBJECTS
#define amxb_is_valid_be_func(ft, member, ptr)
bool PRIVATE amxb_is_local_object(amxb_bus_ctx_t *ctx, const char *obj_path)
void(* amxb_be_cb_fn_t)(const amxb_bus_ctx_t *bus_ctx, const amxc_var_t *const data, void *priv)
#define AMXB_ERROR_NOT_SUPPORTED_OP
Function/operation not supported.
int amxb_new_invoke(amxb_invoke_t **invoke_ctx, amxb_bus_ctx_t *const ctx, const char *object, const char *interface, const char *method)
Prepares a remote function invocation.
void amxb_free_invoke(amxb_invoke_t **invoke_ctx)
Deletes a function invoke context, and frees allocated memory.
int amxb_invoke(amxb_invoke_t *invoke_ctx, amxc_var_t *args, amxc_var_t *ret, amxb_be_cb_fn_t fn, void *priv, int timeout)
Invokes a remote function, as defined by the function invoke context.
int amxb_list(amxb_bus_ctx_t *const bus_ctx, const char *object, uint32_t flags, amxb_be_cb_fn_t fn, void *priv)
List the service elements/nodes of an object.
The back-end interface structure.
const amxb_be_funcs_t * bus_fn
static amxb_bus_ctx_t * bus_ctx