WarpTwin
Documentation for WarpTwin models and classes.
Loading...
Searching...
No Matches
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/*
17Telemetry Manager header file
18
19Author: 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
32namespace warpos {
33
34const uint8 TIME_STR_SIZE = 20;
35const uint8 FILE_NAME_MAX = 100;
36
37class FlightExecutive;
38
51class StorageManager : public App {
52 public:
56 SIGNAL(output_to_csv, bool, true)
59 SIGNAL(pri_storage_loc, char*, nullptr)
62 SIGNAL(sec_storage_loc, char*, nullptr)
64
69 virtual ~StorageManager();
70
75 int16 storeTlm(const cmd_tlm_base& pkt, uint8 instance);
76
81 int16 registerTlmPacket(uint16 tlm_apid, uint8 instance);
82
86 int16 configureTlmPacket(const PacketTypeInfo& info);
87
90 int16 activate() override;
91
94 int16 deactivate() override;
95
101 int16 command(uint16 apid, uint8* buffer, uint16 size) override;
102
106 protected:
107 int16 start() override;
108 int16 execute() override;
109
114 int32 _findPktIndex(uint16 apid, uint8 instance);
115
116 PacketTypeInfo _tlm_table[MAX_TLM_TABLE_SIZE];
117 uint16 _tlm_table_idx = 0;
118
119 char _print_buff[200];
120
121 int32 _fd_table_1[MAX_TLM_TABLE_SIZE] = {-1};
122 int32 _fd_table_2[MAX_TLM_TABLE_SIZE] = {-1};
123
124 char _default_storage_loc[1] = "";
125
126 bool _fsys_working = false;
127
130 char _f_write_buf[CMD_TLM_STR_MAX_SIZE_BYTES];
132
133};
134} // namespace warpos
135
136#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
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
Executive derivation specifically to run flight systems.
Definition FlightExecutive.h:46
int32 _fd_table_2[MAX_TLM_TABLE_SIZE]
Table of file descriptors for individual packet files for SD card 2.
Definition StorageManager.h:122
char _default_storage_loc[1]
Default file storage location.
Definition StorageManager.h:124
int16 command(uint16 apid, uint8 *buffer, uint16 size) override
Process commands issued to the app.
Definition StorageManager.cpp:240
int32 _findPktIndex(uint16 apid, uint8 instance)
Find index of packet in tlm table matching apid.
Definition StorageManager.cpp:276
int32 _fd_table_1[MAX_TLM_TABLE_SIZE]
Table of file descriptors for individual packet files for SD card 1.
Definition StorageManager.h:121
bool _fsys_working
Boolean to track and protect errors in file system.
Definition StorageManager.h:126
uint16 _tlm_table_idx
Table of telemetry packet metadata.
Definition StorageManager.h:117
StorageManager(FlightExecutive &exc)
Only available flight executive constructor.
Definition StorageManager.cpp:25
char _file_name[FILE_NAME_MAX]
Buffer to hold file names.
Definition StorageManager.h:131
char _print_buff[200]
Buffer for printing error/warning/debug statements.
Definition StorageManager.h:119
int16 start() override
Definition StorageManager.cpp:184
uint16 numRegisteredPackets()
Get the number of registered telemetry packets.
Definition StorageManager.h:105
int16 activate() override
Activate the app. The app will step when active.
Definition StorageManager.cpp:266
int16 deactivate() override
Deactivate the app. The app will not step when deactivated.
Definition StorageManager.cpp:271
int16 registerTlmPacket(uint16 tlm_apid, uint8 instance)
Register a telemetry packet by adding it to the table.
Definition StorageManager.cpp:33
PacketTypeInfo _tlm_table[MAX_TLM_TABLE_SIZE]
Definition StorageManager.h:116
int16 storeTlm(const cmd_tlm_base &pkt, uint8 instance)
Add a telemetry packet to the queue.
Definition StorageManager.cpp:92
int16 configureTlmPacket(const PacketTypeInfo &info)
Configure values on telemetry packet.
Definition StorageManager.cpp:77
char _f_write_buf[CMD_TLM_STR_MAX_SIZE_BYTES]
Buffer for file write in both modes.
Definition StorageManager.h:130
char _time_str[TIME_STR_SIZE]
Variables for writing to file.
Definition StorageManager.h:129
int16 execute() override
Definition StorageManager.cpp:235
Definition DeadReckon.cpp:20
const uint8 FILE_NAME_MAX
Constant for filenaming.
Definition StorageManager.h:35
const uint8 TIME_STR_SIZE
Constant for time string conversion.
Definition StorageManager.h:34
Base struct in definition of command and telemetry packets.
Definition Telemetry.h:48
Telemetry packet type metadata struct.
Definition TelemetryManager.h:43
clockwerk::DataIO< char * > sec_storage_loc
Definition StorageManager.h:62
clockwerk::DataIO< bool > output_to_csv
Definition StorageManager.h:56
clockwerk::DataIO< char * > pri_storage_loc
Definition StorageManager.h:59