libamxb  4.8.2
Bus Agnostic C API
amxb_operators.h File Reference

Ambiorix Bus Agnostic Data Model Operators API. More...

#include <amxb/amxb_types.h>

Go to the source code of this file.

Macros

#define AMXB_FLAG_PARAMETERS   0x0001
 
#define AMXB_FLAG_FUNCTIONS   0x0002
 
#define AMXB_FLAG_EVENTS   0x0004
 
#define AMXB_FLAG_OBJECTS   0x0008
 
#define AMXB_FLAG_INSTANCES   0x0010
 
#define AMXB_FLAG_FIRST_LVL   0x0020
 
#define AMXB_FLAG_NAMED   0x0040
 
#define AMXB_FLAG_EXISTS   0x0080
 
#define AMXB_FLAG_TEMPLATE_INFO   0x0100
 
#define AMXB_FLAG_PARTIAL   0x0200
 
#define AMXB_FLAG_PROTECTED   0x0400
 

Functions

int amxb_call (amxb_bus_ctx_t *const bus_ctx, const char *object, const char *method, amxc_var_t *args, amxc_var_t *ret, int timeout)
 Invokes a data model function. More...
 
amxb_request_tamxb_async_call (amxb_bus_ctx_t *const bus_ctx, const char *object, const char *method, amxc_var_t *args, amxb_be_done_cb_fn_t done_fn, void *priv)
 Invokes a data model function. More...
 
int amxb_get (amxb_bus_ctx_t *const bus_ctx, const char *object, 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 *object, 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...
 
int amxb_get_multiple (amxb_bus_ctx_t *const bus_ctx, amxc_var_t *req_paths, int32_t depth, amxc_var_t *ret, int timeout)
 Fetches one or more (root) objects or multiple parameters. More...
 
int amxb_set (amxb_bus_ctx_t *const bus_ctx, const char *object, amxc_var_t *values, amxc_var_t *ret, int timeout)
 Sets parameter values of one single object or of multiple instance objects. More...
 
int amxb_set_multiple (amxb_bus_ctx_t *const bus_ctx, uint32_t flags, amxc_var_t *req_paths, amxc_var_t *ret, int timeout)
 Sets parameter values for multiple objects (request paths) More...
 
int amxb_add (amxb_bus_ctx_t *const bus_ctx, const char *object, uint32_t index, const char *name, amxc_var_t *values, amxc_var_t *ret, int timeout)
 Adds an instance to a multi-instance object. More...
 
int amxb_del (amxb_bus_ctx_t *const bus_ctx, const char *object, uint32_t index, const char *name, amxc_var_t *ret, int timeout)
 Deletes one or more instances of a multi-instance object. More...
 
int amxb_get_supported (amxb_bus_ctx_t *const bus_ctx, const char *object, uint32_t flags, amxc_var_t *ret, int timeout)
 Gets the supported data model. More...
 
int amxb_describe (amxb_bus_ctx_t *const bus_ctx, const char *object, uint32_t flags, amxc_var_t *ret, int timeout)
 Describes an object. More...
 
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. More...
 
int amxb_resolve (amxb_bus_ctx_t *bus_ctx, amxd_path_t *obj_path, amxc_var_t *ret_val)
 
int amxb_get_instances (amxb_bus_ctx_t *const bus_ctx, const char *search_path, int32_t depth, amxc_var_t *ret, int timeout)
 Fetches the instances and the unique keys of a multi-instance object. More...
 

Detailed Description

Ambiorix Bus Agnostic Data Model Operators API.

Definition in file amxb_operators.h.

Macro Definition Documentation

◆ AMXB_FLAG_EVENTS

#define AMXB_FLAG_EVENTS   0x0004

Definition at line 79 of file amxb_operators.h.

◆ AMXB_FLAG_EXISTS

#define AMXB_FLAG_EXISTS   0x0080

Definition at line 84 of file amxb_operators.h.

◆ AMXB_FLAG_FIRST_LVL

#define AMXB_FLAG_FIRST_LVL   0x0020

Definition at line 82 of file amxb_operators.h.

◆ AMXB_FLAG_FUNCTIONS

#define AMXB_FLAG_FUNCTIONS   0x0002

Definition at line 78 of file amxb_operators.h.

◆ AMXB_FLAG_INSTANCES

#define AMXB_FLAG_INSTANCES   0x0010

Definition at line 81 of file amxb_operators.h.

◆ AMXB_FLAG_NAMED

#define AMXB_FLAG_NAMED   0x0040

Definition at line 83 of file amxb_operators.h.

◆ AMXB_FLAG_OBJECTS

#define AMXB_FLAG_OBJECTS   0x0008

Definition at line 80 of file amxb_operators.h.

◆ AMXB_FLAG_PARAMETERS

#define AMXB_FLAG_PARAMETERS   0x0001

Definition at line 77 of file amxb_operators.h.

◆ AMXB_FLAG_PARTIAL

#define AMXB_FLAG_PARTIAL   0x0200

Definition at line 86 of file amxb_operators.h.

◆ AMXB_FLAG_PROTECTED

#define AMXB_FLAG_PROTECTED   0x0400

Definition at line 87 of file amxb_operators.h.

◆ AMXB_FLAG_TEMPLATE_INFO

#define AMXB_FLAG_TEMPLATE_INFO   0x0100

Definition at line 85 of file amxb_operators.h.

Function Documentation

◆ amxb_resolve()

int amxb_resolve ( amxb_bus_ctx_t bus_ctx,
amxd_path_t *  obj_path,
amxc_var_t *  ret_val 
)

Definition at line 78 of file amxb_ba_op_resolve.c.

80  {
81  int retval = amxd_status_unknown_error;
82  const char* obj_path = amxd_path_get(path, AMXD_OBJECT_TERMINATE);
83  amxc_var_t ret;
84  amxc_var_t* result = NULL;
85  uint32_t current = 0;
86 
87  amxc_var_init(&ret);
88 
89  when_null(bus_ctx, exit);
90  when_null(path, exit);
91  when_null(ret_val, exit);
92 
93  current = bus_ctx->access;
95  retval = amxb_get(bus_ctx, obj_path, 0, &ret, 5);
96  amxb_set_access(bus_ctx, current);
97  if(retval == 0) { //
98  result = GETI_ARG(&ret, 0);
99  if(amxc_var_type_of(result) != AMXC_VAR_ID_HTABLE) {
100  goto exit;
101  }
102  if(amxc_htable_is_empty(&result->data.vm)) {
103  goto exit;
104  }
105 
106  amxc_var_set_type(ret_val, AMXC_VAR_ID_LIST);
107  amxc_htable_for_each(hit, (&result->data.vm)) {
108  amxc_var_add(cstring_t, ret_val, amxc_htable_it_get_key(hit));
109  }
110  }
111 
112 exit:
113  amxc_var_clean(&ret);
114  return retval;
115 }
#define AMXB_PROTECTED
Definition: amxb_types.h:74
static void amxb_set_access(amxb_bus_ctx_t *const ctx, uint32_t access)
Sets the access method.
Definition: amxb_connect.h:355
int amxb_get(amxb_bus_ctx_t *const bus_ctx, const char *object, int32_t depth, amxc_var_t *ret, int timeout)
Fetches one or more objects or a single parameter.
uint32_t access
Definition: amxb_types.h:125
static amxb_bus_ctx_t * bus_ctx
Definition: test_amxb_e2e.c:84