ModelSpace
Documentation for ModelSpace models and classes.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
StorageManager.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright (c) ATTX INC 2025. All Rights Reserved.
3  *
4  * This software and associated documentation (the "Software") are the
5  * proprietary and confidential information of ATTX, INC. The Software is
6  * furnished under a license agreement between ATTX and the user organization
7  * and may be used or copied only in accordance with the terms of the agreement.
8  * Refer to 'license/attx_license.adoc' for standard license terms.
9  *
10  * EXPORT CONTROL NOTICE: THIS SOFTWARE MAY INCLUDE CONTENT CONTROLLED UNDER THE
11  * INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) OR THE EXPORT ADMINISTRATION
12  * REGULATIONS (EAR99). No part of the Software may be used, reproduced, or
13  * transmitted in any form or by any means, for any purpose, without the express
14  * written permission of ATTX, INC.
15  ******************************************************************************/
16 /*
17 Telemetry Manager header file
18 
19 Author: Alex Reynolds
20 */
21 #ifndef FLIGHT_STORAGEMANAGER_H
22 #define FLIGHT_STORAGEMANAGER_H
23 
24 #include "architecture/Time.h"
25 #include "flight/App.h"
26 #include "flight/flighterrors.h"
27 #include "flight/Telemetry.h"
29 #include "configuration.h"
31 
32 namespace cfspp {
33 
34 const uint8 TIME_STR_SIZE = 20;
35 
36 class FlightExecutive;
37 
50 class StorageManager : public App {
51  public:
55  SIGNAL(output_to_csv, bool, true)
58  SIGNAL(storage_loc, char*, nullptr)
60 
65  virtual ~StorageManager();
66 
70  int16 storeTlm(const cmd_tlm_base& pkt);
71 
75  int16 registerTlmPacket(uint16 tlm_apid);
76 
80  int16 configureTlmPacket(const PacketTypeInfo& info);
81 
84  int16 activate() override;
85 
88  int16 deactivate() override;
89 
95  int16 command(uint16 apid, uint8* buffer, uint16 size) override;
96 
100  protected:
101  int16 start() override;
102  int16 execute() override;
103 
107  int32 _findPktIndex(uint16 apid);
108 
109  PacketTypeInfo _tlm_table[MAX_TLM_TABLE_SIZE];
110  uint16 _tlm_table_idx = 0;
111 
112  char _print_buff[200];
113 
114  int32 _fd_table[MAX_TLM_TABLE_SIZE];
115 
116  char _default_storage_loc[1] = "";
117 
118  bool _fsys_working = false;
119 
122  char _f_write_buf[CMD_TLM_STR_MAX_SIZE_BYTES];
123 };
124 } // namespace cfspp
125 
126 #endif
Header for generic telemetry packet struct generation and serialization.
#define SIGNAL(NAME, TYPE, INITIAL_VALUE)
Definition: appmacros.h:27
#define START_PARAMS
Definition: appmacros.h:42
#define END_PARAMS
Definition: appmacros.h:47
Base app class for derived implementation.
Definition: App.h:55
FlightExecutive & exc
Override our executive to include the FlightExecutive instead.
Definition: App.h:120
uint16 apid()
Get the apid for this app.
Definition: App.h:105
Executive derivation specifically to run flight systems.
Definition: FlightExecutive.h:46
App which manages all storage output from the flight system.
Definition: StorageManager.h:50
PacketTypeInfo _tlm_table[MAX_TLM_TABLE_SIZE]
Definition: StorageManager.h:109
int32 _findPktIndex(uint16 apid)
Find index of packet in tlm table matching apid.
Definition: StorageManager.cpp:252
int16 configureTlmPacket(const PacketTypeInfo &info)
Configure values on telemetry packet.
Definition: StorageManager.cpp:76
uint16 numRegisteredPackets()
Get the number of registered telemetry packets.
Definition: StorageManager.h:99
bool _fsys_working
Boolean to track and protect errors in file system.
Definition: StorageManager.h:118
int32 _fd_table[MAX_TLM_TABLE_SIZE]
Table of file descriptors for individual packet files.
Definition: StorageManager.h:114
char _time_str[TIME_STR_SIZE]
Variables for writing to file.
Definition: StorageManager.h:121
char _f_write_buf[CMD_TLM_STR_MAX_SIZE_BYTES]
Buffer for file write in both modes.
Definition: StorageManager.h:122
int16 start() override
Definition: StorageManager.cpp:180
char _print_buff[200]
Buffer for printing error/warning/debug statements.
Definition: StorageManager.h:112
int16 execute() override
Definition: StorageManager.cpp:210
int16 activate() override
Activate the app. The app will step when active.
Definition: StorageManager.cpp:242
int16 command(uint16 apid, uint8 *buffer, uint16 size) override
Process commands issued to the app.
Definition: StorageManager.cpp:216
int16 deactivate() override
Deactivate the app. The app will not step when deactivated.
Definition: StorageManager.cpp:247
int16 registerTlmPacket(uint16 tlm_apid)
Register a telemetry packet by adding it to the table.
Definition: StorageManager.cpp:33
uint16 _tlm_table_idx
Table of telemetry packet metadata.
Definition: StorageManager.h:110
char _default_storage_loc[1]
Default file storage location.
Definition: StorageManager.h:116
int16 storeTlm(const cmd_tlm_base &pkt)
Add a telemetry packet to the queue.
Definition: StorageManager.cpp:91
Definition: DeadReckon.cpp:20
const uint8 TIME_STR_SIZE
Constant for time string conversion.
Definition: StorageManager.h:34
Telemetry packet type metadata struct.
Definition: TelemetryManager.h:49
Base struct in definition of command and telemetry packets.
Definition: Telemetry.h:50