CTS-SAT-1-OBC-Firmware
Loading...
Searching...
No Matches
telecommand_args_helpers.h File Reference
#include <stdint.h>
Include dependency graph for telecommand_args_helpers.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

uint8_t TCMD_ascii_to_uint64 (const char *str, uint32_t str_len, uint64_t *result)
 Extracts a uint64, starting from the beginning of str, to a maximum length of str_len.
 
uint8_t TCMD_extract_uint64_arg (const char *str, uint32_t str_len, uint8_t arg_index, uint64_t *result)
 Extracts the nth comma-separated argument from the input string, assuming it's a uint64.
 
uint8_t TCMD_extract_string_arg (const char *str, uint8_t arg_index, char *result, uint16_t result_max_len)
 Extracts the nth comma-separated argument from the input string, assuming it's a string.
 
uint8_t TCMD_extract_hex_array_arg (const char *args_str, uint8_t arg_index, uint8_t result_array[], uint16_t result_array_size, uint16_t *result_length)
 Extracts the nth comma-separated argument from the input string, assuming it's a hex string.
 
uint8_t TCMD_ascii_to_double (const char *str, uint32_t str_len, double *result)
 Extracts the longest substring of double characters, starting from the beginning of the string, to a maximum length or until the first non-double character is found.
 
uint8_t TCMD_extract_double_arg (const char *str, uint32_t str_len, uint8_t arg_index, double *result)
 Extracts the nth comma-separated argument from the input string, assuming it's a double.
 
uint8_t TCMD_ascii_to_int64 (const char *str, uint32_t str_len, int64_t *result)
 Extracts an int64, starting from the beginning of str, to a maximum length of str_len.
 
uint8_t TCMD_extract_int64_arg (const char *str, uint32_t str_len, uint8_t arg_index, int64_t *result)
 Extracts the nth comma-separated argument from the input string, assuming it's an int64.
 

Function Documentation

◆ TCMD_ascii_to_double()

uint8_t TCMD_ascii_to_double ( const char * str,
uint32_t str_len,
double * result )

Extracts the longest substring of double characters, starting from the beginning of the string, to a maximum length or until the first non-double character is found.

Parameters
strInput string, starting with a double
str_lenMax length of the input string
resultPointer to the result
Returns
0 if successful, 1 if the string is empty, 2 if the string does not start with a double
Here is the caller graph for this function:

◆ TCMD_ascii_to_int64()

uint8_t TCMD_ascii_to_int64 ( const char * str,
uint32_t str_len,
int64_t * result )

Extracts an int64, starting from the beginning of str, to a maximum length of str_len.

Parameters
strInput string, starting with an integer or negative sign.
str_lenLength of the input string. The first str_len characters are considered.
resultPointer to the result
Returns
0 if successful, 1 if the string is empty, 2 if the string does not entirely encapsulate an integer
Here is the caller graph for this function:

◆ TCMD_ascii_to_uint64()

uint8_t TCMD_ascii_to_uint64 ( const char * str,
uint32_t str_len,
uint64_t * result )

Extracts a uint64, starting from the beginning of str, to a maximum length of str_len.

Parameters
strInput string, starting with an integer
str_lenLength of the input string. The first str_len characters are considered.
resultPointer to the result
Returns
0 if successful, 1 if the string is empty, 2 if the string size is longer than 19 characters, 3 if the string contains non-integer characters.
Note
Result is not written to if an error occurs. The max digit length that can be store in the result is 19. If the input string is longer than 19 characters, an error will be returned.
Here is the caller graph for this function:

◆ TCMD_extract_double_arg()

uint8_t TCMD_extract_double_arg ( const char * str,
uint32_t str_len,
uint8_t arg_index,
double * result )

Extracts the nth comma-separated argument from the input string, assuming it's a double.

Parameters
strInput string
str_lenLength of the input string
arg_indexIndex of the argument to extract (0-based)
resultPointer to the result
Returns
0 if successful, 1 if the string is empty, 2 if the string does not contain enough arguments 3 if the argument is not a double, 4 for other error
Here is the call graph for this function:
Here is the caller graph for this function:

◆ TCMD_extract_hex_array_arg()

uint8_t TCMD_extract_hex_array_arg ( const char * args_str,
uint8_t arg_index,
uint8_t result_array[],
uint16_t result_array_size,
uint16_t * result_length )

Extracts the nth comma-separated argument from the input string, assuming it's a hex string.

Parameters
args_strInput string containing comma-separated arguments (null-terminated)
arg_indexIndex of the argument to extract (0-based)
resultPointer to the result; a byte array containing the values of the hex string
result_array_sizeSize of the result array
result_lengthPointer to variable that will contain the length of the result after converting
Returns
0 if successful, >0 for error
Note
Delimiters between bytes are ignored, but delimiters within a byte are not allowed.
Here is the caller graph for this function:

◆ TCMD_extract_int64_arg()

uint8_t TCMD_extract_int64_arg ( const char * str,
uint32_t str_len,
uint8_t arg_index,
int64_t * result )

Extracts the nth comma-separated argument from the input string, assuming it's an int64.

Parameters
strInput string
str_lenLength of the input string
arg_indexIndex of the argument to extract (0-based)
resultPointer to the result
Returns
0 if successful, 1 if the string is empty, 2 if the string does not contain enough arguments 3 if the argument is not an integer, 4 for other error
Here is the call graph for this function:
Here is the caller graph for this function:

◆ TCMD_extract_string_arg()

uint8_t TCMD_extract_string_arg ( const char * str,
uint8_t arg_index,
char * result,
uint16_t result_max_len )

Extracts the nth comma-separated argument from the input string, assuming it's a string.

Parameters
strInput string (null-terminated).
arg_indexIndex of the argument to extract (0-based).
resultPointer to the result, to be filled with the extracted string (null-terminated).
result_max_lenMaximum length of the result, including the null-terminator.
Returns
0 if successful, 1 if the string is empty, 2 if the string does not contain enough arguments 3 for other error
Here is the caller graph for this function:

◆ TCMD_extract_uint64_arg()

uint8_t TCMD_extract_uint64_arg ( const char * str,
uint32_t str_len,
uint8_t arg_index,
uint64_t * result )

Extracts the nth comma-separated argument from the input string, assuming it's a uint64.

Parameters
strInput string
str_lenLength of the input string
arg_indexIndex of the argument to extract (0-based)
resultPointer to the result
Returns
0 if successful, 1 if the string is empty, 2 if the string does not contain enough arguments 3 if the argument is not an integer, 4 for other error
Here is the call graph for this function: