#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include "c_tlm_var.h"
Include dependency graph for c_tlm_var.c:

Macros | |
#define | tlm_variable_set_value_find_next_token(value) |
#define | tlm_variable_print_array(format, var, buffer) |
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) |
Macro Definition Documentation
#define tlm_variable_print_array | ( | format, | |
var, | |||
buffer | |||
) |
Value:
for ( i=1; i < reg_var->elm_arr_size; i++) { \
++var; \
size_t curr_len = strlen(buffer); \
} do{ } while(0)
To use the FreeRTOS so play with it a little *uses roughly of and uses roughly of RAM *The larger the the larger recording buffer *You can choose ring buffer
Definition: readme.txt:4
#define tlm_variable_set_value_find_next_token | ( | value | ) |
Value:
while (0 != *value) { \
if (',' == *value) { \
++value; \
break; \
} else { \
++value; \
} }
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"