WarpTwin
Documentation for WarpTwin models and classes.
Loading...
Searching...
No Matches
App.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/*
17Application header file - Includes declaration for app class which is the flight software base unit
18
19Author: Alex Reynolds
20*/
21#ifndef FLIGHT_APP_H
22#define FLIGHT_APP_H
23
26#include "flight/OS.h"
27#include "flight/flighterrors.h"
28#include "appmacros.h"
29
30namespace warpos {
31 class FlightExecutive;
32
56 public:
61 App(FlightExecutive &executive, const char* name, uint16 apid, uint8 instance=0);
62
64 virtual ~App() {};
65
68 int16 startup();
69
72 int16 step();
73
76 virtual int16 activate();
77
80 virtual int16 deactivate();
81
87 virtual int16 command(uint16 apid, uint8* buffer, uint16 size);
88
91
97 void logLevel(log_level_e log_level) {_local_log_level = log_level;}
98
101 bool isStarted() {return _is_started;}
102
105 uint16 apid() {return _apid;}
106
109 uint8 &instance() {return _instance;}
110 protected:
113 virtual int16 start();
114
117 virtual int16 execute();
118
121
124
126 uint16 _apid = 0;
127
129 bool _is_started = false;
130
133
135 GraphTreeObject* _app_children[MAXIMUM_APP_CHILDREN];
136
139 };
140}
141
142#endif
Class for inter-object communication.
Definition DataIO.hpp:60
Base class for object organization.
Definition GraphTreeObject.h:98
GraphTreeObject(const char *gt_nme="", GraphTreeObject **storage_array=nullptr, uint32 storage_size=0)
Name-based constructor for GraphTreeObject which will have no children by default.
Definition GraphTreeObject.cpp:23
const char * name() const
Getter and setter for object name.
Definition GraphTreeObject.h:135
clockwerk::DataIO< bool > active
The active flag for the task – set to true by default.
Definition App.h:90
bool _is_started
Flag indicating whether app has been started or not.
Definition App.h:129
int16 startup()
Initialize the app. Should be called once before step.
Definition App.cpp:31
log_level_e _local_log_level
The log level for this particular app.
Definition App.h:132
virtual int16 command(uint16 apid, uint8 *buffer, uint16 size)
Process commands issued to the app.
Definition App.cpp:72
uint16 _apid
Internal variable to hold the APID for this app.
Definition App.h:126
virtual int16 deactivate()
Deactivate the app. The app will not step when deactivated.
Definition App.cpp:67
App(FlightExecutive &executive, const char *name, uint16 apid, uint8 instance=0)
Executive-based constructor for the task.
Definition App.cpp:21
virtual int16 execute()
Step the app. This is the specific call and should be overwritten in derived apps....
Definition App.cpp:80
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
uint8 _instance
Instance number of this app. Used to differentiate between multiple instances of the same app.
Definition App.h:138
log_level_e logLevel()
Get the log level set for the executive.
Definition App.h:94
void logLevel(log_level_e log_level)
Set the executive log level.
Definition App.h:97
virtual ~App()
Destructor. Doesn't really do anything.
Definition App.h:64
GraphTreeObject * _app_children[MAXIMUM_APP_CHILDREN]
Local storage for App children so it can live on the graph tree.
Definition App.h:135
virtual int16 activate()
Activate the app. The app will step when active.
Definition App.cpp:62
int16 _error
Internal variable to track and return error on app step through.
Definition App.h:123
int16 step()
Step the app by a single step. Maps params, inputs, etc. to outputs.
Definition App.cpp:44
bool isStarted()
Return whether task startup has been run.
Definition App.h:101
FlightExecutive & exc
Override our executive to include the FlightExecutive instead.
Definition App.h:120
virtual int16 start()
Init the app. This is the specific call and should be overwritten in derived apps....
Definition App.cpp:76
Executive derivation specifically to run flight systems.
Definition FlightExecutive.h:46
#define NO_ERROR
Error code in the case where matrix math executed successfully.
Definition clockwerkerrors.h:34
log_level_e
Log level enumerations.
Definition flighterrors.h:159
@ LOG_WARNING
Output in almost all cases.
Definition flighterrors.h:162
Definition DeadReckon.cpp:20