

Go to the source code of this file.
Data Structures | |
struct | tlm_reg_var_type |
Macros | |
#define | TLM_REG_VAR(comp, var, type) tlm_variable_register(comp, #var, &var, sizeof(var), 1, type) |
#define | TLM_REG_ARR(comp, var, type) tlm_variable_register(comp, #var, &var[0], sizeof(var[0]), sizeof(var)/sizeof(var[0]), type) |
Enumerations | |
enum | tlm_type { tlm_undefined = 0, tlm_int = 1, tlm_uint = 2, tlm_char = 3, tlm_float = 4, tlm_double = 5, tlm_string = 6, tlm_binary = 7, tlm_bit_or_bool = 8 } |
Functions | |
bool | tlm_variable_register (tlm_component *comp_ptr, const char *name, const void *data_ptr, const uint16_t data_size, const uint16_t arr_size, tlm_type type) |
const tlm_reg_var_type * | tlm_variable_get_by_name (tlm_component *comp_ptr, const char *name) |
const tlm_reg_var_type * | tlm_variable_get_by_comp_and_name (const char *comp_name, const char *name) |
bool | tlm_variable_set_value (const char *comp_name, const char *name, const char *value) |
bool | tlm_variable_get_value (const char *comp_name, const char *name, char *buffer, int len) |
bool | tlm_variable_print_value (const tlm_reg_var_type *reg_var, char *buffer, int len) |
Detailed Description
This file allows variables to be registered under a component.
- See also
- Sample code of c_tlm_comp.h
Macro Definition Documentation
#define TLM_REG_ARR | ( | comp, | |
var, | |||
type | |||
) | tlm_variable_register(comp, #var, &var[0], sizeof(var[0]), sizeof(var)/sizeof(var[0]), type) |
Macro to register an array.
#define TLM_REG_VAR | ( | comp, | |
var, | |||
type | |||
) | tlm_variable_register(comp, #var, &var, sizeof(var), 1, type) |
Macro to register a variable. If a variable is called "var", then this macro will yield : tlm_variable_register(comp, "var", &var, sizeof(var), 1);
Enumeration Type Documentation
enum tlm_type |
Function Documentation
const tlm_reg_var_type* tlm_variable_get_by_comp_and_name | ( | const char * | comp_name, |
const char * | name | ||
) |
Get the data pointer and the size of a previously registered variable. The tlm_reg_var_type structure contains the pointer and the size.
- Parameters
-
comp_name The component name that contains the variable name The registered name of the variable
const tlm_reg_var_type* tlm_variable_get_by_name | ( | tlm_component * | comp_ptr, |
const char * | name | ||
) |
Get the data pointer and the size of a previously registered variable. The tlm_reg_var_type structure contains the pointer and the size.
- Parameters
-
comp_ptr The component pointer that contains the variable name The registered name of the variable
bool tlm_variable_get_value | ( | const char * | comp_name, |
const char * | name, | ||
char * | buffer, | ||
int | len | ||
) |
Gets a value to one of the telemetry variables
- Parameters
-
comp_name The name of the component (this will be located by name) name The name of the registered variable buffer The buffer at which to print the data len The length of the buffer
bool tlm_variable_print_value | ( | const tlm_reg_var_type * | reg_var, |
char * | buffer, | ||
int | len | ||
) |
Prints the value of the given variable
- Parameters
-
reg_var A registered variable, possibly obtained from tlm_variable_get_by_name() buffer The buffer at which to print the data len The length of the buffer
- Returns
- true upon success
bool tlm_variable_register | ( | tlm_component * | comp_ptr, |
const char * | name, | ||
const void * | data_ptr, | ||
const uint16_t | data_size, | ||
const uint16_t | arr_size, | ||
tlm_type | type | ||
) |
Adds a variable to a component.
- Parameters
-
comp_ptr The component pointer name The name of the variable data_ptr The data pointer of the variable data_size The size of the variable arr_size If not an array, use zero. If registering an array, use the number of elements in the array. type The type of the variable.
- Returns
- true upon success. If memory allocation fails, or if another variable is registered by the same name or same memory pointer, false is returned.
bool tlm_variable_set_value | ( | const char * | comp_name, |
const char * | name, | ||
const char * | value | ||
) |
Sets a value to one of the telemetry variables. This is sort of a back-door way to force a value to the telemetry variable.
- Parameters
-
comp_name The name of the component (this will be located by name) name The name of the registered variable value The string value. For example, to set an integer, just pass string value such as "123". To set boolean value, use "true" or "false"