21#ifndef FLIGHT_COMMANDMANAGER_H
22#define FLIGHT_COMMANDMANAGER_H
33#define MAX_CMD_TABLE_SIZE 100
36#define CMD_INPUT_BUFFER_SIZE 256
78 int16
command(uint16
apid, uint8* buffer, uint16 size) override;
85 int16
start()
override;
#define MAX_CMD_TABLE_SIZE
The maximum amount of commands which can be registered.
Definition CommandManager.h:33
#define SIGNAL(NAME, TYPE, INITIAL_VALUE)
Definition appmacros.h:27
#define START_PARAMS
Definition appmacros.h:42
#define END_PARAMS
Definition appmacros.h:47
Simple Circular Buffer for data storage.
Definition CircularBuffer.hpp:37
Wrapper to manage and convert time as timespce.
Definition Time.h:53
Base app class for derived implementation.
Definition App.h:55
App(FlightExecutive &executive, const char *name, uint16 apid, uint8 instance=0)
Executive-based constructor for the task.
Definition App.cpp:21
uint8 & instance()
Get the instance of this app (used to differentiate between multiple instances of the same app).
Definition App.h:109
uint16 apid()
Get the apid for this app.
Definition App.h:105
FlightExecutive & exc
Override our executive to include the FlightExecutive instead.
Definition App.h:120
int16 deactivateCmd(uint8 *buffer, uint16 size)
Function to handle a deactivate command.
Definition CommandManager.cpp:370
bool ingestCommand()
Function to ingest commands from the HAL.
Definition CommandManager.cpp:46
RegisteredCommandInfo _reg_cmd_table[100]
Table of registered commands.
Definition CommandManager.h:132
uint16 numRegisteredPackets()
Get the number of registered command packets.
Definition CommandManager.h:82
int16 scheduleCmd(uint8 *buffer, uint16 size)
Function to handle Schedule change commands.
Definition CommandManager.cpp:327
tlm_cmd_mngr_status _tlm_cmd_mngr_status
Command manager status telemetry packet.
Definition CommandManager.h:151
uint8 _ccsds_data[CCSDS_FULL_HDR_LEN_BYTES]
Buffer to hold CCSDS header data when processing commands.
Definition CommandManager.h:140
CommandManager(FlightExecutive &exc)
Only available flight executive constructor.
Definition CommandManager.cpp:24
int16 start() override
Definition CommandManager.cpp:29
int16 handleCommands()
Function to handle ingesting and routing commands.
Definition CommandManager.cpp:127
uint16 _cmd_table_idx
Current index in the command table.
Definition CommandManager.h:136
uint16 _successful_cmd_count
Count of successfully processed commands.
Definition CommandManager.h:147
int16 softResetCmd(uint8 *buffer, uint16 size)
Function to handle a received softResetCommand.
Definition CommandManager.cpp:282
clockwerk::Time _last_read_time
Last time bytes were read from input hw queue.
Definition CommandManager.h:134
uint16 _crc_error_count
Count of commands received with CRC errors.
Definition CommandManager.h:145
bool scanForHeader()
Scans through the bytes in the command buffer for a valid CCSDS header.
Definition CommandManager.cpp:97
int16 activateCmd(uint8 *buffer, uint16 size)
Function to handle activate commands.
Definition CommandManager.cpp:349
int16 command(uint16 apid, uint8 *buffer, uint16 size) override
Process commands issued to the app.
Definition CommandManager.cpp:260
tlm_cmd_mngr_error _tlm_cmd_mngr_error
Telemetry Definitions.
Definition CommandManager.h:150
uint16 _pkt_not_registered_count
Count of commands received for unregistered packets.
Definition CommandManager.h:144
clockwerk::CircularBuffer< uint8, 256 > _cmd_input_byte_buff
Buffer of bytes input from hardware device.
Definition CommandManager.h:138
int16 logLevelCmd(uint8 *buffer, uint16 size)
Function to handle LogLevel change commands.
Definition CommandManager.cpp:303
int16 registerCmdPacket(App *cmd_app, uint16 cmd_apid)
Register a command with the command manager.
Definition CommandManager.cpp:237
int16 routeCommand(App *cmd_app_ptr, uint16 apid, uint8 instance, uint8 *buffer, uint16 length)
Routes a command to an associated app.
Definition CommandManager.cpp:66
uint16 _exc_error_count
Counters for various command manager stats, used in telemetry.
Definition CommandManager.h:143
int16 execute() override
Definition CommandManager.cpp:83
uint16 _timeout_count
Count of times the command queue has been cleared due to timeout.
Definition CommandManager.h:146
Executive derivation specifically to run flight systems.
Definition FlightExecutive.h:46
Definition DeadReckon.cpp:20
Command Manager error packet definition.
Definition tlm_CommandManager.h:54
Command Manager status packet definition.
Definition tlm_CommandManager.h:44
clockwerk::DataIO< clockwerk::Time > queue_clear_timeout
Definition CommandManager.h:57
Struct to store info on registered commands.
Definition CommandManager.h:39
uint8 instance
Definition CommandManager.h:42
App * assoc_app
Definition CommandManager.h:40
uint16 apid
Definition CommandManager.h:41