Telemetry stream and decode. More...


Go to the source code of this file.
Typedefs | |
typedef void(* | stream_callback_type) (const char *str, void *arg) |
Functions | |
void | tlm_stream_one (tlm_component *comp, stream_callback_type stream, void *print_ascii, void *arg) |
void | tlm_stream_all (stream_callback_type stream_func, void *arg, bool ascii) |
void | tlm_stream_one_file (tlm_component *comp_ptr, FILE *file) |
void | tlm_stream_all_file (FILE *file) |
bool | tlm_stream_decode_file (FILE *file) |
Detailed Description
Telemetry stream and decode.
Telemetry stream sends encoded ASCII data stream to the provided stream function. Example stream :
START:my_component:3 a:4:1:1:DE,AD,BE,EF b:2:1:1:02,00 c:1:1:1:11 END:my_component
Typedef Documentation
typedef void(* stream_callback_type) (const char *str, void *arg) |
Each stream starts with the tag START and ends with END After the colon is the name of the component and then the number of variables registered in this component. Then the variables' data follows :
- The name of the variable
- Number of bytes per variable
- Number of elements per array (1 for a single variable)
- Variable type.
- See also
- tlm_type at c_tlm_var.h
- HEX bytes
Telemetry decode will do the opposite. It will decode an incoming stream, and based on the stream, it will find the component and the registered variable and set the value of the variable based on the stream. This functionality can be used to take a saved data stream, and set the variables' data value based on the stream. In particular, the registered variables' values can be restored based on a previously saved telemetry stream from a disk etc.
Here is an example of saving the stream into a C++ string :
Typedef of the stream callback function
- Parameters
-
str The ASCII string containing partial stream
Function Documentation
void tlm_stream_all | ( | stream_callback_type | stream_func, |
void * | arg, | ||
bool | ascii | ||
) |
Streams the telemetry for ALL registered components and their variables
- Parameters
-
stream_func The callback stream function that will receive the strings to print arg This argument will be passed to your stream function as its argument ascii If true, ASCII values are printed, rather than hex value of the data
void tlm_stream_all_file | ( | FILE * | file | ) |
Streams all components to a file
- Parameters
-
file Could be stdout, stderr, or an opened file handle Example: To printf the telemetry, just use "tlm_stream_all_file(stdio);"
bool tlm_stream_decode_file | ( | FILE * | file | ) |
This is similar to tlm_stream_decode(char*) except that it decodes stream from an opened file handle. The file will be read until fgets() fails.
- Returns
- true when telemetry decode finds correct stream header.
void tlm_stream_one | ( | tlm_component * | comp, |
stream_callback_type | stream, | ||
void * | print_ascii, | ||
void * | sca | ||
) |
Streams the telemetry for one component and its variables
- Parameters
-
stream The callback stream function that will receive the strings to print print_ascii If non-null, the data will be printed as ASCII values rather than hex values arg This argument will be passed to your stream function as its argument
Callback function for each component
- Parameters
-
sca Stream callback argument
void tlm_stream_one_file | ( | tlm_component * | comp_ptr, |
FILE * | file | ||
) |
Streams your provided component telemetry into a file pointer
- Parameters
-
comp_ptr The telemetry component pointer file Could be stdout, stderr, or an opened file handle