CTS-SAT-1-OBC-Firmware
Loading...
Searching...
No Matches
telecommand_types.h
Go to the documentation of this file.
1
2#ifndef INCLUDE_GUARD__TELECOMMAND_TYPES_H
3#define INCLUDE_GUARD__TELECOMMAND_TYPES_H
4
5#include <stdint.h>
6
7#define TCMD_MAX_RESP_FNAME_LEN 64
8
9// Max len of `args_str_no_parens` in `TCMD_parsed_tcmd_to_execute_t`, including null terminator.
10#define TCMD_ARGS_STR_NO_PARENS_SIZE 240
11
14static const uint16_t TCMD_MAX_FULL_LENGTH = 255;
15
16
18typedef enum {
19 // For commands which are intended for normal operation in flight.
21
22 // For commands which are generally safe to use in flight, but which shouldn't regularly be used,
23 // and which require expert knowledge on the mechanism of operation.
25
26 // For commands like "test the flash memory", which corrupts the filesystem but is flight-safe.
28
29 // Especially for commands which only work over the umbilical UART.
31
32 // For commands which are high risk and unsafe.
35
36typedef uint8_t (*TCMD_TCMDEXEC_Function_Ptr)(const char *args_str,
37 char *response_output_buf, uint16_t response_output_buf_len);
38
39typedef struct {
40 char* tcmd_name;
44 // TODO: maybe add other fields, including priority, expected execution duration, "config vs. action", etc.
45
47
48
49typedef struct {
51 uint8_t tcmd_idx;
52 char args_str_no_parens[TCMD_ARGS_STR_NO_PARENS_SIZE]; // TODO: consider changing this to a pointer, and storing the args somewhere else to save memory
60
61#endif // INCLUDE_GUARD__TELECOMMAND_TYPES_H
Definition telecommand_types.h:39
char * tcmd_name
Definition telecommand_types.h:40
TCMD_TCMDEXEC_Function_Ptr tcmd_func
Definition telecommand_types.h:41
uint8_t number_of_args
Definition telecommand_types.h:42
TCMD_readiness_level_enum_t readiness_level
Definition telecommand_types.h:43
Definition telecommand_types.h:49
char args_str_no_parens[TCMD_ARGS_STR_NO_PARENS_SIZE]
Definition telecommand_types.h:52
char resp_fname[TCMD_MAX_RESP_FNAME_LEN]
Name of file that response should be written to, empty string otherwise.
Definition telecommand_types.h:58
uint64_t timestamp_to_execute
The value of the @tsexec field when the telecommand was received.
Definition telecommand_types.h:56
uint8_t tcmd_idx
The index of the telecommand in the TCMD_telecommand_definitions array.
Definition telecommand_types.h:51
uint64_t timestamp_sent
The value of the @tssent field when the telecommand was received.
Definition telecommand_types.h:54
static const uint16_t TCMD_MAX_FULL_LENGTH
Max full length of a telecommand, including prefix, args, suffix tags, null terminator,...
Definition telecommand_types.h:14
uint8_t(* TCMD_TCMDEXEC_Function_Ptr)(const char *args_str, char *response_output_buf, uint16_t response_output_buf_len)
Definition telecommand_types.h:36
#define TCMD_ARGS_STR_NO_PARENS_SIZE
Definition telecommand_types.h:10
TCMD_readiness_level_enum_t
The permission/risk level of a telecommand.
Definition telecommand_types.h:18
@ TCMD_READINESS_LEVEL_FLIGHT_TESTING
Definition telecommand_types.h:27
@ TCMD_READINESS_LEVEL_FOR_OPERATION
Definition telecommand_types.h:20
@ TCMD_READINESS_LEVEL_FOR_RECOVERY_OR_EXPERT
Definition telecommand_types.h:24
@ TCMD_READINESS_LEVEL_HIGH_RISK_AND_UNSAFE
Definition telecommand_types.h:33
@ TCMD_READINESS_LEVEL_GROUND_USAGE_ONLY
Definition telecommand_types.h:30
#define TCMD_MAX_RESP_FNAME_LEN
Definition telecommand_types.h:7