libamxb  4.8.2
Bus Agnostic C API
amxb_ba_op_get.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <string.h>
#include <amxc/amxc.h>
#include <amxp/amxp.h>
#include <amxd/amxd_common.h>
#include <amxd/amxd_dm.h>
#include <amxd/amxd_path.h>
#include <amxd/amxd_object.h>
#include <amxb/amxb_be_intf.h>
#include <amxb/amxb.h>
#include "amxb_priv.h"

Go to the source code of this file.

Macros

#define _GNU_SOURCE
 

Functions

static int amxb_invoke_get (amxb_bus_ctx_t *const bus_ctx, const char *object, const char *search_path, const char *filter, int32_t depth, amxc_var_t *ret, int timeout)
 
int amxb_get (amxb_bus_ctx_t *const bus_ctx, const char *search_path, int32_t depth, amxc_var_t *ret, int timeout)
 Fetches one or more objects or a single parameter. More...
 
int amxb_get_filtered (amxb_bus_ctx_t *const bus_ctx, const char *search_path, const char *filter, int32_t depth, amxc_var_t *ret, int timeout)
 Fetches one or more objects and their parameters that are matching a filter. More...
 

Macro Definition Documentation

◆ _GNU_SOURCE

#define _GNU_SOURCE

Definition at line 56 of file amxb_ba_op_get.c.

Function Documentation

◆ amxb_invoke_get()

static int amxb_invoke_get ( amxb_bus_ctx_t *const  bus_ctx,
const char *  object,
const char *  search_path,
const char *  filter,
int32_t  depth,
amxc_var_t *  ret,
int  timeout 
)
static

Definition at line 78 of file amxb_ba_op_get.c.

84  {
85  amxb_invoke_t* invoke_ctx = NULL;
86  int retval = amxd_status_unknown_error;
87  amxc_var_t* args = NULL;
88  amxc_string_t full_path;
89 
90  amxc_string_init(&full_path, 0);
91  amxc_var_new(&args);
92  amxc_var_set_type(args, AMXC_VAR_ID_HTABLE);
93 
94  if(search_path != NULL) {
95  amxc_var_add_key(cstring_t, args, "rel_path", search_path);
96  }
97  if((filter != NULL) && (*filter != 0)) {
98  amxc_var_add_key(cstring_t, args, "filter", filter);
99  }
100  amxc_var_add_key(int32_t, args, "depth", depth);
101  amxc_var_add_key(uint32_t, args, "access", bus_ctx->access);
102 
103  retval = amxb_new_invoke(&invoke_ctx, bus_ctx, object, NULL, "_get");
104  when_failed(retval, exit);
105  retval = amxb_invoke(invoke_ctx, args, ret, NULL, NULL, timeout);
106 
107 exit:
108  amxc_string_clean(&full_path);
109  amxc_var_delete(&args);
110  amxb_free_invoke(&invoke_ctx);
111  return retval;
112 }
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.
uint32_t access
Definition: amxb_types.h:125
static amxb_bus_ctx_t * bus_ctx
Definition: test_amxb_e2e.c:84